Repository navigation
fix: keep Gateway responsive while Doctor runs - #157228
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 24, 2026, 8:35 AM ET / 12:35 UTC (Revision 2). ClawSweeper reviewWhat this changesThe System agent launches noninteractive Doctor in a child process, forwards bounded diagnostics, and waits for cleanup so Gateway requests can continue. Merge readiness⛔ Blocked before merge - 1 item remains Current main still runs System-agent Doctor inline. The updated published-updater evidence addresses the prior review blocker, and this review found no introduced correctness or security defect. Priority: P1 Review scores
Verification
How this fits togetherThe System agent runs maintenance requests from the Gateway. Doctor inspects the installation and may perform safe migrations; its diagnostics return to the requesting agent. flowchart LR
A[System agent request] --> B[Gateway operation]
B --> C[Doctor child process]
C --> D[Installation checks]
D --> E[Diagnostics and exit status]
E --> F[System agent response]
B --> G[Other Gateway requests continue]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +159, Tests +188, Docs +7. Total +354 across 8 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the existing Doctor command through the registered child-process entrypoint while preserving noninteractive migration behavior and cleanup settlement. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source calls Doctor inline from the Gateway operation, and the submitted boundary regression demonstrates the event-loop stall mechanism; this reviewer did not execute it. Is this the best way to solve the issue? Yes. Reusing the existing noninteractive Doctor command in a registered child process confines its synchronous work without creating a second Doctor implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ead3b2ee776c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Related: #119720
What Problem This Solves
Fixes Gateway stalls when the System agent runs Doctor's bulk synchronous checks in the Gateway process.
User Impact
Chats and control requests can keep progressing while Doctor inspects the installation. The existing noninteractive checks and safe migrations remain unchanged; cancellation waits for admitted work and cleanup to settle.
Why This Change Was Made
Run Doctor in a child from the same installation and runtime, through its existing command entry. Forward bounded UTF-8 output and preserve failed exits, sealed-runtime selection, and write-capable cleanup. No schema, configuration, permission, or update migration changes.
Evidence
pnpm test src/system-agent/operations.doctor.process.test.ts src/system-agent/operations.doctor.test.ts --maxWorkers=1: 7 passed, 39.75 s Vitest / 44.10 s runner wall including cold subprocess compilation. The six output/failure/cancellation cases take milliseconds. The unchanged dispatcher suite also passed.pnpm buildat1c5f71ca7abe1b888c0d252fd210e47ad314511bpassed, including all declarations (22m16s). Canonical package integrity passed (119s). Candidate tarball SHA-256:59abdb48fdf7ce13a558b939bceace74dcfe5aec3713208f0e07da06e3818843.openclaw update --tag file:/tmp/openclaw-current.tgz --yes --json --no-restartagainst synthetic existing Projects/config/workspace state. All 12 steps passed, statusok, 131.343 s, no repair. This includes migration rehearsal, candidate Doctor lint, Gateway canary, installed Doctor, and final Doctor lint. The installed build identifies1c5f71ca7abe; every application payload hash matched the candidate tarball.doctor --lint --only core/doctor/project-clone-shape --jsonpassed twice (5.566s / 2.556s; zero findings), preserving config and SQLite-family hashes and leaving no private snapshots.Harness limitations: the broad 2026.9.6/base attempt failed before candidate installation because cold baseline channel startup took 94s against its 90s budget. The focused 2026.9.4/projects-doctor aggregate lane passed the update and installed-payload verification, then its observer miscounted a generated forwarding entry and its single implementation as two owners. Its failed outcome remains unchanged. The post-update checks above completed separately in a network-disabled container through the hash-verified forwarding entry and existing canonical assertions; no candidate, fixture source, timeouts, or baselines were changed.