Skip to content

feat: recover interrupted conversations after switching accounts - #206

Open
lifan-builds wants to merge 12 commits into
Lampese:mainfrom
lifan-builds:codex/auto-resume-interrupted-sessions
Open

lifan-builds wants to merge 12 commits into
Lampese:mainfrom
lifan-builds:codex/auto-resume-interrupted-sessions

Conversation

@lifan-builds

@lifan-builds lifan-builds commented Oct 17, 2026 •

Copy link
Copy Markdown

Closes #205.

After quota exhaustion stops a chat, switching accounts can also interrupt other running chats. Both groups otherwise need manual continuation. This adds opt-in recovery after a successful close, account switch, and desktop reopen.

Behavior

  • Enable recovery in Settings or the close-and-switch confirmation dialog. Scan recent local logs for structured usage_limit_exceeded failures or errors beginning with “You've hit your usage limit.” Skip chats already continued, completed, or cancelled, quoted error text, and internal subagent sessions.
  • On macOS, also capture unfinished chats whose rollout files are held open by the Codex process tree before closing. Exclude chats waiting for input or approval; recheck saved log offsets before delivery. Explicit aborts are skipped even when shutdown emitted them. Other platforms retain quota-error recovery.
  • Prepare before closing. Queue a uniquely marked continuation, open the chat through its Codex URL, and confirm the marked message starts a new turn before reporting success. Queue acceptance alone is insufficient.
  • Keep live progress and a dismissible report with Open conversation actions. Bound the scan to 24 hours / 32 chats, each delivery wait to 60 seconds, and the overall run to two minutes.
  • Persist receipts for unconfirmed delivery to prevent duplicate continuations after retries or restarts. Retain safe CLI exit-status/timeout diagnostics without exposing CLI output. Unknown delivery requires inspecting the chat queue before resubmitting.

Validation

Checks rerun on this standalone branch on October 28, 2026, after merging current upstream main: pnpm build passed; pnpm test passed (23 passed, 1 platform-specific skip); cargo test --locked --manifest-path src-tauri/Cargo.toml -- --test-threads=1 passed (82 passed, 3 opt-in live tests ignored); changed Rust formatting and git diff --check passed.

Regression coverage includes one quota-failed chat plus three running chats, post-capture completion/cancellation, waiting-input exclusions, quota detection, internal-agent exclusion, age/order/cap filtering, exact-marker verification, queue acceptance without execution, nonzero exits, timeouts, retry deduplication, cancellation, retained diagnostics, and the batch deadline. Earlier macOS testing exercised the production delivery path against a dedicated harmless chat and observed its new turn; mocked frontend testing covered switch/reopen failures, progress, results, and the confirmation toggle. Those live/UI runs were performed before this PR was separated from the other features; this split reran builds and automated suites.

The latest running-chat fix passed a read-only macOS ownership snapshot in the combined fork. A deliberate live multi-chat close/switch/reopen cycle remains unverified.

Requires a CLI supporting codex queue and a registered desktop codex:// handler. Windows runtime is unverified. Tray-only switches and switches while Codex is already closed do not enter this recovery flow. A started turn does not guarantee task completion.

Related contributions

Automatic quota switching is tracked in #207 / #209; direct re-login is tracked in #208 / #210. This PR includes neither feature nor fork-specific distribution changes. All three branches target upstream main independently. Their shared App/Settings edits may need ordinary conflict resolution when merged together; integrating automatic switching with recovery also requires wiring the automatic close path through the recovery flow.

@lifan-builds
lifan-builds force-pushed the codex/auto-resume-interrupted-sessions branch from 6a6d347 to 1fa667a Compare October 20, 2026 00:08
@lifan-builds lifan-builds changed the title feat: auto-switch accounts, resume quota-stopped chats, and re-login feat: recover quota-stopped conversations after switching accounts Oct 20, 2026
@lifan-builds lifan-builds changed the title feat: recover quota-stopped conversations after switching accounts feat: recover interrupted conversations after switching accounts Oct 29, 2026
@lifan-builds
lifan-builds marked this pull request as ready for review October 29, 2026 03:03
@lifan-builds

Copy link
Copy Markdown
Author

Hi @Lampese, these three independent contributions are now ready for review:

Each branch includes current upstream main and passed a fresh production frontend build, frontend tests, Rust tests, and changed-file formatting checks. The PR descriptions include exact results, remaining live/platform test gaps, and notes for combining the shared UI changes.

GitHub Actions reports action_required on these fork workflow runs; could you approve the runs when you have time? Happy to adjust the scope or implementation based on your feedback. Thanks!

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.

Feature request: recover interrupted Codex conversations after account switching

1 participant