Repository navigation
feat: opt-in resume of interrupted runs after restart (#1512 I3) - #1513
Conversation
…I3) Quit and crash both stamp interruptedAt; any new run clears it. With settings.resumeInterruptedRuns on, boot (after first paint and PATH) gives each eligible thread one machine-delivered turn through deliverNotice, two at a time. autoResumedAt is saved before anything starts and only a human turn clears it, so an interruption is never resumed twice, even across another crash. stopRun drops a queued resume. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Settings › Threads gets "Resume interrupted runs after restart" (off by default). A dismissible notice lists the threads this launch resumed, with Stop all; stopping a still-queued thread drops its resume. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f7d925f1a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| stoppedAt: Date.now(), | ||
| // Opt-in resume after restart (issue #1512 I3). | ||
| interruptedAt: Date.now(), |
There was a problem hiding this comment.
Exclude workflow runs from restart continuation
When the user quits or crashes during a Build workflow on a thread that already has a provider sessionId, this stamps the workflow exactly like an ordinary provider run. On the next launch, isResumable accepts it and deliverNotice starts a normal startRun against the thread's old provider session; workflow state is only held in memory and is neither restored nor restarted. The automatic turn can therefore perform unrelated or duplicate work while claiming to continue the interrupted workflow. Persist the interrupted run kind and exclude workflows, or implement an actual workflow-resume path.
Useful? React with 👍 / 👎.
| if (!t.sessionId) return false; | ||
| if (services.isTrashed(t) || t.archived) return false; |
There was a problem hiding this comment.
Skip ejected sessions when selecting resumable threads
If a previously interrupted thread is ejected while auto-resume is disabled, then auto-resume is enabled before a later restart, this filter still selects it because an ejected thread retains its sessionId. deliverNotice deliberately parks notices for ejected Codex sessions, so the thread is marked and displayed as resumed without starting; worse, the queued [restart] notice can flush as an unexpected extra automatic turn after the user reclaims the session and completes another turn. Treat t.ejected === true as ineligible.
Useful? React with 👍 / 👎.
| if (t.settledOverride === "settled" || t.memoryConsolidate === true) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Apply computed settle rules before resuming
This only recognizes an explicit settle override, but effectiveSettled also classifies CLOSED PRs, and MERGED PRs when autoSettleOnMerge is enabled, as settled unless explicitly kept active. If a PR reaches one of those terminal states while its run is active and the app then quits or crashes, recovery makes the thread idle/failed and therefore settled, yet this filter launches another unattended turn on it. Check the same PR-state and settings-based settle rules used by the sidebar before selecting the thread.
Useful? React with 👍 / 👎.
…I3) The scheduler's poll timers are unref'd so they never hold the app open, which let node:test exit mid-await and cancel tests. Tests now inject a ref'd sleep. cancelAll (stopAll at quit) also releases any lane still polling, so a lane cannot wait forever. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Item I3 of #1512.
What changed
interruptedAt(stamped bystopAllandrecoverInterruptedRuns, cleared by any new run).whenPathReady, each eligible thread gets one machine turn: "[restart] The app restarted while you were working. Continue where you left off."deliverNotice, so the budget gate and the auto-turn cap apply, and it's an auto turn: never user approval forthread_merge/thread_pr.autoResumedAtis written and flushed withsaveNowbefore any turn starts, and only a human turn clears it. A crash during boot can't re-resume the same threads, and a resumed run that crashes again isn't resumed again.Verified independently, on main merged with this branch:
vite buildpasses.auto-resume.test.jscovers the setting off and on, each exclusion, the concurrency cap, no double resume, and auto-turn status.Known limits
🤖 Generated with Claude Code