Repository navigation
fix: prevent worker turns from stalling when group signals are denied - #160465
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 29, 2026, 2:01 AM ET / 06:01 UTC (Revision 24). ClawSweeper reviewWhat this changesThe branch adds negotiated Linux node-worker cleanup, a durable descendant-cleanup certificate, a persistent workspace watchdog, documentation, and lifecycle tests. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 5 items remain Current main still relies on process-group cleanup in the affected path, so this PR remains a distinct repair. The remaining merge question is whether to require a rehearsal using the shipped updater and copied existing state; the PR reports that this was deferred, but the reviewed GitHub discussion does not independently establish that acceptance. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway assigns session work to a paired node host, which starts worker processes and manages their workspace. Cleanup evidence determines when the host can release a physical worker slot for the next turn. flowchart LR
A[Session turn] --> B[Gateway placement]
B --> C[Node capability check]
C --> D[Worker and workspace owners]
D --> E[Process cleanup]
E --> F[SQLite cleanup receipt]
F --> G[Available worker slot]
Decision needed
Why: The repository requires a published-driver proof cell for state and lifecycle changes, while the PR body reports a deferral without a directly verifiable maintainer disposition in the reviewed GitHub discussion. Before merge
Agent review detailsSecurityNone. PR surfaceSource +1309, Tests +1952, Docs +26, Generated +7. Total +3294 across 78 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the negotiated native cleanup design and verify candidate startup, worker-journal custody, and rollback through the published updater on a copied existing database. Do we have a high-confidence way to reproduce the issue? Yes. Current main still uses process-group signaling in the affected owner, and the PR records a stock OpenShell case where those signals were denied; I did not execute current main in this read-only review. Is this the best way to solve the issue? Yes for the process-ownership repair: it uses the existing supervisor and launch journal with negotiated rollout. Merge readiness still depends on resolving the published-updater proof question. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4d8c9bddda7f. LabelsLabel changes: No label 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
HistoryReview history (23 earlier review cycles; latest 8 shown)
|
Keep the legacy ownership probe assertion without passing an unbound process method to expect. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
Exercise the two-process POSIX relay explicitly instead of allowing Linux native-owner selection to bypass the injected relay faults. Preserve every cleanup assertion and deadline. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
Preserve native discovery and extinction checks without treating the test host or its shared spawn broker as a per-server relay. Keep all server-owned processes in the recorded PID set on both native and process-group paths. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
Avoid the unnecessary map spread in the discovery PID-accounting helper while preserving the same server-owned PID set and assertions. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
Use the adapter ownership contract for broker ancestry and exclude only shared caller identities from exec cleanup accounting. Preserve native selection, server-owned process extinction, lineage, and cancellation assertions. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
12b4ed3 to
d194fc1
Compare
Keep native cleanup selected on qualified Linux hosts and assert descendant reaping rather than a legacy lineage receipt. Preserve the mixed-container failure and withheld-capacity assertions, and retain legacy receipt expectations on other supported runtimes. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
Reuse the existing finite root-work observer in the production spawn fixture before its zero-root assertion. Keep all scenario assertions, deadlines, and real registry cleanup intact; no production changes. Hosted CI owns validation under the requested no-additional-local-suite workflow. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
Observe and join the real persistence promise for the synthetic follow-up run before the fixture deletes its session. This includes the failure-notice append that can prepare outside the writer queue. Preserve deletion guards, delivery assertions, deadlines, and production behavior. Fresh hosted CI owns candidate validation; no additional local suite run. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
|
Merged via squash auto-merge.
|
|
Post-merge follow-up for the ClawSweeper update/rollback request:
The high-volume cell completed green. The legacy-operator cell intentionally ran the unchanged canonical rollback verifier before a known unrelated fixture mismatch, then stopped because its exact expected advisory text still says Result: the requested released-driver upgrade, candidate runtime/state, journal/capacity, and rollback evidence is now complete. I found no production-code follow-up needed for this PR; the stale advisory-text expectation is a separate harness cleanup. |
…openclaw#160465) * fix: prevent worker turns from stalling when group signals are denied Worked on by: - @sallyom - @steipete Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 83ccfa62-38b5-4e5f-9b9c-97193ffc76b4 * fix: retain background descendants after command exit Preserve natural descendant lifetime for ordinary commands while owned-worker exit still triggers native cleanup. Align process-group fixtures with their actual contract and launch the canonical compiled native owner in real lifecycle fixtures. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): assert against the captured process signal spy Keep the legacy ownership probe assertion without passing an unbound process method to expect. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): select the retained relay contract for MCP cleanup faults Exercise the two-process POSIX relay explicitly instead of allowing Linux native-owner selection to bypass the injected relay faults. Preserve every cleanup assertion and deadline. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): exclude shared hosts from MCP server cleanup accounting Preserve native discovery and extinction checks without treating the test host or its shared spawn broker as a per-server relay. Keep all server-owned processes in the recorded PID set on both native and process-group paths. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): update decoded MCP fixture records in place Avoid the unnecessary map spread in the discovery PID-accounting helper while preserving the same server-owned PID set and assertions. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): follow declared process ownership in lifecycle fixtures Use the adapter ownership contract for broker ancestry and exclude only shared caller identities from exec cleanup accounting. Preserve native selection, server-owned process extinction, lineage, and cancellation assertions. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): assert the negotiated worker recovery certificate Keep native cleanup selected on qualified Linux hosts and assert descendant reaping rather than a legacy lineage receipt. Preserve the mixed-container failure and withheld-capacity assertions, and retain legacy receipt expectations on other supported runtimes. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): join descendant completion before registry teardown Reuse the existing finite root-work observer in the production spawn fixture before its zero-root assertion. Keep all scenario assertions, deadlines, and real registry cleanup intact; no production changes. Hosted CI owns validation under the requested no-additional-local-suite workflow. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): await queued follow-up lifecycle persistence Observe and join the real persistence promise for the synthetic follow-up run before the fixture deletes its session. This includes the failure-notice append that can prepare outside the writer queue. Preserve deletion guards, delivery assertions, deadlines, and production behavior. Fresh hosted CI owns candidate validation; no additional local suite run. Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> --------- Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes: a completed worker can leave its physical reservation unresolved when the host prohibits process-group signals, preventing the next turn from starting. Command cleanup could also kill the reconciliation watchdog before final workspace validation.
User Impact
Workspace ownership is now negotiated per node connection. Updating the Gateway or node host first preserves the existing command route; the new route activates only when both peers support it on Linux with Node. Windows, macOS, and Bun do not advertise it. There is no operator setting to change.
Use matching current host/worker builds to obtain the repair on hosts that deny process-group signals. Refreshing only the portable bundle does not update node-host capabilities. Missing or uncertain cleanup evidence still retains custody.
The additive same-version SQLite certificate does not reinterpret legacy lineage receipts or backfill old launches. Released-npm upgrade/rollback and native Windows execution remain outside the bounded proof below.
Why This Change Was Made
A per-launch subreaper adopts descendants and uses retained child-wait ownership for positive-PID signals. Only kernel ECHILD certifies extinction. Portable workers receive the admitted host helper without native assets in their archive.
Negotiated workspace commands use the existing process supervisor; legacy commands retain their prior executor. A separate fixed-code recovery watchdog is held by the persistent workspace runtime through command gaps and app shutdown. Its exact PID/start and nonce remain validated; release recovers the lease before retiring the retained child over IPC. The node-host PID is never used as a killable watchdog reference.
Evidence
Current queued-follow-up persistence join — dd3ce05
CI run 36526613589 failed the synthetic queued WebChat timeout case when fixture deletion detected changed SQLite session state. Source tracing identified an unjoined producer: the definitive lifecycle event starts real persistence independently of WebSocket reply completion, and its failure-notice append can prepare outside the writer queue. The fixture now observes and joins the original persistence promise for that exact synthetic follow-up run before deleting its session. The observer delegates the real call unchanged and is restored after cleanup. SQLite deletion guards, delivery assertions, writer drains, and deadlines remain intact; production code is unchanged.
The log establishes a deletion-snapshot mismatch, not the exact racing field/interleaving. The missing producer join is source-supported; candidate runtime validation belongs to fresh CI. No additional local test/type/lint suite was run. On the preceding eae2f08 head, the native mixed-recovery assertion passed in compact-large-6 (job 109271950217); the registry fixture lane was cancelled and is not claimed passing.
Registry teardown fixture correction — eae2f08
CI run 36523102722 attempt 3 exposed two residual-root failures in the production spawn fixture after descendant model admission. The fixture called the zero-root assertion without supplying the shared settlement helper's owned-work callback. It now uses the existing finite root-work observer, as the registry's control and timing fixtures do, and joins completion tails before the same zero-root assertion. All model, authority, lifecycle, and cleanup assertions remain intact; no deadline, production code, broad mock, or skip changed. This is one test file (five additions, one deletion). No additional local test/type/lint suite was run; fresh CI and ClawSweeper will validate the candidate.
The preceding Koffi initialization crash on 63b20f4 did not reproduce in its single diagnostic hosted replay: all 24 Gateway files and 272 tests passed. Its precise cause remains unestablished; a passing replay is not claimed as a code fix. Other selected lanes were cancelled by fail-fast, and are not counted as passes.
Mixed-recovery fixture correction — 63b20f4
The stop-initialization fixture still expected
owned-anchoron every supported host. It now strictly expects native cleanup on Linux/Node and the legacy contract otherwise. For native recovery it checks that the descendant certificate is absent before recovery and present afterward, rather than treating the legacy lineage bit as native extinction proof. The unrelated-container failure, preserved pending launches, owner death, and withheld-capacity assertions remain unchanged. The owner identity is retained before the mode assertion so cleanup can still run if that assertion fails. This is test-only; no local suite was rerun, and fresh CI will validate it.Main-fix rebase — d194fc1
Main’s unrelated cron lint regression is resolved by 743c2ceb72e7. This branch is rebased onto main
1470a9bb092f, which contains that canonical fix. The redundant repair PR #160942 was closed, not merged.The seven commits replayed without conflicts. Every file changed by the worker PR is byte-identical to its
12b4ed3bbe92version, and the resulting tree exactly matches the independently computed composition with pinned main. Both human co-author trailers are preserved throughout. No local test suite was rerun; previous evidence remains source-bound, and fresh current-head CI/security/review gates still apply.Lifecycle fixture corrections — 12b4ed3bbe92
The remaining broker lifecycle assertion on
22377977a146assumed an intermediate relay on every platform. It now uses the adapter’s admittedtreeOwnershipto require the correct, exact broker-parent relationship for native versus process-group ownership. Root-result, retained-lineage, cancellation, and extinction assertions remain intact. A targeted source audit found the same shared-caller ancestry assumption in the completed-exec cleanup fixture; it now excludes only the exact test-host/broker identities while still requiring every recorded owned process to exit. These are two test-only corrections, with no platform fallback, skipped assertions, timeout changes, or new local suite run.The follow-up on this head removes the unnecessary object spread in the freshly decoded fixture record, addressing CI’s
oxc/no-map-spreaderror on437fcc317156. The PID set, assertions, and production behavior are unchanged.The two app-server/CLI discovery cases in compact-large-12 on
86d3f207cc4eassumed every MCP server had an owned relay grandparent. With the direct native owner, that grandparent is the shared test host or spawn broker. The fixture now excludes only those exact caller identities, obtained fromprocess.pidand the active broker owner, from its per-server PID accounting. It still checks every recorded server-owned process for retention and extinction, including a real relay when present. This test stays on the normal native path; no platform override, production change, timeout change, or skipped assertion. No local suite was rerun; fresh CI validates the correction.MCP cleanup fixture correction — 86d3f207cc4e
The remaining compact-small failure on
86235f929aedwas six cases inmcp-stdio-client.cleanup.real.test.ts: their fault injector specifically intercepts the retained two-process relay, while Linux now selects the native owner directly. This fixture now explicitly selects the POSIX process-group contract via the existing platform mock, restored by its existing teardown. All six cases, cleanup assertions, deadlines, and real subprocess operations remain intact; production selection is unchanged. No local test suite was rerun. The fresh hosted run will validate this correction.Prior lint-only correction — 86235f929aed
CI
check-lint-core-2on60f69c15f310reported one error:typescript(unbound-method)on the newexpect(process.kill)assertion. The assertion now uses the capturedvi.spyOnresult instead. This is a two-line test-only correction; production behavior, probe arguments, and assertions are unchanged. The accompanying file-size diagnostics were warnings, not the failing condition. No local test suite was rerun; fresh CI and ClawSweeper review remain the landing gates.Retained-descendant fix and conflict rebase — 60f69c15f310
The two failed compact-small shards exposed real contract issues, not CI noise. Ordinary commands now retain background descendants after their root exits; owned-worker exit still triggers immediate native cleanup. Process-group fixtures select that contract explicitly, retain their uncertainty assertions, and reject native certificates. Real lifecycle fixtures launch the canonical compiled native owner instead of giving a loader/compiler child access to its exclusive wait ownership. Native escaped-descendant cancellation remains covered.
The failing shapes reproduced first. 231 focused tests across 13 complete files passed in 187 s wall, including the unchanged Claude prompt-retention regression, native owned-worker cleanup, denied-group subreaper proof, and legacy lifecycle siblings. Core production typechecking passed. Further local static checks did not complete (exit 137); no passing test-type/lint result is claimed for this follow-up. At @sallyom’s request, further local checks stopped and the remaining validation is assigned to fresh ClawSweeper review and CI.
Rebased onto main
4187710037fc, resolving only the runner-inventory and connection-test conflicts. Main’s disabled-host diagnostics/normalization and this PR’s quiescence capability and tests are both preserved. All eight fix files match the successful pre-rebase proof byte-for-byte; both human co-author trailers are retained. No additional local test suite was run after the rebase.Prior main-fix rebase — 9cfd86b00b95
Rebased at @sallyom’s request onto main
80864601bf9e, including the upstream retired runtime-API guard fix. That fix owns the unrelateddiffs/lobsterinventory mismatch in CI run 36506017284 (including attempt 2); the previous red/cancelled run is not relabeled green.The bot-authored branch history was consolidated before replay to preserve its reviewed merge resolutions. The rebased tree exactly matches the independently computed conflict-free composition with pinned main. All worker implementation and test files match reviewed head
1749fc7cd815byte-for-byte; among the PR’s 64 touched paths, the only inherited difference is two upstream documentation lines. Both human co-author trailers and publication attribution are preserved. No local suite rerun was performed, as requested; prior source-bound proof below is retained. Fresh current-head CI/security and ClawSweeper completion remain required for landing.Prior cancellation/CI follow-up — 1749fc7cd815
The abandoned-acquisition P2 is repaired: the host retains exact lease custody while recovering an undelivered acquisition; fresh-nonce retries join that recovery. An aborted duplicate cannot revoke an already-delivered lease. The Gateway reconciles the original nonce through the existing release contract and clears its capability pin only after a real successful release. Recovery uncertainty still retains custody. No protocol, schema, configuration, timeout, or security guard changed in this follow-up.
Maintainer disposition: retain this PR's existing additive companion-table design and its documented older-reader and uncertain-cleanup behavior. @sallyom explicitly directed landing this implementation on green CI after the blocking cancellation fix, considers the available qualification sufficient, and reports Windows regression testing. The unfinished released-driver upgrade/backup-restore rehearsal is deferred, not claimed as a pass. Decision discussion. Required current-head CI/security/review gates still apply; this is not an admin exception.
Compatibility review follow-up — 43db862 (implementation 1924676)
Earlier watchdog qualification
Real reconciliation failed at 85e because command cleanup retired its detached watchdog. The persistent owner fixes that composition. Nine native lifecycle regressions and the retained-process/remote-script siblings passed; affected paths were rerun in this follow-up. On earlier tree 786cfc05c7bd, actual runtime-owner SIGKILL left the exact helper and lease intact until original expiry; the lease disappeared 11 ms after the deadline and pidfd confirmed helper exit 4 ms later, without renewal, helper signals, or clock manipulation. This is not native Windows or restart/reacquisition proof.
Earlier process-ownership qualification — 85e772a
112 focused tests, core types, scoped lint and generated Kysely checks passed. Separately built prechange 2da0e9a and 85e passed all four host-relay/deployed-worker start, EOF and extinction combinations. Real schema-19 rollback/re-upgrade, certificate preservation, unrelated writes, cascade pruning and unknown custody passed; 11,608 compiler inputs matched source. This does not qualify released-npm rollback or full Gateway enrollment. The compiled owner also passed under the unchanged stock OpenShell filter with group signals still denied. Later CI fixture/errno corrections used no scanner exceptions or guard bypasses.
Matching-build OpenShell boundary proof (earlier combined tree 3a3000e386ba, not this follow-up): all 50,440 tracked inputs matched; the full package build and tarball integrity passed, and 11,201 installed dist files matched inside a stock OpenShell sandbox at Ready/ConfigurationAccepted. The matching isolated Gateway returned TLS-verified readyz 200. Through the real stock broker, the packaged native owner passed terminal output, fork/setsid cancellation with descendant reaping, owner-control loss, and sibling isolation. Group signals still returned EPERM; output drain delivered exactly 262,144 bytes.
Remaining qualification: connected Gateway/enrollment failed at the private bridge's Pasta network-namespace permission boundary, and the task-authorized native provider/model route was unavailable. Full model A/B, retained background across turns, restart/unknown receipt, and complete workspace lifecycle remain unrun. No security relaxation, host-network fallback, or substituted model proof. All owned runtime resources were cleaned up. Separately, the task-private stock healthcheck preflight passed two checks roughly 30 seconds apart; the later full-sandbox run did not capture successful scheduled checks. Neither result qualifies native Windows or the current follow-up package.
Local testing
Sally ran manual update locally:
fa48b100811e→ PR768fc0312d1e.The earlier 453-byte UI startup overrun did not recur in that later combined package: startup JS was 362,992 bytes against a 372,347-byte limit. A CSS advisory remained. This independent PR does not modify the feature-stack branches.
Thanks to @sallyom for reporting the stalled second turn and providing reproduction context.
Worked on by
Work sessions
View the OpenClaw team session