Repository navigation
fix(diagnostics): preserve telemetry during service shutdown - #119705
Conversation
|
@clawsweeper re-review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Exact-head ClawSweeper review completed for Blocking P1: Required resolution before merge:
This blocks dependent protocol PR #119708 until this PR has a clean exact-head review and merges. |
|
@clawsweeper re-review Please review exact head The ordinary plugin stop compatibility finding is addressed: ordinary failures remain warn-and-continue; only trusted diagnostics exporter failures propagate. Focused tests prove all stops still run and producer -> drain -> exporter ordering remains intact. Fresh exact-head local autoreview and AWS OTEL proof are in the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 3:35 PM ET / 19:35 UTC. ClawSweeper reviewWhat this changesThe PR drains diagnostics queued during plugin shutdown before OpenTelemetry exporters detach, checks exporter capability before startup, and reports exporter cleanup failures to the host. Merge readinessKeep open: the final head fixes the prior host-wide error-propagation concern by preserving ordinary plugin stop warnings while propagating only trusted diagnostics-exporter failures. This maintainer-authored, protected PR still needs the normal exact-head CI/approval path. Priority: P2 Review scores
Verification
How this fits togetherPlugin services host diagnostics producers and exporter plugins. During shutdown, producers feed an asynchronous diagnostics queue, which OpenTelemetry and Prometheus exporters consume before the gateway closes or reloads. flowchart LR
A[Plugin services] --> B[Diagnostics producers]
B --> C[Async diagnostics queue]
C --> D[Trusted exporter plugins]
D --> E[OpenTelemetry providers]
A --> F[Gateway shutdown or reload]
F --> B
F --> D
Before merge
Agent review detailsSecurityNone. PR surfaceSource +46, Tests +183. Total +229 across 6 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the narrow lifecycle-owner repair after exact-head CI confirms the final commit, retaining warn-and-continue behavior for ordinary plugin cleanup and diagnostics-only error propagation. Do we have a high-confidence way to reproduce the issue? Yes: current main’s reverse-only service shutdown and swallowed cleanup errors establish the affected path, and the exact-head regression tests encode the producer-to-exporter shutdown sequence. Is this the best way to solve the issue? Yes: the final head repairs ordering at the generic lifecycle owner while keeping provider cleanup and capability admission inside the diagnostics plugin, rather than changing the host-wide stop contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d6233c29b904. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…cope * origin/main: fix(qa): report cleanup failures truthfully (openclaw#119727) fix: keep completed actions visible after settled finalization (openclaw#119726) fix(agents): rearm yielded requester wake (openclaw#119696) fix(diagnostics): preserve telemetry during service shutdown (openclaw#119705)
…w#119705) * fix(diagnostics): preserve otel service shutdown lifecycle * test(diagnostics): type OTEL unsubscribe callback * test(diagnostics): normalize async stop assertion * fix(plugins): preserve ordinary stop handling
Fixes #119694
What Problem This Solves
The diagnostics OTEL service could detach exporters before other plugin services finished emitting their final queued diagnostics. Its own exporter cleanup failures were also swallowed, so shutdown and reload could appear successful after telemetry cleanup failed.
Why This Change Was Made
internalDiagnosticscapability.AggregateError.The generic plugin-service lifecycle owns producer/exporter ordering and trusted exporter failure propagation. The diagnostics-otel service owns provider cleanup. No gateway recovery behavior, config, protocol, endpoint, storage, or payload contract changes are included.
User Impact
Final diagnostics emitted during shutdown or reload are delivered before OTEL listeners detach. Ordinary plugin stop failures still warn and continue, while a trusted diagnostics exporter cleanup failure reaches the existing host lifecycle handling after all service stops have run.
Verification
node scripts/run-vitest.mjs extensions/diagnostics-otel/src/service.test.ts src/infra/diagnostic-events.test.ts src/plugins/services.test.ts: 200 passednode_modules/.bin/oxfmt --checkon all six changed files: passednode_modules/.bin/oxlinton the compatibility fix: passedgit diff --check origin/main...HEAD: passed4b7d6fec9fd5b924df34588231a6c38ea8cbb3d8: clean, no P0-P2 findingsrun_5574cea54e2aat4b7d6fec9fd5b924df34588231a6c38ea8cbb3d8: 291 tests passed, including real OTLP exporter and sibling one-shot lifecycle coveragepnpm qa:otel:smoke -- --collector local --logs-exporter both: passed with 5 spans, 6 metrics, one OTLP log, one stdout log, and one request for each OTLP signalpnpm check:test-types,pnpm tsgo:scripts, andpnpm tsgo:test:root: passed on the exact PR headProduction delta: +63/-17, net +46. Test delta: +190/-7, net +183.