Skip to content

feat(native-chat): keep restart recovery available in status bar - #21397

Merged
brennanb2025 merged 15 commits into
mainfrom
brennanb2025/fix-modal-recheck-action
Sep 21, 2026
Merged

brennanb2025 merged 15 commits into
mainfrom
brennanb2025/fix-modal-recheck-action

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​796 $\color{#cf222e}{\Huge{\mathbf{−}}}$​688 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​108
Prod 23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1035 $\color{#cf222e}{\Huge{\mathbf{−}}}$​620 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​415

Summary

If Orca closes while an agent is halfway through a reply, the chat can now be offered again when Orca opens.

The offer is kept on the machine until the user makes a clear choice:

  • Resume restores the selected chats and asks those agents to continue from where they stopped.
  • Dismiss all removes the saved offers.
  • Closing the dialog postpones the choice. It does not remove anything.
  • Opening a chat to inspect it does not count as resuming it.

The user’s original message is never sent again.

What was wrong before

The old design mixed two separate things together: opening a chat so the user could look at it, and restoring a chat so its agent could continue. Opening a chat could therefore make the offer disappear even though the user had not chosen Resume.

The dialog and the status bar also kept different copies of the list. After one chat was resumed, the dialog could still show it, which made the buttons and the count disagree with what the app could actually do.

What changed

There is now one saved list owned by the chat-session manager. It stores one entry for each interrupted chat on the local machine.

  1. When Orca shuts down, it saves the interrupted chats.
  2. When Orca starts, the dialog and the status bar read that same list. Reading it does not delete it.
  3. Opening a chat only displays it; the saved entry remains.
  4. Pressing Resume checks the list again, acts only on the selected chats, and removes an entry only after that chat was successfully resumed.
  5. Pressing Dismiss all clears the saved entries.
  6. If a second shutdown or another window changes the list, both surfaces pick up the latest answer instead of showing an old copy.

A short retry covers the normal startup race while the chat-session manager is coming online. If the app cannot confirm the list, it hides the offer rather than showing a possibly wrong one.

Why this design

The saved list is the source of truth, and user actions are the only things that change it. This keeps inspection, resuming, postponing, and dismissing separate and predictable.

The older approach tried to infer the user’s choice from chat-window activity. That is why merely opening a chat could be mistaken for recovery. This change records the user’s actual choice instead.

Visual proof

The real app was tested in a hidden Electron window using two genuinely interrupted chats:

  • the offer opened after relaunch;
  • closing the dialog left the offer in the status bar;
  • opening a chat left the offer unchanged;
  • Resume 1 left exactly one chat in the offer;
  • Dismiss all removed the dialog, status-bar entry, and saved offer.

Screenshots are attached in the Electron validation comment.

Testing

  • 164 focused automated tests covering saving, relaunch, postponing, inspection, Resume, Dismiss all, concurrent actions, stale lists, and failed storage reads.
  • Node typecheck.
  • Web typecheck.
  • Changed-code quality checks: 0 findings.
  • Electron/CDP validation on macOS with a background, isolated profile.

Not exercised: Windows, Linux, SSH/remote hosts, mobile, or automatic resume. No code in those areas changed.

Linked issue

Follow-up to merged PR #21096; no separate issue exists.

AI disclosure

Codex (GPT-6) wrote the change. Claude Opus 5 performed the review-driven rewrite.

Scope and compatibility

This changes local structured-chat recovery only. It does not add polling, shell commands, subprocesses, mobile code, or remote-host protocol changes. Folder workspaces remain supported.

Checklist

  • User behavior is described in plain language.
  • Screenshots are attached.
  • Tests, typechecks, and changed-code quality checks pass.
  • Cross-platform, remote, and mobile impact considered.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The restart-resume host now preserves unread, unreadable, and eligible claimed markers during teardown. It removes offers when a chat recovers through a hold. The modal uses shared stores to separate snoozing from explicit dismissal. A status-bar segment displays remaining restart candidates and reopens the modal. Tests cover persistence, recovery, dismissal, store state, feature gating, and status-bar rendering.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to b2dc7

A transient host-read failure can hide recovery offers until relaunch, and a later refresh failure can show candidates the host no longer confirms. These issues should be fixed before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 39.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 21 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: keeping restart-recovery offers available through the status bar.
Description check ✅ Passed The description is detailed and covers the user behavior, implementation, rationale, visual proof, testing, AI disclosure, compatibility, and checklist items. It does not provide a formal linked issue…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Remove continued sessions from the shared candidate… · NativeChatResumeOnRestartModal.tsx:252

src/renderer/src/components/NativeChatResumeOnRestartModal.tsx:252
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove continued sessions from the shared candidate snapshot.

When restartContinue succeeds, this path closes the modal but does not update candidates or the status-bar store. The continued sessions therefore remain in both candidate snapshots.

Mirror the resume remaining-candidate update before resolving the modal.

Proposed fix
         }>(LOCAL, 'agentSession.restartContinue', { sessionIds })
+        const settled = new Set(result.continued.map((entry) => entry.sessionId))
+        const remaining = candidates.filter((candidate) => !settled.has(candidate.sessionId))
         announceRestartResults(sessionIds, result.continued, 'continue')
+        setCandidates(remaining)
+        setNativeChatResumeOnRestartCandidates(remaining)
         setResolved(true)
@@
-    [persistPreference]
+    [candidates, persistPreference]

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 63f54f13-435c-428b-b9ac-0f446a746b4d

📥 Commits

Reviewing files that changed from the base of the PR and between 9907117 and 222f009.

📒 Files selected for processing (9)
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-claim.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts
  • src/main/runtime/rpc/methods/structured-agent-session-restart-resume.ts
  • src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
  • src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
  • src/renderer/src/components/native-chat-resume-on-restart-store.ts
  • src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx
  • src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.tsx
  • src/renderer/src/components/status-bar/StatusBarSurface.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment on lines +285 to +286
consumeNativeChatResumeOnRestartDialogRequest()
setResolved(false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '130,310p' src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
sed -n '90,155p' src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx

Repository: stablyai/orca

Length of output: 8935


🏁 Script executed:

printf '%s\n' '--- modal state and handlers ---'
sed -n '1,145p' src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
printf '%s\n' '--- modal tests around reopen/status behavior ---'
rg -n -C 8 'reopen|openRequested|resume|Not now|snapshot|status' src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
printf '%s\n' '--- snapshot API bindings ---'
rg -n -C 6 'setNativeChatResumeOnRestartCandidates|consumeNativeChatResumeOnRestartDialogRequest|getNativeChatResumeOnRestartSnapshot|openRequested' src/renderer/src

Repository: stablyai/orca

Length of output: 34594


Do not reapply the initial offer when reopening the dialog.

After a partial successful resume, the settled sessions are removed from local and shared candidates, but resolved remains false while candidates remain. Snoozing then reopening sets resolved to false and reruns the loading effect. Because launchOffer.current contains the original offer, the effect restores settled sessions to both candidate lists.

Load and apply the launch offer only when structured chat becomes enabled. Do not make the loading effect depend on resolved.

Proposed fix
-    if (!structuredEnabled || resolved) {
+    if (!structuredEnabled) {
       return
@@
-  }, [resolved, structuredEnabled])
+  }, [structuredEnabled])

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

