Repository navigation
fix(terminal): retire tab icon after confirmed shell return (STA-3867) - #15711
brennanb2025 wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughExpanded shell detection for additional shell types and executable paths. Added shared title-based no-agent detection. Updated tab-agent resolution to suppress sleeping-session identity when launched-agent exit evidence and a no-agent title are present. Updated confirmed-shell PTY handling to track foreground-agent evidence and clear sleeping-agent sessions under confirmed conditions. Added tests for shell detection, session cleanup, restore-shell retention, leaked markers, and tab/sidebar indicators. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
Confirmed-shell already cleared titles and launch routing, but identity resolution still fell back to the pane sleeping-session record, so a Codex /exit left the previous icon on a live shell tab. Suppress that sleeping occupancy on the same local exit evidence as launch identity, clear the pane-scoped sleeping record at the confirmed-shell boundary, and treat ksh/dash and similar interactive shells as shell foreground. Fixes #13749 STA-3867
Confirmed-shell /exit still retires leftover occupancy after this PTY generation hosted the agent. A replacement shell before resume must not blank the icon or delete the sleeping record.
353e463 to
cd4368b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 98373f9c-3c5c-44ba-9a34-845c85a141e1
📒 Files selected for processing (4)
src/renderer/src/components/terminal-pane/pty-connection-command-finished-cleanup.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/lib/use-tab-agent-sleeping-session.test.tssrc/renderer/src/lib/use-tab-agent.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| // pane sleeping record would keep painting the exited agent on the tab. | ||
| // Restore shells must not wipe occupancy or the persisted agent title | ||
| // before resume consumes the sleeping record. | ||
| state.clearSleepingAgentSession(cacheKey) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Clear the resolved sleeping record.
getSleepingRecordForPane can return a legacy pane key. Clearing only cacheKey leaves that record available for a later cold restore. Clear the resolved record and its provider-session aliases with clearSleepingRecordProviderDuplicates.
Proposed fix
- state.clearSleepingAgentSession(cacheKey)
+ const sleepingRecord = getSleepingRecordForPane(state)
+ if (sleepingRecord) {
+ clearSleepingRecordProviderDuplicates(state, sleepingRecord)
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| state.clearSleepingAgentSession(cacheKey) | |
| const sleepingRecord = getSleepingRecordForPane(state) | |
| if (sleepingRecord) { | |
| clearSleepingRecordProviderDuplicates(state, sleepingRecord) | |
| } |
|
Visual proof — tab-icon retirement after confirmed shell return (STA-3867)Captured with Playwright CDP against this worktree's Orca dev build ( 1. Before — launched agent pane still shows the Codex tab iconLeftmost tab is titled 2. After
|
Review status (STA-3867 / #13749)Rebased onto current What landedThe original fix still retires leftover tab-agent occupancy after a confirmed local
Follow-up commit Hibernation / restore
Sibling PR #15658Both PRs widen Checks
Visual proofStore-driven Electron CDP shots of the real tab strip are on this comment: launched Codex icon, leftover Merge bar: no revert. Ready to merge once CI on the rebased head is green (ignore the known-red e2e jobs that already fail on |



ELI5
After Codex (or another agent) finishes and you
/exitback to a live shell, the tab could still show the agent's icon even though the prompt is back. Orca now treats that leftover sleeping-session identity as stale, and only keeps the agent icon when there is still a real occupant.What Changed
ksh/dash/fish-style interactive shells stay recognized as shells, so a confirmed return to those prompts retires the same way aszsh/bash.Why
STA-3867 / #13749: after a launched Codex pane completed and
/exited, the process tracker correctly saw a shell, but identity resolution still fell back to the sleeping-session record that owned the same pane. That is the same class of "last occupant wins" bug as launch-routing reuse, not a missing title-change.Related in-flight work this does not replace:
133;D/willContinuelaunch-authority. Shell-name overlap is intentional and identical./exit.Linked Issue
Fixes #13749
STA-3867
Visual Proof
N/A — no new chrome. The user-visible effect is the existing terminal tab icon retiring to the shell after
/exit. Automated tests pin the live identity ladder, including leftover sleeping occupancy, confirmed-shell clearing, and ksh/dash/fish shell names.Testing
/exitnot driven from this worktree)TDD:
012e9f410c)use-tab-agent-sleeping-sessionexpected a retired icon after/exitwith leftover sleeping occupancy (expected 'codex' to be null). Confirmed-shell did not clear the sleeping record.ksh/dashwere not treated as shells.use-tab-agent-sleeping-session.test.ts,tui-agent-startup.test.tsshell names,pty-connection-command-finished-cleanup.test.tsconfirmed-shell sleeping clear.Also:
pnpm typecheckpassed.oxlinton changed files — clean.Covered: leftover sleeping occupancy after
/exit; confirmed-shell clearing of pane-scoped sleeping identity; ksh/dash/fish recognized as shells; conversation-title keep path from #15665 left intact.Platforms: identity is process-table + sleeping-record state (macOS / Linux / Windows / SSH identical once the host reports a shell). Folder workspaces use the same tab/leaf model.
Review
.exestripping already happens inisShellProcess.processProvesShell); remote panes still require the existing title/hook evidence and are not inferred from an unconfirmed shell.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Out of scope (file separately):
133;Dlaunch-authority (STA-4521 / fix(pi): settle OMP status from the agent-end contract #15658)./exiton a real pane — unit tests cover the identity ladder; a hosted agent session was not driven from this worktree.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Focused unit tests and
pnpm typecheckpassed locally.Author