Repository navigation
Description
Summary
Switching the active Codex account does not move existing Codex panes, and the offered remedy — "Restart N Sessions" — starts a fresh codex process rather than resuming the pane's conversation. The practical result is that a user cannot move a running Codex pane to a different account without destroying that pane's conversation and any unsent composer draft.
The same operation for Claude has no equivalent problem, and no equivalent machinery. That asymmetry is the core of this report.
Why it happens
A Codex pane's account identity is bound at process launch via CODEX_HOME, which cannot be changed on a running process:
src/main/rate-limits/codex-backend-auth.ts:71—return codexHomePath ?? process.env.CODEX_HOME ?? join(homedir(), '.codex')src/main/rate-limits/codex-auth-presence.ts:63— same resolution order
So runtime-account-controller.ts:92 selectCodex() changes which account new panes get, while existing panes keep the old one. To cope, the app ships a stale-account/restart apparatus:
StatusBar.tsx:599-624 ("N Codex sessions are still on the old account" / "Restart N Sessions"), CodexRestartChip.tsx, codex-restart-notice-state.ts, codex-restart-status-summary.ts, codex-pane-stale.ts, codex-detached-pane-restart.ts, codex-pane-restart-eligibility.ts, codex-restart-notice-account-identity.ts, and more.
Counted in this tree: 25 non-test source files reference the Codex stale-account/restart flow. There are zero Claude analogues — no staleClaude, no claudeRestart, and no "old account" string outside Codex paths. selectClaude() takes effect without asking the user to restart anything.
The second half: restart is not resume
src/renderer/src/lib/codex-session-restart.ts — the default CODEX_ACCOUNT_RESTART_STARTUP is a fresh codex invocation, not an exact resume. TerminalPane.tsx handleRestartCodexPane clears the notice/binding, disposes the transport, and reconnects with that fresh command. The detached-pane executor has ownership/generation guards but likewise starts codex.
src/main/codex/codex-session-resume-preparation.ts can return outcome: fresh when provenance is missing, and nothing refuses that outcome before replacing the original process.
Notably, the Codex CLI already exposes codex resume <SESSION_ID> (and fork, queue, archive) — so an exact-resume restart looks achievable without new protocol work.
Third: the label reports the wrong thing
The account shown for a pane reflects the selected default, not the account that pane is actually bound to. With two accounts under the same email, panes on different accounts are indistinguishable in the UI, so a user cannot tell which panes are stale. (codex-restart-notice-account-identity.ts, CodexRestartChip.tsx.)
Reproduction
- Add two Codex accounts (ours share one email address, which makes step 4 clearly visible).
- Open several Codex panes and let them accumulate conversation.
- Switch the active Codex account in Settings.
- Observe: panes keep running on the previous account; the status bar offers "Restart N Sessions".
- Click it: panes come back on the new account with no conversation history and any unsent draft gone.
Impact for us
We run a large number of concurrent Codex panes across many worktrees. Because panes cannot follow an account switch, our automated account rotation moved the default while ~21 live panes stayed on the exhausted account, and the only remedy on offer would have discarded their in-flight work — including an unsent draft and a build in progress. We exhausted a full weekly Codex allowance in 41 minutes partly while working around this.
Being straight with you about how we found it: one of our own agents diagnosed this, then went further than it should have — it cloned this repository and began writing fixes across five branches, burning a substantial amount of our Codex session quota before we caught it. That was our process failure, not yours. We are not going to keep investing in fixing your code.
We are sending one of those branches as a partial fix in a separate PR, purely so the diagnosis is not wasted. It is not a complete solution and we are not proposing to maintain it — please treat it as evidence and take it wherever you think is right. Note that a second branch touching the account-identity labels failed our own source review and is deliberately not included.
What would help most
Ranked by value to us:
- Make an account switch either move existing panes or resume them exactly (
codex resume <session-id>), so no conversation is lost. - Show each pane's actual bound account, not the selected default.
- Reach parity with the Claude path, so Codex does not need a bespoke stale/restart apparatus at all.
Environment
- Orca 1.4.194 (
com.stablyai.orca), macOS 15 / Darwin 25.6.0, Apple Silicon - Codex CLI 0.153.4
- Two Codex accounts on one email; plan types
proandself_serve_business_prolite
Activity
TheAbyss commentedon Sep 16, 2026
@brennanb2025 @nwparker — tagging you as the de-facto owners of the Codex account surface (you two authored essentially all of
src/main/codexaccount-switch work). Sorry for the ping; this has been open 8 days with no triage and we would like to know whether it is wanted before it goes any further stale.Two things that have changed since filing:
codex resume <session-id>instead of a freshcodex.We are not asking anyone to take our PR. #19590 is a partial fix and we said in it that we are not maintaining the branch — CodeRabbit rated it low-priority with a merge conflict, and that is a fair call. Close it whenever you like.
What would actually help is a one-line disposition on this issue: is the account-switch-cannot-move-a-running-pane behaviour considered a bug you intend to fix, or is it working as designed? If it is by design, we will stop treating it as one and document the wind-down-and-respawn workaround on our side instead. Either answer closes it out for us.
Tauri-EPO commentedon Sep 22, 2026
Additional Windows evidence from an isolated reproduction against package version 1.4.197, source commit
197550c952563647802b844ebff643ecdf55276c. This is evidence for the existing issue, not a new duplicate report or a test of the latest release.The reported user workflow is: switch accounts when the old account runs out of quota, accept the restart prompt, then manually recover affected conversations through Agent History because the restarted panes are not usable as expected. With many sessions, some are missed. Claude account switching works for this user's workflow; this report does not claim a Claude regression.
What the isolated test establishes
providerSessionand an existing synthetic PTY.queueCodexPaneRestarts.window.api.pty.spawnandpty.killmocked.codex, the previous PTY is passed to the kill mock, and the pending restart queue becomes empty. The captured conversation ID is absent from the replacement command.buildAgentResumeStartupPlanwith the same session,platform: 'win32', andshell: 'powershell'emits a command containing bothresumeand that exact session ID.The shared restart startup constant and detached executor agree with the observation. The passing command-builder control does not prove that a real cross-account resume has completed successfully.
Suggested acceptance criteria
The accepted restart should prepare the captured conversation for the selected account's home, resume that exact conversation in its existing pane, and provide a recoverable failure if that is not possible. Starting a fresh conversation or resuming against the depleted account's home should not count as success. The existing History resume preparation and startup builder are worth reusing, with those outcomes checked explicitly.
For orchestrated sessions, preserve logical pane/task continuity while correctly rebinding the replacement process. Do not silently retarget stale process handles; account switching needs a separate end-to-end check of that handoff. Orchestration continuity was not exercised by this test.
No real Codex process, ConPTY, Electron window, login, credential change, or live session was used in this reproduction. It establishes the detached restart's command/state behavior, not the root cause of every Windows terminal failure.
The complete executable fixture and its two passing controls/two failing assertions are included in #22243. That issue tracks a separate reproduced defect: one pending spawn blocks later accepted restarts in the detached sweep.
nwparker commentedon Oct 24, 2026
Thanks for the thorough report @TheAbyss. Restarting Codex sessions after an account switch now resumes the same conversation on the newly selected account (#25485, v1.4.222), and hidden-pane restarts were fixed in #31994 (v1.4.239). Could you retry on the latest build? If Restart still loses conversations or doesn't move a pane, please reply or reopen.
nwparker commentedon Nov 5, 2026
Closing as completed — Codex account-switch session resumption without losing the conversation or blanking the terminal landed in #25485 (
40f9e7a3fc,fix(codex): resume account switches without blanking the terminal) and #31994.