Two behavioral issues found and reproduced: a stale claimed marker can overwrite the fresh teardown marker for the same session, and reopening the dialog from the status bar after a partial reconnect resurrects already-settled candidates (inflating the status-bar count).

Reviewed changes

  • Status-bar recovery segment — a new NativeChatResumeStatusSegment shows the remaining reconnect count and reopens the existing resume dialog through a shared external store.
  • Snooze vs. dismiss — closing the dialog ("Not now") is now a non-destructive snooze; a new "Dismiss all" button is the only path that spends the host claim via agentSession.restartResumableDismiss.
  • Teardown carries unconsumed claims — recordMarkers merges claimed launch markers into the persisted set so a second orderly quit does not lose the offer.
  • Shared renderer store — native-chat-resume-on-restart-store.ts backs both the modal and the status segment.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…t on recovery

Closing the reconnect dialog spent the durable recovery offer, so looking around
before deciding lost the recovery for good. The offer now survives a close, and
the status bar carries it — but a durable offer needs a way to die, and it only
had a reconnect, an explicit dismiss, and a 24h expiry.

The claim's launch-scoped lifecycle moves into its own collaborator, which splits
what the host ADVERTISES from the evidence it holds. A resume-capable hold that
hands a marked chat its provider child back is the recovery the offer existed to
perform, so it stops being advertised and stops being written back at quit, while
the marker stays valid evidence — a user who reopened a chat can still ask the
agent to carry on. Teardown re-derives the snoozed offer rather than round-tripping
raw markers, and this teardown's own witness now outranks the stale claim for the
same chat instead of being overwritten by it, which was silently persisting an old
turn id and making the next launch refuse the chat that was actually mid-turn.

On the renderer the candidate list gets its own producer against
agentSession.restartResumable, so the status entry and the dialog read one
host-owned answer instead of the dialog pushing its local state at a sibling. The
entry re-reads the host before reopening, so a reopened list can never name a chat
the host would now refuse; dialog open becomes the external one-shot request
rather than a flag mirrored into render state, which is what let a reopen replay
the launch answer and re-offer chats already reconnected. Dismiss all is quiet
rather than destructive, saves the preference like every other exit, and reports a
write the host never confirmed instead of trapping the dialog open.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 0c9b90cd-7f39-4352-a050-67e600c54fa8

📥 Commits

Reviewing files that changed from the base of the PR and between 222f009 and 47f45f4.

📒 Files selected for processing (18)
  • src/main/native-chat/agent-session-wire/structured-agent-session-holds.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-holds.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-lifetime.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-claim.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-claim.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-ownership.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts
  • src/main/runtime/agent-session-recovery-capsule.ts
  • src/renderer/src/components/NativeChatResumeOnRestartGroups.tsx
  • src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
  • src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
  • src/renderer/src/components/native-chat-restart-action-notifications.ts
  • src/renderer/src/components/native-chat-resume-on-restart-dialog.ts
  • src/renderer/src/components/native-chat-resume-on-restart-store.ts
  • src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx
  • src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.tsx
  • src/renderer/src/i18n/locales/en.json

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

useEffect(() => {
if (enabled) {
// Fetched after mount, never awaited by startup: the workspace is usable first.
launch ??= loadLaunchOffer()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,190p' src/renderer/src/components/native-chat-resume-on-restart-store.ts
sed -n '1,120p' src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.tsx
rg -n -C 5 'useNativeChatRestartOffer|refreshNativeChatRestartOffer|loadLaunchOffer|_resetNativeChatRestartOffer' src/renderer/src

Repository: stablyai/orca

Length of output: 27636


Retry a failed launch offer read.

When the initial agentSession.restartResumable call fails, refreshNativeChatRestartOffer returns the initial empty candidate list. loadLaunchOffer then resolves, so launch remains cached and useEffect does not retry while enabled stays true. Both renderer consumers receive no candidates; the status segment also returns null, so its refresh action is unavailable.

Add a bounded retry, or clear and retry the cached launch operation when the host did not return an answer.

setResolved(true)
} finally {
setBusy(false)
consumeNativeChatResumeOnRestartDialogRequest()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '160,245p' src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
rg -n -C 5 'restartContinue|continued' src/main src/renderer/src | head -240
sed -n '45,105p' src/renderer/src/components/native-chat-resume-on-restart-store.ts

Repository: stablyai/orca

Length of output: 29506


🏁 Script executed:

set -eu
rg -n -C 8 "restartContinue|RestartActionOutcome|continueAfterRestart|settleNativeChatRestartOffer|NativeChatRestartOffer" src/main/native-chat src/renderer/src/components src/renderer/src | head -320

Repository: stablyai/orca

Length of output: 38797


🏁 Script executed:

set -eu
printf '%s\n' '--- restart-related files ---'
rg --files src/main/native-chat src/renderer/src | rg 'restart|agent-session.*wire'
printf '%s\n' '--- RPC and continuation definitions ---'
rg -n -C 12 "agentSession\\.restartContinue|restartContinue|continueAfterRestart|type RestartActionOutcome|interface RestartActionOutcome" src/main src/shared src/renderer/src --glob '*.ts' --glob '*.tsx' | head -500

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

set -eu
printf '%s\n' '--- RPC wiring ---'
rg -n -C 18 "restartContinue|restartResume|continueAfterRestart" src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-wiring.ts src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
printf '%s\n' '--- modal imports and action ---'
sed -n '1,35p' src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
sed -n '175,218p' src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
printf '%s\n' '--- shared offer state ---'
sed -n '1,145p' src/renderer/src/components/native-chat-resume-on-restart-store.ts

Repository: stablyai/orca

Length of output: 25844


🏁 Script executed:

set -eu
printf '%s\n' '--- continuation result types and return path ---'
rg -n -C 10 "StructuredAgentSessionContinuationOutcome|type .*ContinuationOutcome|interface .*ContinuationOutcome|return \{.*continued|continued\\.push|continueStructuredAgentSessionAfterRestart" src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts
printf '%s\n' '--- continuation implementation ---'
sed -n '1,180p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
sed -n '210,285p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts

Repository: stablyai/orca

Length of output: 31816


🏁 Script executed:

set -eu
sed -n '100,212p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts
sed -n '1,220p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-claim.ts

Repository: stablyai/orca

Length of output: 9019


Settle continued candidates before closing the dialog.

When agentSession.restartContinue returns, result.continued contains entries with sessionId. reconnectAndContinue only announces those entries, then closes the dialog. The shared offer remains unchanged, so the status segment can continue counting processed candidates.

         }>(LOCAL, 'agentSession.restartContinue', { sessionIds })
         announceRestartResults(sessionIds, result.continued, 'continue')
+        settleNativeChatRestartOffer(result.continued.map((entry) => entry.sessionId))

…e the one a continuation spent

Teardown replaced the recovery capsule with whatever this launch still owed,
and a launch that never read the offer owes nothing — so a quit after a
failed first read, a disabled flag, or a window that never mounted deleted a
recovery the user was never shown. The write-back now distinguishes "claimed
and still owed" from "never claimed": the first is re-derived as before, the
second carries forward verbatim, because nothing revealed those sessions and
the predicate would refuse every one for want of a journal nobody opened.

Reconnect and continue spent the same claims Reconnect does but never shrank
the offer, leaving the status bar counting chats the host had already handed
back and sending the user to an entry that re-reads, finds nothing and does
nothing.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • Claim moved to its own collaborator — structured-agent-session-restart-claim.ts splits what the host advertises (offered, minus recovered sessions) from the evidence it holds (evidence), with spend/recover/abandon replacing the inline claim state.
  • Reopening a chat retires its offer — StructuredAgentSessionHolds.onResumeCapableAcquisition is wired to restartResume.recoveredByHold, so a resume-capable hold stops the offer being advertised or written back while the marker stays valid evidence.
  • Teardown re-derives rather than round-trips — recordMarkers re-runs the predicate over the outstanding offer and merges confirmedMarkers last, so this teardown's fresh witness outranks a stale carried claim.
  • Renderer store replaces modal-local state — native-chat-resume-on-restart-store.ts and native-chat-resume-on-restart-dialog.ts back both the modal and the new status segment, and the status entry re-reads the host before reopening.
  • Snooze vs. dismiss split — closing is now a non-destructive snooze; "Dismiss all" is the only path that spends the claim and reports a dismissal the host did not confirm.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • A durable offer a launch never read is preserved — owed() reports whether this launch claimed the capsule, and recordMarkers carries an unclaimed capsule forward verbatim instead of re-deriving it, which would refuse every marker for journals nobody revealed.
  • Continuation now settles the shared offer — reconnectAndContinue reads the host's resumed outcomes (optional, so an older host degrades to no settle) and calls settleNativeChatRestartOffer, so the status segment stops counting chats the host already handed back.
  • Teardown coverage reworked — the stale leaves no marker behind test was replaced by a never-claimed case, and real-teardown tests now cover both the snoozed and never-claimed paths.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

… read

Two ways the write-back deleted a durable recovery offer nobody had seen.

A take that FAILED left the claim holding an empty list and reporting that
this launch had answered for the offer. The markers were still on disk,
unread and unknowable, and teardown then overwrote them with its own empty
list. It now writes nothing at all unless it has a witness of its own.

`owed()` read "has the capsule been touched" where it meant "did anything
here LOOK at the offer" — and its own write-back read counted. Teardown is
retried when a phase fails, so the second attempt re-derived carried markers
against a session map eviction had already emptied, refused every one, and
wiped what the first attempt had just carried forward. The flag is now set
only by the paths that actually read or act on the offer.

The mock guard for the carry could not fail: it indexed the session it
claimed nothing had revealed, so re-deriving passed and the verbatim carry
was never the reason it went green. It now runs against no indexed session,
which is what an unread offer looks like.

Also drops the `Not now` row from the preference table, where it was paired
with a dismiss method it no longer calls, and asserts the same thing where
the snooze is already covered. Splits the marker predicate's journal reader
out of the resume host, which was at its line ceiling.
@brennanb2025

brennanb2025 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Electron validation pass — commit 35f1d45a58f59b9c99dbfdcbea8057b399fdd567

Every screenshot below was taken from the real app running this exact commit, in a separate checkout with its own isolated app profile and its own window that was never brought to the front. No product code was changed to make anything easier to photograph.

How the interrupted chats were produced

The PR body previously said the status-bar item could not be photographed because there was nothing to reconnect. That gap is now closed, and the state was produced the honest way:

  1. Turned on the experimental structured chat setting and restarted the app.
  2. Created a scratch folder workspace and opened several Codex chats in it.
  3. Gave each chat a command that takes five minutes to finish, so each one was genuinely mid-reply.
  4. Quit Orca while all of them were still working.

Orca's own shutdown path wrote the recovery record — three entries, one per chat that was mid-reply, each naming the reply it was in the middle of. Nothing was hand-written, and nothing was injected into the app.


1. The status-bar item

Before the interrupted quit, with nothing to reconnect, there is no such item in the bar (bottom right shows only the usual entries):

00-before-quit-three-working.png

After relaunching, it is there with a count:

03b-statusbar-crop-3-chats.png

Shrinking the window collapses it to just the icon and the number, alongside the other items that do the same thing. The app as a whole is cramped at that width; the only thing this screenshot is evidence for is that the item collapses:

09-statusbar-icon-only-compact.png

09b-statusbar-crop-icon-only.png

2. One chat versus several

Two chats waiting reads "2 chats to reconnect":

10b-statusbar-crop-2-chats-plural.png

One chat waiting reads "1 chat to reconnect", not "1 chats":

07b-statusbar-crop-1-chat-singular.png

3. The dialog and its buttons

Dark:

01-dialog-dark-3.png

Light:

02-dialog-light-3.png

The buttons sit in two groups — the two ways out on the left, the two things you can do on the right — with the quieter "Dismiss all" first. Nothing overlaps, wraps or crowds in either colour scheme, at this window size.

4. Closing the dialog and getting back to it

This is the sequence the change exists for.

Clicking the status-bar item reopens the dialog on the chats that are still waiting:

04-dialog-reopened-2.png

Unticking one of the two leaves a single chat selected, and the main button says so:

05-dialog-select-one-of-two.png

After reconnecting that one, the list shrinks to the chat that is left and the status bar behind it drops to one. (The remaining row is unticked because it was unticked a moment ago, which is why the main button is greyed out.)

06-after-reconnect-one-remaining.png

Closing with "Not now" leaves the count at one:

07-statusbar-1-chat-singular.png

Clicking it reopens the dialog on the one remaining chat. The chat that was already reconnected does not come back, and the count does not climb:

08-dialog-reopened-only-remaining.png

Two other things observed

  • Simply having one of the interrupted chats open in front of you takes it off the list the next time the list is read. During this run the count went from three to two for that reason. It went down, never up.
  • A list that was closed with "Not now" and then left alone survived quitting Orca a second time, and came back on the next launch alongside a newly interrupted chat.

What this run does not cover

  • Only Codex chats were used. Claude chats were not exercised at all.
  • Only a folder workspace on a local Mac. No Git worktree workspace, no remote or SSH host, and nothing on Windows or Linux.
  • "Reconnect and continue" and "Dismiss all" were photographed but never clicked, so what they do is untested here.
  • The "Don't ask again — reconnect automatically next time" path was never taken, so the automatic reconnect on the next launch is untested here.
  • The item is supposed to be hidden when the experimental chat setting is off. This run only shows it absent when there is nothing to reconnect; the setting was never turned off while chats were waiting, so that half is untested.
  • Only one window size was used for the dialog. Very small or very large windows were not checked.

The branch moved after these were taken

These screenshots are pinned to 35f1d45a58f59b9c99dbfdcbea8057b399fdd567. While they were being captured, a further commit landed on the branch — d58d340fe22ccf32fcc40642cbf49acac6304cd1, "stop a teardown answering for an offer it could not read".

That commit changes only background bookkeeping about when the list of interrupted chats is kept or thrown away as Orca shuts down, plus one test file. It does not touch any of the on-screen pieces photographed above, so the dialog, its buttons and the status-bar item look and behave the same on the newer commit. What is genuinely only proven on the older commit is the shutdown behaviour itself: the list surviving a quit and coming back on the next launch was observed on 35f1d45a5, not on the newer one.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Retain claimed markers when re-derivation fails. · structured-agent-session-restart-resume-host.ts:280-287

src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts:280-287
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Retain claimed markers when re-derivation fails.

When claim.owed() returns claimed markers, derive(owed.markers, ...) runs before carried receives them. If the candidate reader throws, the catch leaves carried empty. The subsequent AgentSessionRecoveryCapsule.record() replaces the capsule with only the current teardown witnesses, so the outstanding markers are lost. The current-head check only filters a successful result; it does not preserve markers after an exception.

Assign owed.markers as the fallback before calling derive, then replace it only after eligibility evaluation completes.

Suggested fix
         } else if (!owed.claimed) {
           carried = owed.markers
         } else {
+          carried = owed.markers
           const stillResumable = new Set(
             derive(owed.markers, 'must-be-released').map((candidate) => candidate.sessionId)
           )
-          carried = owed.markers.filter((marker) => stillResumable.has(marker.sessionId))
+          carried = carried.filter((marker) => stillResumable.has(marker.sessionId))
         }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ea633e70-6828-4c9f-80c8-a0095106c5ba

📥 Commits

Reviewing files that changed from the base of the PR and between 35f1d45 and d58d340.

📒 Files selected for processing (5)
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-candidates.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-claim.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-claim.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts
  • src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit added since the prior pullfrog review (35f1d45), which reworks teardown so it never answers for a recovery offer it could not read.

  • Teardown stops overwriting an unreadable offer — recordMarkers now returns without writing when the capsule take failed and this teardown has no witness of its own, instead of replacing the intact-but-unreadable markers with an empty list.
  • "Did this launch read the offer" is now an explicit flag — owed() reports read (set only by evidence/abandon) rather than "has the capsule been touched", so a teardown repeated after a failed phase carries the same unread offer forward instead of re-deriving it against an emptied session map.
  • The marker predicate's journal reader was extracted — the inline derive/itemsFor moved to createStructuredAgentSessionRestartCandidateReader, built once by the host and shared by the offer, click and write-back.
  • Tests tightened — the never-claimed teardown guard now runs against no indexed sessions (so a re-derive would fail it), with new coverage for repeated teardown and both failed-take write-back paths; the "Not now" preference row folded into its dedicated snooze test.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

A capsule whose contents no longer parse made take() throw before it ever
reached the clear, so the bad file survived every launch. Nothing else
rewrites it now that a teardown owing nothing readable declines to write, and
the freshness filter runs after the parse, so the 24h window could not release
it either: one corrupt file refused recovery forever.

Clear it inside the same transaction that failed to read it, then rethrow, so
the poison dies on the next launch while callers still see why the take failed.
A clear that fails is swallowed rather than allowed to mask the parse error.
Refusing to expose partial candidates is unchanged, and a read that fails for
any other reason still writes nothing.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Clear the shared offer when refresh fails. · NativeChatResumeStatusSegment.tsx:17-20

src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.tsx:17-20
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clear the shared offer when refresh fails. reopenOffer() can receive cached candidates because refreshNativeChatRestartOffer() returns offer.candidates from its catch block. The dialog can reopen with stale candidates, and the status bar keeps rendering the cached candidates because the store is not updated. Clear the shared offer and return an empty list only on failure. Keep the successful empty response path unchanged.

  } catch {
    clearNativeChatRestartOffer()
    return []
  }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ee27a4a5-c5f5-47c6-8673-ad97aae875d7

