Repository navigation
Keep new terminal tabs open during startup - #6796
Conversation
Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughThe changes refactor how terminal pane visibility resumes are detected and acted upon. A new exported helper 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4383a587-e379-49e8-927f-e58e772e4d50
📒 Files selected for processing (4)
src/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Summary
Prevents newly created local terminal tabs and agent terminal tabs from being mistaken for dead sessions during startup. The dead-session reconciler now runs only after a real hidden-to-visible resume, while fresh mounts start with resume-only liveness probes disarmed until a true resume re-arms one check.
This does not change normal shell or agent process failures after startup. If Codex/Claude needs trust/auth/quota input, the terminal tab should persist and show that prompt rather than closing immediately.
Fixes #6773.
Design Approach
previousIsVisible === false && isVisible === trueas the only visibility resume edge.noteVisibilityResume()behind that edge.noteVisibilityResume()grant exactly one post-resume input probe.remote:web-runtime skips because locallistSessions()is not authoritative for those PTYs.Design Review Outcome
Design review was clean after tightening the plan around input-triggered liveness: fresh mounts must not arm
listSessions()from the first terminal input, and real agent terminal Electron validation is required.Implementation
isTerminalPaneVisibilityResumeand passed previous visibility intoscheduleVisibilityReconcilePass.No deviations from the reviewed design.
Completeness Verification
Read-only completeness verification found the headline behavior implemented with no blockers. It confirmed startup-time dead-session reconciliation no longer applies to fresh terminal/agent launches, while real hidden-session cleanup remains available on resume.
Headline Behavior Status
Implemented. The shared local terminal startup path used by
New Terminaland tab-menu agent launches no longer runs authoritative dead-session checks during PTY birth.Broad App Consistency
Source-of-truth behavior compared: desktop active-workspace tab bar
New tabmenu.Compared neighboring surfaces:
New tab -> New TerminalNew tab -> Codexagent terminal launchThis PR fixes the local desktop terminal/agent tab persistence mismatch without changing visible labels, menu order, shortcuts, remote ownership, or mobile terminal behavior.
Risks, Ambiguities, And Non-Goals
listSessions()can lag during PTY birth.Perf Audit
Perf audit found no performance bug. The diff reduces initial-mount daemon listing work, avoids fresh-input
listSessions()polling, preserves one-shot post-resume checks, and keeps mobile-fit resize suppression in the spawn reconcile path. Existing deterministic call-count tests were considered sufficient.Code Review
Code-review loop ran one round with two parallel reviewers. Both returned clean, with no actionable findings and no fixes required.
Brennan Test Changes Result
Verdict: land.
Electron validation used a separate dev app launched from this worktree with CDP, a temporary user-data path, and a disposable local git repo/workspace. App identity confirmed
devRepoRoot: /Users/thebr/orca/workspaces/orca/seabiscuit.Manual validation screenshots:
/var/folders/nk/tt6kt56s3hn9rv32dj7kymv00000gn/T/orca-terminal-validation.TQ4LPl/new-terminal-terminal-2.png/var/folders/nk/tt6kt56s3hn9rv32dj7kymv00000gn/T/orca-terminal-validation.TQ4LPl/codex-agent-terminal-3.pngObserved:
New tab -> New Terminal: after 6s,Terminal 2remained selected with shell prompt and a backing PTY listed bywindow.api.pty.listSessions().New tab -> Codex: after 12s,Terminal 3remained selected,launchAgent: "codex", with Codex trust prompt visible and a backing PTY listed bywindow.api.pty.listSessions().Checks
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts src/renderer/src/components/terminal-pane/terminal-dead-session-reconcile.test.ts src/renderer/src/components/terminal-pane/pty-connection.test.tspnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-size-reconcile.test.tspnpm exec tsgo --noEmit -p config/tsconfig.tc.web.jsonpnpm run lintpassed with one existing warning inuseGitStatusPolling.tsoutside this diffgit diff --checkPost-PR Stabilization
CodeRabbit stabilization completed: one actionable comment was addressed in commit
82f3239, and the refreshed CodeRabbit review reported no actionable comments. PR checks are passing:verifyandwayland terminal input.Made with Orca 🐋