Repository navigation
fix(nodes): prevent orphaned work and incompatible launches - #149158
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 19, 2026, 7:54 AM ET / 11:54 UTC (Revision 7). ClawSweeper reviewWhat this changesKeeps worker capacity reserved until descendant cleanup is verified, preserves cancellation results, and prevents older nodes from accepting incompatible OpenClaw sessions. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 4 items remain The PR remains necessary, with no blocking correctness finding identified. The earlier recovery defects are addressed, and the updated qualification closeout satisfies the previous review’s remaining follow-up. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway assigns session work to paired node hosts. Each node supervises worker processes and records their ownership, results, and available capacity so crashes and cancellation cannot prematurely free occupied slots. flowchart TD
A[Gateway session request] --> B[Node capability and authority checks]
B --> C[Node worker supervisor]
C --> D[Durable launch journal]
C --> E[Worker and descendant processes]
E --> F[Cleanup completion and process extinction]
F --> D
D --> G[Updated capacity and preserved results]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single journal-backed supervisor and exact cleanup certificates, with the documented node update, restart, and drain-before-rollback contract. Do we have a high-confidence way to reproduce the issue? Yes, source and focused fault cases establish the crash-and-restart path involving retained descendants and premature capacity release. This read-only review did not execute the runtime. Is this the best way to solve the issue? Yes. Extending the existing supervisor, journal, and negotiated startup contract preserves one cleanup owner and avoids reconstructing authority from a dead PID. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c5eab8179c2f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
Relay-owned workers share their anchor process group, so forcing detached group signaling can silently miss the application after anchor loss. Let the existing process-tree owner choose the verified target, preserve direct-worker group behavior, and cover noncooperative application exit with the real worker regression. Follow-up for #149158.
Compose current main with the reviewed worker lifetime repair. Keep awaited stdout consumption in the shared output owner and retain owned-worker lineage and capacity until physical cleanup is confirmed. Join output settlement within the existing non-forced cleanup budget before retiring the anchor, preventing a successful worker exit from losing buffered output. Preserve the real IPC-disconnect regression, full output-drain proof and existing test order through a shared background-exec suite. Normal node bootstrap and sealed worker helpers retain their separate build contracts. Ref: #149158.
|
@clawsweeper re-review The stale GitHub base projection has been refreshed without changing head Exact-head CI passed. Final successor native/live qualification and cleanup remain pending; merge stays held. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Restore released process-group recovery after the leader exits. Record the selected transport before admission and retain exact-anchor root/lineage completion in a journal-owned companion table before releasing capacity after restart. Use existing-file completion transactions so late cleanup cannot recreate removed state. Preserve public receipts, schema version and terminal retention; drain active modern workers before rollback to an older writer.
Preserve current node-update admission and cleanup-budget owners while retaining durable exact-anchor recovery and released worker compatibility. Keep one observed-terminal projection, migrate the moved initialization coverage, and verify that unresolved cleanup remains active work. Preserve the current standalone node launcher and six-artifact worker build. Remove redundant protocol imports and their unused private re-export.
Preserve the existing canonical first-use schema exception at the leading callsite recognized by the SQL guard. No SQL, guard rule or runtime behavior changes.
Integrate current process cleanup contracts while retaining capacity for uncertain native results and unresolved Windows restarts. Capture admitted external-supervisor context for the private host cleanup writer without broadening the worker environment.
Hold the failed startup owner beyond an explicit waiter budget, then require a fresh health request and cleared failure state. Preserve the owner deadline and join cancellation cleanup. Production inputs are unchanged by this commit; disposable native proof runs on a separate task branch.
Bound observation of an unfinished cleanup anchor without releasing its reservation or escalating against it. Reconcile retained physical owners through status even when their requested turn has completed, preserving the turn outcome and requiring both lineage completion and tree extinction before freeing capacity.
Retain exact cleanup observation in the node supervisor after startup returns, publish freed capacity automatically after verified cleanup, and stop and join observation on shutdown. Share cancellation intent and preserve completed turn results.
|
@clawsweeper re-review Please refresh the completed review for unchanged head These are separately scoped runs; earlier incomplete campaigns retain their original outcomes. Final fleet cleanup is being verified, and merge remains held until that closeout is accepted. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
What Problem This Solves
Commands could survive worker or node-host crashes after their slots were released. Stop could fail during cancellation, and older nodes could accept sessions without preserving the Gateway's captured execution policy.
User Impact
Work keeps its slot until descendant cleanup is confirmed. Restart recovery leaves other free slots usable and automatically returns recovered capacity. Stop preserves the cancelled result while unrelated workers continue.
Update the Gateway and restart updated node hosts for the complete protection. After a Gateway-first upgrade, hosts missing captured execution-policy support show Update required before dispatch. Remote-exec placement keeps its existing requirements.
Why This Change Was Made
The existing supervisor owns cleanup observation, capacity, and shutdown. Bounded recovery waits let startup expose other free slots while observation continues. The journal records transport before execution and accepts lineage completion only from the exact running owner. Capacity returns after recorded lineage completion and physical process-tree extinction; status, replay, and cancellation share that recovery without rewriting completed results. Cancellation revokes authority immediately while allowing the exact cancelled owner to acknowledge completion.
The journal adds one private companion table without changing its schema version, public receipts, or existing 24-hour terminal retention. Released direct workers keep their process-group recovery contract. Drain modern workers before rollback to an older writer. The qualified rollback covers standalone node/shared state without agent databases; draining does not reverse other migrations, and agent-state rollback requires a compatible schema or baseline backup.
Unconfirmed cleanup retains capacity and blocks automatic updates. Native Windows restart recovery remains unverified; its evidence is limited to source, types, and platform-boundary checks.
Evidence
The canonical build and exact-head CI passed. Focused runtime/recovery tests and relevant static checks passed, including the unchanged passive capacity regression. Independent review found no actionable issues.
The Gateway and three Linux nodes constructed the runtime successfully. Native recovery on one node passed 59 node-host tests and four original-order worker fault cases. Published-worker startup/idle/disconnect IPC passed with joined processes and no remaining groups. The compiled UI passed 17 mock flows covering capacity and virtual-timer behavior.
The released v2026.9.4 updater installed the exact candidate in 71.605 seconds; all 10,065 application files matched and both Doctor results passed. Installed node activation, descendant drain, and capacity recovery passed. Restoring the old runtime over drained node-only state preserved the journal and both completed results, with schema 17 and integrity intact. All diagnostic processes and the enclosing cgroup settled. This does not establish Gateway-service or agent-schema rollback.
Using real OpenAI requests through the Web UI, R8 passed 14 core scenarios covering occupied capacity, the retained seventh draft, Stop under load and recovery, and network interruption and restoration. Its scheduled-work portion did not run.
A separate scheduling-only run passed the Home prelude and populated-Home reuse, cold-node seed installation, Web UI job creation/readback, and natural execution on that same node. It recorded one successful occurrence, removed the job through the UI, and returned all six slots to idle with zero live application workers. For that single observed occurrence, assignment was recorded 140 ms after its due time and execution took 12.975 seconds; this is a sample, not a benchmark.
Cleanup of every contributing execution generation is verified: physical worker and service groups retired, browser/profile owners joined, scheduled work removed, task credential files and management keys removed, and all four machines stopped in each fleet. The qualification hold is lifted.
Source and proof scope
Candidate:
54de94d63ed707a4f93d49d7e7252bb74d12ff01. Build:2026.9.4-54de94d63ed7-2026-09-18T21-54-47.972Z.Source hydration, archive readbacks, all six portable worker artifacts, three WASMs, journal dependencies, Windows helper bytes, and UI assets passed identity checks. The focused selection passed 169 tests before the final private-helper/export cleanup, followed by 35 recovery/initialization cases afterward. The native four-fault selection skips the other 75 worker-runtime cases; the complete file passed locally in its original order.
The scheduling run proves its successful no-fault contract; it did not retain stderr for a separate clean-lifecycle claim. Fleet closeout proves physical service retirement and owned log/SSH joins, without asserting application async joins. A retained Gateway registry row was distinguished from the independently verified absence of live application workers.
The v2026.9.4 tag-source journal matrix separately verified reader/writer/pruning compatibility. Candidate agent schema 21 versus the tag's schema 19 is inherited from main and lies outside the node-only rollback proof.
The macOS readiness proof passed 70 cases. A freshly built historical counterfactual failed exactly the five intended assertions and completed cleanup. This PR contains no production Swift change or proof workflow.
Inspected synthetic UI screenshots and their original provenance
Earlier compiled UI capacity states (mock)
The compiled
2e1eb1fcUI shows the same seventh draft while synthetic capacity is full and after a slot is released. These are historical mock states from that build’s 17-flow run; they are not an old/new code comparison or live fleet proof.Earlier built synthetic Stop flow
These captures show a synthetic Stop flow in the compiled
b9924a0UI. They are historical state progression, not an old/new code comparison or current-candidate live proof.Outdated-node placement before and after the eligibility repair
This before/after pair uses the same synthetic node and compiled
97fe2df3UI. The prior Gateway inventory makes the outdated node selectable; the repaired registered inventory disables it with update/restart guidance. Supported OpenClaw and Codex destinations remain selectable. This synthetic proof sends no session or model request.