Skip to content

fix(terminal): Restart on a failed terminal opens a plain shell instead of Codex - #30872

Merged
Jinwoo-H merged 2 commits into
mainfrom
sta-11209-restart-opens-codex
Oct 19, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
sta-11209-restart-opens-codex

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​114 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​114
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4

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

  • Before: a local shell exits with a non-zero code (exit 1, a failing .envrc/direnv on a new worktree, a failing exec command), and you press Restart. The new terminal runs codex, or codex resume <id> if that pane once had a Codex session. If Codex isn't installed, you get "command not found".
  • After: Restart opens a plain shell. The Git Bash console-limit case still retries its original startup command, as before.
  • Mechanism: the exit card's Restart (handleRestartExitedPane) asks resolveTerminalProcessExitRestartStartup what to start, and that returns null ("plain shell") for ordinary failures. A ?? fallback then replaced that null with 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 to null. 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 through buildAccountRestartStartup(agent, …), and panes that aren't on screen use codex-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 main and passes with this change.

Testing

  • New test use-terminal-pane-process-exit-actions.test.ts:

    • The exit-card restart passes startup: null, and no account-restart startup is built. This test fails on origin/main.
    • A Codex account-switch restart still builds and launches codex resume ….
  • pnpm tc:web, pnpm run check:code-quality:changed, and the existing terminal-process-exit-restart.test.ts all 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7756d37c-3015-4b24-a212-8bf7298e62fe
📥 Commits

Reviewing files that changed from the base of the PR and between 575d3b2 and f586666.

📒 Files selected for processing: 2
  • src/renderer/src/components/terminal-pane/use-terminal-pane-process-exit-actions.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-process-exit-actions.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H merged commit 099350d into main Oct 19, 2026
40 checks passed
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.

1 participant