Skip to content

fix(gateway): resume main sessions after missed restart markers - #168651

Merged
steipete merged 5 commits into
mainfrom
steipete/restart-recovery-always-resume-20261010
Oct 11, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/restart-recovery-always-resume-20261010

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Main dashboard/WebChat/channel sessions that are working when the Gateway restarts must resume automatically. A production restart on 2026-10-10 left two dashboard main turns interrupted indefinitely until a human sent another message.

Abbreviated timeline, UTC (c18792f → 3050cdc): SIGTERM at 19:36:27; drain exhausted at 19:37:12.385; both reply admissions released for restart-abort at 19:37:12.408, before the shutdown marker; startup at 19:37:45 reported started=0. The affected rows retained status: interrupted and abortedLastRun: true, but no recovery claim. Separately, 51 archived recovery rows were repeatedly reported as work_start_blocked requiring operator action.

User Impact

A main chat session (dashboard, WebChat, or channel) that is mid-turn when the Gateway restarts for a deploy, crash, or kill now resumes on the next boot without anyone typing a follow-up. Before, a restart whose connection cleanup ran a few milliseconds ahead of the shutdown marker left the session showing interrupted forever. Operators also stop seeing archived sessions reported as blocked recovery work on every boot.

Why This Change Was Made

The close prelude calls runtime.connectionWork.beginClose(createAgentRunRestartAbortError()) in src/gateway/server-lifecycle.ts:402 before calling shutdown preparation. AsyncWorkScope.beginClose synchronously cancels inherited work, and the reply-admission listener in src/auto-reply/reply/reply-turn-admission.ts:551 releases its database lease on that signal. This ordering exists in the old production revision too.

Shutdown collection and its subsequent owner recheck excluded already-aborted controllers, even when the reason was restart. Startup then required an existing recovery claim, so it could not repair the missed marker. Archived rows reached the generic work-start refusal before being classified separately.

Fix

  • Keep exact, still-registered restart-aborted runs eligible for shutdown marking and its owner recheck; retain session/generation and terminal-persistence checks. Warn when supplied runs produce zero marks, including counts and the dominant skip reason.
  • Let the existing startup owner mark unclaimed interrupted main sessions through its existing recovery transition. Preserve live-owner checks at commit, startup cutoff, archive/tombstone exclusions, yielded continuations, pending delivery, and retry budgets.
  • Preserve explicit terminal cancellations: abortedLastRun also describes killed turns, so an unclaimed completed outcome remains unchanged.
  • Classify archived recovery rows as archived, deferred with no next owner, before work-start checks. Document the automatic resume guarantee and startup safety net. No schema, config, or changelog changes.

Evidence

Merge validation — fa4f746dacfd

Merged origin/main at 6cc0e8460192 without rebasing or amending. Resolved the overlap with #168650 by retaining dispatch-target resolution before resolveSessionWorkStartBlock. Its distinct archived reason is non-retryable; only that reason selects skip("archived") inside the existing block branch. The branch still records decision.reason and preserves pending/blocked behavior and onPreparationPending. The separate early archived check is removed.

Diagnostics retain both work_start_pending and archived/deferred/no-owner handling. The docs retain main's Session preparation paragraph and the recovery guarantee/startup safety net, with the combined skip-reason list and archived-deferred sentence. Main's new admission cases are unchanged, and the existing continue case still expects archived/deferred/none.

Command Result Wall time
pnpm test src/agents/main-session-recovery/main-session-restart-recovery-admission.test.ts --maxWorkers=1 19 passed, 0 failed 71.51 s
pnpm test src/agents/main-session-recovery/main-session-startup-recovery.test.ts --maxWorkers=1 14 passed, 0 failed 26.04 s
pnpm test src/agents/main-session-recovery/main-session-restart-recovery-marking.test.ts --maxWorkers=1 12 passed, 0 failed 33.87 s
pnpm test src/agents/main-session-recovery/main-session-restart-abort.integration.test.ts --maxWorkers=1 5 passed, 0 failed 27.56 s
pnpm test src/gateway/server-run-shutdown.recovery.test.ts --maxWorkers=1 1 passed, 0 failed 17.33 s

