Repository navigation
fix(gateway): durable execs are reported as stopped after a Gateway restart - #199085
Conversation
…start Graceful shutdown marked every running background process as stopped, durable ones included, so each restart sent a resume turn telling the agent to rerun a process the registry had just adopted. Skip durable processes in the shutdown marker; their adopted exit still wakes the session. Co-authored-by: obviyus <[email protected]>
|
🦞👀 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: needs maintainer review before merge. What this changesExclude durable background processes from graceful-restart markers that report stopped commands. Example: A durable background CI waiter survives a graceful Gateway restart.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main false restart notice with a minimal change at the existing owner; no blocking defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway shutdown collects live work into persisted session-resume markers; startup turns those markers into conversation inputs, while the background-process registry independently adopts durable commands and delivers their outcomes. flowchart TD
A[Gateway shutdown] --> B[Live work enumeration]
B --> C[Ordinary process restart marker]
C --> D[Startup conversation resume]
A --> E[Durable process continues]
E --> F[Registry startup adoption]
F --> G[Exit notification]
Technical reviewBest possible solution: Keep the existing durable registry responsible for surviving commands and mark only ordinary background processes as stopped. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically marks durable background processes as stopped, and the supplied live base trace shows the resulting false conversation input; this read-only review did not execute a reproduction. Is this the best way to solve the issue? The patch repairs the marker producer using the existing durable flag, preserves ordinary recovery, and adds one distinct regression case without introducing another recovery owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3f7d2a1c77f5. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Tests +17, Docs 0. Total +18 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
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 November 14, 2026, 1:47 PM ET / 18:47 UTC. |
|
Landed as 0c1fe01. After a graceful Gateway restart, sessions whose only background work is a surviving durable process no longer get a false "stopped" notice. Real-agent restart test: false stopped turns 6 -> 0, polls after restart 91 -> 0. |
…nds exit together (#199113) ## What Problem This Solves Fixes: when several background commands exit close together, the agent gets one wake turn per command, so three exits cost three model turns and three replies. ## User Impact User impact: completions that arrive while an earlier completion turn in the same conversation is still queued or running now reach the agent together in one turn, with each result's process ID, status, exit code and output tail. A single completion starts at once, exactly as before. ## Why This Change Was Made Each exit enqueued its own session event and became its own turn. The session event owner already turns a set of exact queued occurrences into one ordinary turn (`occurrences`, used by session-state notices), and `combineSessionEventTargetsForHost` already checks that a set shares one destination and requester authority. This change reuses both: - New `session-event-batch.ts` in the session event owner keeps one in-flight completion turn per conversation. A completion with nothing in flight starts at once through `enqueueSessionEventForHost`, unchanged. A completion that arrives while that turn is queued or running claims its queued occurrence and waits. One second after the turn settles, every waiting completion that shares the same exec request owners, launching run, route and combinable target starts one turn with all of their occurrences. - `bash-tools.exec-notify.ts` only switches its enqueue import to the batched entry point. Each result keeps the wake format from #199122 (`Exec completed (<id>, code 0, 4m3s):` plus a tail of up to 2,000 chars). - One shared turn carries at most about 8,000 characters of results. Occurrence text must stay byte-exact, so the bound limits membership, not text: results past the budget start the next turn. - The exec completion guidance is count-neutral ("Treat each completion result above as an internal continuation…") so a batched turn no longer says "this completion" for several results. Choices and accepted edges: - **A 1 s settle, only for completions that already waited.** A first or lone completion still starts at once (measured base: its turn starts within about 1 s of the exit, before later exits arrive), so no delay is added to single wakes. Without a settle, exits about 1 s apart sometimes straddle the end of the turn they waited behind: on the intermediate head, 2 of 6 trials split into three turns because the last exit arrived just after the batch started. Waiting completions now start 1 s after that turn settles, so stragglers join. - **Only one request's completions share a turn.** Stop aborts every exec request owner of a turn, so mixing requests would let one Stop retire another request's result. Completions from different requests keep separate turns. - **Only one launching run's completions share a turn.** The completion turn's input provenance names the run that launched the command, which plugins use to correlate a completion with its run (#179816). Request owners carry over into completion turns, so commands launched by a later run can share owners with earlier ones; the batch also requires the same launching run, and each shared turn keeps a truthful `inputProvenance.runId`. - **Cron-run completions never wait.** They check at acceptance that the originating run is still alive; holding them could turn an accepted completion into a refused one. - Removing one member after its shared turn is queued (for example, the model polled that result) leaves the shared prompt as is; the turn is retired only when every member is removed. Before the shared turn is queued, removal drops just that member. - A waiting completion starts after its predecessor settles, so a human message queued in `followup` or `collect` mode meanwhile can run first. - Rebased on #199122 (wake format) and #199085. This PR touches only the import line in `bash-tools.exec-notify.ts` and the guidance wording in `agent-runner-run-params.ts`. ## Evidence **Real-agent E2E** (isolated source Gateway via `ocx src`, real OpenAI model, 6 concurrent trial sessions per arm). Each trial asks the agent to start three background waiters with `yieldMs`, waits until the session is idle with all three running, then releases them 1 s apart. Base = current `main` (`afeadf1c4fe0`, includes #199122); fix = this PR rebased on it. | Arm | Wake turns (6 trials) | Results acknowledged | Wake-turn tokens (total) | Wake-turn cost | | --- | --- | --- | --- | --- | | base, 3 exits | 18 (3 per trial) | 18/18 | 501,233 | $1.152 | | fix, 3 exits | 12 (2 per trial) | 18/18 | 326,362 (-35%) | $0.930 | | base, 1 exit | 6 | 6/6 | 153,377 | $0.402 | | fix, 1 exit | 6 | 6/6 | 153,934 | $0.403 | Single-exit wake latency (release to wake message, median of 6): base 0.85 s, fix 0.85 s. A single completion never waits for the settle. Time from release to the last reply in the 3-exit arm: base median 9.2 s, fix median 7.3 s. Every fix trial: the first exit starts its turn at once; the two later exits arrive during it and share the next turn, each keeping its own id, exit code, duration and tail. Results from earlier runs before the rebase (same arms, older wake format) matched: 12 turns vs 18. <details><summary>Redacted trace, trial 1 (times relative to release of the first waiter)</summary> Base (before the rebase, old wake format): ``` +8.8s USER: Exec completed (gentle-c, code 0) :: job 1 result: r11-1603127358 +11.7s reply (26930 tok): job 1 result: r11-1603127358 +19.1s USER: Exec completed (dawn-gla, code 0) :: job 2 result: r12-78193628 +22.0s reply (27407 tok): job 2 result: r12-78193628 +26.5s USER: Exec completed (kind-sum, code 0) :: job 3 result: r13-1811516849 +29.2s reply (27885 tok): job 3 result: r13-1811516849 ``` Fix (rebased head): ``` +1.2s USER: Exec completed (tide-cov, code 0, 34s): job 1 result: r11-1383216 +3.7s reply (26761 tok): job 1 result: r11-1383216 +5.1s USER: Exec completed (tidy-com, code 0, 32s): job 2 result: r12-262323306 Exec completed (rapid-bi, code 0, 29s): job 3 result: r13-179203848 +7.7s reply (27281 tok): job 2 result: r12-262323306 / job 3 result: r13-179203848 ``` </details> **Regression tests:** `bash-tools.exec-background-followup.test.ts` runs three real background commands through the exec tool and the real session event owner with a held first model turn. Same launching run: base starts three completion turns (red); the fix starts two, the second carrying both later results and naming their run. Different launching runs with shared request owners: the later results keep separate turns, each naming its own run (red without the launch-run check). Five results of ~2,000 chars: the shared turn takes three and the fifth starts its own turn (size bound). **Focused suites (`ocx test`, rebased head, 14 files):** `bash-tools.exec-background-followup`, `bash-tools.test`, `bash-tools.exec-runtime`, `bash-tools.exec-runtime.cleanup`, `bash-tools.visible-subagent-notify`, `bash-tools.exec-request-stop`, `bash-tools.exec.egress-lifecycle`, `bash-tools.notify-on-exit-ack`, `bash-tools.process.e2e`, `bash-tools.exec-notify.requester`, `bash-tools.exec-notify.queue-full`, `infra/exec-session-event`, `session-event-handoff`, `agent-runner-execution-session-events`: all pass. `exec-session-event`'s chained-completion case now waits for the second receipt, which starts after the 1 s settle. **Full tier:** `ocx build --dts` (full profile) built `92847fc`; the self-contained source package passed its tarball integrity check, installed with npm into a scratch prefix, and the packed CLI reported `OpenClaw 2026.11.3 (92847fc)` with `gateway --help` exit 0. The later head commit only changes a test type. **Gaps:** E2E covers exits from one request in an idle Control UI-style session; completions from different requests and channel-delivered sessions are covered by the shared owner's existing tests, not by a new live run. Co-authored-by: Ayaan Zaidi <[email protected]>
…estart (openclaw#199085) ## What Problem This Solves Fixes: after a graceful Gateway restart, every conversation with a running `durable: true` background command was told "Background exec processes were stopped; rerun them if still needed", even though the registry had just adopted that command and would wake the conversation when it exits. ## User Impact User impact: a durable waiter now survives a restart quietly. The conversation keeps waiting and wakes once, when the command exits. The agent no longer gets a false "stopped" turn, so it neither polls the surviving command nor reruns it. Ordinary (non-durable) background commands still get the same restart notice as before. ## Why This Change Was Made The graceful-shutdown marker counted every running background process, durable ones included. It now skips durable processes. Their own owner adopts them at startup and delivers the exit or lost-process wake. Docs now state which processes the restart notice covers. They also note that a crash sends no notice for ordinary processes; that gap is tracked separately. ## Evidence Real-agent E2E on an isolated source Gateway (`openai/gpt-6-astra`, 6 concurrent conversations per arm, automations tool denied). Each conversation is asked to wait for a fake CI that flips green about 300 s later. The Gateway gets SIGTERM about 90 s after every conversation armed its waiter and ended its turn, then a new Gateway starts on the same state. | Arm | Waiters armed, turn ended | False "stopped" restart turns | `process poll` calls after restart | Waiters that exited and woke their conversation | | --- | --- | --- | --- | --- | | base, `durable: true` waiter | 6/6 | **6** | **91** | 6/6, collected by the poll loop inside the false turn | | fix, `durable: true` waiter | 6/6 | **0** | **0** | 4/4 by the exit wake (2 model-written loops never matched "all 15 checks passed" and never exited, unrelated to restart) | | base, ordinary waiter | 6/6 | 6 (correct) | 0 | re-armed 6/6 | | fix, ordinary waiter | 5/6 (1 was still mid-turn) | 6 (correct) | 0 | re-armed 5/5, finished 6/6 | Shutdown log, durable arm: base `marked: 6`, fix `marked: 0`. <details><summary>Public trace, durable waiter, base vs fix (trial 2, paths redacted)</summary> Base: false restart turn, then a poll loop on the adopted process: ``` + 53s -> Command still running (session faint-otter:…). Its exit wakes this conversation … + 62s reply: The durable background waiter is running. … +186s USER: The Gateway restarted while you were working. Resume your work … Background exec processes were stopped; rerun them if still needed. +190s process {"action": "poll", "timeout": 1000} +198s reply: The original durable waiter survived the restart and is still running, so I haven't started another. … +198s process {"action": "poll", "timeout": 30000} +206s -> PR openclaw#4242: 4 checks pending, 11 passed Process still running. Automatic completion wake is unavailable after ending this turn. … … 13 more polls until CI turned green … ``` Fix: no restart turn; the adopted exit wakes the conversation once: ``` + 69s exec {"yieldMs": 1000, "background": true, "durable": true, "timeoutSeconds": 0} "python3 -u - <<'PY' …" + 69s -> Command still running (session quick-fjord:…). Its exit wakes this conversation … + 76s reply: The durable background wait is running. … +354s USER: Exec completed (quick-fj, code 0) :: … PR openclaw#4242: all 15 checks passed … +364s reply: PR openclaw#4242 is ready—all 15 checks passed. Saved and verified in `pr-2/RESULT.md` … ``` </details> Regression test: `src/gateway/session-restart-resume.test.ts`, "marks ordinary conversations without inheriting cron, external execution or durable processes". It fails on base (`agent:main:durable-waiter: expected { queuedInputIds: [], … } to deeply equal undefined`) and passes with the fix; the file passes 21/21. Known gaps, out of scope for this PR: - After a crash (SIGKILL), ordinary waiters still get no notice: base 0/6 conversations resumed. Closing that needs a stored fact written when the waiter is armed, which is a separate decision. - After restart, `process poll` on an adopted durable process still says its automatic wake is unavailable, although the exit does wake the conversation. With this fix, no restart turn prompts that poll. Co-authored-by: Ayaan Zaidi <[email protected]>
…nds exit together (openclaw#199113) ## What Problem This Solves Fixes: when several background commands exit close together, the agent gets one wake turn per command, so three exits cost three model turns and three replies. ## User Impact User impact: completions that arrive while an earlier completion turn in the same conversation is still queued or running now reach the agent together in one turn, with each result's process ID, status, exit code and output tail. A single completion starts at once, exactly as before. ## Why This Change Was Made Each exit enqueued its own session event and became its own turn. The session event owner already turns a set of exact queued occurrences into one ordinary turn (`occurrences`, used by session-state notices), and `combineSessionEventTargetsForHost` already checks that a set shares one destination and requester authority. This change reuses both: - New `session-event-batch.ts` in the session event owner keeps one in-flight completion turn per conversation. A completion with nothing in flight starts at once through `enqueueSessionEventForHost`, unchanged. A completion that arrives while that turn is queued or running claims its queued occurrence and waits. One second after the turn settles, every waiting completion that shares the same exec request owners, launching run, route and combinable target starts one turn with all of their occurrences. - `bash-tools.exec-notify.ts` only switches its enqueue import to the batched entry point. Each result keeps the wake format from openclaw#199122 (`Exec completed (<id>, code 0, 4m3s):` plus a tail of up to 2,000 chars). - One shared turn carries at most about 8,000 characters of results. Occurrence text must stay byte-exact, so the bound limits membership, not text: results past the budget start the next turn. - The exec completion guidance is count-neutral ("Treat each completion result above as an internal continuation…") so a batched turn no longer says "this completion" for several results. Choices and accepted edges: - **A 1 s settle, only for completions that already waited.** A first or lone completion still starts at once (measured base: its turn starts within about 1 s of the exit, before later exits arrive), so no delay is added to single wakes. Without a settle, exits about 1 s apart sometimes straddle the end of the turn they waited behind: on the intermediate head, 2 of 6 trials split into three turns because the last exit arrived just after the batch started. Waiting completions now start 1 s after that turn settles, so stragglers join. - **Only one request's completions share a turn.** Stop aborts every exec request owner of a turn, so mixing requests would let one Stop retire another request's result. Completions from different requests keep separate turns. - **Only one launching run's completions share a turn.** The completion turn's input provenance names the run that launched the command, which plugins use to correlate a completion with its run (openclaw#179816). Request owners carry over into completion turns, so commands launched by a later run can share owners with earlier ones; the batch also requires the same launching run, and each shared turn keeps a truthful `inputProvenance.runId`. - **Cron-run completions never wait.** They check at acceptance that the originating run is still alive; holding them could turn an accepted completion into a refused one. - Removing one member after its shared turn is queued (for example, the model polled that result) leaves the shared prompt as is; the turn is retired only when every member is removed. Before the shared turn is queued, removal drops just that member. - A waiting completion starts after its predecessor settles, so a human message queued in `followup` or `collect` mode meanwhile can run first. - Rebased on openclaw#199122 (wake format) and openclaw#199085. This PR touches only the import line in `bash-tools.exec-notify.ts` and the guidance wording in `agent-runner-run-params.ts`. ## Evidence **Real-agent E2E** (isolated source Gateway via `ocx src`, real OpenAI model, 6 concurrent trial sessions per arm). Each trial asks the agent to start three background waiters with `yieldMs`, waits until the session is idle with all three running, then releases them 1 s apart. Base = current `main` (`faf88178b453`, includes openclaw#199122); fix = this PR rebased on it. | Arm | Wake turns (6 trials) | Results acknowledged | Wake-turn tokens (total) | Wake-turn cost | | --- | --- | --- | --- | --- | | base, 3 exits | 18 (3 per trial) | 18/18 | 501,233 | $1.152 | | fix, 3 exits | 12 (2 per trial) | 18/18 | 326,362 (-35%) | $0.930 | | base, 1 exit | 6 | 6/6 | 153,377 | $0.402 | | fix, 1 exit | 6 | 6/6 | 153,934 | $0.403 | Single-exit wake latency (release to wake message, median of 6): base 0.85 s, fix 0.85 s. A single completion never waits for the settle. Time from release to the last reply in the 3-exit arm: base median 9.2 s, fix median 7.3 s. Every fix trial: the first exit starts its turn at once; the two later exits arrive during it and share the next turn, each keeping its own id, exit code, duration and tail. Results from earlier runs before the rebase (same arms, older wake format) matched: 12 turns vs 18. <details><summary>Redacted trace, trial 1 (times relative to release of the first waiter)</summary> Base (before the rebase, old wake format): ``` +8.8s USER: Exec completed (gentle-c, code 0) :: job 1 result: r11-1603127358 +11.7s reply (26930 tok): job 1 result: r11-1603127358 +19.1s USER: Exec completed (dawn-gla, code 0) :: job 2 result: r12-78193628 +22.0s reply (27407 tok): job 2 result: r12-78193628 +26.5s USER: Exec completed (kind-sum, code 0) :: job 3 result: r13-1811516849 +29.2s reply (27885 tok): job 3 result: r13-1811516849 ``` Fix (rebased head): ``` +1.2s USER: Exec completed (tide-cov, code 0, 34s): job 1 result: r11-1383216 +3.7s reply (26761 tok): job 1 result: r11-1383216 +5.1s USER: Exec completed (tidy-com, code 0, 32s): job 2 result: r12-262323306 Exec completed (rapid-bi, code 0, 29s): job 3 result: r13-179203848 +7.7s reply (27281 tok): job 2 result: r12-262323306 / job 3 result: r13-179203848 ``` </details> **Regression tests:** `bash-tools.exec-background-followup.test.ts` runs three real background commands through the exec tool and the real session event owner with a held first model turn. Same launching run: base starts three completion turns (red); the fix starts two, the second carrying both later results and naming their run. Different launching runs with shared request owners: the later results keep separate turns, each naming its own run (red without the launch-run check). Five results of ~2,000 chars: the shared turn takes three and the fifth starts its own turn (size bound). **Focused suites (`ocx test`, rebased head, 14 files):** `bash-tools.exec-background-followup`, `bash-tools.test`, `bash-tools.exec-runtime`, `bash-tools.exec-runtime.cleanup`, `bash-tools.visible-subagent-notify`, `bash-tools.exec-request-stop`, `bash-tools.exec.egress-lifecycle`, `bash-tools.notify-on-exit-ack`, `bash-tools.process.e2e`, `bash-tools.exec-notify.requester`, `bash-tools.exec-notify.queue-full`, `infra/exec-session-event`, `session-event-handoff`, `agent-runner-execution-session-events`: all pass. `exec-session-event`'s chained-completion case now waits for the second receipt, which starts after the 1 s settle. **Full tier:** `ocx build --dts` (full profile) built `92847fc`; the self-contained source package passed its tarball integrity check, installed with npm into a scratch prefix, and the packed CLI reported `OpenClaw 2026.11.3 (92847fc)` with `gateway --help` exit 0. The later head commit only changes a test type. **Gaps:** E2E covers exits from one request in an idle Control UI-style session; completions from different requests and channel-delivered sessions are covered by the shared owner's existing tests, not by a new live run. Co-authored-by: Ayaan Zaidi <[email protected]>
…estart (openclaw#199085) ## What Problem This Solves Fixes: after a graceful Gateway restart, every conversation with a running `durable: true` background command was told "Background exec processes were stopped; rerun them if still needed", even though the registry had just adopted that command and would wake the conversation when it exits. ## User Impact User impact: a durable waiter now survives a restart quietly. The conversation keeps waiting and wakes once, when the command exits. The agent no longer gets a false "stopped" turn, so it neither polls the surviving command nor reruns it. Ordinary (non-durable) background commands still get the same restart notice as before. ## Why This Change Was Made The graceful-shutdown marker counted every running background process, durable ones included. It now skips durable processes. Their own owner adopts them at startup and delivers the exit or lost-process wake. Docs now state which processes the restart notice covers. They also note that a crash sends no notice for ordinary processes; that gap is tracked separately. ## Evidence Real-agent E2E on an isolated source Gateway (`openai/gpt-6-astra`, 6 concurrent conversations per arm, automations tool denied). Each conversation is asked to wait for a fake CI that flips green about 300 s later. The Gateway gets SIGTERM about 90 s after every conversation armed its waiter and ended its turn, then a new Gateway starts on the same state. | Arm | Waiters armed, turn ended | False "stopped" restart turns | `process poll` calls after restart | Waiters that exited and woke their conversation | | --- | --- | --- | --- | --- | | base, `durable: true` waiter | 6/6 | **6** | **91** | 6/6, collected by the poll loop inside the false turn | | fix, `durable: true` waiter | 6/6 | **0** | **0** | 4/4 by the exit wake (2 model-written loops never matched "all 15 checks passed" and never exited, unrelated to restart) | | base, ordinary waiter | 6/6 | 6 (correct) | 0 | re-armed 6/6 | | fix, ordinary waiter | 5/6 (1 was still mid-turn) | 6 (correct) | 0 | re-armed 5/5, finished 6/6 | Shutdown log, durable arm: base `marked: 6`, fix `marked: 0`. <details><summary>Public trace, durable waiter, base vs fix (trial 2, paths redacted)</summary> Base: false restart turn, then a poll loop on the adopted process: ``` + 53s -> Command still running (session faint-otter:…). Its exit wakes this conversation … + 62s reply: The durable background waiter is running. … +186s USER: The Gateway restarted while you were working. Resume your work … Background exec processes were stopped; rerun them if still needed. +190s process {"action": "poll", "timeout": 1000} +198s reply: The original durable waiter survived the restart and is still running, so I haven't started another. … +198s process {"action": "poll", "timeout": 30000} +206s -> PR openclaw#4242: 4 checks pending, 11 passed Process still running. Automatic completion wake is unavailable after ending this turn. … … 13 more polls until CI turned green … ``` Fix: no restart turn; the adopted exit wakes the conversation once: ``` + 69s exec {"yieldMs": 1000, "background": true, "durable": true, "timeoutSeconds": 0} "python3 -u - <<'PY' …" + 69s -> Command still running (session quick-fjord:…). Its exit wakes this conversation … + 76s reply: The durable background wait is running. … +354s USER: Exec completed (quick-fj, code 0) :: … PR openclaw#4242: all 15 checks passed … +364s reply: PR openclaw#4242 is ready—all 15 checks passed. Saved and verified in `pr-2/RESULT.md` … ``` </details> Regression test: `src/gateway/session-restart-resume.test.ts`, "marks ordinary conversations without inheriting cron, external execution or durable processes". It fails on base (`agent:main:durable-waiter: expected { queuedInputIds: [], … } to deeply equal undefined`) and passes with the fix; the file passes 21/21. Known gaps, out of scope for this PR: - After a crash (SIGKILL), ordinary waiters still get no notice: base 0/6 conversations resumed. Closing that needs a stored fact written when the waiter is armed, which is a separate decision. - After restart, `process poll` on an adopted durable process still says its automatic wake is unavailable, although the exit does wake the conversation. With this fix, no restart turn prompts that poll. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 0c1fe01) Release adaptation: Exclude durable processes from lost non-durable resume markers at existing owner; preserve process-registry recovery. Baseline regression failed, fixed 9 tests passed. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e7171f258ec8c4ced3cfd58977e3384e61bed6f4)
Correct the 11.7 adaptation of openclaw#199085: this target has no durable ProcessSession lifecycle. Remove the unsupported access and synthetic fixture, restore the two prior documentation claims, and retain ordinary restart notices and cron/external-owner coverage. No durable feature is introduced. Proof: focused compiler reproduced both TS2339 errors on the parent and passes after correction; session-restart-resume.test.ts passes 9/9; targeted lint and diff check pass. Independent fresh review found no P0-P2 issues and verified the inverse of d4178f68bd25. The commit hook additionally normalized inherited import ordering in the touched source; the final four-file format check passes. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 918399fac56a5b4781925aae0850c6267a6901ed)
What Problem This Solves
Fixes: after a graceful Gateway restart, every conversation with a running
durable: truebackground command was told "Background exec processes were stopped; rerun them if still needed", even though the registry had just adopted that command and would wake the conversation when it exits.User Impact
User impact: a durable waiter now survives a restart quietly. The conversation keeps waiting and wakes once, when the command exits. The agent no longer gets a false "stopped" turn, so it neither polls the surviving command nor reruns it. Ordinary (non-durable) background commands still get the same restart notice as before.
Why This Change Was Made
The graceful-shutdown marker counted every running background process, durable ones included. It now skips durable processes. Their own owner adopts them at startup and delivers the exit or lost-process wake. Docs now state which processes the restart notice covers. They also note that a crash sends no notice for ordinary processes; that gap is tracked separately.
Evidence
Real-agent E2E on an isolated source Gateway (
openai/gpt-6-astra, 6 concurrent conversations per arm, automations tool denied). Each conversation is asked to wait for a fake CI that flips green about 300 s later. The Gateway gets SIGTERM about 90 s after every conversation armed its waiter and ended its turn, then a new Gateway starts on the same state.process pollcalls after restartdurable: truewaiterdurable: truewaiterShutdown log, durable arm: base
marked: 6, fixmarked: 0.Public trace, durable waiter, base vs fix (trial 2, paths redacted)
Base: false restart turn, then a poll loop on the adopted process:
Fix: no restart turn; the adopted exit wakes the conversation once:
Regression test:
src/gateway/session-restart-resume.test.ts, "marks ordinary conversations without inheriting cron, external execution or durable processes". It fails on base (agent:main:durable-waiter: expected { queuedInputIds: [], … } to deeply equal undefined) and passes with the fix; the file passes 21/21.Known gaps, out of scope for this PR:
process pollon an adopted durable process still says its automatic wake is unavailable, although the exit does wake the conversation. With this fix, no restart turn prompts that poll.