Repository navigation
fix(sidebar): keep launched agent rows after conversation titles - #15665
brennanb2025 wants to merge 4 commits into
Conversation
📝 WalkthroughWalkthroughThe change adds 🚥 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 |
cursor-agent replaces its native OSC identity title with an arbitrary conversation name, so title-derived sidebar rows dropped the pane. Bind the row to launch provenance pinned to the original leaf, and retire only when the title returns to a shell or default Terminal title. Fixes #15335 STA-4774 Co-authored-by: Ouyang Xingyuan <[email protected]>
Hoisting titleShowsNoAgent also broadened it to treat any "Terminal N" as evidence of exit, which dropped a pane's retained Codex identity (use-tab-agent-retained-identity). A bare default-shaped title is only exit evidence when it matches the tab's own defaultTitle.
Host snapshots skip setTabLayout, so the original-leaf pin never armed on paired web/SSH and could linger after launchAgent dropped. Stamp and drop the pin with the same resolver the store uses. STA-4774
360358b to
d20d60f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e85a305b-3c82-4137-ba64-1b456f9993da
📒 Files selected for processing (14)
src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.tssrc/renderer/src/components/sidebar/worktree-title-derived-agent-rows.tssrc/renderer/src/lib/tui-agent-startup.test.tssrc/renderer/src/lib/use-tab-agent.tssrc/renderer/src/runtime/web-session-tabs-sync-terminal-mirroring.test.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/launch-agent-leaf-stamp.test.tssrc/renderer/src/store/slices/launch-agent-leaf-stamp.tssrc/renderer/src/store/slices/terminals.tssrc/shared/agent-detection.tssrc/shared/shell-process-detection.tssrc/shared/terminal-tab-types.tssrc/shared/workspace-session-schema.test.tssrc/shared/workspace-session-schema.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| const owner = | ||
| args.ownerAgentType && args.ownerAgentType !== 'unknown' ? args.ownerAgentType : null | ||
| const ownerClaimsLiveSession = owner !== null && !titleShowsNoAgent(title, args.tab.defaultTitle) | ||
| const status = classifiedStatus ?? (ownerClaimsLiveSession ? 'idle' : null) | ||
| if (!status || (!classifiedLabel && !ownerClaimsLiveSession)) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reject no-agent titles before title classification.
When titleShowsNoAgent(title, args.tab.defaultTitle) is true, return null before deriving the row status. The current condition only disables owner fallback. A default title such as Cursor Agent still produces an idle row because isCursorAgentTitle supplies classifiedStatus.
Add a regression test where title equals an agent-recognized defaultTitle.
Proposed fix
const owner =
args.ownerAgentType && args.ownerAgentType !== 'unknown' ? args.ownerAgentType : null
- const ownerClaimsLiveSession = owner !== null && !titleShowsNoAgent(title, args.tab.defaultTitle)
+ if (titleShowsNoAgent(title, args.tab.defaultTitle)) {
+ return null
+ }
+ const ownerClaimsLiveSession = owner !== null📝 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.
| const owner = | |
| args.ownerAgentType && args.ownerAgentType !== 'unknown' ? args.ownerAgentType : null | |
| const ownerClaimsLiveSession = owner !== null && !titleShowsNoAgent(title, args.tab.defaultTitle) | |
| const status = classifiedStatus ?? (ownerClaimsLiveSession ? 'idle' : null) | |
| if (!status || (!classifiedLabel && !ownerClaimsLiveSession)) { | |
| const owner = | |
| args.ownerAgentType && args.ownerAgentType !== 'unknown' ? args.ownerAgentType : null | |
| if (titleShowsNoAgent(title, args.tab.defaultTitle)) { | |
| return null | |
| } | |
| const ownerClaimsLiveSession = owner !== null | |
| const status = classifiedStatus ?? (ownerClaimsLiveSession ? 'idle' : null) | |
| if (!status || (!classifiedLabel && !ownerClaimsLiveSession)) { |
Visual proof (real app)Staged a launched Cursor pane in the running app (store setup; no real cursor-agent binary). After the OSC title became the conversation name Rename the auth helper, the left worktree Agents list still showed a Cursor row (Idle) under that title. Changing the same pane title to zsh removed the Agents row while the tab stayed live. Staging a remaining-sibling recycle (conversation title still on the tab, launch identity pinned to the original closed leaf) also kept the Agents row off the leftover pane. Gaps: this did not launch a real Cursor/Codex binary, did not drive a live split-close from the pane chrome, and did not re-check a default Terminal title retire path in the UI (zsh was the retire case). Not claiming merge-safe from this pass alone. After: conversation title keeps the Cursor rowRetire: zsh title hides the Agents rowRecycle: remaining sibling does not inherit the launched row |
Review statusRebased onto current One in-scope hole was real. Host snapshots never go through Pushed as Assertion auditThis PR previously had a bad round: hoisting
Verification
Residual (not blockers)Electron used store-staged titles/launch identity, not a real Cursor/Codex binary, and did not drive a live split-close from pane chrome. Default No further in-scope product changes planned. |
|
Revised the implementation in What changed:
What I kept:
Non-vacuity proof: with the production transfer temporarily removed, the acceptance test failed at the source-tab assertion exactly as intended: Verification:
The expanded sidebar below shows the working Cursor entry on the detached |




ELI5
If you start Cursor from Orca, the session is running, but it disappears from the left-hand Agents list as soon as Cursor names the chat. Orca now keeps that row for the whole session, and only hides it when the terminal is back at a shell prompt.
What Changed
zsh,bash,cmd.exe, …) and the tab's default Terminal title still mean the agent exited, matchinguse-tab-agent.zsh/Terminal 1hides the row; a closed pane's identity is not inherited by a new pane in the same slot.Why
#10258 kept panes whose title was the native
Cursor Agentliteral. cursor-agent then replaces that literal with a generated conversation name that has no provider token. Grok session titles still containgrok, so they stay classified; Cursor titles do not. Parsing one Cursor title format is the wrong fix — the conversation name is arbitrary, and any launched agent that overwrites OSC the same way has the same defect.Supersedes #15336
This PR supersedes #15336. Carry-forward: keep a launched pane visible under a non-shell conversation title, and retire on
zsh/ default Terminal title.How it differs:
launchAgentLeafId) so a remaining sibling after a split-pane close cannot inherit the row (STA-2926 recycle hazard).Linked Issue
Fixes #15335
STA-4774
Visual Proof
N/A — no new chrome. A launched Cursor pane whose title is an arbitrary conversation name now gets a Cursor row; previously that title classified as nothing. Shell / default Terminal titles still hide the row.
Testing
Focused:
worktree-title-derived-agent-rows.test.ts,launch-agent-leaf-stamp.test.ts,workspace-session-schema.test.ts,tui-agent-startup.test.ts,use-tab-agent.test.ts,worktree-status-spinner-launch-agent.test.ts, web-session tab mirroring tests.pnpm typecheckpassed.Pre-fix: conversation-name keep tests failed (
expected []vs Cursor/Codex row). Post-fix: those tests pass. Neutering the keep-row hunk made them fail again. Neutering the leaf pin made the recycle test fail (expected length 0, received 1).Platforms: classification is on the OSC title string plus launch provenance (macOS / Linux / Windows / SSH identical). Folder workspaces use the same tab/leaf model.
Review
Agent code-review summary
launchAgentLeafIdis preserved across host snapshots.launchAgentLeafIdis an optional persisted field (safe for mixed versions).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
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Out of scope (do not widen): Windows "never detected" reports #8258 / STA-1628 and #14434 / STA-4265 — those panes are never recognised at all. This only keeps a pane Orca launched after its conversation title replaces the identity title.
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