feat(mcp): export delegated-loop topology to the OTLP / Tangle Intelligence sink#86
Merged
Merged
Conversation
…igence sink
The MCP bin built delegates whose runLoop ctx was {sandboxClient, signal} — it
never wired the trace emitter, so delegated build/research loops exported NO
topology spans even with OTEL_EXPORTER_OTLP_ENDPOINT set. That's the missing
plumbing for "the delegation MCP, configurably hooked to the intelligence sink."
- createDefaultCoderDelegate gains optional `traceEmitter`, forwarded into every
delegated runLoop ctx (single-shot + fanout).
- bin: builds createPropagatingTraceEmitter(readTraceContextFromEnv()) once and
passes it to the coder + researcher delegates; flushes the exporter on
shutdown. Cheap no-op when OTEL_EXPORTER_OTLP_ENDPOINT is unset, so it's
configurable by construction — a fleet agent forwards the env into this MCP's
process to turn export on (TRACE_ID/PARENT_SPAN_ID correlate it to the caller).
Now a delegated code/research loop emits its nested gen_ai-semconv topology tree
(loop → round → iteration) to the configured OTLP collector. Test: a delegate
given a trace emitter emits loop.started / iteration.ended / loop.ended. Full
suite green, tsc + biome clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MCP delegates' runLoop ctx never wired a trace emitter, so delegated loops exported no topology spans even with
OTEL_EXPORTER_OTLP_ENDPOINTset. NowcreateDefaultCoderDelegatetakes an optionaltraceEmitter, and the bin buildscreatePropagatingTraceEmitter(readTraceContextFromEnv())+ forwards it to the coder/researcher delegates (no-op when the endpoint is unset). A fleet agent forwardsOTEL_EXPORTER_OTLP_ENDPOINTinto the MCP process to turn export on — the enabler for hooking the delegation MCP to the intelligence sink.0.41.0.