Skip to content

fix(exec): a conversation waiting on a background command hangs after a Gateway crash - #199499

Merged
obviyus merged 2 commits into
mainfrom
fix/exec-lost-waiter-notice
Nov 15, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/exec-lost-waiter-notice

Conversation

@obviyus

@obviyus obviyus commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: a conversation that ended its turn waiting for a background command to exit never hears about it again when the Gateway crashes or is killed mid-wait. The exit wake lived only in memory, and the restart resume marker is written only by a graceful shutdown, so after a crash the conversation hung silently.

User Impact

User impact: after any Gateway restart, crashes included, each conversation that was waiting on an ordinary background command gets one notice for that command. The notice names the process handle and start time and says what happened to the command, so the agent can check its output and run it again. Durable commands (durable: true) keep their existing adopted exit wake and get no notice.

Behavior changes:

  • The generic "Background exec processes were stopped; rerun them if still needed" sentence in the graceful-restart resume input is gone. The per-command notice replaces it.
  • A background command whose exit would not wake the conversation, such as a service with notifyOnExit off, no longer causes a restart resume turn.

Why This Change Was Made

The process registry already owns the durable_background_processes table, its startup pass and the lost-process wake. It now also keeps a best-effort row for each running ordinary command whose exit would wake its conversation, on every platform:

  • The row reuses the existing table with kind: "ordinary" and the generic command summary. It needs no new table, column or schema version.
  • The row is written when the command is backgrounded and deleted when the command exits.
  • Incognito sessions are never recorded, because their state stays in memory.
  • Sandbox commands are recorded with a sandboxed flag. The Gateway cannot see inside the container, so their notice says the command may still be running.
  • Windows runs the startup pass too (durable launches stay Linux and macOS only), so Windows waiters keep a restart notice.

On startup, the existing durable pass:

  • reports every remaining row once through the existing completion path, under the session's current authority, then deletes it;
  • rechecks eligibility as for durable outcomes (reset, archived and hidden subagent sessions, or notifyOnExit off, get nothing);
  • waits for agent database readiness, which finishes after the listener binds after a crash.

The graceful-restart marker no longer tracks background processes (hadBackgroundExec is removed), so one owner reports lost commands.

The notice text follows a measured fact. In each case below, the Gateway process alone was killed and a real agent's background commands were watched:

Host Gateway killed (SIGKILL) Graceful stop
macOS, plain and under a launchd LaunchAgent A silent command keeps running as an orphan; one that writes output dies at its next write All stopped
Linux (systemd 255 user service with the installed policy, and plain) All stopped within 2 s All stopped

The startup pass reads the Gateway boot record to tell a crash from a shutdown. After a shutdown, or a crash on Linux, the notice says the command was stopped. After a crash on macOS it says the command may still be running, but its result will not wake this conversation. No orphan tracking is added; durable: true remains the way to keep a command alive.

Evidence

Real-agent E2E on an isolated source Gateway (openai/gpt-6-astra, 6 concurrent conversations per arm, automations tool denied). Each conversation waits on a fake CI that turns green about 300 s after its first check. The Gateway is stopped about 90 s after every conversation has started its wait and ended its turn, then a new Gateway starts on the same state.

