Skip to content

docs(gateway): describe restart wakes for background processes accurately - #202066

Merged
obviyus merged 1 commit into
mainfrom
docs/restart-background-process-wakes
Nov 19, 2026
Merged

obviyus merged 1 commit into
mainfrom
docs/restart-background-process-wakes

Conversation

@obviyus

@obviyus obviyus commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

What problem this solves

docs/gateway/restart-recovery.md still describes the pre-#199499 behavior for background processes:

  • "a session counts as running when … it owns a running background process";
  • "Background process: … its root session receives the resume input";
  • "a shutdown marker still resumes … when a completed reply had background commands".

#199499 deleted the hadBackgroundExec marker and moved lost background commands to their own exit notices, but left these sentences behind. Shutdown selection (src/gateway/session-restart-resume-selection.ts:91-150) selects active session operations, live agent runs, sub-agent roots and yield waits. It does not select background-process owners, and a finished turn clears lifecycleRunId (src/config/sessions/session-run-lifecycle-projection.ts:293-295), so crash discovery skips it too.

Change

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 inputs and may reply twice. This is rare, visible and recoverable, and it is kept so that restart recovery stays independent of process reporting.

Evidence

  • A real-Gateway restart (isolated Gateway, real model, SIGKILL) on unchanged main: an interrupted root with a notifying background command received the resume input and the lost-process notice, and replied twice.
  • pnpm docs:list, pnpm docs:check-mdx, pnpm docs:check-links, pnpm format:docs:check and git diff --check pass. pnpm lint:docs reports one existing, unrelated MD012 in docs/internal/conversation-history-redesign.md:340.

…tely

- Distinguish interrupted-root resume inputs from finished-root lost-process exit notices.
- Document the accepted double-wake edge without coupling restart recovery to process reporting.
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XS labels Nov 19, 2026
@obviyus
obviyus merged commit 73a53a5 into main Nov 19, 2026
71 checks passed
@obviyus
obviyus deleted the docs/restart-background-process-wakes branch November 19, 2026 21:20
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

docs Improvements or additions to documentation gateway Gateway runtime size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant