Repository navigation
feat: automatically switch accounts when quota is exhausted - #209
lifan-builds wants to merge 1 commit into
Conversation
|
I compared this with the auto-switch feature in my fork. The I also tried merging this PR into current upstream |
|
Thanks @Bl0ck154 for verifying this branch and running the full CI suite in your fork! cc @emreertunc @Lampese — #209 (opt-in quota auto-switch) and #210 (direct re-login for expired saved accounts) are both small, self-contained, conflict-free against |
emreertunc
left a comment
There was a problem hiding this comment.
[P2] Prevent automatic closing when unsupported sessions are also running
In src/lib/quotaAutoSwitch.ts:53–56, finding one reopenable desktop is enough to allow automatic switching. However, the shared close operation terminates all detected active sessions.
With one desktop and one terminal CLI session running, this closes both but only reopens the desktop. This contradicts the stated behavior of leaving unsupported processes alone.
I reproduced the policy decision with count: 2 and desktop_count: 1: it calls the switch callback and returns switched: true.
Please require every active process root to belong to a supported desktop before proceeding, and enforce this again in the native close path. Add regression coverage for mixed desktop/terminal sessions.
The reviewed head passed 62 Rust tests, 28 frontend tests, and the production frontend build; those tests do not cover this case.
Since #206 is now merged, please also sync with main, resolve the App/Settings conflicts, and preserve conversation recovery in the automatic switching flow when enabled.
1f6a89d to
79a9cd2
Compare
|
Thanks @emreertunc — updated in
|
Closes #207.
When the active ChatGPT account exhausts its quota, this opt-in feature selects the next saved account with freshly confirmed capacity and reuses the existing close/switch/reopen flow.
Behavior
Validation
Checks rerun on this standalone branch on October 28, 2026, after merging current upstream main:
pnpm buildpassed;pnpm testpassed (28 passed, 1 platform-specific skip);cargo test --locked --manifest-path src-tauri/Cargo.toml -- --test-threads=1passed (62 passed, 1 opt-in live test ignored); changed Rust formatting andgit diff --checkpassed.Five policy tests cover quota thresholds, credits, unknown/error results, saved-order wraparound, candidate failures, resets, source changes, cancellation, unsupported processes, and switch failures. The native race test verifies the source is checked after waiting for the authentication lock. Earlier mocked production-frontend scenarios covered close/switch/reopen ordering and failures, opt-in/off, cooldown, and source races in the combined implementation; this split reran builds and automated suites.
A full automatic switch against a real newly exhausted account has not been observed. Windows runtime and hidden-window timing outside macOS 14+ remain unverified. Enabling the feature authorizes automatic closing; unsaved Codex work can be lost, as stated in Settings.
Related contributions
Conversation recovery: #205 / #206. Direct re-login: #208 / #210. This branch targets upstream
mainindependently and contains no recovery or fork-distribution code. When merging the features together, preserve both App/Settings changes, route automatic closing through recovery when enabled, and include the re-login dialog in the monitoring pause guard.