📥 Commits

Reviewing files that changed from the base of the PR and between d58d340 and b2dc7e3.

📒 Files selected for processing (2)
  • src/main/runtime/agent-session-recovery-capsule.test.ts
  • src/main/runtime/agent-session-recovery-capsule.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit added since the prior pullfrog review (d58d340), which makes a refused recovery-capsule read self-healing.

  • Corrupt capsule content is cleared, not left to refuse forever — AgentSessionRecoveryCapsule.take() now empties the capsule when its content cannot be parsed or validated, then rethrows, so one unreadable file no longer fails every subsequent take.
  • Discriminating coverage — a new it.each proves a later take (and a fresh capsule instance) returns [] after the refused read, for both invalid JSON and a valid capsule containing one malformed marker.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready to merge

All checks green at 508eedf09e. This review replaced the original mechanism rather than patching it, after two independent architecture reviews reached the same conclusion. Four rounds of fixes landed; eight distinct defects were found and closed.

What the change does

When Orca restarts while a chat is mid-reply, that reply is lost. Orca notes which chats were interrupted and offers to reconnect them at the next launch.

Previously, closing that dialog any way threw those notes away — so if you closed it to go look at the chats first, the offer was gone for good. Now closing it is a snooze: the offer stays reachable from a status-bar entry until you either reconnect, dismiss it outright, or simply open the chat yourself.

Why the mechanism changed

The original version kept the list of interrupted chats in the window, written there by the dialog. The status-bar entry read that copy. This meant the same fact lived in three places — the backend, the dialog, and the shared copy — and they could disagree.

They did. Reopening the dialog after reconnecting some chats restored the original list, re-offering chats that had already been reconnected and pushing the count back up. Clicking reconnect on one of those then failed, because the backend had already handed it back.

The backend now owns the offer outright. Both the dialog and the status-bar entry read the backend's current answer, and anything about to act on the offer asks again first. A count can no longer name a chat the backend would refuse.

The bugs that mattered most

Five of the eight were ways the saved notes could be destroyed or corrupted — the exact thing this feature exists to prevent:

  1. A stale note could overwrite a fresh one for the same chat, so the chat that was actually interrupted was silently never offered.
  2. A launch that never read the offer deleted it at shutdown, because "nobody looked at this" was being treated as "nobody is owed this".
  3. If reading the saved notes failed, that was treated as "there were none", and shutdown then overwrote an intact file with nothing.
  4. A retried shutdown could erase the notes it had just written.
  5. A corrupt notes file could never repair itself, so recovery would be silently refused forever. This one was introduced by the fix for Add Shift+Enter to insert newline in terminal #3 — before this branch, the file was rewritten on every shutdown, which repaired it by accident.

The rest: reconnecting a chat and continuing it left the status-bar count too high; dismissing silently discarded the "don't ask again" preference; and a failed dismiss left the dialog stuck open with nothing reported.

