Skip to content

Make crew notices durable across restarts, held for an explicit Resume - #1613

Merged
currentbits merged 10 commits into
mainfrom
coder/p1-durable-crew-notices-and-honest-resta-342476
Oct 13, 2026
Merged

currentbits merged 10 commits into
mainfrom
coder/p1-durable-crew-notices-and-honest-resta-342476

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes the crew-notice part of #1426. Before this change, pending lead wake-ups and the auto-turn counter lived only in memory. A crash or quit dropped work the lead was owed, and a restart reset the CREW_AUTO_TURN_CAP counter. A lead also never learned that a worker had been cut off mid-run.

What changed

Durable notice queue (electron/runner-orch-notices.js, electron/store.js)

  • The in-memory orchNotices and autoTurns maps are now stored as orchNoticesByThread and autoTurnsByThread.
  • enqueueNotice calls store.saveNow(), so a queued notice reaches disk right away instead of waiting for the save debounce.
  • Each worker run gets a noticeKey dedupe key, so a replayed finish does not wake the lead twice.

Honest restart: held, not auto-delivered

  • On load, holdRestoredNotices sets heldNotices (a count) on any lead whose queue survived the restart. flushOrchNotices skips a lead with that flag set.
  • When a run is interrupted by a restart, the worker is now stamped interruptedBy: "restart". This happens both in recoverInterruptedRuns and on the runner's quit path.
  • At boot, noticeInterruptedWorkers sends each affected lead a held notice. The notice gives the worker's worktree, branch, last commit, and whether the tree is clean or how many uncommitted changes it has. It then asks the lead to re-dispatch the worker or review what it left. It is keyed by interruptedAt, so a second boot does not add it again.
  • Auto-resume (runner-auto-resume.js) passes resume: true, which clears the hold. The user's auto-resume setting counts as consent to deliver.

Resume crew action

  • New runs:resumeCrew IPC, added to preload, the channel list, the web scopes, the shared types and the dev mock. It clears heldNotices and flushes the queue under the normal budget and auto-turn gates.
  • When the lead thread has held notices, ThreadView shows a status strip: "The app restarted. Your crew's updates are on hold." It has a Resume crew (N updates) button.

Tests

  • New electron/test/crew-restart.test.js covers the restart behaviour.
  • store.test.js and composerSlashActions.test.tsx cover the new store fields and the Resume crew strip. fakeCoder has the new API method.

🤖 Generated with Claude Code

Willem and others added 6 commits October 12, 2026 12:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T20:19:32.196551Z 1933f5a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1933f5a0c1

ℹ️ 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".

Comment on lines +402 to +403
dropQueue(threadId);
store.save();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Retain notices until the resumed turn is durable

If the user clicks Resume crew immediately after launch, startRun can remain blocked awaiting the login-shell PATH before it creates an active run or appends the notice prompt. This code has already removed the only persisted queue, so a clean quit during that wait calls stopAll() with no active entry and saveNow() permanently persists the deletion; the next launch has neither held notices nor a retryable prompt. Keep the queue until startRun has durably accepted/stored the notice, or restore it when startup is interrupted.

Useful? React with 👍 / 👎.

Willem and others added 3 commits October 13, 2026 08:44
Persist orchNotices/autoTurns in the store, dedupe wake-ups per worker run,
mark crash-interrupted runs interruptedBy:"restart", queue a held notice to
each interrupted worker's lead, and add a "Resume crew (N updates)" strip
backed by runs:resumeCrew.

Also unblock CI: refresh two stale test expectations already failing on
main (prLinks, GitHub trigger fields) and let the html fence test wait for
its lazy chunk.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-notices-and-honest-resta-342476

# Conflicts:
#	electron/test/automation-create-mcp.test.js
@currentbits
currentbits enabled auto-merge (squash) October 13, 2026 07:18
The tool.html card test waited three flushes for a lazy import() that can
take longer on a loaded CI runner, failing it and leaking an unwrapped
suspense resolve into the next test. Same fix main applied to
htmlFence.test.tsx.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@currentbits
currentbits merged commit e2fe3ce into main Oct 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant