Repository navigation
fix: suspension and restart wait for background execs - #104172
Conversation
|
Codex review: stale review; fresh review needed. Summary Next step Review history (2 earlier review cycles)
|
5d2160e to
8eb03ef
Compare
|
@clawsweeper please re-review this exact head with the real behavior proof below. Exact head: Exact-head CI: run 29141777808 completed with all 68 checks green at the SHA above. The rebased fixture repair also passed Fresh Testbox-through-Crabbox live proof: I fetched the exact commit on the fresh Testbox, asserted that the synced tracked tree had no working-tree or index delta from it, and built it. I then started the actual built Gateway against an isolated deterministic Responses endpoint. The model issued a real background Observed contract:
Sanitized terminal result: {
"whileChildLive": {
"suspendPrepare": {
"status": "busy",
"reason": "active-work",
"activeCount": 1,
"blockers": [
{
"kind": "background-exec",
"count": 1,
"message": "1 active background exec session(s)"
}
]
},
"safeRestart": {
"status": "deferred",
"safe": false,
"backgroundExecSessions": 1,
"totalActive": 1
}
},
"afterActualChildExit": {
"inProcessRestartCompleted": true,
"gatewayReadyEpochs": 2,
"suspendPrepare": {
"status": "ready",
"activeCount": 0,
"blockerCount": 0
},
"suspendStatus": "ready",
"resume": {
"ok": true,
"status": "running",
"resumed": true
},
"postResumeStatus": "running"
},
"disclosureCheck": {
"blockerIsAggregateOnly": true,
"commandPidSessionDetailsPresent": false
},
"cleanup": {
"controllerStopped": true,
"gatewayStopped": true,
"gatewayPortClosed": true,
"mockClosed": true,
"isolatedStateRemoved": true,
"testboxStopped": true
}
}The fresh exact-head build passed in the same Testbox. The temporary harness was not committed and was removed; the PR worktree is clean at the SHA above. The Testbox was stopped after proof capture. |
|
🦞👀 I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes. Request: please re-review this exact head with the real behavior proof below. Exact head: |
8eb03ef to
ab0a51c
Compare
|
ClawSweeper assist: The proof is strong for Evidence:
Suggested next action: Provide equivalent exact-head CI and behavior proof for Source: #104172 (comment) |
ab0a51c to
9f70249
Compare
|
🦞👀 I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes. Request: please re-review this exact head with the real behavior proof below. Exact head: |
|
Merged via squash.
|
* fix: block restart and suspension on background execs * test: cover background exec suspension inspector
…roval admission (#161469) The exec-approval admission catch matched a plain Error whose message was "gateway is draining for restart". That matched the untyped refusal that runWithGatewayIndependentRootWorkAdmission threw when the check was added in #104172. #112989 changed that producer to GatewayDrainingError, so the instanceof branch already covered it, and #160869 then changed the draining copy, so the string could no longer match anything. No path delivers a draining refusal here without class identity: the admission call passes no AbortSignal, the wrapper and the error class come from the same module, and the callback's spawn and authorization failures are caught inside the admitted run.
…roval admission (openclaw#161469) The exec-approval admission catch matched a plain Error whose message was "gateway is draining for restart". That matched the untyped refusal that runWithGatewayIndependentRootWorkAdmission threw when the check was added in openclaw#104172. openclaw#112989 changed that producer to GatewayDrainingError, so the instanceof branch already covered it, and openclaw#160869 then changed the draining copy, so the string could no longer match anything. No path delivers a draining refusal here without class identity: the admission call passes no AbortSignal, the wrapper and the error class come from the same module, and the callback's spawn and authorization failures are caught inside the admitted run.
Fixes #104079
What Problem This Solves
Fixes an issue where hosts using cooperative Gateway suspension or safe restart could receive an idle result while an approved background exec process was still running. A visible process entry could also be removed before the operating-system process had actually exited, leaving the remaining work unaccounted for.
Why This Change Was Made
The process registry now retains a count-only live background-exec marker through confirmed exit. Detached approval execution atomically hands work from Gateway root admission to that marker, while suspension and every safe-restart path account for both sides of the handoff. The protocol exposes only an aggregate
background-execblocker; commands, PIDs, output, and session identifiers remain private.User Impact
Hosting controllers no longer freeze, snapshot, or restart the Gateway across a live background command.
process removecan still hide a session immediately, but lifecycle admission remains blocked until the process owner confirms exit.Release-note context: cooperative suspension and safe restart now wait for live background exec sessions.
Evidence
blue-prawn/ run 29139283576: 207 focused test executions passed across registry, detached approval, suspension, restart, reload, and protocol suites.pnpm protocol:checkpassed.pnpm buildpassed.pnpm check:changed -- <touched files>passed, including core/test typecheck and the full core lint fan-out.pnpm docs:check-mdx,pnpm docs:check-links,pnpm docs:check-i18n-glossary, andpnpm format:docs:checkpassed; link audit checked 5,807 internal links with zero broken links.