Also fixed

  • A single chat read "1 chats to reconnect". It now reads "1 chat".
  • The dialog footer had three buttons spread apart, stranding "Not now" in the middle. Now grouped, with "Dismiss all" no longer styled as a destructive action — it does not destroy anything you cannot get back by opening the chat.
  • Comments that contradicted the shipped behaviour were rewritten, including one arguing against the very change being made.
  • Two files were split to stay under the line limit — real extractions, no suppressions.
  • Four missing interface strings were added to the catalogue. This had not surfaced in CI because the check that catches it is skipped when the lint step fails first.

Validation

  • Full test suite green; the affected areas run 764 tests locally.
  • Type checking, linting, code-quality, and all four localisation gates pass.
  • Tested in the real app, twice, using genuinely interrupted chats — created by quitting while chats were mid-reply so the app's own shutdown wrote the notes. Nothing was hand-written or stubbed. Screenshots are in the comment above.
  • The reconnect-one-then-reopen flow is photographed working: the count goes down and stays down, and the reconnected chat is not re-offered.
  • The corrupt-file repair was checked both ways: on this branch the file repairs itself and recovery works again on the next launch; on the previous commit the file came back byte-for-byte identical and recovery stayed broken. That is measured, not assumed.

Durability evidence is pinned to b2dc7e353a. The only change since is a merge of main, which does not touch any file involved in that behaviour.

Known gaps

  • Tested with one agent type on macOS, in a folder workspace. Not exercised against a git-worktree workspace, a remote host, Windows, or Linux.
  • In a multi-window setup, dismissing in one window leaves another window's number stale until that window next reads. It cannot act on a stale count — clicking re-reads and refuses to open on an empty answer — so this is cosmetic. Closing it would cost a background request per window focus for as long as an offer is outstanding, which is not worth it.

Suggested follow-ups (not blocking)

  • The saved notes are deleted the moment they are read, so from then until a clean shutdown they exist only in memory. The offer therefore survives a normal quit but not a crash or a force-quit. Moving the note onto the existing per-chat record — written by a transaction that already runs at the same moment — would make it durable throughout, and would remove the shutdown bookkeeping that produced four of the bugs above. That touches a safety-critical stored format and deserves its own change.
  • Clicking the status-bar entry briefly re-reads chats that were already recovered. Wasted work only, nothing visible.
  • One malformed note discards the whole file rather than just that entry.

…tually resume

The restart prompt offered two actions: "Reconnect all", which reattached
and sent nothing — exactly what opening the chat already does — and
"Reconnect and continue", which reattached and asked the agent to carry
on. The vacuous one is gone, the "Not now" button and the info popover
with it, and the feature is now called resume throughout.

