Repository navigation
fix(terminal): wait for shell readiness on Codex account restart - #9365
Merged
nwparker merged 1 commit intoJul 24, 2026
Merged
Conversation
kazu-42
marked this pull request as ready for review
July 20, 2026 17:40
Contributor
📝 WalkthroughWalkthroughCodex account restart handling now uses the exported 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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. Comment |
nwparker
force-pushed
the
agent/fix-codex-restart-shell-ready
branch
from
July 23, 2026 11:49
6c4fe1a to
b9502f3
Compare
Contributor
|
Thanks so much for this, @kazu-42 — wait for shell readiness on Codex account restart. Verified (fail-on-main/pass-on-branch), rebased on latest |
This was referenced Jul 27, 2026
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a race where switching Codex accounts could drop, mangle, or leave unsubmitted the
codexcommand in the restarted terminal pane.ELI5
When you switch Codex accounts, Orca reopens the terminal and types
codexfor you. Sometimes it typed too early — before the shell was ready — so the command got garbled. Now it waits until the shell is actually listening.Root cause & fix
The account-switch restart relaunched panes with
startup: { command: 'codex' }, which used the default "fast" delivery (a 300 ms daemon fast-path). Slow prompt integrations like Starship can still be rendering the first prompt past that boundary, so the command could be delivered before the shell accepts input. The fix introduces a shared constantCODEX_ACCOUNT_RESTART_STARTUP = { command: 'codex', startupCommandDelivery: 'shell-ready' }and uses it at the relaunch site — matching the fresh-launch behavior already defined for codex inshared/tui-agent-startup.ts. Ordinary blank Codex launches keep the low-latency fast path.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23.
codex-session-restart.test.tsvianpx vitest run --config config/vitest.config.ts src/renderer/src/lib/codex-session-restart.test.tsstartupCommandDeliveryis a recognized startup field, read inpty-connection.tsand honored byshouldUseShellReadyStartupDeliveryinshared/codex-startup-delivery.ts.npx oxlint TerminalPane.tsx codex-session-restart.ts→ exit 0, no warnings/errors.7ab601487c; branch diff against it is exactly the 3 PR files, no conflicts.Trade-offs
The account-switch restart may wait for the remaining shell initialization time before starting Codex. This is intentional — the new process must reliably inherit the selected
CODEX_HOME— and transport-specific bounded fallbacks (local, daemon, SSH, remote) still apply, so there is no unbounded wait.Regression risk
Near-zero. Only the account-switch restart branch changes delivery mode; ordinary blank Codex launches and all non-affected paths are byte-identical. The regression test proves the corrected descriptor and fails when the fix is reverted.
Credit to @kazu-42 for the original fix. Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.