All 51 tests passed. Times use /usr/bin/time -p and include existing compilation/import and SQLite fixture costs. Changed-file oxfmt and oxlint, pnpm tsgo:core, the canonical core-test-agents-sessions and core-test-gateway-server type graphs, and git diff --check passed. node --import ./scripts/tsx.mjs scripts/check-export-name-collisions.mts passed. Codex autoreview against the new merge base 6cc0e8460192d6dae2f1f3622665755d09b908b7 was scoped-clean with no actionable P0–P2 findings. No PR merge or manual CI action was performed.

Follow-up validation — 0503ea4969e6

Fixed the two findings from head f26dc47e2329, with no other changes. Claimless startup now preserves a terminal receipt for the interrupted continuation, checking its lifecycle, writer, or delivery-source run ID. The regression pairs that delivered row with a claimless interruption whose receipts belong only to other runs; only the latter is marked. The admission test now expects archived / deferred / none, while retaining its startup-concurrency and shutdown-custody assertions.

Command Result Wall time
pnpm test src/agents/main-session-recovery/main-session-restart-abort.integration.test.ts --maxWorkers=1 5 passed, 0 failed 60.71 s
pnpm test src/agents/main-session-recovery/main-session-restart-recovery-admission.test.ts --maxWorkers=1 14 passed, 0 failed 45.34 s
pnpm test src/agents/main-session-recovery/main-session-startup-recovery.test.ts --maxWorkers=1 14 passed, 0 failed 34.37 s
pnpm test src/agents/main-session-recovery/main-session-restart-recovery-marking.test.ts --maxWorkers=1 12 passed, 0 failed 34.25 s
pnpm test src/gateway/server-run-shutdown.recovery.test.ts --maxWorkers=1 1 passed, 0 failed 18.50 s

All five files passed (46 tests). Times use /usr/bin/time -p and include existing compilation/import and worker-backed SQLite fixture costs; no new timers, sleeps, polling, or Gateway boots. The new focused regression failed before the fix (marked=2, expected 1; 46.73 s).

Changed-file oxfmt and oxlint checks passed. pnpm tsgo:core and node scripts/run-tsgo-core-test-shards.mjs --ci-graphs-json '["core-test-agents-sessions"]' passed. git diff --check passed. The isolated Codex autoreview helper reviewed only the delta from f26dc47e2329 and found no actionable P0–P2 findings. No merge or manual CI action was performed.

Initial validation

Command Result Wall time
pnpm test src/gateway/server-run-shutdown.recovery.test.ts --maxWorkers=1 1 passed 49.85 s
pnpm test src/agents/main-session-recovery/main-session-startup-recovery.test.ts --maxWorkers=1 13 passed 66.86 s
pnpm test src/agents/main-session-recovery/main-session-restart-recovery-marking.test.ts --maxWorkers=1 12 passed 89.36 s

All wall times use /usr/bin/time -p. The final marking run used a separate filesystem module cache while static checks ran. These files exercise real worker-backed SQLite ownership, persistence, and dispatch admission using existing fixtures; no new sleeps, polling, or per-test Gateway boots. Wall time includes compilation/imports and host contention; the marking file previously passed in 45.70 s. Hosted CI seconds are not yet available.

The shutdown and claimless-startup regressions failed against the original behavior. After startup marking was fixed, archive classification failed independently. An added cancellation control also failed before preserving the terminal-outcome check. All now pass. Independent isolated review found no actionable P0–P2 issues.

Changed-file formatting and lint, production types, all 28 selected test-type graphs, and the remaining policy/schema/import/authorization checks passed. pnpm check:changed --base HEAD (run before committing) initially caught a test-fixture literal widened to string; an explicit session-entry type fixed it. The five unfinished type graphs then passed through node scripts/run-tsgo-core-test-shards.mjs --ci-graphs-json '["core-test-agents-sessions","core-test-services-cron","core-test-ui-app","core-test-ui-components","core-test-ui-e2e-chat"]' (41.40 s), and the remaining checks ran through the same exported changed-check planner.

One inherited check remains red: node --import ./scripts/tsx.mjs scripts/check-deadcode-exports.mts reports 16 unused exports in model-auth/prepared-model files and tools/solid-lint/index.mjs (98.79 s). The same command reproduced the exact same 16 findings on unchanged baseline b66d8da2938d in an isolated checkout (131.84 s). No changed file is in that list. The full-tree export scan passes. These unrelated findings were not suppressed or edited.

Risk

Startup deliberately discovers more interrupted rows, so the important boundary is unfinished work versus a completed/cancelled turn or a current live owner. Those controls are covered and retained. Recovery uses the existing store, dispatch, retry, and delivery owners; it does not automatically replay an uncertain external side effect.

