Skip to content

fix(native-chat): keep chats that failed to resume in the status bar and say what to do - #22448

Merged
brennanb2025 merged 21 commits into
mainfrom
brennanb2025/fix-chat-resume-toast
Sep 24, 2026
Merged

brennanb2025 merged 21 commits into
mainfrom
brennanb2025/fix-chat-resume-toast

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1219 $\color{#cf222e}{\Huge{\mathbf{−}}}$​122 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1097
Prod 26 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2174 $\color{#cf222e}{\Huge{\mathbf{−}}}$​437 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1737

ELI5

After Orca restarts it offers to resume the chats that were mid-turn. When one of those resumes did not work, the only sign was a four-second toast saying "1 chat could not be continued", with no name, and then the status bar entry vanished too. Now the failed chat stays named in the status bar and the resume dialog with one clear next step, the chat itself says what happened, and the entry clears on its own once the user replies in that chat.

What Changed

Before

  • Toast: "1 chat could not be continued. Open it to continue manually." Gone in ~4 s, no chat named.
  • The status bar entry disappeared, because reattaching the chat spends the offer even when the follow-up "please continue" message is refused.
  • Nothing durable pointed at the chat afterwards, and the chat itself said nothing.

After

  • The status bar keeps an entry for chats that did not carry on: "N chats failed to resume" (yellow alert), or "N chats to check" when Orca could not confirm the continue message was delivered. It stays until the user acts, and it clears by itself as soon as the user replies in that chat.
  • The resume dialog is otherwise unchanged (title, body, "Don't ask again", Dismiss all / Resume). A failed chat is listed as a row with a status icon (tooltip: status and the host's reason code), a ✕ to dismiss that one chat, and a "To resume" line with one action: Open chat, Retry, or Dismiss. Its checkbox is enabled and pre-ticked only when a retry can actually run; otherwise it is disabled, so Resume never re-runs something that would only fail again.
  • The chat gets a status row explaining what happened: red when Orca could not continue it, amber when delivery could not be confirmed, and a neutral "couldn't reconnect" note when another window or process owned the chat.
  • The toast is count-only and splits "N chats couldn't be resumed" from "Couldn't confirm N chats were resumed", with Show and Dismiss.
  • A chat that simply finished on its own before the resume ran is not reported as a failure.

Mechanism

  • When an action finishes, each chat it reserved is either removed from the recovery file (agent-session-recovery.json, the agent carried on) or filed in a new optional top-level failed list with the outcome (refused / unconfirmed), the reason code, the prompt the offer quoted, and the chat's newest user message at the moment that chat's own attempt ended.
  • Whether a failure is still current is derived every time it is listed, from the chat's live journal: it is current only while the chat's newest user message is still the one recorded. The user's own reply, from any client, therefore retires it with no hook on the send path. Whether a failure can be retried is derived the same way, with the check a retry itself uses. Other ways a record dies: dismiss, a successful retry, a newer teardown of the same chat, and the existing 24 h expiry.
  • The status row in the chat is written through the existing restart-continuation note path.
  • The renderer's offer store watches the host's session status feed only while it holds failures, and re-reads the offer (debounced, never during an in-flight action) when a failed chat's status changes. That is what clears the status bar after a reply.
  • agentSession.restartResumable / restartContinue return a new optional failed list (with an optional retryable per row); agentSession.restartResumableDismiss accepts optional sessionIds. All additive.
  • Three main-process files were over the 300-line cap after the change, so the capsule's entry format, the failure ledger, and the teardown witnesses moved into their own modules (pure moves). New tokens status-warning* in main.css mirror the status-success family.

Why

The failure was invisible because the outcome of the action was never stored anywhere: the reattach consumed the offer, the refusal lived only in a transient toast counter, and the chat recorded nothing. The common way to handle this is to record the failure on the chat itself so it clears naturally when the user's next turn starts; this PR does that (the in-chat note, and currency derived from the chat's own newest user message).

Deviation, stated plainly: Orca also keeps a small host-side index of failed chats in the recovery file, because nothing else can answer "which of my chats failed?" across another restart without reading every chat's journal. That index is deliberately not a second source of truth: whether each entry is current or retryable is re-derived from the chat on every read, and stale entries are pruned.

Alternatives considered:

  • Keep the failure in renderer memory only. Rejected: the trigger here was an update install, and a second restart shortly after is common, so the pointer would vanish exactly when it matters.
  • Clear the record from a hook on the user's send, with an in-memory list of failed chats. Rejected after review: it was empty after a host restart until something listed failures, and it cleared the record even when the send was then refused.
  • Store the failure as a third entry state in the recovery file. Rejected: an older Orca build rejects unknown entry states, which would silently lose every restart offer after a downgrade. A top-level key is ignored by older builds instead.
  • Merge failures into the pending count. Rejected: the offer and the outcome of acting on it are different facts with different actions.

While investigating the report I found the cause of the refusal in that case: on reattach, Claude Code replayed a queued background-task notification into the conversation, Orca journaled it as a new user turn, and the continuation was refused as agent_session_restart_work_superseded. That guard treating a provider-injected item as newer user work is a separate bug and is not fixed here; this PR makes such a failure visible and actionable.

Linked Issue

No issue was filed; reported directly by @BrennanKB5 after the 1.4.209 update restart.

Fixes #

Visual Proof

Before: a four-second toast reading "1 chat could not be continued. Open it to continue manually." and nothing in the status bar afterwards (the offer was spent by the reattach, so the "chats to resume" entry unmounted). Not captured live; the string and the vanishing entry are the code path this PR replaces.

After (hidden dev instance at f5040c2f6d — later commits change only main-process parsing — on a throwaway profile, two real Claude chats that each completed a prompt, then one refused (agent_session_restart_work_superseded) and one unconfirmed failure recorded against them):

Status bar with one refused and one unconfirmed failure:
r1-statusbar

Clicking it opens the resume dialog. Both rows name the chat and give one next step; neither can be retried here, so their checkboxes are disabled:
r2-dialog

✕ on the unconfirmed row leaves only the refused chat, and the status bar reads "1 chat failed to resume":
r3-one-left

Open chat, then reply in it. Before the reply:
r4-before

After the reply is accepted, the status bar entry is gone with no click, and the host lists no failures:
r4-after

Testing

Exercised on macOS in hidden Electron dev instances (ORCA_BACKGROUND_LAUNCH=1, own profile and CDP port), driven through the real surfaces:

  1. Status bar label for a refused + unconfirmed pair ("2 chats to check") and for a refused chat alone ("1 chat failed to resume").
  2. Dialog rows: guidance, tooltip with reason code, disabled checkbox for rows the host reports as not retryable, footer count.
  3. Per-row ✕ removes only that record (RPC confirms). Open chat closes the dialog and keeps the record.
  4. A real reply in the failed chat is accepted and clears the status bar and the host's failed list within seconds, without clicking anything.
  5. Dismiss all clears everything; a relaunch then shows no dialog and no entry.

Not exercised live: a real mid-turn restart followed by a refused continuation (the in-chat note and filing for that path are covered by host tests), and Retry against a real ownership conflict. SSH hosts: the restart-resume RPCs are local-only today, unchanged by this PR. Linux and Windows: no platform-specific code; not run.

Automated (each central mechanism was also checked by removing it and confirming the named test fails):

  • agent-session-recovery-capsule.test.ts: filing, retry-by-name only, a retried failure survives rollback and lease expiry, newer teardown supersedes a failure, dismiss by name, TTL expiry, and a file written by this build parsed with the older build's schema.
  • structured-agent-session-restart-failure-filing.test.ts / -ownership.test.ts / -continuation.test.ts: the reported superseded case is filed, listed, and noted in the chat; a chat that finished on its own is not filed; a reply before or after the chat's own attempt retires its failure; unconfirmed failures retire once the continuation's turn opens, and not when it was never journaled; reattach and ownership refusals get the neutral note.
  • native-chat-resume-failed-chat-watch.test.ts: the store re-reads when a failed chat moves on, coalesces, skips during an in-flight action, and never lets a slow read bring back a dismissed failure.
  • NativeChatResumeOnRestartModal.test.tsx, NativeChatResumeStatusSegment.test.tsx, native-chat-restart-action-notifications.test.ts, native-chat-resume-failure-guidance.test.ts: dialog rows and selection, status-bar labels, toast counts and actions, reason → action table.
  • tests/e2e/cross-version-wire: the stub host gains the failure listing the restart RPC now reaches.

pnpm tc, oxlint on every changed file, and the surrounding test directories pass locally; CI is green.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Downgrade: an older build ignores the new top-level failed key, so its restart offers keep working; it drops the failure records the next time it rewrites the file.
  • Forward compatibility: failure records are parsed one by one, and a record this build cannot read (for example a newer outcome) is skipped rather than rejecting the whole file, so restart offers keep working in that direction too.
  • Wire: new response fields and the dismiss sessionIds request field are optional. The client names sessions only for rows a host listed as failed, which an older host never does. Mobile does not call these methods.
  • Performance: nothing on the send path. Listing reads the recovery file once more and, per failure (few, 24 h bounded), the chat's journal the way offer listing already does. The status-feed watch exists only while failures do.
  • Known small edges: an "unconfirmed" entry can stay until the chat's status next changes even while its continued turn is visibly running; a reply that neither starts a turn nor changes the prompt text clears on the next status change instead of immediately.
  • Size: the change grew during review (the chat note, derived currency, and the feed-driven refresh); it remains scoped to making a failed restart resume visible and actionable.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…and say what to do

After a restart, a chat whose resume did not carry on was reported only by a
four-second toast that named nothing, and the status bar entry vanished because
the reattach had already spent the offer.

The host now files the outcome as a durable `failed` entry in the recovery
capsule, with the refusal code and the prompt the offer quoted, and returns it
from the restart-resume RPCs. The renderer shows a "N chats failed to resume"
status bar entry, a count-only toast with Show and Dismiss, and keeps the resume
dialog open with a status icon per row and a "To resume" line whose action is
chosen from the reason. A failure dies on dismiss, on a successful retry, on the
user's own send in that chat, or with the marker's 24h expiry.

@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

One user-visible defect in the new failure dialog: after the per-row Retry succeeds (or the last failure is dismissed while a just-resumed row is still shown), the dialog stays open and its title reads "0 chats couldn't be resumed" next to a green "Resumed and asked to continue" row, with only a disabled "Dismiss failed" button as its control. Details inline. There is also one minor wire-compatibility note inline.

Reviewed changes

  • Durable failure record. The recovery capsule gains a third entry state failed (outcome/reason/prompt snapshot) with listFailed/failResume/dismiss(sessionIds); file parsing and normalization move to agent-session-recovery-capsule-entries.ts. Failures die via dismiss, a successful retry, the user's own send, or the marker TTL; a newer teardown replaces them with a fresh offer.
  • Host wiring. New structured-agent-session-restart-failure-ledger.ts decides filing and eviction. settle files refused/unconfirmed outcomes before rollbackResume, so a failure is never reopened as an offer. restartContinuationDeps is extracted from the resume host; the host's send releases a recorded failure on the user's own message, skipping the continuation caller. Teardown witnesses move to their own module.
  • Wire (additive). restartContinue/restartResumable return optional failed; restartResumableDismiss accepts optional sessionIds via a widened RestartResumableParams.
  • Renderer. The store carries host-owned failed plus window-local settled; a new NativeChatResumeOutcomeRow and native-chat-resume-failure-guidance.ts map each reason to one sentence and its action; the modal stays open on partial failure; the status bar adds a separate yellow failure entry; the toast becomes count-only with Show/Dismiss; new status-warning* tokens replace raw palette colours.
  • Tests. Capsule, restart-ownership, modal, status-segment, and guidance suites are extended.

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

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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 recovery capsule now stores refused and unconfirmed restart-resume failures. Host and RPC interfaces list these records and support named dismissal and retry. The renderer shows failures separately from pending chats, provides outcome-specific guidance, and supports opening, retrying, or dismissing failed chats. Continuation attempts also add refused or unconfirmed status notes to the chat journal.

Merge Risk: 🟡 Moderate · up to 75170

An unusually long message ID can make recovery records unavailable. Resolve that persistence mismatch before merging unless the risk is explicitly accepted; the dismissal test and older-host retry guidance also need correction.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 57 functions across 30 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 and concisely describes the main change: failed native-chat resumptions remain visible and provide user guidance.
Description check ✅ Passed The description is detailed, on-topic, and covers the user impact, implementation, rationale, testing, compatibility, and visual behavior. The linked issue requirement is not satisfied because it stat…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • 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: 5

🧹 Nitpick comments (1)
src/renderer/src/assets/main.css (1)

191-195: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use status-warning for the skill-update failure icon.

SkillUpdateStatusSegment still uses text-yellow-500 for its failed state. Use the shared, theme-specific token for this same status tone.

Suggested fix
-      icon: <AlertCircle className="size-3 text-yellow-500" />,
+      icon: <AlertCircle className="size-3 text-status-warning" />,

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 65e421e9-c6fe-4dcf-91ee-20aa1d9c21fb

📥 Commits

Reviewing files that changed from the base of the PR and between a2a78ab and 5aba432.

📒 Files selected for processing (27)
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.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/native-chat/agent-session-wire/structured-agent-session-restart-resume-set.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-witnesses.ts
  • src/main/runtime/agent-session-recovery-capsule-entries.ts
  • src/main/runtime/agent-session-recovery-capsule.test.ts
  • src/main/runtime/agent-session-recovery-capsule.ts
  • src/main/runtime/rpc/methods/structured-agent-session-restart-resume.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/NativeChatResumeOnRestartGroups.tsx
  • src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
  • src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
  • src/renderer/src/components/NativeChatResumeOutcomeRow.tsx
  • src/renderer/src/components/native-chat-restart-action-notifications.ts
  • src/renderer/src/components/native-chat-resume-failure-guidance.test.ts
  • src/renderer/src/components/native-chat-resume-failure-guidance.ts
  • src/renderer/src/components/native-chat-resume-on-restart-grouping.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/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/shared/agent-session-resume-marker.ts
  • src/shared/rpc-contract/structured-agent-session-params.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/i18n/en-runtime-required.json

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

Comment on lines +284 to +288
send = (...args: Parameters<StructuredConversationCommandController['send']>) => {
// The user's own message is the manual continuation a failed restart resume asked for.
this.restartResume.releaseFailureOnUserSend(...args)
return this.conversationCommands.send(...args)
}

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

Release the failure record only after the user's send is accepted.

releaseFailureOnUserSend runs before conversationCommands.send, whatever the result. StructuredConversationCommandController.send can return { ok: false }, for example agent_session_operation_invalid while a conversation command is pending. Fence and payload refusals are also possible. In each of these cases, the durable failure is already dismissed while the chat was never continued. The status bar entry and the dialog row then disappear, and nothing still names the chat. The ledger documents this record as released by "the manual continuation", not by an attempt.

Release the record after the send resolves with ok: true. The release stays fire-and-forget, so the send is not delayed.

🐛 Proposed fix
   send = (...args: Parameters<StructuredConversationCommandController['send']>) => {
-    // The user's own message is the manual continuation a failed restart resume asked for.
-    this.restartResume.releaseFailureOnUserSend(...args)
-    return this.conversationCommands.send(...args)
+    // The user's own ACCEPTED message is the manual continuation a failed restart resume asked for;
+    // a refused send continued nothing and must not erase the record.
+    return this.conversationCommands.send(...args).then((result) => {
+      if (result.ok) {
+        this.restartResume.releaseFailureOnUserSend(...args)
+      }
+      return result
+    })
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
send = (...args: Parameters<StructuredConversationCommandController['send']>) => {
// The user's own message is the manual continuation a failed restart resume asked for.
this.restartResume.releaseFailureOnUserSend(...args)
return this.conversationCommands.send(...args)
}
send = (...args: Parameters<StructuredConversationCommandController['send']>) => {
// The user's own ACCEPTED message is the manual continuation a failed restart resume asked for;
// a refused send continued nothing and must not erase the record.
return this.conversationCommands.send(...args).then((result) => {
if (result.ok) {
this.restartResume.releaseFailureOnUserSend(...args)
}
return result
})
}

Comment on lines +207 to +214
const before = await readFile(filePath)

expect(await capsule.dismiss([SESSION, 'second', 'missing'], NOW)).toBe(2)
expect(await capsule.list(NOW)).toEqual([marker({ sessionId: 'third' })])
expect(await capsule.listFailed(NOW)).toEqual([])
// Nothing named, nothing rewritten.
expect(await capsule.dismiss(['missing'], NOW)).toBe(0)
expect(await readFile(filePath)).not.toEqual(before)

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

Fix the "nothing rewritten" assertion so it tests the no-op dismiss.

before is read before the first dismiss([SESSION, 'second', 'missing']). The assertion on Line 214 therefore only proves that the first dismiss rewrote the file. It does not show that dismiss(['missing']) left the file unchanged, which is what the comment on Line 212 claims. Read the bytes after the first dismiss and assert equality after the second.

💚 Proposed fix
-    const before = await readFile(filePath)
-
     expect(await capsule.dismiss([SESSION, 'second', 'missing'], NOW)).toBe(2)
     expect(await capsule.list(NOW)).toEqual([marker({ sessionId: 'third' })])
     expect(await capsule.listFailed(NOW)).toEqual([])
     // Nothing named, nothing rewritten.
+    const before = await readFile(filePath)
     expect(await capsule.dismiss(['missing'], NOW)).toBe(0)
-    expect(await readFile(filePath)).not.toEqual(before)
+    expect(await readFile(filePath)).toEqual(before)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const before = await readFile(filePath)
expect(await capsule.dismiss([SESSION, 'second', 'missing'], NOW)).toBe(2)
expect(await capsule.list(NOW)).toEqual([marker({ sessionId: 'third' })])
expect(await capsule.listFailed(NOW)).toEqual([])
// Nothing named, nothing rewritten.
expect(await capsule.dismiss(['missing'], NOW)).toBe(0)
expect(await readFile(filePath)).not.toEqual(before)
expect(await capsule.dismiss([SESSION, 'second', 'missing'], NOW)).toBe(2)
expect(await capsule.list(NOW)).toEqual([marker({ sessionId: 'third' })])
expect(await capsule.listFailed(NOW)).toEqual([])
// Nothing named, nothing rewritten.
const before = await readFile(filePath)
expect(await capsule.dismiss(['missing'], NOW)).toBe(0)
expect(await readFile(filePath)).toEqual(before)

Comment thread src/renderer/src/i18n/locales/en.json Resolved
Comment thread src/renderer/src/i18n/locales/en.json Outdated
"notContinuedOne": "1 chat couldn’t be resumed",
"notContinuedMany": "{{value0}} chats couldn’t be resumed",
"failedBody": "Resumed chats were asked to check their last action before carrying on. A chat that couldn’t be resumed stays here and in the status bar until you open, retry, or dismiss it.",
"outcomeListLabel": "How each chat was resumed",

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

Use a label that includes failed outcomes.

The dialog lists chats that could not be resumed, so “How each chat was resumed” can imply that every listed chat resumed successfully. Use a neutral label, such as “Resume outcomes.”

The PR objective says the dialog shows each chat’s outcome, including failed chats.

…ts as rows

The failure view had replaced the resume dialog's title, checkboxes, preference
box, and footer. The dialog is back to main's layout. A chat an earlier resume
could not carry on is now an ordinary selectable row there, plus a status icon
whose tooltip carries the reason, a dismiss control, and a "To resume" line.
Selecting it and pressing Resume retries it; it is pre-selected only when a
retry can succeed. Resumed chats leave the list as before.

Also stubs the new failure listing on the cross-version wire host fixture, which
the restart-resume RPC now reaches.

@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 label suggestion inline.

Reviewed changes

Reviewed a039073 (the delta since the prior pullfrog review at 5aba432). The main-process work (capsule failed state, failure ledger, host wiring, additive wire fields) is unchanged by this commit and was covered in the prior review.

  • Merged failed resumes into the dialog's ordinary row list: a failed chat is now the same selectable row plus a status icon/tooltip, a ✕, and a "To resume" guidance line, instead of a separate outcome list. NativeChatResumeOutcomeRow.tsx is deleted and its pieces live in NativeChatResumeFailureDetails.tsx.
  • Kept the dialog chrome generic — title, body, and the Dismiss all / Resume footer no longer branch on whether failures exist, which removes the prior review's stale "0 chats couldn't be resumed" header.
  • Replaced the window-local settled list and the excluded selection set with per-row overrides (default from the row's reason), and dropped the generic row renderer from NativeChatResumeOnRestartGroups.
  • Removed the now-unused failedBody, outcomeListLabel, dismissFailed, continueRefused, and continued strings, and added stub-host failure members to tests/e2e/cross-version-wire.

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

Comment on lines +88 to +94
rows
.filter(
(row) =>
overrides.get(row.sessionId) ?? selectedByDefault(failureBySession.get(row.sessionId))
)
.map((row) => row.sessionId),
[rows, overrides, failureBySession]

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.

When the only failures are not retryable — the agent_session_restart_work_superseded case this PR is about — chosen is empty, so the footer renders a disabled Resume 0 chats next to the per-row Open chat action. That zero-count label reads oddly as the dialog's primary control. Optional: when chosen.length === 0, use a neutral label (or hide the primary button) instead of naming zero chats; the count suffix only earns its place once something is ticked.

Technical details
# Disabled footer names a zero count

## Affected sites
- `src/renderer/src/components/NativeChatResumeOnRestartModal.tsx:252-270` — the footer button renders `chosen.length === 1 ? 'Resume 1 chat' : 'Resume {{value0}} chats'`, i.e. "Resume 0 chats" when nothing is selected.
- `src/renderer/src/components/NativeChatResumeOnRestartModal.tsx:86-95` — `chosen` is empty whenever every failure's `selectedByDefault` is false (e.g. `agent_session_restart_work_superseded`).
- `src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx:508` — pins the exact `'Resume 0 chats'` string, so a label change updates that expectation.

## Required outcome
Treat the empty selection as a distinct state so the primary control does not advertise resuming zero chats; the per-row actions already carry the real affordances. Mergeable as-is if the current wording is intended.

… admitted

Keeps the host file at main's size, and only releases the record for a send the
controller actually lets through.

@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 coverage note inline.

Reviewed changes

Reviewed 5df6d36, the delta since the prior pullfrog review at a039073. The commit is a small refactor of where a recorded resume failure is released.

  • Moved releaseFailureOnUserSend off the host's send wrapper and into StructuredConversationCommandController.admitSend, so a send the per-session pending gate refuses no longer clears a recorded failure.
  • Widened the controller's host Pick with restartResume; the host's send is a thin delegate again, keeping that file at its existing size.

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

brennanb2025 and others added 2 commits September 23, 2026 13:19
… when it is settled

The chat itself now says when Orca could not continue it after a restart,
with an error (refused) or warning (unconfirmed) status row, so the failure
survives the toast, a dismissed record, and another restart.

A recorded failure is current only while the chat's newest user message is
the one it had when the failure was filed. Listing re-derives that from the
journal and prunes superseded records, replacing the in-memory set and the
hook on every send.

Failures move to their own optional top-level key in the recovery file, so an
older build that rejects unknown entry states keeps reading its offers. A
retried failure stays a failure through a rollback or a lapsed lease instead
of returning as a pending offer, and the toast's Dismiss names only the chats
the host listed as failed.

Co-Authored-By: Claude <[email protected]>

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 80717059-c070-41fa-8ef7-bb3d75c0c08e

📥 Commits

Reviewing files that changed from the base of the PR and between a039073 and 5d0d433.

📒 Files selected for processing (16)
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-candidates.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.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-entries.ts
  • src/main/runtime/agent-session-recovery-capsule.test.ts
  • src/main/runtime/agent-session-recovery-capsule.ts
  • src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
  • src/renderer/src/components/native-chat-restart-action-notifications.ts
  • src/renderer/src/components/native-chat-resume-on-restart-store.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/agent-session-restart-continuation.ts
  • src/shared/rpc-contract/structured-agent-session-params.ts
  • tests/e2e/cross-version-wire/structured-agent-session-host-fixture.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/locales/en.json

Included review availability: Your plan provides up to 10 included reviews per hour; 5 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 critical issues — a careful rework of where the durable failure record comes from and when it leaves. One edge case inline, one rollout observation, one nitpick.

Reviewed changes

Reviewed 2afadce and 5d0d433, the delta since the prior pullfrog review at 5df6d36.

  • Moved failures out of the entry list. A failed resume is now a top-level optional failed array in the recovery capsule instead of a third entry state, so an older build's two-state entry parser still reads every offer; parseState/normalizeState now split offers from failures.
  • Derived settlement. Removed releaseOnUserSend and the admitSend placement entirely: a failure is current only while the chat's live newest root user message is the one it had when filed, and superseded records are pruned from the file. latestUserItemId joins the failure record, and settle() reads it after the action so a journaled continuation message does not retire its own failure.
  • Chat-authored notes. A refused or unconfirmed continuation appends a host status note (tone: 'error' | 'warning') to the chat itself.
  • Toast Dismiss narrowed. announceNotContinued forwards only ids the host listed as failed, closing the prior review's compatibility gap.
  • Tests. Added continuous-settlement-notes, no-send-hook retirement, named-retry-success, and older-reader compatibility cases.

ℹ️ A downgrade write silently discards the new failure records

The capsule comment reasons only about how an older build reads an unknown key, and the new format is a clear win there — a two-state entry parser no longer loses every offer. But the older build also writes: every capsule mutation republishes the file through the base publish, which serialized only { version, entries, dismissedAt }. Since teardown record() runs on every quit, a downgrade + quit + re-upgrade permanently drops the failed array (offers are untouched). This looks like accepted degradation rather than a bug, but it is not covered by the compatibility test, which exercises only the old reader.

Technical details
# Older-build writes clobber the top-level `failed` key

## Affected sites
- `src/main/runtime/agent-session-recovery-capsule-entries.ts:35-36` — design comment covers older reads, not older writes.
- `src/main/runtime/agent-session-recovery-capsule.ts` `publish()` — this build serializes `failed`; the base build's `publish` did not.
- `src/main/runtime/agent-session-recovery-capsule.test.ts:256-284` — asserts offers survive an old read only.

## Required outcome
- Decide whether losing failure records on a downgrade is acceptable (advisory data, re-filed only on a new failure) or not. If not, failures need a home an older build never rewrites.

## Open questions for the human
- A sibling file (`agent-session-recovery-failures.json`) would survive an older build's mutations, at the cost of cross-file ordering with the offers it settles. Is the current same-file shape a deliberate trade for the "newer teardown supersedes" normalization?

ℹ️ Nitpicks

  • src/main/runtime/agent-session-recovery-capsule.ts:183 — failResume slices reason and latestPrompt to MAX_FAILURE_FIELD_LENGTH but stores latestUserItemId unsliced, while failureSchema caps that field at 512 on read. Bound it where the id is produced (or slice here) so a long provider item id cannot make the whole capsule unparseable.

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

}
const latest = liveStructuredAgentSessionLatestUserItemId(deps.sessions, sessionId)
// An unreadable journal decides nothing; the record stays until something that can decide.
if (latest !== undefined && latest !== failure.latestUserItemId) {

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.

list() treats a live session with no root user item as a decisive different answer, but a session can be present in the map with an empty journal: reveal deliberately restores a pre-SQLite-format chat into a fresh, empty journal (structured-agent-session-read-restore.ts:44-61). In that state latest is null and the record is pruned with no user send — contradicting the comment on the line above. A journal that cannot yield a user item should decide nothing.

Technical details
# `null` (present, no user item) is treated as decisive, so an empty revealed journal prunes the failure

## Affected sites
- `src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.ts:138-144` — `latest === null` supersedes when `failure.latestUserItemId` is a non-null string.
- `src/main/native-chat/agent-session-wire/structured-agent-session-restart-candidates.ts:47-55` — `undefined` only for an absent session; a present session with no root user item yields `null`.
- `src/main/native-chat/agent-session-wire/structured-agent-session-read-restore.ts:44-61` — a legacy remnant opens a fresh, empty journal and the session becomes present via `onReadable`.

## Required outcome
- A session that is present but cannot produce a root user item must not prune a record whose stored id was non-null; only a genuinely newer user item should.

## Suggested approach (optional)
- Treat `latest === null` as undecidable when `failure.latestUserItemId !== null`, e.g. gate on `latest !== undefined && latest !== null && latest !== failure.latestUserItemId` (a real user action only ever adds items, so a non-null stored id can never legitimately become `null`), or thread the reveal's readability/empty-journal signal into the ledger.

brennanb2025 and others added 3 commits September 23, 2026 14:03
…s attempt ended

A failure was filed against the chat's newest user message read at settlement, after every chat in
the action had finished. The chat's note asks the user to send a message, and one sent while other
chats were still being continued became part of the filed state, so the failure stayed listed after
the user had done what it asked. Each chat's newest message is now observed as its own attempt ends.

Co-Authored-By: Claude <[email protected]>
…failure

When a restart resume reached a chat the user had already replied in, the
attempt was refused as no longer eligible, but the failure was filed against
that very reply. It then stayed listed as "finished on its own" until the user
sent yet another message. An ineligible chat is no longer observed at the
attempt, so its failure falls back to the reserved marker and the reply that
made it ineligible supersedes it at the next listing.

Co-Authored-By: Claude <[email protected]>
…uld run

When the agent refused Orca's "continue" message with its own reason, the
failed row fell to the generic guidance, which offers Retry and pre-selects
the chat in the resume dialog. The refused message is already the chat's
newest user message, so a retry is never eligible: it did nothing and the
same "couldn't be resumed" toast came back.

The host now reports whether a retry would run, derived at list time from
the same predicate the retry applies to the failure's marker. Where it would
not, the row offers Open chat and Dismiss and is not pre-selected. An older
host omits the flag and the reason alone decides, as before.

Co-Authored-By: Claude <[email protected]>

@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: 2

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 named witness after dismissal. · structured-agent-session-restart-resume-host.ts:323

src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts:323
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clear the named witness after dismissal.

Named dismissal removes the durable record but does not clear the confirmed in-memory witness. A later recordMarkers() can write that witness again. Add a session-scoped witness-clear operation and call it after named dismissal succeeds. Keep the existing all-session clear for unnamed dismissal.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: fba04789-f47d-4636-80f2-f184407daddb

📥 Commits

Reviewing files that changed from the base of the PR and between 5d0d433 and 5c31f06.

📒 Files selected for processing (3)
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.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

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

Comment on lines 218 to 223
await afterAcquire?.(marker)
}
} finally {
attempts.observe(sessionId)
surfaces.release(sessionId, holder)
}

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '200,290p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts
sed -n '85,150p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-runner.ts
sed -n '135,235p' src/main/native-chat/agent-session-wire/structured-agent-session-turns.ts

Repository: stablyai/orca

Length of output: 7938


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- relevant declarations/usages ---'
rg -n --glob '*.ts' 'admission\.run|create.*Admission|attempts\.observe|function.*observe|class.*Admission|surfaces\.(hold|release|send)|continueStructuredAgentSessionAfterRestart|failureAfterResume|latestUserItemId|forgetFailures|setFailure|settle\(' src/main/native-chat/agent-session-wire
printf '%s\n' '--- host surrounding definitions ---'
sed -n '1,245p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-host.ts
printf '%s\n' '--- ledger relevant definitions ---'
sed -n '120,265p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.ts
printf '%s\n' '--- continuation and admission-related definitions ---'
sed -n '1,115p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
rg -n --glob '*.ts' 'type .*Admission|interface .*Admission|run:\s*.*owner|create.*admission|admission =|acquire.*session|resume.*owner|AgentSessionPreDispatchError' src/main/native-chat src | head -120

Repository: stablyai/orca

Length of output: 42171


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- resume admission and attempt types ---'
sed -n '1,145p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-runner.ts
sed -n '1,125p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.ts
printf '%s\n' '--- continuation implementation ---'
sed -n '165,245p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
printf '%s\n' '--- hold/send bindings in native chat ---'
rg -n --glob '*.ts' 'hold:\s*(async\s*)?\(|hold\s*=\s*|release:\s*(async\s*)?\(|send:\s*(async\s*)?\(|createStructuredAgentSessionRestartResume\(' src/main
printf '%s\n' '--- candidate surface implementations ---'
rg -n --glob '*.ts' 'class .*Surface|type .*Surface|interface .*Surface|holdSession|sessionHolds|holderId|awaitSendSettlement' src/main/native-chat src/main | head -160

Repository: stablyai/orca

Length of output: 42306


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- hold lifecycle ---'
sed -n '1,125p' src/main/native-chat/agent-session-wire/structured-agent-session-holds.ts
sed -n '130,190p' src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
printf '%s\n' '--- restart wiring ---'
sed -n '1,90p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume-wiring.ts
printf '%s\n' '--- send route and dispatch admission ---'
rg -n --glob '*.ts' 'dispatchSafely|AgentSessionPreDispatchError|function.*send|send\s*=\s*async|async function.*send|resolveDispatch|holds\.(has|hold|release)|resumeCapable|may-be-held' src/main/native-chat/agent-session-wire
sed -n '1,180p' src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
sed -n '1,180p' src/main/native-chat/agent-session-wire/structured-agent-session-holds.ts

Repository: stablyai/orca

Length of output: 37840


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- mutation admission and host mutation context ---'
sed -n '1,180p' src/main/native-chat/agent-session-wire/structured-agent-session-mutation-admission.ts
sed -n '1,285p' src/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.ts
printf '%s\n' '--- host serialization and task queue ---'
rg -n --glob '*.ts' 'serialize\s*=|serialize\(|class StructuredAgentSessionTaskQueue|mutationContext|sendStructuredAgentSessionTurn|structuredAgentSessionMutationDelegates' src/main/native-chat/agent-session-wire/structured-agent-session-host.ts src/main/native-chat/agent-session-wire/structured-agent-session-task-queue.ts
sed -n '180,360p' src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
sed -n '1,180p' src/main/native-chat/agent-session-wire/structured-agent-session-task-queue.ts
printf '%s\n' '--- continuation send and host send binding ---'
sed -n '220,330p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
rg -n --glob '*.ts' 'sendStructuredAgentSessionTurn|mutationDelegates|send\(' src/main/native-chat/agent-session-wire/structured-agent-session-rpc.ts src/main/native-chat/agent-session-wire src/main/runtime/rpc/methods 2>/dev/null | head -120

Repository: stablyai/orca

Length of output: 45070


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- continuation recheck and send-plan ordering ---'
sed -n '1,165p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
sed -n '1,150p' src/main/native-chat/agent-session-wire/structured-agent-session-mutation-plans.ts
printf '%s\n' '--- keyed queue contract ---'
rg -n --glob '*.ts' 'function runKeyedSerializedOperation|export .*runKeyedSerializedOperation' src
sed -n '1,140p' src/main/cli/keyed-promise-queue.ts

Repository: stablyai/orca

Length of output: 13479


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- send execution boundary ---'
sed -n '1,145p' src/main/native-chat/agent-session-wire/structured-agent-session-turns.ts
sed -n '145,245p' src/main/native-chat/agent-session-wire/structured-agent-session-turns.ts
printf '%s\n' '--- attempt implementation and relevant tests ---'
sed -n '215,250p' src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.ts
rg -n --glob '*.ts' 'attempts\(|latestUserItemId|consumeMarker|agent_session_restart_work_superseded|afterAcquire|unconfirmed' src/main/native-chat/agent-session-wire/structured-agent-session-restart-*.test.ts

Repository: stablyai/orca

Length of output: 12685


Record the continuation attempt before waiting for settlement.

restartContinuationDeps runs stillResumable inside the serialized send. performSend then returns after it records an admitted submission, while continueStructuredAgentSessionAfterRestart waits separately in awaitSendSettlement. The keyed queue is free during that wait, so a user submission can append a newer user item.

The resume wrapper observes that newer item in finally. If the continuation settles as refused or unconfirmed, failures.settle files the failure against the newer submission ID. Failure listing then keeps the record because the live latest ID still matches. Fixing only the earlier consumeMarker observation does not remove this later overwrite.

Capture the continuation submission inside the serialized send, before that send operation returns and before settlement waits. Remove the post-settlement attempts.observe call. Keep surfaces.release as the unconditional finally action.

@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 — one scoping question inline about when a user's own send retires the record.

Reviewed changes

Reviewed 5c31f06, the delta since the prior pullfrog review at 5d0d433. It changes how a failed restart resume is filed, not what any surface shows.

  • Filed against the chat's state at its own attempt's end. A new StructuredAgentSessionRestartAttempts (observe/latestUserItemId) captures each chat's newest user item when that chat's attempt finishes — in consumeMarker and in the resume finally — instead of reading the live journal once at settlement. settle files the observed id, falling back to the reserved marker when the chat was unreadable at its attempt.
  • Retires a failure the user answered mid-batch. In a multi-chat action, a send the user makes while other chats are still resuming now retires the failure it answers, rather than being stored as the failure's own baseline and keeping it current.
  • Test. A new ownership case drives a send between the chat's attempt and settlement and asserts the record is pruned; the shared supersededRefusal helper gains an afterAttempt hook.

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 in these commits — the two earlier suggestions remain open and unchanged.

Reviewed changes

Reviewed e36769f and 7517012, the delta since the prior pullfrog review at 5c31f06.

  • A reply that made a chat ineligible now retires its failure. Removed the pre-attempt observe from consumeMarker; an ineligible chat keeps its reserved marker as the baseline, so the newer user message that caused the ineligibility prunes the record. The ownership test now covers a reply landing before or after the chat's own attempt.
  • Retry offered only where it would run. The host derives a retryable flag per failure row from the same candidate predicate a retry applies; when it is false the guidance line and the modal's default tick drop Retry for Open/Dismiss, so a chat that already holds its refused continuation is not re-run. ResumeFailure.retryable is optional, so an older host leaves the reason to decide alone.

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

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: cf276d89-8130-4d87-a84a-74c4391d8090

📥 Commits

Reviewing files that changed from the base of the PR and between 5c31f06 and 7517012.

📒 Files selected for processing (7)
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-failure-ledger.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/native-chat/agent-session-wire/structured-agent-session-restart-resume-set.ts
  • src/renderer/src/components/native-chat-resume-failure-guidance.test.ts
  • src/renderer/src/components/native-chat-resume-failure-guidance.ts
  • src/renderer/src/components/native-chat-resume-on-restart-grouping.ts

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

secondary: 'dismiss'
}
}
return { text: manualContinuationText(), primary: 'open', secondary: 'retry' }

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 '95,135p' src/renderer/src/components/native-chat-resume-failure-guidance.ts
sed -n '20,50p' src/renderer/src/components/native-chat-resume-failure-guidance.test.ts
rg -n -C3 'retryable|readActionMarkers|beginResume' 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-failure-ledger.ts src/renderer/src/components/native-chat-resume-on-restart-store.ts

