feat(compass-agent): activate loop OpenTelemetry in cli.ts main() (RIG-2508 T1) - #648
Merged
Merged
Conversation
…G-2508 T1)
Implements task T1 of the frozen record
docs/designs/platform/compass-agent-loop-otel/design.md: activate the OMP
agent loop's native GenAI-semconv OpenTelemetry (invoke_agent / chat /
execute_tool spans) by passing `telemetry: {}` to createAgentSession,
gated hard on an OTLP endpoint being configured.
- `isTelemetryEndpointConfigured(env)`: the pre-registration gate mirroring
`initTelemetryExport` (endpoint present via OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
or the base OTEL_EXPORTER_OTLP_ENDPOINT, kill-switches clear).
- Enabled path only: default OTEL_SERVICE_NAME (never clobber a deployer
value), append `compass.session.id=<manager session id>` to
OTEL_RESOURCE_ATTRIBUTES as the cross-signal join key (Decision 3a), then
`initTelemetryExport()`. Order is load-bearing: env before registration.
- `telemetry: {}` on the session options keyed off the authoritative
post-registration `isTelemetryExportEnabled()` check; the key is omitted
entirely when off.
- Off by default: with no OTLP endpoint the whole block is skipped, so
process.env is unmutated and the session build is bit-identical to a
no-telemetry container (Global Constraints; F2).
- Telemetry hooks injected at the MainDeps seam so tests assert the gating /
env / option logic without running the real global-provider registration
(F3 test isolation).
Zero transport change (OQ1 ruled (b)); no new deps, no bun.lock change.
Co-authored-by: Matt Wilkinson <matt@rigel.build>
|
Compass engineering docs preview: https://compass-agent-rig-2508-loop-sx7m.compass-eng-docs.pages.dev Deployed from |
…sEnabled (RIG-2508 T1) Review of #648 flagged that the load-bearing "option gate authority" invariant -- the telemetry session key gates on the post-registration isEnabled(), not on the endpoint being configured -- had no behavioral test. A regression swapping the gate to isTelemetryEndpointConfigured would ship green because every existing test conflates endpoint-set with enabled-after-init. Add the distinguishing branch: telemetryDeps now takes registerOnInit (default true); false models the protocol-decline case where init() runs (endpoint gate fired, env defaults written) but no provider registers, so isEnabled() stays false. The new test asserts that with an endpoint set and a declining provider, init ran and env was written yet NO telemetry key is added. Verified non-vacuous: swapping the gate to the endpoint predicate reds this test alone. Co-authored-by: Matt Wilkinson <matt@rigel.build>
mattwilkinsonn
approved these changes
Aug 26, 2026
rigel-mintaka
added a commit
that referenced
this pull request
Aug 26, 2026
…in (RIG-2508 T2) T2 of the frozen loop-OTel record. Two additive deliverables, no production code-path change beyond T1. - Env reachability test (cli.test.ts): pins that all four loop-OTel keys the Runner materializes into $HOME/.compass/env -- OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_RESOURCE_ATTRIBUTES, OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT -- survive isReservedEnvKey filtering (none are HOME/COMPASS_*) and reach process.env before the registration point (cli.ts:838), via the env-merge loop (cli.ts:614-618) that runs earlier. Non-vacuous: a COMPASS_-prefixed or HOME key would be dropped, as the neighboring test pins for COMPASS_FUTURE_VAR. - deployer-contract.md: maintainer-facing reference for configuring a collector -- endpoint key, service-name override, content-capture opt-in + sensitivity warning, off-by-default guarantee, and the two asymmetries a deployer must know: F5 endpoint-gate (the loop honors OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, the transport gates only on OTEL_EXPORTER_OTLP_ENDPOINT) and F1 service-name split (an OTEL_SERVICE_NAME override renames the loop signal only; the durable cross-signal join is compass.session.id, not service.name). All cites source-verified against @oh-my-pi/pi-coding-agent@16.5.2 and the frozen transport otel-layer.ts. Doc lives under docs/designs/platform/ (ungoverned ledger root -> no DECISIONS row). Stacked on #648 (T1). Co-authored-by: Matt Wilkinson <matt@rigel.build>
mattwilkinsonn
added a commit
that referenced
this pull request
Aug 27, 2026
…in (RIG-2508 T2) (#654) * docs(compass-agent): loop-OTel deployer contract + env reachability pin (RIG-2508 T2) T2 of the frozen loop-OTel record. Two additive deliverables, no production code-path change beyond T1. - Env reachability test (cli.test.ts): pins that all four loop-OTel keys the Runner materializes into $HOME/.compass/env -- OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_RESOURCE_ATTRIBUTES, OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT -- survive isReservedEnvKey filtering (none are HOME/COMPASS_*) and reach process.env before the registration point (cli.ts:838), via the env-merge loop (cli.ts:614-618) that runs earlier. Non-vacuous: a COMPASS_-prefixed or HOME key would be dropped, as the neighboring test pins for COMPASS_FUTURE_VAR. - deployer-contract.md: maintainer-facing reference for configuring a collector -- endpoint key, service-name override, content-capture opt-in + sensitivity warning, off-by-default guarantee, and the two asymmetries a deployer must know: F5 endpoint-gate (the loop honors OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, the transport gates only on OTEL_EXPORTER_OTLP_ENDPOINT) and F1 service-name split (an OTEL_SERVICE_NAME override renames the loop signal only; the durable cross-signal join is compass.session.id, not service.name). All cites source-verified against @oh-my-pi/pi-coding-agent@16.5.2 and the frozen transport otel-layer.ts. Doc lives under docs/designs/platform/ (ungoverned ledger root -> no DECISIONS row). Stacked on #648 (T1). Co-authored-by: Matt Wilkinson <matt@rigel.build> * test(compass-agent): pin OTEL_SERVICE_NAME reachability with a distinct sentinel (RIG-2508 T2) The four-key loop-OTel reachability test wrote OTEL_SERVICE_NAME=compass-agent, which is byte-identical to the activation's `??=` default (cli.ts:839). A filter-drop regression (key wrongly reserved by isReservedEnvKey) would re-default to the same value, leaving the assertion green. Swap to a distinct sentinel (deployer-custom-name) so the key must genuinely survive the filter and reach process.env for the assertion to pass; proven to red under a simulated reserve of OTEL_SERVICE_NAME. The other three keys were already non-vacuous. Co-authored-by: Matt Wilkinson <matt@rigel.build> --------- Co-authored-by: Matt Wilkinson <matt@rigel.build>
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.
This PR is part of a stack containing 2 PRs:
mainImplements task T1 of the frozen record
docs/designs/platform/compass-agent-loop-otel/design.md: activate the OMP
agent loop's native GenAI-semconv OpenTelemetry (invoke_agent / chat /
execute_tool spans) by passing
telemetry: {}to createAgentSession,gated hard on an OTLP endpoint being configured.
isTelemetryEndpointConfigured(env): the pre-registration gate mirroringinitTelemetryExport(endpoint present via OTEL_EXPORTER_OTLP_TRACES_ENDPOINTor the base OTEL_EXPORTER_OTLP_ENDPOINT, kill-switches clear).
value), append
compass.session.id=<manager session id>toOTEL_RESOURCE_ATTRIBUTES as the cross-signal join key (Decision 3a), then
initTelemetryExport(). Order is load-bearing: env before registration.telemetry: {}on the session options keyed off the authoritativepost-registration
isTelemetryExportEnabled()check; the key is omittedentirely when off.
process.env is unmutated and the session build is bit-identical to a
no-telemetry container (Global Constraints; F2).
env / option logic without running the real global-provider registration
(F3 test isolation).
Zero transport change (OQ1 ruled (b)); no new deps, no bun.lock change.
Co-authored-by: Matt Wilkinson matt@rigel.build