The historical lease log does not identify whether operation.abortSignal or inherited workSignal fired first for each turn. The prelude's inherited restart cancellation is identified from source and precedes marking; the fix tolerates either signal order and a missing shutdown marker. No live Gateway was modified or restarted for this work. This PR remains a draft.

Keep restart-aborted registrations eligible for shutdown marking and recover orphaned interruption state without a claim at startup. Preserve live owners and terminal cancellations, and report archived recovery candidates separately.
@clawsweeper

clawsweeper Bot commented Oct 10, 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 Oct 10, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves shutdown recovery markers for restart-aborted runs and recovers interrupted main sessions whose marker was missed.

Example: The Gateway restarts while agent:main:dashboard:main is working, leaving status=interrupted and abortedLastRun=true without a recovery claim.

  • Before: Startup overlooks the session, which remains interrupted until the user sends another message.
  • After: Startup creates the missing recovery cycle and admits a continuation automatically, while preserving completed, cancelled, archived, and live-owned sessions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused repair with meaningful persisted-state regressions and no remaining code finding; behavior evidence reaches the in-process boundary.
Proof confidence 🦐 gold shrimp (3/6) The host identifies this as maintainer-authored, outside the ordinary contributor proof gate; supplied evidence exercises real recovery and SQLite owners with mocked Gateway dispatch, while the earlier shipped-restart rank-up remains optional.
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 main chat turn interrupted by a Gateway restart can remain stranded until the user sends another message.
Reason: The production incident and source establish a continuity defect, and the maintainer-authored direction restores the existing automatic-recovery contract without new configuration or APIs.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs an evidenced restart-recovery failure still present on current main, and no actionable introduced defect remains after review.

Priority: P1
Reviewed head: fa4f746dacfd0d392f824b1058f06c275506f21b

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not show a shipped Gateway restart automatically continuing a claimless interrupted turn through final reply delivery.
Agent review details

How this fits together

Gateway shutdown and startup feed persisted session facts into the existing main-session recovery owner, which checks ownership and delivery state before admitting an ordinary agent continuation.

flowchart TD
  A[Gateway restart] --> B[Shutdown marker]
  B --> C[SQLite session state]
  C --> D[Startup orphan reconciliation]
  D --> E[Ownership and completion checks]
  E --> F[Existing recovery admission]
  F --> G[Agent continuation and reply]
Loading

Technical review

Best possible solution:

Land the focused repair through the existing recovery owner while retaining completion, cancellation, live-owner, and delegated-authority safeguards.

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

The reported cancellation-before-marking sequence matches the shutdown source, and current main excludes claimless interrupted rows; the supplied regressions reportedly fail before the fix, but this read-only review ran no target code.

Is this the best way to solve the issue?

The repair addresses both missed shutdown marking and startup reconciliation through existing owners, preserves the prior terminal-receipt fix, and retains the preparation-aware flow.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Shutdown recovery eligibility changes intended behavior with a stated reason (0d830e9: Shutdown preparation retained grace, cancellation, recovery marking, and received-work lifetime ownership.)
  • Claim-only startup discovery changes intended behavior with a stated reason (10334ec: Persist outcomes while deriving liveness from the run registry, keeping restart recovery tied to retained claims.)
  • Preparation-aware work-start decisions keeps the original intent (00daf0f: Retain transient preparation candidates and retry them through the startup scheduler while preserving permanent restrictions.)
  • Recovery diagnostics keeps the original intent (134631a: Record each candidate's decision and next owner while preserving bounded startup preparation.)
  • Restart-recovery documentation keeps the original intent (fef5c61: Document the existing automatic restart and crash recovery system and its safety limits.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit bac4218 adds src/agents/main-session-recovery/main-session-restart-recovery-marking.ts:359 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bac42185c475; files: src/agents/main-session-recovery/main-session-restart-recovery-marking.ts)
  • Vincent Koc: Raw commit 6b5fb4b adds src/agents/main-session-recovery/main-session-restart-recovery-store.ts:533 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 6b5fb4b23509; files: src/agents/main-session-recovery/main-session-restart-recovery-store.ts)

PR surface