Repository: stablyai/orca

Length of output: 8126


Do not offer Retry when retry eligibility is unknown.

If an older host omits retryable, an unknown refusal such as codex said no reaches the fallback and returns secondary: 'retry'. The explicit retry path only re-runs eligible markers, so this action can do nothing. Return a retry action only when failure.retryable === true, and update the absent-field expectation in src/renderer/src/components/native-chat-resume-failure-guidance.test.ts.

brennanb2025 and others added 6 commits September 23, 2026 16:05
A chat that stopped being resumable between listing and acting (it
finished on its own or is waiting on the user) was filed as a failure
with no note in the chat. It now just spends the offer.

A failed reattach now writes the same in-chat note as a refused
continuation, so every filed failure explains itself in the chat.

An unconfirmed continuation's failure retires once the chat shows the
continuation's own message opened the newest turn.

Co-Authored-By: Claude <[email protected]>
…chat moves on

While a failed resume is listed, the restart store watches the host's
status feed; when a failed chat's status or latest prompt changes after
the list was read, it re-reads the host once. The host still decides
whether the failure stands. Nothing is watched while nothing failed.

The failure toast now counts only the requested chats the host still
lists as failed, keeping the old count for a host that sends no list.

Co-Authored-By: Claude <[email protected]>
… Orca couldn't reconnect