"Don't ask again (resume automatically)" now runs the action the button
runs: the launch calls agentSession.restartContinue instead of
agentSession.restartResume, so the preference means what it says. Several
comments asserted the opposite as a structural guarantee and are
corrected. agentSession.restartResume stays: no in-app caller is left,
but it is a published wire method a non-desktop or older client can call.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This run re-reviewed the only substantive commit landed since the prior pullfrog review (508eedf merged main without touching the PR's files; 87b6f2771b is the change).

  • One restart action, and it resumes — the dialog's separate "Reconnect" and "Reconnect and continue" buttons, the "Not now" button, and the "what gets sent" popover are gone; the single primary action calls agentSession.restartContinue (reattach AND send), with the description copy carrying the transparency.
  • The automatic path now resumes too — an opted-in launch calls restartContinue and settles the offer from result.resumed, instead of the send-free restartResume; restartResume stays published on the wire.
  • Snooze and dismiss are preserved — closing the dialog only consumes the request and persists the preference; Dismiss all remains the sole path that spends the claim, clears the store only on a confirmed host answer, and reports the unconfirmed case.
  • Strings and catalogues renamed — Reconnect→Resume across the modal, status segment, settings and notifications, with en.json/en-runtime-required.json kept in sync and the now-dead keys removed.
  • Comments corrected — the "automatic reconnect can never continue" guarantee is explicitly retired everywhere it was asserted (continuation module, host send/continueAfterRestart, RPC method, claim test).

ℹ️ The automatic setting now sends a message, not just a reconnect

The single action is a deliberate and well-documented change, but note that it changes what an existing nativeChatResumeWorkOnRestart = true means. Such a user opted in to reconnecting mid-turn chats; on the next launch they will now have a continuation message sent to each agent without pressing anything, with only the launch toast as notice. That is the intended semantics of "make it actually resume", and the setting copy now says so, so this is for the maintainer to bless rather than a defect. Worth confirming that widening an existing boolean from "reattach" to "send at launch" is acceptable, since the opt-in was taken under the old wording.

Technical details
# Automatic launch now sends a continuation message

## Affected sites
- `src/renderer/src/components/native-chat-resume-on-restart-store.ts:112-138` — `loadLaunchOffer`
  calls `agentSession.restartContinue` when `nativeChatResumeWorkOnRestart === true`.
- `src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts:173-233`
  — `continueAfterRestart` sends `AGENT_SESSION_RESTART_CONTINUATION_MESSAGE` to each reattached
  session.
- `src/shared/agent-session-restart-continuation.ts:8-13` — the old "no setting can reach this"
  contract is explicitly retired.

## Required outcome
- None mechanically; the behavior matches the PR's stated intent. This is a consent/rollout question.

## Open questions for the human
- Is the widened meaning of the existing setting acceptable without a migration or a one-time
  re-prompt for users who already had it enabled?
- Should the launch toast (the only notice a message went out) be more prominent than the same
  fire-and-forget toast the interactive button raises?

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

brennanb2025 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Fresh screenshots — this replaces the earlier screenshot comment

This supersedes the earlier screenshot comment. Those pictures show the previous design of this dialog and are now out of date: the wording, the buttons and the status-bar text have all changed since. Please read this comment instead.

One change since these were taken. The main button read "Resume all" when every chat
happened to be ticked. It has since been changed to always name the count instead — so it now
reads "Resume 3 chats", "Resume 2 chats", or "Resume 1 chat". It always acted on the
ticked chats only; the old label just described the selection rather than the action.

And one more. The settings description in the last picture has since been shortened to a
single line: "When Orca quits or installs an update, chats that were mid-turn are automatically
resumed when Orca is reopened."
The toggle title is unchanged.

Every other detail in these pictures is current.

Everything below was photographed from the real app running commit 87b6f2771bc9dff3183c2d725cd9fae468f8f58a, in a separate checkout with its own app profile and its own window that was never brought to the front. No product code was changed to make anything easier to photograph.

What changed since the old pictures

Old design Now
"Reconnect all" and "Reconnect and continue" one action: Resume all
A "Not now" button closing the dialog (X, Esc, or clicking outside) quietly puts it off
An ⓘ icon hiding an explanation the explanation is in the dialog, in plain sight
"2 chats to reconnect" in the status bar "2 chats to resume"

How the interrupted chats were produced

Nothing was hand-written or injected. The state came from the app doing what it normally does:

  1. Turned on the experimental Chat UI settings and restarted the app.
  2. Made two scratch folders inside one project and opened real Codex chats in them.
  3. Gave three of those chats a command that takes several minutes, so each was genuinely part-way through a reply.
  4. Quit Orca while all three were still working.

Orca's own shutdown wrote the recovery record — three entries, one per chat that was mid-reply. On the next launch the dialog below came up on its own.


1. The dialog, three interrupted chats, dark

The chats are grouped the way the sidebar groups things: project, then workspace, then the chats inside it. Every chat is ticked to begin with, and each row shows which assistant it was, the first line of what you asked, the model, and how long ago it stopped.

dialog dark, three chats

2. The same dialog in light mode

dialog light, three chats

3. Untick a chat and the button counts what is left

With one chat unticked the button reads "Resume 2":

resume 2

With two unticked it reads "Resume 1":

resume 1

Untick everything and the button is greyed out, because there would be nothing to do.

4. Closing the dialog does not throw the chats away

Closing with the X puts the list aside rather than discarding it. The bottom-right of the window keeps a way back to it:

closed, status bar shows three

Clicking that entry reopens the dialog. It asks the app again before it opens, so the list is always current — here it correctly shows two, because in between I had opened one of those chats, and simply opening a chat already picks it back up:

reopened showing the remaining two

5. The status-bar wording, plural and singular

Two waiting reads "2 chats to resume":

two chats to resume, whole window

two chats to resume, close up

Then I actually used the button: ticked one chat, pressed "Resume 1", and that chat started working again. The list shrank with it, and one waiting reads "1 chat to resume" — not "1 chats":

one chat to resume, whole window

one chat to resume, close up

6. In a narrow window it shrinks to an icon and a number

The whole app is cramped at this width; the only thing this is evidence for is that the entry collapses like the other status-bar items do.

narrow window

narrow window, close up

7. The rewritten Settings text

Settings → Experimental → Chat UI. The description of the automatic option used to say resuming does not carry on the interrupted reply. It now says what actually happens, and matches the dialog: the chat is put back where it stopped and the assistant is asked to check its last action before carrying on, and your own message is not sent again.

settings section close up

The same text in the full Settings window:

settings whole window


What I did not photograph

  • "Dismiss all". Pressing it throws the whole list away, which would have ended the session and cost me the later pictures. Not exercised.
  • The automatic mode. I left "Don't ask again (resume automatically)" unticked throughout, so the no-prompt path is not shown here.
  • The update wording. The dialog has a second opening line for when an update caused the restart ("...when Orca installed an update"). I quit the app rather than installing an update, so only the quit wording appears above.
  • The brief "Resuming…" button label while the request is in flight; it passed too quickly to catch.

…lected

The button read "Resume all" whenever every chat happened to be ticked,
which described the selection rather than the action. It always acted on
the selected chats only. Now it always names that count, with a singular
variant so one chat does not read "1 chats".

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit added since the prior pullfrog review (87b6f2771b), which fixes the resume button's label.

  • The Resume button now names the selection count — it no longer reads "Resume all" merely because every chat happened to be ticked. It shows Resume 1 chat (a dedicated resumeSelectedOne key) when exactly one is checked and Resume {{value0}} chats otherwise; the two branches already acted on the same chosen list, so this is copy-only.
  • Dead branch and string removed — the chosen.length === candidates.length condition and the resumeAll catalog entry are gone, so the label depends only on chosen.length.
  • Tests and catalogue updated — the modal tests target the new labels (including the "exactly two actions" assertion, now Resume 2 chats), and en.json carries the renamed/added keys.

chosen is still intersected against the host's candidate list and resume(chosen) is unchanged. pnpm verify:localization-runtime-catalog passes (the new keys are rebuildable from their call-site defaults, so no runtime-required regeneration is needed), and the modal, status-segment and catalog tests pass (47 tests).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…n left behind

Resuming became one action — reattach and ask the agent to carry on — so the
notification helpers no longer need to be told which action they are reporting.
Every caller passed `continue`; the `reconnect` branch, its helper and its
catalog keys are gone.

The dialog and the launch path had grown two copies of the same call: same RPC,
same response shape, same announce-and-settle. That now lives once in the store
module that owns the offer, which also takes the dismiss call, leaving the modal
presentational. The two copies had drifted — only the dialog's caught a
malformed payload — and the unified one keeps the defensive reading.

No behaviour change. `agentSession.restartResume` stays: it is a published wire
method even though nothing in the app calls it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit added since the prior pullfrog review (db148c2), which removes the reconnect vocabulary the single-action resume left behind and consolidates the offer's two network actions.

  • Notification helpers speak only continue — announceResumed, the action: 'reconnect' | 'continue' parameters, and the reconnectUnconfirmed / reconnectRefused catalog keys are gone; RestartActionOutcome now mirrors the host's StructuredAgentSessionContinuationOutcome exactly (continued | pending | unknown | refused). The call sites already passed continue, so this is vocabulary-only.
  • The two offer actions live once in the store — continueNativeChatRestartOffer and dismissNativeChatRestartOffer replace the duplicated call in the modal and the launch path. Both former copies had the same RPC, response shape and announce/settle order; the unified one keeps the dialog's defensive malformed-payload catch, so an unexpected shape is reported as an unconfirmed delivery rather than surfacing as an unhandled rejection on the launch path.
  • Dead catalog keys pruned — oneAgent, manyAgents, projects, reconnectAgent, resume, resumedOne/resumedMany and the reconnect variants are removed from en.json and en-runtime-required.json, all unreferenced from any call site.
  • Small cleanups — a notify() helper in native-chat-resume-on-restart-dialog.ts, and comment-only updates in the main-process resume host, RPC methods, and the shared continuation constant.

I traced the refactor against both former call sites and found no behavior change: RPC arguments ({ sessionIds } versus {}), the reported list used for toasts, and the settle input are identical. pnpm tc:web and verify:localization-runtime-catalog pass; the modal (17), status-segment (5), runtime-required catalog (23) and main restart-claim/ownership/holds (81) suites pass. All prior pullfrog threads are resolved.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…cting it

The modal's selection was intersected back against the host's candidate list
before every action, as a guard against naming a chat the host never offered.
That guard could never fire: the selection was already derived from that same
list, so the intersection was the identity. The array of chosen ids is now the
derived value and the lookup set falls out of it, which makes the property
structural rather than checked. The helper had no other caller and is gone,
along with its three tests.

Three tests mocked the resume response in the shape the old API returned. Two
never reached that branch at all; the third only passed because the unreadable
shape happened to exercise the malformed-payload path. All three now use the
real shape, and the malformed-payload behaviour — report an unconfirmed
delivery, leave the offer standing — gets a test that says so.

Also: the candidate reader took two trailing optional parameters, so one caller
passed a placeholder `false` to reach the second; they are an options object
now. `isFolderWorkspaceId` had no caller outside its own module and is no
longer exported. `RestartActionOutcome` only ever describes a continuation row,
so it is named for that. `dismissAll` set a busy flag that nothing could
render, since it closes the dialog first. Several comments repeated an argument
already made in the module they point at.

Settings: the automatic-resume description is one sentence again.

No behaviour change.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one copy suggestion inline.

Reviewed changes

This run re-reviewed the single commit landed since the prior pullfrog review (ec2dce4f24): ac2c65ca33 ("derive the resume selection instead of intersecting it"), a self-described no-behavior-change cleanup.

  • The dialog's selection is now structurally safe — chosen is the derived id array (offered minus exclusions) and selected falls out of it; the selectedResumeSessionIds intersection helper and its three tests are gone, because the selection was already derived from the host's list.
  • Candidate reader takes an options object — the trailing providerStopped / pendingContinuationId positional params became StructuredAgentSessionRestartCandidateOptions, removing the placeholder false at one call site.
  • Continuation rows are named for what they are — RestartActionOutcome → RestartContinuationOutcome.
  • Small cleanups — a dead busy flag removed from dismissAll (the dialog is already consumed) and isFolderWorkspaceId un-exported.
  • Tests use the real response shape — three mocks returned the pre-refactor { results: [] }; a new test pins the malformed-payload path (unconfirmed toast, offer left standing).
  • Settings copy shortened — the automatic-resume description is one sentence again.

I traced the refactor against the deleted helper and the former positional parameters: the intersection was the identity, and the options object is equivalent, so the "no behaviour change" claim holds. pnpm tc:web and verify:localization-runtime-catalog pass; the renderer modal/grouping/status suites (33) and the main-process restart-claim/ownership/holds suites (81) pass. All prior pullfrog threads remain resolved.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

)}
</Label>
<p className="text-xs text-muted-foreground">
{translate(
'auto.components.settings.ExperimentalPane.nativeChat.resumeCopy',
'When Orca quits or installs an update, chats that were mid-turn are offered again on the next launch. On, they are reconnected without asking and Orca tells you afterwards — the same thing as ticking "Don\'t ask again" in that prompt. Off, you choose from the list each time. Reconnecting restores a chat where it stopped; it does not continue the interrupted reply.'
'When Orca quits or installs an update, chats that were mid-turn are automatically resumed when Orca is reopened.'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now that the automatic path sends a continuation message, this is the only place a user who enables the setting from Settings — rather than ticking the dialog's box — learns what will happen, and the shortened sentence no longer says a message is sent. Consider keeping it a single sentence but retaining that disclosure, e.g. …automatically resumed when Orca reopens — each agent is asked to carry on, so a message is sent on your behalf.

Technical details
# Automatic-resume description drops the message-send disclosure

## Affected sites
- `src/renderer/src/components/settings/NativeChatExperimentalSetting.tsx:168` — the call-site default for `resumeCopy`.
- `src/renderer/src/i18n/locales/en.json:7129` — the rendered value; must stay in sync with the default above.

## Required outcome
- The settings copy states that enabling automatic resume sends a continuation message to each mid-turn agent at launch.

## Open questions for the human (optional)
- Is dropping the disclosure deliberate, on the view that the dialog body (or the post-hoc toast) already covers it?

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron validation (hidden window, CDP only)

Ran against this branch in an isolated profile. window.api.app.getIdentity() was Orca: brennanb2025/fix-modal-recheck-action, dev branch brennanb2025/fix-modal-recheck-action, repo root this worktree. The renderer helper used --user-data-dir=/tmp/orca-pr21397-profile.x3a0lH and --remote-debugging-port=9411.

The chats were real Claude sessions. Orca was quit through its normal restart path while a turn was still in progress, and the recovery file on disk held a quit marker for that session before the next launch.

Working reply, just before quit

Working chat before quit

Relaunch shows "Resume interrupted chats?" with Resume 1 chat. The row is the tides prompt. Close is the X. The status bar already reads "1 chat to resume" behind the dialog.

Resume prompt

After clicking Close (snooze, not Dismiss all). The dialog is gone and the status bar still reads "1 chat to resume". The chat itself is open and shows "Worked for 30s".

Status bar after snooze

A second quit, this time during sleep 90, produced the same prompt:

Sleep resume prompt

Status bar after snoozing the sleep prompt

Clicking that status-bar entry did not reopen the dialog. The entry disappeared. agentSession.restartResumable then returned no sessions. The restored chat tab was already on screen, which is the path that retires an offer.

After the status-bar click

Clicking Resume 1 chat on a later interrupt (a sleep 120 that was mid-turn at quit) closed the dialog and toasted "1 chat could not be continued. Open it to continue manually." The status bar still read "1 chat to resume" after that toast, while a fresh host list returned 0 sessions. No continuation message was sent.

Resume refused

Renderer console on these launches: 0 errors, 1 warning (React Grab outdated). The dev log also reported ws-transport failing to bind 127.0.0.1:6769 (EADDRINUSE) and falling back to an OS-assigned port.

Not exercised: a continuation the host accepts, "Don't ask again", Dismiss all, light theme, Windows, Linux, and SSH.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Fresh hidden-app check of the restart-recovery offer on this branch. Two Codex chats were mid-command when the app quit, and the next launch offered both.

  • The offer opens on launch, with both chats selected and the status bar already reading "2 chats to resume".
  • Closing the dialog only postpones it. The status-bar entry stays.
  • Opening the other chat to look at it leaves that entry at "2 chats to resume".
  • The status-bar entry reopens the same list.
  • Resume of the one selected chat asks that agent to continue, and the host's remaining list is what the status bar shows next: "1 chat to resume". The original prompt is not sent again.
  • Reopening then shows only the chat that was not resumed. Dismiss all removes the dialog, the status-bar entry, and the saved offer.

Offer opens

Closing postpones the offer

Opening a chat leaves the offer

Status bar reopens the offer

Resume updates the count from the host

Only the chat that was not resumed remains

Dismiss all clears the offer

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready to merge

The restart-recovery flow has been replaced with a durable, machine-local per-chat store.

  • Opening a chat is inspection only; it never consumes or recovers the offer.
  • Closing the dialog snoozes it without changing the saved records.
  • Resume rechecks the host at click time, continues only the selected eligible chats, and removes only the chats that actually resumed.
  • Dismiss all explicitly clears the saved records. A dismissal fence prevents a late teardown write from resurrecting them.
  • The dialog and status bar use the host’s authoritative remaining list, fail closed on malformed/unavailable reads, and retry transient startup races without polling.
  • The old whole-capsule take/claim coupling and recovery-on-ordinary-hold path are removed.

Validation on commit f991fe3872:

  • 158 targeted tests across durable storage, restart ownership/teardown/resume/restore, holds, modal, and status-bar behavior
  • pnpm tc:node
  • pnpm tc:web
  • changed-code quality gate: 0 findings
  • git diff --check
  • hidden Electron/CDP flow: open offer → close/snooze → inspect a chat → reopen → Resume 1 → verify 1 remains → Dismiss all; screenshots are attached in the Electron validation comment

No mobile, SSH, WSL, Windows, or remote-host surfaces are changed. The Electron run covered the manual flow; automatic-resume and non-macOS/remote-host validation remain outside this change’s exercised matrix.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The new durable capsule drops its dismissedAt fence whenever any newer teardown marker arrives, which reopens the door to a stale cross-owner write resurrecting a different chat the user explicitly dismissed. Details and a one-line fix inline.

Reviewed changes

This run re-reviewed the single substantive commit landed since the prior pullfrog review (7d114997bf merged main without touching the PR's files); f991fe3872 is the change, which reworks restart recovery from a launch-scoped take into durable per-session records.

  • Restart offers are now durable, per-session records — AgentSessionRecoveryCapsule was rewritten to a v2 file of { state, marker, replacement } entries with beginResume / completeResume / rollbackResume / clearAll replacing the take-and-delete workflow (take is gone; v1 files migrate on first mutation).
  • Listing is read-only, and opening a chat no longer retires an offer — list() never spends or rewrites records; recoveredByHold and StructuredAgentSessionHolds.onResumeCapableAcquisition are removed, and list/run derive with may-be-held so a chat the user inspected stays offered.
  • Renderer reconciliation replaces local settle — restartContinue / restartResumableDismiss now return the host's authoritative remaining sessions, the store publishes that list after every action, and the launch read retries transient failures three times before hiding the offer.
  • Teardown write-back is merge-based — record merges this teardown's confirmed witnesses into existing offers (fenced by dismissedAt) instead of replacing the file, so an offer no launch acted on survives a subsequent quit.
  • Tests moved to the durable model — the take-era structured-agent-session-restart-claim.test.ts suite was deleted; the ownership and capsule suites were expanded with real-file coverage (a chat stays offered after being opened, concurrent reads are non-destructive, corrupt storage is advisory, dismissal serializes behind publication).

ℹ️ The settlement-outcome unit tests were lost with claim.test.ts

Production still branches on the settled dispatch in continueStructuredAgentSessionAfterRestart (accepted → note, pending after a timed-out waiter, unknown, rejected dispatch), but the only direct tests for those branches were in the deleted claim.test.ts. The ownership suite keeps the important "accepted vs pending" regression pinned, so this is a coverage reduction rather than a gap in the primary path.

Technical details
# Settlement-outcome branch coverage removed

## Affected sites
- `src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts:157-186` — the branches: `awaitSettlement` undefined → `pending`, `unknown` dispatch → `unknown`, `rejected` → refused, `accepted` → note.
- `src/main/native-chat/agent-session-wire/structured-agent-session-restart-ownership.test.ts:96-134` — the surviving integration coverage (continued + note, and note failure).
- Deleted: `src/main/native-chat/agent-session-wire/structured-agent-session-restart-claim.test.ts` — previously covered `pending` after settlement timeout, `unknown`, rejected dispatch, and send refusal.

## Required outcome
- Keep direct coverage for the untested settlement branches, or state that the ownership-level tests are considered sufficient.

## Open questions for the human (optional)
- Is the loss of the fine-grained settlement tests intentional (they mocked the surface heavily), or an oversight from replacing the take-based harness?

ℹ️ The PR description still describes the take-based design

The description's "Review" and "Suggested follow-up" sections predate this commit: recovery notes are no longer "read and then deleted at startup", "Opening one of those chats yourself retires its offer" is now the opposite of the behavior, and the suggested follow-up ("store each recovery note against its own chat record rather than in a single file that is deleted on read") is exactly what this commit implements. A reviewer reading the description will form the wrong model of the shipped behavior.

Technical details
# PR body is stale against head f991fe38

## Affected sites
- PR description, "## Review" and "**Suggested follow-up:**" sections.

## Required outcome
- The description reflects the durable per-session capsule and that opening a chat no longer retires its offer.

## Open questions for the human (optional)
- Is the single-file capsule now considered permanent, so the crash-survival follow-up should be dropped or re-scoped?

ℹ️ Nitpicks

  • src/main/runtime/agent-session-recovery-capsule.ts:176 — the in-progress guard's || marker.teardownId !== current.teardownId disjunct is dead: with equal recordedAt, shouldReplaceMarker returns teardownId === current.teardownId, so the second disjunct can never be the deciding one. Dropping it would make the intent (only a strictly newer, or same-teardown, witness replaces an in-progress record) explicit.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Follow-up review update

The latest review identified one real edge case: a newer interruption could clear the dismissal timestamp, allowing an older delayed shutdown write to bring back a chat the user had already dismissed.

That is fixed in c139b377ca:

  • The dismissal fence now stays in place after newer interruptions.
  • Newer interruptions are still accepted.
  • Older delayed writes remain blocked.
  • Direct tests now cover accepted, pending, unknown, rejected, refused, and unattached continuation outcomes that were previously only covered by the removed legacy suite.

Final readiness on this commit is clean:

  • 155 focused tests passed
  • Node and web typechecks passed
  • Changed-code quality passed with 0 findings
  • Diff checks passed
  • No functional, architectural, performance, compatibility, or data-loss issues found

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one coverage suggestion inline.

Reviewed changes

This run re-reviewed the single commit added since the prior pullfrog review (f991fe3872): c139b377ca ("preserve dismissal fence across new interruptions").

  • record keeps the global dismissedAt fence unconditionally — the reopensDismissal branch that dropped the fence whenever any incoming marker was newer is gone; genuinely newer interruptions still pass the per-marker recordedAt <= dismissedAt skip, so a stale cross-owner write can no longer resurrect a previously dismissed chat.
  • Settlement-outcome unit coverage is restored — the new structured-agent-session-restart-continuation.test.ts pins accepted (note written), pending / unknown / rejected (preserved, no note), send refusal (no settlement wait) and unattached (no send), replacing the branches the deleted claim.test.ts held.
  • A fence regression assertion was added to the capsule suite's late-teardown test (see inline note on its discriminating power).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

expect(await capsule.list(NOW + 2)).toEqual([newer])

// A new interruption must not remove the fence before the old callback has finished.
await capsule.record([marker()], NOW + 2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new fence assertion uses the same SESSION as newer, so shouldReplaceMarker already blocks the late marker and the test passes whether or not the fence is kept — I confirmed it still passes with the old reopensDismissal logic restored. Using a different session id, which is the stale cross-owner write this fence actually guards against, makes it fail on the old code and pass on the fixed code.

Suggested change
await capsule.record([marker()], NOW + 2)
await capsule.record([marker({ sessionId: 'second' })], NOW + 2)

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final validation on c139b37:

  • Fresh Electron run used the structured Codex chat path with two real mid-turn chats.
  • After quit and relaunch, the modal showed exactly one remaining chat.
  • Closing the modal and opening the chat did not consume the offer; the status bar still showed 1 chat available to resume.
  • Resume 1 chat resumed it and cleared that entry from the durable recovery file.
  • A second quit/relaunch followed by Dismiss all removed the offer; the durable file ended as an empty v2 capsule with a dismissal fence.
  • Fresh visual proof: recovery-modal-one-chat.png

Backing checks: 164 focused tests pass, node/web typechecks pass, changed-code quality is clean, and the worktree is clean. Mobile, Windows/WSL, and SSH QA are not applicable to this local desktop-only change.

@brennanb2025
brennanb2025 merged commit 15472cd into main Sep 21, 2026
32 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