Repository navigation
Observability: OTel GenAI spans from the orchestrator + cross-thread failure-mode clustering - #333
Merged
currentbits merged 14 commits intoAug 17, 2026
Conversation
Shared plumbing only — no behavior. Lets the three implementation files be written independently without touching the same layers: - AppSettings.otel (endpoint, headers, claudeMetrics) + FailureMode types - store.js normalizeOtel + setSettings validation (http(s) URL or null) - insights:failureModes wired through ipc/preload/wireClient/devCoder - electron/otel.js: documented no-op skeleton (createOtel API) - electron/failuremodes.js: clusterFailureModes signature returning [] Co-Authored-By: Claude Opus 5 <[email protected]>
Span emission for every provider path through the two choke points that already exist: startRun opens the run span, notifyRunTerminal closes it with status and usage. Tool spans hang off appendMessage (the one place every adapter mints a tool message, so it is the only place a tool START is visible) and are closed by noteToolSpan at the four adapter result sites. The orchestrator fork gets its own span and parents the worker's run, so a crew reads as one trace tree — the cross-provider view only Solenta has. claude.js gains envExtra (same shape codex.js already had) so Claude Code's native OTel metrics can be pointed at the same collector. It is env-only, so it joins the warm-CLI reuse key: toggling the setting must not be masked by a kept-alive process spawned before it. All of it is inert while settings.otel.endpoint is null. Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Normalized-signature grouping of failed, stalled, and retried threads so the same diagnostic (paths and ids redacted) ranks as one mode with offenders. Deterministic, no LLM.
Emit invoke_agent and execute_tool spans over OTLP/HTTP JSON with no @opentelemetry/* dependency. The wire format is a documented stable encoding, so a batched fetch of a plain object is enough; an SDK would only pay off for sampling, context propagation into the CLIs, or metrics. Ids are sha256-derived (never stored) so a fork crew shares one trace and a tool span can name its parent run without a registry. Export is inert when endpoint is null.
…into coder/observability-otel-spans-from-the-orches-63d5e2
Co-Authored-By: Claude Opus 5 <[email protected]>
…into coder/observability-otel-spans-from-the-orches-63d5e2
otel.js: `i()` -> `intValue()`, `kv()` -> `attr()`, and a new `unixNano()` that also fixes a real gap — toolCall never validated its timestamps, so a missing one produced "undefined000000" and a collector rejects the whole batch. dest() is pure now; dropping the buffer when export is switched off is explicit in enqueue rather than a side effect of reading config. otel-runner.test.js covers the half unit tests cannot: a real run through the runner reaching a collector, the tool span parented to the run span in one trace, an ERROR span carrying the stderr reason, nothing posted with no endpoint, and the Claude telemetry env actually arriving in the spawned CLI. Co-Authored-By: Claude Opus 5 <[email protected]>
The three-digit HTTP rule cannot distinguish a 404 from a SIGINT exit 130 by shape, so 'exit 130' was forming its own failure mode while exit 1 and 2 collapsed — contradicting the comment above it. Normalizing 'exit <digits>' first makes both claims true: exit codes collapse, 404 vs 500 stay separate. Co-Authored-By: Claude Opus 5 <[email protected]>
Ranked failure-mode list with click-through to offending threads, and OTLP endpoint/headers/Claude-metrics fields in Settings.
…into coder/observability-otel-spans-from-the-orches-63d5e2
A Record<FailureKind, string> mapping each kind to its own name, plus a ?? fallback to the same value. Rendering offender.kind is identical. Co-Authored-By: Claude Opus 5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Eight conflicts, all the same shape: main landed the morning digest (#323), worktree GC (#316) and the verification gate (#296) in the same additive slots this branch used for insights/otel. Both sides kept everywhere — - preload/ipc/wireClient/shared-ipc: insights:failureModes alongside digest:* - devCoder: both fixtures - App/Sidebar: "insights" and "digest" both in the view union, both nav buttons with their own icons, both open callbacks - SettingsModal: OtelSettings alongside the Gc* types No behavioral reconciliation was needed — the two features do not interact. core 38/38, renderer 822/822, memory 144/144, electron 966/967 (the one failure is the pre-existing wireClient/webBridge reconnect baseline). Co-Authored-By: Claude Opus 5 <[email protected]>
currentbits
deleted the
coder/observability-otel-spans-from-the-orches-63d5e2
branch
October 3, 2026 16:07
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.
Closes #280.
Solenta drives claude/codex/kimi/grok/opencode from the outside, so it is the only place a cross-provider trace tree exists. This makes that tree exportable, and mines the event log it already keeps for recurring failures.
Spans
electron/otel.jsemits OTLP/HTTP with a JSON body (POST <endpoint>/v1/traces). There is deliberately no@opentelemetry/*dependency: OTLP/JSON is a stable documented encoding, so the exporter is a batchedfetchof a plain object, and the batching mirrors the existingsession-record.jsfire-and-forget pattern.package.jsonis unchanged.Ids are derived, never stored:
traceIdfrom the ROOT thread (walkinghandoffFrom, cycle-guarded), so an orchestrator and its entire forked crew share one trace and a restart mid-thread keeps it.spanIdfrom the run id, tool span ids fromrunId:toolId— so a tool span can name its parent with no registry.Attributes follow the OTel GenAI semantic conventions:
gen_ai.operation.name,gen_ai.provider.name,gen_ai.agent.id(provider+profile),gen_ai.request.model,gen_ai.usage.{input,output}_tokens, andsession.id= the thread id, plussolenta.*for cost, project and orch-worker.Emission lives in
electron/runner.jsat the choke points that already existed, so all five provider paths are covered by one call site each rather than five parallel implementations:startRunopens the run span;notifyRunTerminalcloses it with status and usage.appendMessage— the one place every adapter mints a tool message, therefore the only place a tool start is observable — and closed bynoteToolSpanat the four adapter result sites.Claude Code's native metrics
Redirected rather than received.
otel.claudeEnv()returnsCLAUDE_CODE_ENABLE_TELEMETRY=1plusOTEL_EXPORTER_OTLP_*pointed at the same collector, spread into the spawn through a newclaude.jsenvExtraoption (the same shapecodex.jsalready had). Because that is env-only it joins the warm-CLI reuse key instartClaudeRun— otherwise a kept-alive process spawned before the toggle would silently mask it.This is ~10 lines instead of standing up an in-process OTLP receiver. The metrics land beside our spans in the user's collector, correlated by
session.id. Displaying them inside Solenta would be the follow-up.Failure-mode clustering
electron/failuremodes.jsgroups errored/stalled/retried threads by a normalized error signature — paths, uuids, hex ids, long digit runs, quoted strings, timestamps, durations and byte counts all redacted — so the same failure across six threads reads as one mode with six offenders instead of six unrelated errors. HTTP statuses stay distinct (404 and 500 are two modes); exit codes collapse. Signatures that normalize down to nothing meaningful are discarded rather than forming one giant useless bucket, and one-offs are filtered since they are not yet recurring. Ranked by count, then recency, with a stable tiebreak so the order never flickers.Deterministic, no LLM and no embeddings, computed on demand at
insights:failureModes. Surfaced in a new Insights view with click-through to each offending thread, and the OTLP endpoint / headers / Claude-metrics fields added to Settings.Behaviour when off
Everything is inert while
settings.otel.endpointis null: nothing buffered, no timer armed, no request made, and no exception path into a run. Every exporter method swallows its own failures, so a dead collector cannot affect a run.Deliberate deviation from the issue
#280 asks for a periodic automation for the clustering. This computes on demand instead — it is deterministic and runs in milliseconds over the whole store, so a scheduler would add stored state and a retention policy without producing any additional information. The tradeoff: a mode is visible when you open the view, rather than proactively telling you something has now failed six times.
automations.jsalready has the minute-ticker if that notification turns out to be worth it.Tests
+38 new, all four suites run:
The single electron failure is
wireClient × webBridge over a real socket > reconnect, which fails identically onmain— a pre-existing baseline, not a regression.New coverage:
otel.test.js(8, exporter against injected fetch/thread/clock — derived id stability, nanosecond string timestamps, fork trace sharing, error status, no-endpoint inertness),failuremodes.test.js(10, clustering/normalization/ranking/corrupt input),otel-runner.test.js(4, a real run through the runner reaching a stubbed collector with the tool span parented to the run span in one trace, an ERROR span carrying stderr, nothing posted with no endpoint, and the telemetry env actually arriving in the spawned CLI), plus 16 renderer tests for the view, the settings fields and header parsing.