A failed reattach, or a continuation refused because another window or terminal owns the
session, now leaves a note saying Orca couldn't reconnect the chat instead of advising a send
that would meet the same refusal. The restart list keeps the reason-specific advice.

Co-Authored-By: Claude <[email protected]>
… or missing a reply

The status-bar re-read no longer runs while a resume or dismiss is in flight, and its answer is
dropped if one settled meanwhile, so a dismissed failure cannot come back. A change to a failed
chat already seen always triggers it, whatever the host's timestamp says. A chat whose unconfirmed
continuation the host already retired is now reported as resumed instead of saying nothing.

Co-Authored-By: Claude <[email protected]>

@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 in these commits — one comment-accuracy nitpick inline.

Reviewed changes

Reviewed 618fd9e and 1b151b9, the delta since the prior pullfrog review at 7517012.

  • Files only the failures a user must act on. settle no longer records an agent_session_resume_not_eligible outcome; a chat that stopped being resumable between listing and acting just spends its offer, and the now-unreachable notEligible guidance branch and string are removed.
  • Every filed failure explains itself in the chat. A reattach that fails before any continuation is attempted now writes the same in-chat refused note as a refused continuation, and noteNotContinued is narrowed to the two dependencies it uses.
  • An unconfirmed failure retires once its own message opens a turn. failureAnsweredByChat reads the journal snapshot: a newer user message supersedes as before, and an unconfirmed record additionally retires when the newest root turn's user item resolves to the continuation's own submission (by submission key or provider key).
  • The status bar clears itself once the chat moves on. While a failure is listed, the renderer store watches the local status feed keyed on status + latestPrompt and does one debounced host re-read when a failed chat's summary is newer than the list. The host stays the judge, no stream opens while nothing failed, and the watch is released when offer.failed empties.
  • The failure toast counts only what the list can show. announceRestartResults filters the not-continued ids to the host's own failure list, and a missing list (older host) keeps the old count with no Dismiss button.
  • Tests. New failure-filing and failed-chat-watch suites; the ownership/interruption harness moves to a shared module; notification filtering is pinned. The five changed suites pass (69 tests).

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

)
for (const outcome of outcomes) {
const resumed = outcome.outcome === 'resumed'
// Ineligible means the chat moved on by itself (finished, or is waiting on the user), so there

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.

not_eligible is broader than this comment claims: consumeMarker also returns false for a forked provider handle, an expired marker, or a record that is gone or unsupported by the adapter — not only "finished, or waiting on the user". Spending the offer and filing nothing is defensible for all of those, but the rationale here should name the general rule (the marker no longer describes resumable work) rather than one subset of 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 critical issues — one wording suggestion inline.

Reviewed changes

Reviewed 2662e8e, 48b99418, 449ce49f, b179005, and 5a18e95, the delta since the prior pullfrog review at 1b151b9.

  • Ownership refusals no longer advise a send. A failed reattach and a continuation refused because another owner holds the session now write AGENT_SESSION_RESTART_NOT_CONNECTED_NOTE instead of the refused note; OWNERSHIP_REFUSALS (agent_session_conflict, agent_session_ownership_unknown, execution_owner_reconciling) selects which refusals get it, and noteRestartRefused is renamed noteRestartReattachFailed.
  • Failed-chat re-read is race-safe. The store's status-feed watch skips a re-read while a resume/dismiss is in flight (actionsBegun/actionsSettled) and drops an in-flight read's answer if an action settled meanwhile, so a dismissed failure cannot be restored; a change to a chat already seen now triggers a re-read regardless of the host's timestamp.
  • Unconfirmed-but-retired chats reported as resumed. announceRestartResults counts pending/unknown chats the host no longer lists as failed as resumed instead of saying nothing.
  • Tests. A new failure-filing case pins that an unjournaled continuation never retires its unconfirmed failure; new watch cases pin the in-flight guard and the stale-read drop; notifications pin the new count.

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

/** For a chat Orca could not get hold of. Why decides the fix, which the restart list gives; advice
* to send a message would meet the same refusal. */
export const AGENT_SESSION_RESTART_NOT_CONNECTED_NOTE =
"Orca couldn't reconnect this chat after the restart, so it didn't ask the agent to continue."

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 stated cause is only true on the reattach-failure path. This note is also written for agent_session_conflict, agent_session_ownership_unknown, and execution_owner_reconciling, where the reattach succeeded and the send was refused because another process owns the session — so the chat tells the user it would not reconnect when it did.

Technical details
# Ownership refusals keep a note that names the wrong cause

## Affected sites
- `src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts:120-124` — `OWNERSHIP_REFUSALS` covers three codes whose fix is an existing owner process, not a failed reconnect.
- `src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts:229-237` — selects `not-connected` for those reasons.
- `src/shared/agent-session-restart-continuation.ts:39-40` — the wording.
- `src/main/native-chat/agent-session-wire/structured-agent-session-refusal-message.ts:41-46` — canonical text for the same codes (an existing owner process / settlement in progress).

## Required outcome
- The chat note must not assert a reconnect failure for a refusal whose cause is a conflicting owner. Either reword the shared note so it is true on both paths, or let the ownership reasons carry their own message.

## Open questions for the human
- Is one generic note a deliberate trade for keeping the chat note reason-agnostic, with the restart list carrying the specific fix?

brennanb2025 and others added 2 commits September 23, 2026 16:36
…offer params

The dismiss call now names sessions, so the older comment contradicted the schema below it.

Co-Authored-By: Claude <[email protected]>
…n the action toast

The post-action toast said "N chats couldn't be resumed" for chats whose
continuation may well have gone out, while the list and the chat itself say
Orca couldn't confirm it. That wording invites a duplicate "continue" send.
Unconfirmed chats now get their own count, classified by the outcome the
host filed, so the toast matches the row it points to.

Co-Authored-By: Claude <[email protected]>

@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 in this commit — the failure toast now separates unconfirmed resumes from refusals, matching how the list already renders them. Earlier review threads remain open and unchanged.

Reviewed changes

Reviewed 32f357b, the delta since the prior pullfrog review at 5a18e95 (3c3db43 was a comment-only doc fix, recorded without a review).

  • Unconfirmed resumes counted apart from refused ones. announceRestartResults splits the chats an action did not carry on into refused and unconfirmed: the host's filed outcome decides when the host still lists the chat, falling back to the continuation outcome (pending/unknown) otherwise. The toast titles the refused count with the unconfirmed count in its description, or titles the unconfirmed count when nothing was refused.
  • Host failure rows now reach the toast. The store forwards result.failed (not just ids) into announceRestartResults, matching the new Pick<ResumeFailure, 'sessionId' | 'outcome'>[] parameter.
  • Strings and tests. notConfirmedOne/notConfirmedMany added to en.json; the notifications suite gains a host-filed-unconfirmed case and an all-unconfirmed case, and the modal test's mixed case pins the split. Both changed suites pass.

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

…not retry

A failed row the host marks unretryable could still be ticked, sending a resume
that could only fail again; its checkbox is now disabled and it never joins the
action. An older host that omits the flag keeps today's selectable row.

The status bar no longer calls a chat "failed to resume" when the host only
couldn't confirm the resume, matching the dialog's own wording, and the mixed
toast's second line now says "other" so it cannot read as the same chat.

Co-Authored-By: Claude <[email protected]>

@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 in this commit — the renderer stops offering Resume on a failure the host says cannot retry, and distinguishes an unconfirmed resume in the status bar and the mixed toast. Earlier review threads remain open and unchanged.

Reviewed changes

Reviewed f5040c2, the delta since the prior pullfrog review at 32f357b.

  • Non-retryable failures are no longer resumable. A new resumeFailureSelectable(failure) (retryable !== false) disables a failed row's checkbox and excludes it from the modal's chosen, so a tick made before the host marked the row unretryable cannot reach the action; resumeFailureGuidance now reuses the same predicate for its Retry→Open/Dismiss override. An older host that omits the flag leaves the row selectable as before.
  • The status bar stops calling an unconfirmed resume failed. When any listed failure is outcome: 'unconfirmed', the failure entry reads "N chats to check" (new checkLabel*/checkTooltip strings, worded to cover a refused and an unconfirmed row alike) instead of "N chats failed to resume".
  • The mixed toast no longer restates one chat. With both a refusal and an unconfirmed chat, the description is now "Couldn't confirm N other chat(s) was/were resumed" (notConfirmedOtherOne/notConfirmedOtherMany).
  • Tests. The modal suite pins that an older host's row stays selectable, that a host-marked non-retryable row is disabled and dropped from chosen even after a tick, and the footer's disabled state; the status-segment suite pins "2 chats to check" for a mixed list and the absence of "failed to resume".

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

brennanb2025 and others added 2 commits September 23, 2026 17:41
…g the capsule

A failure record this build cannot parse (a newer outcome, say) made the
whole recovery file unreadable, so a downgraded build listed no restart
offers and could not record new teardowns. Failures are advisory: parse
each one on its own and drop what does not parse.

Co-Authored-By: Claude <[email protected]>
…r is skipped

The skip-unreadable-failure test only covered an unknown outcome, so going back to the throwing
marker parser for failure records still passed. A failure record usually outlives its offer
entry, so a newer marker shape can appear only there.

Co-Authored-By: Claude <[email protected]>

@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

Reviewed 82f026d, the delta since the prior pullfrog review at f5040c2 — a hardening of the recovery capsule's read path.

  • An unreadable failure record is skipped, not fatal. capsuleSchema.failed becomes z.unknown() (was z.array(z.unknown())) and parseState reads it through the new parseFailures, which safeParses each record and drops any whose shape this build cannot read — an unknown outcome, an out-of-range field, an unparseable marker — along with a non-array failed value. Before this, a single bad record threw out of parseState, costing every offer on the next read and failing every later teardown write; failures are advisory, so they now degrade one row at a time and are gone after the next write. Offers (parseEntry) still throw on invalid entries, which is the right asymmetry since an offer is not advisory.
  • Tests. Two capsule cases pin it: a file mixing a newer build's unknown-outcome record with a readable one keeps the offers and the readable failure, and a non-array failed value reads as no failures. Both would throw against the prior parser, so they can genuinely fail.

The four earlier inline threads (the null-item ledger prune, the disabled "Resume 0 chats" footer, the not_eligible comment scope, and the ownership-refusal note wording) remain open and are unchanged by this commit.

Pullfrog  | Fix it ➔ | 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

Reviewed 327de43, the delta since the prior pullfrog review at 82f026d — a test-only addendum.

  • A bad-marker fixture joins the unreadable-record case. The skips a failure record it cannot read instead of rejecting the whole file capsule case gains a second unreadable record whose marker.trigger is 'later' (only 'quit'/'update' parse), so the marker branch of parseFailures is now exercised alongside the unknown-outcome branch. The assertions are unchanged and the readable record still survives, so the case genuinely pins the drop rather than absorbing whatever parses.

No production code changed in this commit. The four earlier inline threads remain open and are unchanged.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready for merge review (head 327de436b2)

Summary. The PR fixes the reported problem: when a restart resume doesn't carry on, the chat now stays named in the status bar and the resume dialog with one next step, the chat itself explains what happened, and the entry clears on its own once the user replies in that chat. Review reworked how the failure is stored and cleared (details below). The final review loop came back clean with no changes.

What changed during review

  • The failure is recorded in the chat itself. The chat shows a status row: red when Orca couldn't continue it, amber when delivery couldn't be confirmed, and neutral when another window owned the chat.
  • Nothing is cleared from the send path. The failed-chat record is now an index. Whether each entry is still current, and whether it can be retried, is re-checked against the chat's own history every time it is listed. Before, a cached list checked on every send cleared the record; that list was empty after a host restart, and it cleared the record even when the send was then refused.
  • Failures live under a new top-level key in the recovery file. An older Orca build ignores that key instead of losing every restart offer. Failure records this build can't read are skipped, not treated as a broken file.
  • Chats that finished on their own aren't reported as failures. Failed rows that can't be retried get a disabled checkbox, so Resume never re-runs something that would fail again.
  • The status bar keeps itself current. It re-reads when a failed chat moves on, and never during an in-flight action. It says "N chats to check" when a delivery couldn't be confirmed. The toast counts refused and unconfirmed chats separately.

Verification

  • Review loops: 12 loops, with each loop's fixes re-reviewed by the next. An independent architecture review ran after loop 3, when defects kept clustering in one area. Every central mechanism was checked by removing it and confirming its test fails.

  • Readiness checklist: run at the start and at the end. The end run passed with nothing blocking; its one follow-up (skip unreadable failure records) is in 82f026d91d and 327de436b2.

  • CI: green on 327de436b2: 20 checks pass, 11 skipped, 0 failing. Mergeable.

  • Local checks: pnpm tc, oxlint on every changed file (including max-lines), and React Doctor pass. About 2,300 tests pass across the capsule, restart-resume host, RPC, and renderer suites.

  • Electron QA: a hidden dev instance with real Claude chats, at f5040c2f6d; the later commits change main-process parsing only. Every step below passed:

    • the status bar read "2 chats to check", then "1 chat failed to resume";
    • the dialog rows showed guidance and reason tooltips, with checkboxes disabled on rows that can't be retried;
    • ✕ on a row removed only that chat;
    • Open chat kept the record;
    • a real reply in the failed chat was accepted and cleared the status bar with no click;
    • Dismiss all, followed by a relaunch, left no dialog and no entry.

    Screenshots are in the PR body.

Not verified live

  • A real mid-turn restart followed by a refused continuation. The QA agent couldn't keep a Claude turn running long enough to quit inside it. The filing and in-chat note on that path are covered by host tests.
  • Retry against a real ownership conflict.
  • Linux and Windows. There is no platform-specific code. SSH is not affected, because the restart-resume RPCs only run against the local host.

Known small edges (not blocking)

  • An "unconfirmed" entry can stay listed while its continued turn is visibly running, until the chat's status next changes.
  • A reply that neither starts a turn nor changes the prompt text clears the entry on the next status change, not immediately.
  • The neutral "couldn't reconnect" note in the chat gives no next step. The dialog row carries the reason-specific action.
  • A status tooltip in the dialog opens over the row above it, which is the app's default tooltip placement.

Separate bug, not fixed here: the refusal in the original report happened because a notification the provider replayed was recorded as a new user message.

@brennanb2025
brennanb2025 merged commit 3ea15dd into main Sep 24, 2026
31 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