Skip to content

Continue chats automatically when a usage limit resets - #36873

Merged
brennanb2025 merged 43 commits into
mainfrom
brennanb2025/usage-limit-auto-continue
Nov 2, 2026
Merged

brennanb2025 merged 43 commits into
mainfrom
brennanb2025/usage-limit-auto-continue

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2012 $\color{#cf222e}{\Huge{\mathbf{−}}}$​49 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1963
Prod 72 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1436 $\color{#cf222e}{\Huge{\mathbf{−}}}$​178 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1258

ELI5

When Claude or Codex stops a chat because you hit your usage limit, you currently have to come back after the limit resets and continue the chat yourself. This PR adds an opt-in setting so Orca continues the chat for you once, right after the limit resets.

What Changed

Before: a chat stopped by a usage limit shows the usage-limit row ("Claude hit its session limit. It resets at 9:59 AM.") with Continue Now (after the reset), Hand Off and Add Account. Nothing happens at the reset time until you act.

After:

  • New setting, off by default: Settings → Chat → Behavior → "Continue chats automatically when a usage limit resets".
  • Setting off: the usage-limit row gains one underlined link with a gear icon, "Continue automatically when limits reset". It opens Settings at that switch; it does not turn the setting on.
  • Setting on: the row says "Orca will continue this chat at 4:30 PM." with a small "Don't continue" button. Shortly after the reset (15 seconds), Orca sends the ordinary visible message "Continue where you left off." in that chat, once, and the agent replies as usual.
  • "Don't continue" cancels just that chat's continuation (the row then says "Orca won't continue this chat automatically."), and the cancel survives an app restart. Sending your own message, Continue Now, Stop, Hand Off to another agent, or rewinding the chat also withdraws the pending continuation, so Orca never sends on top of something you did. That includes pressing Stop just before the limit error arrives.
  • Chats in a sleeping workspace or not open in any tab are not continued; they are picked up again when the workspace wakes or the chat is reopened, if the limit has still not been dealt with.
  • A limit whose reset passed more than 24 hours ago is never continued automatically. Its row shows only the usual manual actions (Continue Now, Hand Off, Add Account), so turning the setting on never fires into days-old chats.

How it works: the machine that runs the agent (your Mac, or the paired Orca server for remote chats) owns the decision. A light sweep every 10 seconds (idle while the setting is off) looks at chats whose latest turn ended on a usage limit with a known reset time, and derives "this chat is due" from the chat's own saved history rather than storing a schedule. When a chat is due, it re-checks everything just before sending (setting still on, same limit, chat still open and awake, not cancelled) inside the same queue that handles user sends, then sends through the normal send path. At most one automatic send starts per sweep; a send that fails before the agent accepts it is retried a few times with growing gaps (1, 2, 4, 8 minutes), and a send whose outcome is unknown is never repeated. The only thing saved is the "Don't continue" cancel, as an identity of the stopped turn on the chat's record, so an older Orca simply ignores it. The setting lives on the machine that runs the agent; older paired servers that don't know about it don't show the schedule or the link, and their chats behave exactly as before.

Why

Hitting a limit mid-task and coming back hours later to type "continue" is the main friction this row still leaves. The common pattern for this is a server-side sweep that derives the candidate from the latest failed run and its reset time and sends an ordinary visible continuation message; this PR follows that. Like the common pattern, limits whose reset passed more than 24 hours ago stay manual. Differences are intended: one global switch instead of a per-chat toggle (approved design), and only the cancel is saved, so the current setting always applies and there is no schedule record to go stale. Because no schedule is saved, a chat Orca could not continue within those 24 hours (Orca closed, workspace asleep, tab hidden) also stays manual, and Continue Now still works there. Alternatives considered: a hidden "retry" queue entry (hides what Orca sent and needs a new saved queue kind), and a renderer-side timer (only works while that window is open and breaks for remote chats).

Linked Issue

Builds on the usage-limit row from #31241. Not done here: a "Sent by Orca" label on the automatic message (later follow-up) and phone controls for the schedule (the phone shows the existing row; the host can still continue the chat).

Visual Proof

Setting off, the new link in the usage-limit row:

(screenshot removed: contained real product data)

Setting on, scheduled, with "Don't continue":

(screenshot removed: contained real product data)

After the reset: Orca sent "Continue where you left off." and Codex replied; a second limit was cancelled with "Don't continue":

(screenshot removed: contained real product data)

Settings switch:

(screenshot removed: contained real product data)

These were captured before this branch was synced with main, so Continue Now still shows before the reset; on main (#31241) it appears only once the reset time has passed, and that is unchanged here.

Testing

  • Real app on macOS with real Claude and Codex CLIs: automatic continuation and a real reply exactly once; Don't continue (and still cancelled after restart); your own message and Continue Now replace the schedule; Hand Off cancels the source; a saved schedule survives a graceful restart, then two normal sends and replies; rewind leaves a restored limited turn idle; the off-state link opens Settings without turning the setting on.

  • After syncing with main, the two flows main's changes touched were run again with real Claude and Codex on Windows and macOS: an unopened chat in a tab is continued after a relaunch (one send, real reply, then two normal exchanges), and a rewind that brings back a limited turn leaves it idle (Claude through main's new rewind, Codex through the ordinary one), with Continue Now still working.

  • Stop on an idle scheduled chat has no user-reachable control today (Stop only appears while a turn runs), so it is covered by tests, not the app run.

  • Paired servers (setting owned by the server, older servers without the capability) are covered by contract tests, not a paired-machine run.

  • Unit and integration tests for the sweep, admission checks, cancel identity, every rewind path, Stop (including a Stop that lands before the limit error, fed real Codex output), hand-off, the 24-hour bound, the settings bridge and the row, plus performance contract tests for the sweep and the row's render count.

  • 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 copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Remote/SSH: the execution host decides and sends; the setting is edited on that host (or through the web settings of that host). Older hosts never see the new saved field or the new setting.
  • Mobile: no new controls; the existing row still shows.
  • Performance: one 10-second sweep per host; it does no work when the setting is off, reads at most three unopened chats per pass, and republishes only chats with a known reset time. Contract tests hold these bounds at 10x the chat count, and the usage-limit row re-renders only when its own state changes.

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)

…ore its next message

A running chat's agent read its account only when it started, and nothing compared it with the
account a start would use now, so open chats kept answering on the old account after a switch.

The agent a chat runs now records the account its launch used, and the host's replace-before-the-
next-send check replaces an idle one whose account is no longer what a start would use. A chat
mid-reply finishes on the old account first. Claude chats follow; agents whose chats keep the
account they were created on are never compared.

A chat's model-list reads and saves now use the account it runs on, so a moved chat no longer
writes its new account's list under its first account (STA-11281).

Tracked in STA-11211.
Resolved against 8fe9e7e (the old #31241 head) as the effective base, since main holds #31241 as a squash. Main wins everywhere it changed; the auto-continue delta is re-applied on top. Moves the chat Stop acceptance step beside its callees and the host's auto-continue wiring into the dependencies base so both files stay within the line limit.
…inue

Unopened chats were read through the raw-row replay, which no longer sees
chats saved as keyed records, so a usage-limited chat that was not open
was never continued after its reset. Read them the way the rest of the app
reads a chat without opening it. Also use the shared visible-tab check,
keep the ordinary rewind result without a sequence as main does, and adapt
two tests to the current queued-message and saved-status behavior.
Rewind completion read the resulting conversation through the raw-row
replay, which no longer sees chats saved as keyed records, and a forked
rewind wrote its completion before the new history's records. So a
limited turn that a rewind brought back was continued automatically
after its reset. The completion now reads the saved result the way the
app reopens a chat, and the forked rewind writes its completion after
the new history in the same transaction.
@brennanb2025
brennanb2025 marked this pull request as ready for review November 2, 2026 04:08
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5c53f254-b1d6-4283-ad66-e85c9c38a7d3
Commits

Reviewing files that changed from the base of the PR and between 96df713 and 12197f9.

Files selected for processing: 4
  • src/main/native-chat/agent-session-wire/structured-agent-session-conversation-open.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-stop.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-sweep-scaling.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-usage-limit-auto-continue.ts
Files skipped from review as they are similar to previous changes: 1
  • src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-sweep-scaling.test.ts

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

Walkthrough

The PR adds automatic continuation for eligible native chats after a usage limit resets. It adds host scheduling, retry and cancellation handling, status reporting, and a setting to enable the feature. Renderer and web settings expose the setting and continuation state. Stop and rewind paths persist cancellation through operation receipts and journal recovery.

Estimated code review effort

Merge Risk: Minimal · up to 12197

No merge-blocking issue was identified in the inspected continuation paths.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 43.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "Continue chats automatically when a usage limit resets" matches the main change. The changeset adds an opt-in setting that sends one continuation message after a usage-limit reset, and the …
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.
Description check Passed The description follows the template well. It has an ELI5, What Changed (before/after and mechanism), Why (with alternatives considered), Visual Proof with screenshots, Testing steps and platforms, Ri…
Full details: Title check

Explanation

The title "Continue chats automatically when a usage limit resets" matches the main change. The changeset adds an opt-in setting that sends one continuation message after a usage-limit reset, and the usage-limit row, scheduling, cancellation, and settings UI all support that behavior. The title is short, specific, and states the primary user-facing change.

Full details: Description check

Explanation

The description follows the template well. It has an ELI5, What Changed (before/after and mechanism), Why (with alternatives considered), Visual Proof with screenshots, Testing steps and platforms, Risk discussion, and Notes covering security, remote/SSH, mobile, performance, and backwards compatibility. Gaps: the Linked Issue section cites builds-on #31241 rather than an actual 'Fixes #' issue, and the Risk section has no explicit 'Level' value or revert plan. The AI Disclosure and Review sections are empty. The final checklist item for lint/typecheck/test/build is unchecked. These are non-critical or need author confirmation, so the description is mostly complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 43.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 55 functions across 74 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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.

Nitpick comments: 2
src/renderer/src/components/native-chat/use-native-chat-usage-limit-auto-continue.ts: 1

38-74: Trivial · Performance & Scalability · Quick win

Return a stable state object from the hook.

On every render, the hook returns a new object: { kind: 'off' }, { kind: 'cancelled' }, or a scheduled object with a new cancel closure. useNativeChatInterruptedContinuation lists this value in the dependencies of its view memo. So view is rebuilt on every render of that hook whenever the state is non-null.

NativeChatUsageLimitActionsProvider builds stopView from view, and openHandOff depends on view.onUsageLimitHandOffStarted. The new identity therefore propagates to every NativeChatOrcaStopContext consumer and to the actions memo. The existing useMemo calls no longer prevent re-renders.

Fix this in two parts:

  • Use module-level constants for the off and cancelled states.
  • Memoize the scheduled object and its cancel callback. Call useCallback and useMemo before the early returns, and key them on feed, sessionId, target, cancelling, state?.turnItemId, and state?.resetsAt.
♻️ Proposed change for the constant states
+const OFF_STATE: NativeChatUsageLimitAutoContinueState = { kind: 'off' }
+const CANCELLED_STATE: NativeChatUsageLimitAutoContinueState = { kind: 'cancelled' }
+
 ...
   if (state.state === 'off') {
-    return target.kind === 'local' ? { kind: 'off' } : null
+    return target.kind === 'local' ? OFF_STATE : null
   }
   if (state.state !== 'scheduled') {
-    return { kind: 'cancelled' }
+    return CANCELLED_STATE
   }
src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-continue.ts: 1

156-162: Trivial · Performance & Scalability · Quick win

Move the isEnabled() check before the per-session republish loop.

The setting is off by default. tick() still calls this.deps.publish(id) for every loaded session every 10 seconds, even when it is off. Each call recomputes the summary and runs notifyStructuredAgentSessionPublication in StructuredAgentSessionStatusFeed.publish, before the equality check. This work has no effect while the setting is off.

A setting change already republishes all sessions through the subscribe callback in start(). Visibility changes already republish through host-tabs. Only workspace-sleep changes need the periodic republish, and that matters only when the setting is on.

Proposed change
-      // Visibility and workspace sleep can change without a journal or settings commit.
-      for (const id of this.deps.sessions.keys()) {
-        this.deps.publish(id)
-      }
       if (this.deps.host.usageLimitAutoContinue?.isEnabled() !== true) {
         return
       }
+      // Visibility and workspace sleep can change without a journal or settings commit.
+      for (const id of this.deps.sessions.keys()) {
+        this.deps.publish(id)
+      }

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: efe29b10-65a1-4260-bcaa-3635fe043804
Commits

Reviewing files that changed from the base of the PR and between 1cc843e and e1eed4b.

Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 69
  • src/main/native-chat/agent-session-journal/journal-epoch-replacement.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-chat-stop-target.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-chat-stop.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-clear-rewind.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-client-delivery.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-command-receipt.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-fork-rewind.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-background.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-status-feed.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-tabs.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-types.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-mutation-plans.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-rewind-usage-limit.test-fixture.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-rewind.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-rewind.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-deps.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-journal-projection.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-summary-equality.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-summary.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-stop-acceptance.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-continue.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-continue.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-status.test.ts
  • src/main/native-chat/agent-session-wire/structured-rewind-recovery.ts
  • src/main/runtime/agent-session/agent-session-operation-receipt.ts
  • src/main/runtime/agent-session/agent-session-rewind-completion.ts
  • src/main/runtime/agent-session/records/agent-session-record-store.ts
  • src/main/runtime/agent-session/records/agent-session-store-transactions.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-usage-limit-continue.ts
  • src/main/runtime/rpc/methods/structured-agent-session.ts
  • src/main/runtime/runtime-client-settings-shape.ts
  • src/main/runtime/runtime-client-settings.ts
  • src/main/runtime/structured-agent-session-host-assembly.ts
  • src/main/runtime/structured-agent-session-runtime-contract.ts
  • src/main/runtime/workspaces/workspace-process-listing-dependencies.ts
  • src/main/runtime/workspaces/workspace-process-listing.ts
  • src/renderer/src/components/native-chat/NativeChatInterruptedContinue.tsx
  • src/renderer/src/components/native-chat/NativeChatNoticeRow.tsx
  • src/renderer/src/components/native-chat/NativeChatUsageLimitActions.test.tsx
  • src/renderer/src/components/native-chat/NativeChatUsageLimitActions.tsx
  • src/renderer/src/components/native-chat/NativeChatUsageLimitAutoContinue.test.tsx
  • src/renderer/src/components/native-chat/NativeChatUsageLimitAutoContinue.tsx
  • src/renderer/src/components/native-chat/native-chat-orca-stop-context.ts
  • src/renderer/src/components/native-chat/use-native-chat-usage-limit-auto-continue.ts
  • src/renderer/src/components/settings/ChatBehaviorSetting.test.tsx
  • src/renderer/src/components/settings/ChatBehaviorSetting.tsx
  • src/renderer/src/components/settings/chat-behavior-search.ts
  • src/renderer/src/components/settings/native-chat-usage-limit-continue-setting-target.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/web/preload-api/web-native-chat-settings.ts
  • src/renderer/src/web/preload-api/web-preferences-store.ts
  • src/renderer/src/web/preload-api/web-settings-api.ts
  • src/renderer/src/web/web-usage-limit-settings.test.ts
  • src/shared/agent-session/agent-session-create-capabilities.ts
  • src/shared/agent-session/agent-session-wire.ts
  • src/shared/agent-session/lifecycle/agent-session-record.ts
  • src/shared/agent-session/lifecycle/agent-session-usage-limit-continue.ts
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts
  • src/shared/native-chat/native-chat-usage-limit-cut.ts
  • src/shared/rpc-contract/client-settings-params.ts
  • src/shared/rpc-contract/usage-limit-continue-params.ts

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

@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.

Nitpick comments: 1
src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-continue.test.ts: 1

173-183: Trivial · Functional Correctness · Quick win

Add a cancellation-at-admission test.

The existing tests do not detect removal of the persisted-cancellation check from beforeRun. Add a test that persists the matching cancellation inside the mocked send, immediately before calling params.beforeRun?.(). This checks cancellation after selection and before admission without asserting a current production race.

Suggested fix
 it('rechecks setting and cancellation under acceptance and reads unloaded journals without opening them', async () => {
   const { current, sweep, resetsAt } = await setup()
   const sessions = current.host.collaboratorsForTests().sessions
@@
   sessions.set(SESSION, held)
 })
 
+it('rejects a matching cancellation persisted after selection', async () => {
+  const { current, sweep, resetsAt, turnItemId } = await setup()
+  current.clock.now = resetsAt + 15_000
+  const send = vi.spyOn(current.host, 'send').mockImplementation(async (_caller, params) => {
+    await current.store.cancelUsageLimitContinue(SESSION, { turnItemId, resetsAt })
+    expect(() => params.beforeRun?.()).toThrow('agent_session_restart_work_superseded')
+    return {
+      ok: false,
+      refusal: refuse(
+        'agent_session_operation_invalid',
+        { reason: 'continuationSuperseded' },
+        'This chat has moved on. Check the latest messages before continuing.'
+      )
+    }
+  })
+  await sweep.tick()
+  expect(send).toHaveBeenCalledOnce()
+})
+
 it('lets later due chats run while an earlier chat has an edited queued message, then retries it', async () => {

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 443a5572-499e-4775-a0c8-74d11cf47610
Commits

Reviewing files that changed from the base of the PR and between e1eed4b and cff104a.

Files selected for processing: 6
  • src/main/native-chat/agent-session-wire/structured-agent-session-clear-rewind.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-rewind-usage-limit.test-fixture.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-usage-limit-continue.test.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/renderer/src/components/native-chat/NativeChatUsageLimitAutoContinue.test.tsx
  • src/renderer/src/web/web-usage-limit-settings.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

… and list the cancel method in wire contracts

Settings reads and writes that don't carry the automatic-continue choice go
through the common runtime call again, so a reply that completes after the
paired host is removed still merges, as before this change. Only a write of
that choice stays pinned to the host it was made for. The structured method
count and the cross-version method manifest now include the cancel method.
…it arrives later

A person could Stop a running Codex turn, have the turn then end with a
usage-limit failure, and still get an automatic "Continue where you left
off." after the reset, because Stop had nothing to cancel yet. The journal
write that first reveals a limited turn the latest personal Stop owns now
saves the same exact cancellation in that transaction, and a Stop accepted
just after the limit landed withdraws it too. Resume, deleting a queued card
and restarting keep it withdrawn; manual Continue and later turns are
unaffected.
…ring

The 10-second sweep now does nothing while the setting is off, republishes
only chats with a scheduled continuation, reads at most three unopened chats
per pass, and keeps going when one chat's saved history can't be read (that
chat is retried after the others instead of stopping every chat on the host).
Settings writes republish only when the switch changes. Working out the
usage-limit cut no longer indexes the whole conversation on every streamed
row. The chat's notice rows no longer re-render for status changes they
don't show. Adds operation-count and render-count tests for these bounds.
…uild no command index

Drives real Codex rows through the host at 20 and 200 history rows: each streamed commit runs the Stop's commit hook and the status projection's cut reader with no newest-turn scan, no render and no full command index; the next turn end scans once and renders nothing.
Turning automatic continue on later no longer sends into chats whose limit reset days ago. Eligibility, which the row's summary, the sweep and the pre-send recheck all read, now requires the reset to be within the last 24 hours; older limits show the usual manual actions and are never continued unasked.
A limit more than a day past its reset is never continued, but its row still showed the setting link, inviting people to turn on a switch that could not help that chat. One shared check now decides whether a cut can ever be scheduled; the status summary and the sweep's eligibility both use it, so past the bound the row keeps only Continue Now, Hand Off and Add Account. A row already on screen when the day passes drops the line on the shared minute clock; the host alone decides sends.
The type-aware lint requires exhaustive switches; epoch, tombstone, submission and queue rows still cannot reveal a cut.
The changed-code casting gate rejects type assertions; the mock now carries the real subscription signature, so the recorded handler is typed.
Acquisition-only opens have no record store, so a person's Stop followed by a limited turn end made the journal commit throw and drop the turn end. Install the withdrawal only when a store exists; without one there is no continuation to withdraw. Also narrow the status summary before reading it and type the sweep test's send mock.
@brennanb2025

brennanb2025 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Review status: auto-continue after usage limits

The problem. When Claude or Codex stops a chat because you hit a usage limit, nothing happens when the limit resets: you have to come back and continue the chat yourself.

What this PR does for users. A new setting, off by default (Settings → Chat → Behavior, "Continue chats automatically when a usage limit resets"). When it's on, the usage-limit row says "Orca will continue this chat at ." with a small "Don't continue" button, and about 15 seconds after the reset Orca sends one ordinary "Continue where you left off." in that chat. When it's off, the row offers a link to that setting. Your own message, Continue Now, Stop, Hand Off and rewinding all withdraw a pending continuation. A limit whose reset passed more than 24 hours ago is never continued automatically; its row shows only the manual actions.

What changed during review (since the PR opened).

  • Syncing with main broke two things, both fixed: a chat in a tab that wasn't opened since a relaunch was never continued (main stopped opening chats at startup and changed how chats are saved), and a rewind that brought back a limited turn re-armed it. That one is now fixed on every rewind path, including main's new Claude rewind.
  • Pressing Stop just before a turn's usage-limit error arrives (seen with Codex) left the continuation armed, so Orca could later send into a chat you stopped. Fixed: the cancel is saved together with the turn's end.
  • Web settings: an ordinary settings reply was dropped if the paired host changed mid-call. Fixed.
  • New 24-hour rule (launcher's ruling, matching the common pattern), and such chats show only manual actions instead of a link to a setting that's already on.
  • Performance: the background check does nothing while the setting is off, reads at most three unopened chats per pass, and the row re-renders only when its own state changes, each held by a contract test.

Verified.

  • Real app with real Claude and Codex CLIs. The original full run on d9b66a2 covered: automatic continuation with a real reply exactly once, Don't continue (still cancelled after restart), your own message and Continue Now replacing the schedule, Hand Off cancelling the source, a saved schedule surviving a graceful restart, rewind, and the off-state link.
  • After the main syncs, the two flows main's changes touched were run again on Windows (9622b5f) and macOS (39cda47): an unopened chat continued after a relaunch (one automatic send, real reply, then two normal exchanges), and a rewind leaving the restored limited turn idle (Claude through main's new rewind, Codex through the ordinary one), with Continue Now still working. All passed.
  • Commits after the QA'd head 39cda47 are covered by tests: c0bcbd2 (row shows only manual actions past 24 h; host and renderer tests plus a render-count test), d27673c (lint only), 96df713 (test only), 12197f9 (guard for a store-less conversation open, plus types; test added).
  • CI green on 12197f9. Final reference comparison: no unlabelled differences.

Not verified in a running app. Stop on an idle scheduled chat has no on-screen control today, so it is covered by tests. The Stop-before-limit race is covered by tests fed real Codex output, since a live quota can't be timed. Paired servers and older servers are covered by contract tests.

Deferred (no failing input found). How the reset time reads while a send is being retried, and whether the row's first appearance shifts the layout (visual only; screenshots looked fine). Two internal hardening ideas: making the rewind cancel parameter required, and having a single writer at Stop acceptance.

Noticed on main, not caused by this PR.

  • After a rewind that removes only the latest prompt, the saved status can keep that removed prompt as the chat's last prompt.
  • In QA, after a Codex rewind the removed message's text came back in the message box on reopening. It may be the test driver; unconfirmed.
  • Codex's usage-limit Details show the raw provider JSON.

For Brennan's review

Unopened chat continued automatically after a relaunch, with Codex's reply:

(screenshot removed: contained real product data)

A rewind brought back a limited Claude turn; it stays idle, with manual actions only:

(screenshot removed: contained real product data)

Where judgment matters:

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