Source +56, Tests +191, Docs +8. Total +255 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 73 17 +56
Tests 4 196 5 +191
Docs 1 25 17 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 294 39 +255

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +73/-17, net +56; tests +196/-5, net +191. The growth adds a focused startup safety net and diagnostics, with persisted-state controls rather than a second recovery service.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported production restart stranded active main-chat turns indefinitely, breaking automatic continuity until another user message.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Automatic continuation and final reply delivery after a missed restart marker are observable in a Telegram main session.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Optionally capture a shipped Gateway restart that resumes a claimless interrupted turn and delivers its final reply, with sensitive details redacted.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-10T21:17:09.960Z sha 9ecffee :: blocked before merge. :: none
  • reviewed 2026-10-10T21:26:29.431Z sha 9ecffee :: needs maintainer review before merge. :: none
  • reviewed 2026-10-10T21:51:30.166Z sha f26dc47 :: blocked before merge. :: [P1] Exclude completed sources with matching terminal delivery evidence | [P2] Update the admission test for archived recovery decisions
  • reviewed 2026-10-10T22:26:45.921Z sha 0503ea4 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-10T22:43:31.494Z sha 65f879f :: needs maintainer review before merge. :: none

Reviewed October 10, 2026, 8:14 PM ET / October 11, 2026, 00:14 UTC (Revision 6).

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer note on the "Add data-model compatibility proof" item: this PR does not change any stored data model. It reads fields that already exist on every persisted session entry (abortedLastRun, status, archivedAt, mainRestartRecovery) and creates the recovery cycle through the existing mark_interrupted transition that the shutdown marker already uses today. No schema, migration, codec, or Doctor change is involved, and no existing row is rewritten except the ones the startup pass now recovers, which is the intended behavior fix. The startup-recovery test persists real pre-existing interrupted rows (claimless, archived, cancelled, live-owned, newer-turn) into a worker-backed SQLite store and verifies which ones are marked and dispatched, which is the compatibility proof for the rows this change touches. Declining the end-to-end upgrade-run request on that basis.

