Repository navigation
fix(terminal): Restart on a failed terminal opens a plain shell instead of Codex - #30872
Merged
Merged
Conversation
…ad of Codex The exit card's Restart passed a null startup, and a Codex account-restart fallback added in #25485 turned that null into `codex`. Account switches already name their agent explicitly, so the fallback had no legitimate caller.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
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 |
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.
ELI5
When a terminal's shell exits with an error, Orca shows a "Terminal exited" card with a Restart button. Pressing Restart started Codex in the new terminal instead of giving you a normal shell. Now it gives you a normal shell again.
What Changed
exit 1, a failing.envrc/direnv on a new worktree, a failingexeccommand), and you press Restart. The new terminal runscodex, orcodex resume <id>if that pane once had a Codex session. If Codex isn't installed, you get "command not found".handleRestartExitedPane) asksresolveTerminalProcessExitRestartStartupwhat to start, and that returnsnull("plain shell") for ordinary failures. A??fallback then replaced thatnullwith a Codex account-restart startup. This PR removes the fallback, so the resolver's answer goes through unchanged.Why
This is a regression from #25485 (first shipped in v1.4.222). That PR changed a default parameter, which only applies to
undefined, into??, which also applies tonull. The Codex default was meant for the account-switch restart, which used to call the restart function with no startup. Since #29898 the account-switch restart passes its agent explicitly throughbuildAccountRestartStartup(agent, …), and panes that aren't on screen usecodex-detached-pane-restart.ts. Neither goes through the exit card, so the fallback no longer has a legitimate caller, and removing it doesn't affect the Codex account restart. A new test pins both behaviours.The alternative, having Restart re-run the pane's original command or agent, would be a deliberate behaviour change and overlaps with restoring startup commands (STA-9028). It's left out on purpose.
Linked Issue
Linear STA-11209
Visual Proof
Not attached yet. This changes no UI; it changes which command a restarted terminal runs. The new hook test covers both paths: it fails on
mainand passes with this change.Testing
New test
use-terminal-pane-process-exit-actions.test.ts:startup: null, and no account-restart startup is built. This test fails onorigin/main.codex resume ….pnpm tc:web,pnpm run check:code-quality:changed, and the existingterminal-process-exit-restart.test.tsall pass.Not manually tested in the app.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Renderer-only and platform-independent. Only local terminals show this card (
runtimeEnvironmentId === null); remote-runtime terminals are unaffected. Nothing is sent between client and host, so there's no compatibility impact.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)