Repository navigation
fix(update): prevent debug logs from blocking Gateway updates - #177563
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR routes managed-update helper diagnostics to stderr so debug logs cannot corrupt its stdout control handshake. Example: A managed Gateway update runs with OPENCLAW_LOG_LEVEL=debug and emits a SQLite inspection diagnostic before READY.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a source-supported handshake failure still present on current main; no actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe installed updater starts a detached helper that loads recovery code, exchanges control messages with the Gateway parent, and owns update handoff and recovery. flowchart LR
A[Installed updater] --> B[Detached helper]
B --> C[Sealed runtime]
B --> D[Recovery runtime]
D --> E[Shared logging state]
C --> E
E --> F[Diagnostics on stderr]
B --> G[Control responses on stdout]
Technical reviewBest possible solution: Keep control parsing strict and initialize the existing shared stderr route before loading the installed recovery runtime. Do we have a high-confidence way to reproduce the issue? Source establishes a recovery import before READY and rejection of an earlier diagnostic line; the PR reports published-release reproduction and a red-on-base regression, which this read-only review did not execute. Is this the best way to solve the issue? The patch repairs diagnostic routing at the existing sealed-runtime boundary without weakening the handshake, changing ownership checks, or adding parallel machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dc81220e46b6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests +19, Docs +4. Total +26 across 5 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 19, 2026, 2:22 PM ET / 18:22 UTC. |
…aw#177563) Route managed handoff diagnostics to stderr before the recovery runtime runs, preserving stdout for READY and other control messages. Retain the generated-helper regression and document the installed-driver limitation.
What Problem This Solves
Fixes managed Gateway updates failing before startup when debug console logging emits a SQLite diagnostic during the handoff handshake.
User Impact
Updates can start with debug logging enabled. This repairs future installed updaters; a candidate cannot change an already-published updater's pre-activation handshake. No protocol, configuration, or schema changes.
Why This Change Was Made
The helper reserves stdout for control responses, but the imported recovery runtime can log before READY. Initialize the existing stderr route inside the sealed handoff runtime so diagnostics remain available without entering the control pipe. Ownership checks and control parsing stay unchanged. Net production delta: +3 lines; five files changed.
Evidence
Two real cross-machine attempts from published 2026.10.5 reproduced the failure with a node-local tool active. A bounded syscall capture confirmed a SQLite debug line preceded READY; the Gateway kept serving. The requested stable-to-main/version-skew sequence remains blocked by that installed-driver defect; no successful upgrade is claimed.
The regression extends the existing legacy SQLite recovery case: READY must be first on stdout, the actual recovery-module diagnostic must survive on stderr, and recovery must complete. Base failed on the wrong first line (24.92 s wrapper). The focused suite passed six tests, with five PostgreSQL-server cases skipped (27.08 s wrapper / 23.59 s Vitest). After the final sealed-runtime relocation, the real helper regression passed again (43.62 s wrapper / 39.50 s Vitest, including cold worker preparation). Oxfmt, oxlint, diff check, commit hooks, and independent review passed. Broader validation runs in PR CI.
CI run 39304400855 passed on refreshed head
02f817ca8587c19198c17e351b583a8ec892d490, including selected tests, all PostgreSQL conformance shards, types, lint, source contracts, security, and docs. Current main was merged once without conflicts; the authored patch is unchanged. The earlier inherited formatter failure is resolved on this head.Published-driver compatibility
The stdout writer is the installed handoff helper, not the candidate service. In published 2026.10.5,
update-managed-service-handoff.tsloads the installed recovery module, calls the foreground-owner assertion, and only then writes READY. The actual update command starts after READY and ownership transfer. Neither the handoff marker nor the sentinel metadata can make candidate code run before that point, so this fix protects subsequently installed drivers; it cannot repair an already-published driver's handshake.Source-audited affected releases: regular stable 2026.9.6–2026.9.9 and 2026.10.1–2026.10.5; extended-stable 2026.9.33; prereleases 2026.10.1-beta.1–2, 2026.10.5-beta.1–4, and 2026.10.10-beta.1–2. Only 2026.10.5 has been live reproduced. The immediately preceding 2026.9.5 lacks this foreground-helper path.
Workaround for affected installed drivers: temporarily set
logging.consoleLeveltoinfoand remove or override any inheritedOPENCLAW_LOG_LEVEL=debugbefore retrying the update. File logging can remain at debug. This is an operator workaround, not a passing DEBUG-enabled upgrade result.Post-merge follow-up: merged as
60f7650683f74c3f47a528ec396557b26d8a9f9cafter exact-head CI/security passed. Native retained-request recovery refused twice; used the authorized head-pinned REST squash. A fresh 2026.10.5 install passed Gateway health with DEBUG console/file logging enabled. Its update RPC was not dispatched because the lease finished; the replacement queued and was cancelled under the immediate-capacity rule. No fresh published-to-candidate or version-skew pass is claimed. The two existing live failures and the published source identify the installed helper as the pre-READY writer; no candidate-side mitigation can execute that early.