Arm Waiting, turn ended Conversations resumed Re-armed a waiter Finished the task
base 669576890a1f, crash (SIGKILL) 6/6 0/6 0/6 0/6
fix, crash (SIGKILL) 6/6 6/6 6/6 6/6
fix, graceful (SIGTERM) 6/6 6/6, one notice each 6/6 5/6 (one model-written loop's pattern never matched "all 15 checks passed")
fix, durable: true waiter, graceful 6/6 0 restart notices, 0 polls; 6/6 woken by the adopted exit n/a 6/6
Public trace, crash on macOS, base vs fix (trial 1, paths redacted)

Base: the conversation waits forever.

+ 28s exec {"yieldMs": 1000, "timeoutSeconds": 3660} "python3 -u - <<'PY' …"
+ 29s   -> Command still running (session quiet-ocean:…). Its exit wakes this conversation …
+ 32s sessions_yield
(Gateway SIGKILLed at +137 s, new Gateway ready; nothing else ever arrives)

Fix: one notice, the agent checks and re-arms, then finishes.

+ 32s exec {"background": true, "timeoutSeconds": 1830} "python3 -u - <<'PY' …"
+ 32s   -> Command still running (session briny-falcon:…). Its exit wakes this conversation …
+ 36s sessions_yield
+166s USER: Exec failed (briny-fa, unknown exit code, 2m9s): The Gateway restarted unexpectedly while this background command (started 2026-11-15T05:37:58.662Z) was running. It may still be running, but its result will not wake this conversation. Check its output and side effects before running it again.
+176s exec "ps -p 13156 …; ./ci-status"
+176s   -> PR #4241: 4 checks pending, 11 passed
+190s exec {"background": true, "timeoutSeconds": 1830} "python3 -u - <<'PY' …"
+326s USER: Exec completed (neat-bre, code 0, 2m15s): … all 15 checks passed …
+328s reply: PR #4241 is ready—all 15 checks passed. Saved and verified the summary in `pr-1/RESULT.md` …

Graceful stop with the fix: Exec failed (vivid-du, unknown exit code, 2m12s): This background command (started …) was stopped when the Gateway shut down, so its result will not arrive. If you still need it, check its output and side effects, then run it again.

Upgrade from latest stable (v2026.11.3, 847611dcaa3b), real agent, isolated state:

  1. A v2026.11.3 Gateway ran 3 waiting conversations, then got a graceful stop.
  2. This branch ran openclaw doctor --fix --yes, which migrated state schema 22 to 40 (exit 0), then started on the same state. Sessions and transcripts loaded (transcript backfill 3/3 sessions, 122 rows). The startup pass found no durable_background_processes table, because the table is created on first use, and logged nothing.
  3. A new conversation on the upgraded state started a waiter and ended its turn. The table was created and held one row: ordinary:cool-ridge:….
  4. The Gateway got SIGKILL. The next start sent Exec failed (cool-rid, unknown exit code, 1m5s): The Gateway restarted unexpectedly while this background command (started 2026-11-15T07:22:46.300Z) was running. It may still be running, …. The agent checked for survivors, re-armed, and finished (PR #4249 is ready—all 15 checks passed). 0 rows remained.

v2026.11.3 writes neither restart markers nor process rows. Commands running when it stops therefore get no notice after the upgrade. This PR does not change the legacy upgrade bridge.

Tests:

  • src/agents/bash-process-durable.test.ts adds "reports each wake-armed ordinary command a restart lost, once, with what happened to it". It fails on base and passes with the fix. It covers: a command that exits leaves no row; a crashed command and a stopped command are each reported once with the right text; rows are gone afterwards.
  • Restart marker tests now mark sessions through a live run instead of a background process, because background processes no longer create a marker.
  • test/gateway-restart-resume.e2e.test.ts now expects the stopped background case to receive the per-command notice instead of the resume sentence. It passes 5/5 on 4 consecutive runs. Under heavy host load, both base and this branch hit an intermittent mock-provider JSON Parse error: Unexpected EOF.
  • The durable registry test also records a sandbox command (cautious notice) and an incognito command (no row); removing the incognito check turns it red (4 rows instead of 3).
  • Focused suites pass: restart resume, session event context, lifecycle state, startup resume, process registry, durable notify, post-attach startup, and the restart recovery integrity suite.

Known gaps:

  • Worker and host=node commands are not recorded, as before; their processes are owned elsewhere.
  • A best-effort row write can fail; the command still runs normally and only the restart notice is missing.
  • If the boot record is unavailable, a macOS crash would be reported as a shutdown.

…ng crashes

A conversation that ended its turn waiting on an ordinary background command hung silently after a Gateway crash: the command's exit wake lived only in memory. Graceful restarts sent a generic resume input from a shutdown marker instead.

The process registry now keeps a best-effort row for each wake-armed ordinary Gateway-host command in the existing durable_background_processes table (kind: "ordinary", generic command summary, no unit) while it runs. On startup the durable owner reports each remaining row once through the existing lost-process completion path, under the session's current authority, then deletes it. The notice says what happened, using the boot record to tell a shutdown from a crash: shutdown and Linux crashes stop the command; on macOS a killed Gateway can leave it running.

The restart marker no longer tracks background processes (hadBackgroundExec is gone), so one owner reports lost commands. Commands that would not wake the conversation no longer trigger a restart resume turn.

Co-authored-by: obviyus <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M labels Nov 15, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Persist running background-command waiters and notify their conversations when a Gateway restart loses their completion wake.

Example: A macOS Gateway receives SIGKILL while background command briny-falcon waits for CI.

  • Before: The conversation receives no completion and waits indefinitely.
  • After: A restart notice identifies the lost command, and the agent checks for survivors, starts another waiter, and finishes.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused recovery repair with shipped-entry-point and upgrade evidence, and no blocking finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied real-agent Gateway traces exercise ordinary waiters across SIGKILL and SIGTERM, preserve adopted durable completion, and show successful recovery after upgrading isolated v2026.11.3 state; the reported crash arm improves from no resumed conversations to all six completing.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A conversation promised a background-command completion wake can remain silent forever after the Gateway crashes.
Reason: The maintainer-authored direction addresses an observed failure with best-effort records in an existing owner and documents its remaining limits.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current silent recovery failure without a blocking defect found; the supplied upgrade run resolves the previous review’s compatibility blocker.

Priority: P2
Reviewed head: 376e4d87fe7b4cae7a8ff83bbc3b45dd67e10309

Before merge

None.

Findings

None.

Agent review details

How this fits together

The process registry owns background commands and their restart records; Gateway startup converts surviving ordinary-command records into completion events admitted through the existing session authority and delivery path.

flowchart TD
  A[Background exec] --> B[Process registry]
  B --> C[Existing SQLite process store]
  C --> D[Gateway startup recovery]
  D --> E[Current session admission]
  E --> F[Conversation continuation]
Loading

Technical review

Best possible solution:

Use the existing process registry and completion path to report lost ordinary waiters while preserving durable adoption and current session authority.

Do we have a high-confidence way to reproduce the issue?

Current-main source retains completion state only in memory for ordinary commands and writes their restart marker only during shutdown; the supplied base crash trace shows the resulting stalled conversations.

Is this the best way to solve the issue?

The change uses the existing storage, startup, notification, and authority owners, removes the superseded marker path, and adds no configuration or schema version.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d9a692869294.

Provenance checked

  • Shutdown-only background-command recovery changes intended behavior with a stated reason (9344233: The restart redesign deliberately accepted crash loss to remove continuous recovery bookkeeping and competing reconstruction paths.)
  • Durable-command restart exclusion keeps the original intent (0c1fe01: Surviving durable commands must retain their adopted exit wake without a false stopped-command continuation.)
  • Process persistence and completion ownership keeps the original intent (20c1a15: The process registry owns persisted restart facts and admits post-restart completions as fresh input under current session authority.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +170, Tests +117, Docs +33. Total +320 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 204 34 +170
Tests 7 211 94 +117
Docs 3 37 4 +33
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 452 132 +320

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: A Gateway crash can silently strand conversations waiting for background-command completion; the failure is limited to interrupted waits.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-15T06:28:30.332Z sha 5366926 :: blocked before merge. :: [P1] Preserve graceful recovery outside the new recorder’s coverage | [P1] Exclude incognito commands before writing restart records
  • reviewed 2026-11-15T07:01:03.559Z sha 376e4d8 :: blocked before merge. :: none
  • reviewed 2026-11-15T07:07:05.549Z sha 376e4d8 :: blocked before merge. :: none

Reviewed November 15, 2026, 2:31 AM ET / 07:31 UTC (Revision 4).

@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 15, 2026
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@obviyus
obviyus merged commit 68971b3 into main Nov 15, 2026
186 of 187 checks passed
@obviyus
obviyus deleted the fix/exec-lost-waiter-notice branch November 15, 2026 07:33
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 68971b3. A conversation waiting on a background command no longer hangs silently after a Gateway crash: the lost waiter is recorded and reported on startup, incognito conversations write no record, and sandbox/Windows commands keep graceful-restart recovery.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
… a Gateway crash (openclaw#199499)

## What Problem This Solves

Fixes: a conversation that ended its turn waiting for a background command to exit never hears about it again when the Gateway crashes or is killed mid-wait. The exit wake lived only in memory, and the restart resume marker is written only by a graceful shutdown, so after a crash the conversation hung silently.

## User Impact

User impact: after any Gateway restart, crashes included, each conversation that was waiting on an ordinary background command gets one notice for that command. The notice names the process handle and start time and says what happened to the command, so the agent can check its output and run it again. Durable commands (`durable: true`) keep their existing adopted exit wake and get no notice.

Behavior changes:
- The generic "Background exec processes were stopped; rerun them if still needed" sentence in the graceful-restart resume input is gone. The per-command notice replaces it.
- A background command whose exit would not wake the conversation, such as a service with `notifyOnExit` off, no longer causes a restart resume turn.

## Why This Change Was Made

The process registry already owns the `durable_background_processes` table, its startup pass and the lost-process wake. It now also keeps a best-effort row for each running ordinary command whose exit would wake its conversation, on every platform:
- The row reuses the existing table with `kind: "ordinary"` and the generic command summary. It needs no new table, column or schema version.
- The row is written when the command is backgrounded and deleted when the command exits.
- Incognito sessions are never recorded, because their state stays in memory.
- Sandbox commands are recorded with a `sandboxed` flag. The Gateway cannot see inside the container, so their notice says the command may still be running.
- Windows runs the startup pass too (durable launches stay Linux and macOS only), so Windows waiters keep a restart notice.

On startup, the existing durable pass:
- reports every remaining row once through the existing completion path, under the session's current authority, then deletes it;
- rechecks eligibility as for durable outcomes (reset, archived and hidden subagent sessions, or `notifyOnExit` off, get nothing);
- waits for agent database readiness, which finishes after the listener binds after a crash.

The graceful-restart marker no longer tracks background processes (`hadBackgroundExec` is removed), so one owner reports lost commands.

The notice text follows a measured fact. In each case below, the Gateway process alone was killed and a real agent's background commands were watched:

| Host | Gateway killed (SIGKILL) | Graceful stop |
| --- | --- | --- |
| macOS, plain and under a launchd LaunchAgent | A silent command keeps running as an orphan; one that writes output dies at its next write | All stopped |
| Linux (systemd 255 user service with the installed policy, and plain) | All stopped within 2 s | All stopped |

The startup pass reads the Gateway boot record to tell a crash from a shutdown. After a shutdown, or a crash on Linux, the notice says the command was stopped. After a crash on macOS it says the command may still be running, but its result will not wake this conversation. No orphan tracking is added; `durable: true` remains the way to keep a command alive.

## Evidence

Real-agent E2E on an isolated source Gateway (`openai/gpt-6-astra`, 6 concurrent conversations per arm, automations tool denied). Each conversation waits on a fake CI that turns green about 300 s after its first check. The Gateway is stopped about 90 s after every conversation has started its wait and ended its turn, then a new Gateway starts on the same state.

| Arm | Waiting, turn ended | Conversations resumed | Re-armed a waiter | Finished the task |
| --- | --- | --- | --- | --- |
| base `0a8e0b7d9cd0`, crash (SIGKILL) | 6/6 | **0/6** | 0/6 | 0/6 |
| fix, crash (SIGKILL) | 6/6 | **6/6** | 6/6 | 6/6 |
| fix, graceful (SIGTERM) | 6/6 | 6/6, one notice each | 6/6 | 5/6 (one model-written loop's pattern never matched "all 15 checks passed") |
| fix, `durable: true` waiter, graceful | 6/6 | 0 restart notices, 0 polls; 6/6 woken by the adopted exit | n/a | 6/6 |

<details><summary>Public trace, crash on macOS, base vs fix (trial 1, paths redacted)</summary>

Base: the conversation waits forever.
```
+ 28s exec {"yieldMs": 1000, "timeoutSeconds": 3660} "python3 -u - <<'PY' …"
+ 29s   -> Command still running (session quiet-ocean:…). Its exit wakes this conversation …
+ 32s sessions_yield
(Gateway SIGKILLed at +137 s, new Gateway ready; nothing else ever arrives)
```

Fix: one notice, the agent checks and re-arms, then finishes.
```
+ 32s exec {"background": true, "timeoutSeconds": 1830} "python3 -u - <<'PY' …"
+ 32s   -> Command still running (session briny-falcon:…). Its exit wakes this conversation …
+ 36s sessions_yield
+166s USER: Exec failed (briny-fa, unknown exit code, 2m9s): The Gateway restarted unexpectedly while this background command (started 2026-11-15T05:37:58.662Z) was running. It may still be running, but its result will not wake this conversation. Check its output and side effects before running it again.
+176s exec "ps -p 13156 …; ./ci-status"
+176s   -> PR openclaw#4241: 4 checks pending, 11 passed
+190s exec {"background": true, "timeoutSeconds": 1830} "python3 -u - <<'PY' …"
+326s USER: Exec completed (neat-bre, code 0, 2m15s): … all 15 checks passed …
+328s reply: PR openclaw#4241 is ready—all 15 checks passed. Saved and verified the summary in `pr-1/RESULT.md` …
```

Graceful stop with the fix: `Exec failed (vivid-du, unknown exit code, 2m12s): This background command (started …) was stopped when the Gateway shut down, so its result will not arrive. If you still need it, check its output and side effects, then run it again.`
</details>

Upgrade from latest stable (v2026.11.3, `847611dcaa3b`), real agent, isolated state:
1. A v2026.11.3 Gateway ran 3 waiting conversations, then got a graceful stop.
2. This branch ran `openclaw doctor --fix --yes`, which migrated state schema 22 to 40 (exit 0), then started on the same state. Sessions and transcripts loaded (transcript backfill 3/3 sessions, 122 rows). The startup pass found no `durable_background_processes` table, because the table is created on first use, and logged nothing.
3. A new conversation on the upgraded state started a waiter and ended its turn. The table was created and held one row: `ordinary:cool-ridge:…`.
4. The Gateway got SIGKILL. The next start sent `Exec failed (cool-rid, unknown exit code, 1m5s): The Gateway restarted unexpectedly while this background command (started 2026-11-15T07:22:46.300Z) was running. It may still be running, …`. The agent checked for survivors, re-armed, and finished (`PR openclaw#4249 is ready—all 15 checks passed`). 0 rows remained.

v2026.11.3 writes neither restart markers nor process rows. Commands running when it stops therefore get no notice after the upgrade. This PR does not change the legacy upgrade bridge.

Tests:
- `src/agents/bash-process-durable.test.ts` adds "reports each wake-armed ordinary command a restart lost, once, with what happened to it". It fails on base and passes with the fix. It covers: a command that exits leaves no row; a crashed command and a stopped command are each reported once with the right text; rows are gone afterwards.
- Restart marker tests now mark sessions through a live run instead of a background process, because background processes no longer create a marker.
- `test/gateway-restart-resume.e2e.test.ts` now expects the stopped background case to receive the per-command notice instead of the resume sentence. It passes 5/5 on 4 consecutive runs. Under heavy host load, both base and this branch hit an intermittent mock-provider `JSON Parse error: Unexpected EOF`.
- The durable registry test also records a sandbox command (cautious notice) and an incognito command (no row); removing the incognito check turns it red (4 rows instead of 3).
- Focused suites pass: restart resume, session event context, lifecycle state, startup resume, process registry, durable notify, post-attach startup, and the restart recovery integrity suite.

Known gaps:
- Worker and `host=node` commands are not recorded, as before; their processes are owned elsewhere.
- A best-effort row write can fail; the command still runs normally and only the restart notice is missing.
- If the boot record is unavailable, a macOS crash would be reported as a shutdown.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 19, 2026
…tely (#202066)

Problem: docs/gateway/restart-recovery.md still said a session owning a running background process is marked running at shutdown and resumed, and that a completed reply with background commands resumes. #199499 removed that marker (hadBackgroundExec) and moved lost background commands to their own exit notices; shutdown selection does not select background-process owners.

Fix (docs only): an interrupted root gets the ordinary resume input; a finished root with a notifying background command gets the lost-process exit notice instead. Named accepted edge case: an interrupted root that also had a notifying background command gets both and may reply twice (rare, visible, recoverable; kept so restart recovery stays independent of process reporting).

Proof: real-Gateway SIGKILL restart on unchanged main showed the two-input case; pnpm docs:list, docs:check-mdx, docs:check-links, format:docs:check, git diff --check; clean exact-head local ClawSweeper review.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
…tely (openclaw#202066)

Problem: docs/gateway/restart-recovery.md still said a session owning a running background process is marked running at shutdown and resumed, and that a completed reply with background commands resumes. openclaw#199499 removed that marker (hadBackgroundExec) and moved lost background commands to their own exit notices; shutdown selection does not select background-process owners.

Fix (docs only): an interrupted root gets the ordinary resume input; a finished root with a notifying background command gets the lost-process exit notice instead. Named accepted edge case: an interrupted root that also had a notifying background command gets both and may reply twice (rare, visible, recoverable; kept so restart recovery stays independent of process reporting).

Proof: real-Gateway SIGKILL restart on unchanged main showed the two-input case; pnpm docs:list, docs:check-mdx, docs:check-links, format:docs:check, git diff --check; clean exact-head local ClawSweeper review.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant