Skip to content

feat(mcp): export delegated-loop topology to the OTLP / Tangle Intelligence sink#86

Merged
tangletools merged 2 commits into
mainfrom
feat/mcp-otel-trace-export
May 31, 2026
Merged

feat(mcp): export delegated-loop topology to the OTLP / Tangle Intelligence sink#86
tangletools merged 2 commits into
mainfrom
feat/mcp-otel-trace-export

Conversation

@tangletools
Copy link
Copy Markdown
Contributor

The MCP delegates' runLoop ctx never wired a trace emitter, so delegated loops exported no topology spans even with OTEL_EXPORTER_OTLP_ENDPOINT set. Now createDefaultCoderDelegate takes an optional traceEmitter, and the bin builds createPropagatingTraceEmitter(readTraceContextFromEnv()) + forwards it to the coder/researcher delegates (no-op when the endpoint is unset). A fleet agent forwards OTEL_EXPORTER_OTLP_ENDPOINT into the MCP process to turn export on — the enabler for hooking the delegation MCP to the intelligence sink. 0.41.0.

drewstone added 2 commits May 31, 2026 04:23
…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.
@tangletools tangletools merged commit 3a6504f into main May 31, 2026
1 check failed
@tangletools tangletools deleted the feat/mcp-otel-trace-export branch May 31, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants