Repository navigation
feat(gateway): hot reload diagnostics service settings - #138556
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 10:07 PM ET / September 5, 2026, 02:07 UTC. ClawSweeper reviewWhat this changesAdds selective background-service reload so diagnostics settings apply without restarting the Gateway, and gives the Gateway ownership of the shared diagnostic heartbeat. Merge readiness⛔ Blocked before merge - 3 items remain Keep open for landing: current main does not provide selective diagnostics-service reload, and no blocking introduced defect was found. The earlier precedence/scoping findings and SDK-integration rank-up are addressed; the recovery tradeoff has an explicit maintainer disposition. Priority: P2 Review scores
Verification
How this fits togetherGateway reload translates configuration changes into subsystem lifecycle actions. Diagnostic events flow through a process-owned dispatcher to plugin exporters, which send telemetry to collectors. flowchart TD
A[Configuration edit] --> B[Reload policy planner]
B --> C[Commit settings]
C --> D[Diagnostic dispatcher and heartbeat]
C --> E[Selected service lifecycle]
C --> G[Unrelated services stay running]
D --> E
E -->|Successful replacement| F[Telemetry collectors]
E -->|Replacement failure| H[Gateway recovery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +114, Tests +968, Docs +29, Other 0. Total +1111 across 35 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep selective replacement inside the existing service lifecycle, preserve established reload precedence, and retain the explicitly accepted recovery policy rather than adding exporter-specific restart machinery. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature reproduction: current-main source lacks selected-service reload, and the supplied exact-head collector run demonstrates the new behavior. No tests or application code were executed during this read-only review. Is this the best way to solve the issue? Yes: extending the existing service lifecycle avoids restarting all plugins or creating a second exporter-control path, while reusing main's retained-config reader. The SDK addition and failure-recovery policy already have explicit acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f9967ce8d40f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
e96d3ef to
55832ba
Compare
55832ba to
102452c
Compare
|
Merged via squash.
|
* feat(gateway): hot reload diagnostics service settings * fix(gateway): preserve reload policy precedence and scoped diagnostics * test(config): remove duplicate retained-reader binding after rebase
What Problem This Solves
Changes to
diagnostics.otel.*anddiagnostics.enabledtake effect without restarting the Gateway or every plugin. Successful exporter replacements preserve unrelated services, sessions, channels, and operator connections while adopting the configured endpoint, headers, service name, metric prefix, and enabled signals.Why This Change Was Made
Plugin services can declare existing configuration paths through optional
reload.configPrefixesmetadata. The planner preserves established core, plugin, and channel policy before adding service ownership. The existing service lifecycle then replaces only the selected generations after configuration publication, using the same start/stop, lease, cron, and cleanup owners. Full plugin replacement subsumes selected service reload. If cleanup or startup fails, the existing Gateway recovery path takes over; this failure path can interrupt otherwise unrelated connections.The Gateway owns diagnostic enablement, heartbeat, and shutdown together. Telegram webhook shutdown no longer stops the host heartbeat, and webhook diagnostics use the canonical retained-config reader at emission. Explicit standalone configurations remain scoped. Exporter cleanup uses one generation state object, and the managed reload wrapper forwards its existing owner callbacks directly.
User Impact and Compatibility
No new or removed configuration keys, changed defaults, wire protocol, or storage schema. Existing host-owned OpenTelemetry SDK providers remain host-owned. The optional plugin-service reload metadata is an additive SDK capability explicitly accepted for this work and documented with precedence and failure-recovery semantics. The shared config reader and SDK budget increment landed in #138638 and are deduplicated here.
Production LOC: +310/-196 (net +114); tests/test support +1056/-88 (net +968); docs +31/-2 (net +29). The production growth implements selected service generations, lease ownership, and recovery after consolidating duplicated lifecycle and callback plumbing.
Validation
Failed-before regressions cover service fallback suppressing established reload policy, lost managed-owner callbacks, stale diagnostic observations after re-enable, and webhook teardown or scoped configuration affecting host diagnostics. Selected-service tests preserve sibling instances and counters, fence old capabilities and callbacks, and cover cleanup/start failure plus cron ownership.
The first main integration passed 1,040 tests in 14 files, covering Gateway reload/planner/startup/close/generation, service/cron lifecycle, diagnostics, Telegram webhook, retained config, and OTLP receiver behavior. The complete changed gate passed formatting, guards, every type project, SDK boundaries, dead-code scans, typed lint, and import-cycle checks. Independent full review found only a duplicate test declaration introduced during rebase; the staged two-line removal passed a focused follow-up review. The subsequent registry-owner integration at
102452c8b93d566582b3e440987666341869a445, based on pinned maina592554b536c8d3ba6d833252718588451321b0d, passed another 393 tests in 8 files, core/core-test typechecking, merged-file formatting, and independent review. The only further conflict retained generic parameter forwarding, including main’s new Gateway registry callback. Final exact-head Linux proof and required CI 33936454662 both passed.Final Exact-Head Linux Proof
Built and exercised
102452c8b93d566582b3e440987666341869a445on Linux in run 33936577463. Full build and all five groups passed: initial global enablement; endpoint/header/service-name/metric-prefix replacement; metrics-only operation; exporter disable/re-enable; and global disable/resume while retaining Prometheus counters. Real loopback collectors received OTLP protobuf traces, metrics, and logs with generation-specific headers/resources. Gateway PID 9721, boot IDaeae44c1-ed06-4728-9d24-5d456a824534, and the existing operator connection survived throughout (one hello, zero closes). Joined shutdown produced no late exports for two configured intervals plus 200 ms. State and upstream traffic were synthetic, with no credentials or model/provider calls.Command and wrapper exited 0. The verified 17,039-byte receipt archive has SHA-256
5d0246ac0fea7bff904432d2876ab4293aac24a029c6bd5c000a1befc6a5ec2b. Source and build identity both match the published head; verified treece746af45c1ca2c80d15a8b0ceec471f4886bb2a, transport carrierf4b6f1ff178d0fefdb007ccd517257d5c7997d92. The owned lease was stopped and native status confirmed completed. Full build took 236.5 seconds; the live phase took 39.9 seconds.The scoped run invokes the committed helper. The aggregate hot-reload QA entrypoint also calls it; that aggregate and its startup-only
gateway.controlUi.basePathpositive control have static/type coverage. Externally preloaded SDK ownership and injected replacement failures are covered by focused lifecycle tests rather than this successful-transition collector run.Review Disposition
The latest completed ClawSweeper review of
55832bacfound no code or security defects. Its SDK-budget/integration rank-up is addressed by reusing the reader already on main and validating the combined owner paths. The documented recovery tradeoff is retained intentionally: failed replacement enters canonical recovery instead of leaving a partially replaced service generation active. Compatibility is unchanged apart from the accepted optional service metadata. Exact integrated CI and the final Linux proof both passed. No additional configuration, protocol, or storage changes were introduced by the main integration.