@steipete
steipete marked this pull request as ready for review October 10, 2026 21:19
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 10, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 10, 2026
Keep delivered claimless continuations settled by checking their exact terminal run identities. Cover historical-only receipts as a recoverable sibling and align archived admission diagnostics without changing startup concurrency or shutdown custody.
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@steipete
steipete enabled auto-merge (squash) October 10, 2026 22:48
Merge origin/main while preserving its preparation-aware work-start flow. Classify archived recovery inside the shared block decision, retain pending preparation handling, and combine the recovery documentation.
@steipete
steipete merged commit 4754d39 into main Oct 11, 2026
122 checks passed
@steipete
steipete deleted the steipete/restart-recovery-always-resume-20261010 branch October 11, 2026 00:15
steipete added a commit that referenced this pull request Oct 11, 2026
…ed head (#168818)

* fix(pr): record merged receipts for auto-merged pushed heads

GitHub's auto-merge head precondition applies only at submission. When a
collaborator pushes after an accepted auto request, GitHub keeps the request
armed and merges the pushed head, and the retained intent head no longer
matches the merged head. merge-run, merge-recover --cancel-auto, and
merge-complete all refused, leaving the outcome at phase intent forever
(2026-10-11, #168651).

Add an explicit operator route, merge-recover --merged-head <SHA>, that
records a validated MERGED receipt as a CAS successor with phase merged,
landed, and headDrift {actor, outcome, mergedHead}. It requires the exact
current accepted non-queue auto intent without a cancellation record, the
MERGED PR with retained identity and base, the explicitly selected head equal
to GitHub's authoritative head and strictly descending from the retained
head, a landed commit reachable from main, and a landed tree that
reconstructs under the retained method. head stays the prepared intent head;
the merged head object is retained as a parent. Reconciliation prints the
exact command when it observes this drift. Every other drift keeps its
refusal; nothing is dispatched, cancelled, re-armed, or cleared.

The landed-receipt verification moves into one helper shared by
reconciliation and the new route, and squash receipts now require a
single-parent landed commit so the retained method stays checkable.

* test(scripts): cover the merged-head recovery argument

The wrapper argument-vector tests pin merge_run's exact parameters; account
for the new --merged-head slot, reject it alongside incompatible recovery
flags, and pass an explicitly selected merged head through to recovery.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…claw#168651)

* fix(gateway): always recover interrupted main sessions after restart

Keep restart-aborted registrations eligible for shutdown marking and recover orphaned interruption state without a claim at startup. Preserve live owners and terminal cancellations, and report archived recovery candidates separately.

* fix(recovery): preserve terminal receipts during claimless startup

Keep delivered claimless continuations settled by checking their exact terminal run identities. Cover historical-only receipts as a recoverable sibling and align archived admission diagnostics without changing startup concurrency or shutdown custody.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…ed head (openclaw#168818)

* fix(pr): record merged receipts for auto-merged pushed heads

GitHub's auto-merge head precondition applies only at submission. When a
collaborator pushes after an accepted auto request, GitHub keeps the request
armed and merges the pushed head, and the retained intent head no longer
matches the merged head. merge-run, merge-recover --cancel-auto, and
merge-complete all refused, leaving the outcome at phase intent forever
(2026-10-11, openclaw#168651).

Add an explicit operator route, merge-recover --merged-head <SHA>, that
records a validated MERGED receipt as a CAS successor with phase merged,
landed, and headDrift {actor, outcome, mergedHead}. It requires the exact
current accepted non-queue auto intent without a cancellation record, the
MERGED PR with retained identity and base, the explicitly selected head equal
to GitHub's authoritative head and strictly descending from the retained
head, a landed commit reachable from main, and a landed tree that
reconstructs under the retained method. head stays the prepared intent head;
the merged head object is retained as a parent. Reconciliation prints the
exact command when it observes this drift. Every other drift keeps its
refusal; nothing is dispatched, cancelled, re-armed, or cleared.

The landed-receipt verification moves into one helper shared by
reconciliation and the new route, and squash receipts now require a
single-parent landed commit so the retained method stays checkable.

* test(scripts): cover the merged-head recovery argument

The wrapper argument-vector tests pin merge_run's exact parameters; account
for the new --merged-head slot, reject it alongside incompatible recovery
flags, and pass an explicitly selected merged head through to recovery.
RomneyDa added a commit that referenced this pull request Oct 12, 2026
) (extracted hotfix)

Extracted from #168651 (4754d39): took only the
src/gateway/server-run-shutdown.ts hunk (isRestartRecoveryRun) plus its
regression case in server-run-shutdown.recovery.test.ts. The connection-close
prelude can abort a main run with a restart reason before the shutdown marker
runs; the branch then skipped that run, so the session stayed "interrupted"
and never resumed. Left out the claimless startup-recovery store/marking
changes, diagnostics, and docs: they conflict on the branch and pair with
#168650, which was not approved.

Extracted-from: 4754d39
Co-authored-by: Peter Steinberger <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 12, 2026
Release provenance: 89329f6 -> #168587
Release provenance: e6a9022 -> #168905
Release provenance: 15f3f12 -> #162266
Release provenance: 20805b8 -> #169430
Release provenance: 568fec8 -> #169102
Release provenance: 39dba6d -> #160440
Release provenance: 5df28c7 -> #168393
Release provenance: 10bcd8e -> #168164
Release provenance: dc5f1f5 -> #168446
Release provenance: 9f1e441 -> #168044
Release provenance: 5a235fc -> #168651
RomneyDa pushed a commit that referenced this pull request Oct 13, 2026
) (2026.10.5 backport)

Startup restart recovery treated a session that was still initializing or
preparing its workspace as a terminal operator block and never revisited it,
so turns interrupted by an update restart stayed stranded. The work-start
owner now reports whether the block is retryable; startup recovery retains
those candidates and rechecks them after session preparation commits, using
the existing bounded retry and exact-target admission.

Grouped with the remaining startup-recovery half of #168651 (4754d39),
which pairs with this change: shutdown/startup marking now also recovers an
interrupted main session that persisted abortedLastRun/status "interrupted"
without a recovery claim (crash or early restart abort), skips archived
sessions with their own diagnostic, preserves already-delivered terminal
receipts, and logs why a shutdown marked zero sessions. The
src/gateway/server-run-shutdown.ts hunk of #168651 is already on the branch
as 5a235fc and is not repeated.

Backport adaptation: the store import block conflicted only because main
imports session-source-authority helpers the branch does not use; kept the
branch imports and added resolveSessionWorkStartBlock.

Extracted-from: 00daf0f
Extracted-from: 4754d39
Co-authored-by: Peter Steinberger <[email protected]>
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…claw#168651)

Adapt the released restart recovery invariant to this branch's consolidated server-close coverage.

Co-authored-by: RomneyDa <[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 P1 High-priority user-facing bug, regression, or broken workflow. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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