Skip to content

fix(sidebar): keep launched agent rows after conversation titles - #15665

Open
brennanb2025 wants to merge 4 commits into
mainfrom
brennanb2025/sta-4774-cursor-row-vanishes
Open

brennanb2025 wants to merge 4 commits into
mainfrom
brennanb2025/sta-4774-cursor-row-vanishes

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​483 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​480
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​198 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​174

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

  • Title-derived sidebar rows bind identity to launch provenance (Orca launched this pane as this agent), not to a provider token in the live OSC title.
  • Shell names (zsh, bash, cmd.exe, …) and the tab's default Terminal title still mean the agent exited, matching use-tab-agent.
  • Provenance is pinned to the original leaf UUID so a remaining sibling after a split-pane close cannot inherit the launched identity.
  • Tests cover: arbitrary session title + launched Cursor/Codex stays visible; zsh / Terminal 1 hides 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 Agent literal. cursor-agent then replaces that literal with a generated conversation name that has no provider token. Grok session titles still contain grok, 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:

  1. Generic launch provenance for every launched agent, not a Cursor-only owner fallback.
  2. Pins provenance to the original leaf (launchAgentLeafId) so a remaining sibling after a split-pane close cannot inherit the row (STA-2926 recycle hazard).
  3. Tests the recycle case and a Codex conversation-name case, not only Cursor keep/retire.

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

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

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 typecheck passed.

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

  • Cross-platform: matching is on the title string and tab launch provenance; no path or shortcut changes.
  • SSH/remote: title-derived rows already run on the client that owns the pane; client-stamped launchAgentLeafId is preserved across host snapshots. launchAgentLeafId is an optional persisted field (safe for mixed versions).
  • Agent compatibility: generic owner fallback. Explicit title identity still outranks launch identity. A shell / default Terminal title still drops the row.
  • Performance: one extra shell/default-title check on an existing title-derived path; first-layout stamp is a single tab write.
  • UI: no new controls.
  • Security: no new network, credentials, or command execution.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and 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

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

Focused unit tests and pnpm typecheck passed locally.

Author

  • X / Twitter: @BrennanKB5

@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds launchAgentLeafId to terminal tab state and workspace-session parsing. Terminal layouts stamp the originating leaf on the first valid layout and preserve or clear the stamp with launch metadata. Web session mirroring resolves and compares the stamp. Shared title detection identifies shell and default terminal titles. Sidebar agent rows use title state, pane ownership, and launch-leaf identity to retain or reject agent rows. Tests cover parsing, stamping, mirroring, title detection, and row derivation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies issue #15335 by preserving launched Cursor rows under arbitrary titles and hiding them for shell or default Terminal titles.
Out of Scope Changes check ✅ Passed The changes remain focused on launch provenance, title-derived rows, terminal layouts, persistence, mirroring, and regression tests for the linked issue.
Title check ✅ Passed The title clearly and concisely describes keeping launched agent rows visible after conversation titles replace native terminal titles.
Description check ✅ Passed The description follows the template, explains the change and rationale, links the issue, documents testing, and addresses compatibility and review considerations.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

brennanb2025 and others added 3 commits August 20, 2026 20:12
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
@brennanb2025
brennanb2025 force-pushed the brennanb2025/sta-4774-cursor-row-vanishes branch from 360358b to d20d60f Compare August 21, 2026 03:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between df7460a and d20d60f.

📒 Files selected for processing (14)
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts
  • src/renderer/src/lib/tui-agent-startup.test.ts
  • src/renderer/src/lib/use-tab-agent.ts
  • src/renderer/src/runtime/web-session-tabs-sync-terminal-mirroring.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/store/slices/launch-agent-leaf-stamp.test.ts
  • src/renderer/src/store/slices/launch-agent-leaf-stamp.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/shared/agent-detection.ts
  • src/shared/shell-process-detection.ts
  • src/shared/terminal-tab-types.ts
  • src/shared/workspace-session-schema.test.ts
  • src/shared/workspace-session-schema.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment on lines +161 to +165
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)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
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)) {

@brennanb2025

Copy link
Copy Markdown
Contributor Author

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 row

15665-after-conversation-title.png

Retire: zsh title hides the Agents row

15665-retire-zsh.png

Recycle: remaining sibling does not inherit the launched row

15665-recycle-remaining-sibling.png

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status

Rebased onto current main and reviewed until clean. The original product shape is the right one: bind the Agents-list row to launch provenance, retire on a real shell or this tab’s own default Terminal title, and pin that identity to the original leaf so a remaining sibling cannot inherit it.

One in-scope hole was real. Host snapshots never go through setTabLayout, so launchAgentLeafId was preserve-only on paired web/SSH: the first sole leaf was never stamped there, and a later local layout write refused to stamp because a root already existed. After split-close, tab-scoped launchAgent would have recycled onto the leftover pane. That is now stamped and dropped through the same resolver the store uses (resolveLaunchAgentLeafId), including dropping the pin when the host omits launchAgent.

Pushed as d20d60ffcb (fix(sidebar): stamp launch leaf on mirrored first layout).

Assertion audit

This PR previously had a bad round: hoisting titleShowsNoAgent treated any Terminal N as exit and a test was flipped to endorse that. Current code and tests pin the original helper:

  • titleShowsNoAgent('Terminal 1') is false unless it matches this tab’s defaultTitle
  • conversation names (Rename the auth helper) are not exit evidence
  • zsh / matching default title still hide the row
  • no pre-existing expect was flipped to make a failure disappear

resolveTabAgentFromSignals still lives in use-tab-agent.ts. SHELL_NAMES was not widened. The nearby stuck-OSC + shell-foreground + sleeping-record contradiction is untouched.

Verification

  • Focused unit tests: 306 passed (worktree-title-derived-agent-rows, launch-agent-leaf-stamp, workspace-session-schema, tui-agent-startup, use-tab-agent including retained-identity and sleeping-session, worktree-status-spinner-launch-agent, web-session-tabs-sync-terminal-mirroring)
  • Readiness START: one P2 (the mirror stamp gap). Readiness END: PASS, zero candidates, that P2 is gone. No mobile-facing surface. Counsel not required.
  • Electron (this worktree’s app, isolated profile): conversation title keeps the Cursor Agents row; zsh hides it; remaining sibling with the conversation title does not inherit the row. Full-window shots: fix(sidebar): keep launched agent rows after conversation titles #15665 (comment)

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 Terminal N retire was unit-tested, not re-shot in the UI.

No further in-scope product changes planned.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Revised the implementation in 1674bd9e71.

What changed:

  • Pane-to-tab detach now moves launchAgent and its launchAgentLeafId pin with the detached leaf, removes both fields from the source tab, and schedules the existing runtime-graph sync when that published provenance changes.
  • The transfer is deliberately ownership-safe: it requires the detached leaf’s existing pin, does not infer ownership from an unpinned split tab, and does not overwrite target provenance.
  • Added detach integration coverage plus focused helper coverage for successful transfer, target conflicts, and unpinned sources.

What I kept:

  • The existing first-layout leaf-stamping mechanism remains the right root mechanism for binding tab-scoped launch provenance to a physical pane.
  • Recognized live titles still outrank ambiguous title === defaultTitle equality. Mirrored/adopted tabs can seed their default title from a live Cursor Agent title, so unconditional default-title suppression would incorrectly hide a live agent. A regression test now locks this in.

Non-vacuity proof: with the production transfer temporarily removed, the acceptance test failed at the source-tab assertion exactly as intended:

AssertionError: expected { ptyId: 'pty-sibling', … } to not have property "launchAgent"
Expected: undefined
Received: "droid"

Verification:

  • Affected Vitest suites: 10 files, 175 tests passed.
  • Final focused rerun: 3 files, 38 tests passed.
  • pnpm typecheck: passed.
  • Changed-code quality: zero findings.
  • React Doctor changed-code check: zero issues.
  • git diff --check: passed.
  • Electron CDP validation: attached to this exact worktree’s isolated dev app, created a real split through the UI, dragged the pinned pane by its real pane handle onto the real tab strip, and confirmed the detached tab visibly retained the working Cursor sidebar row. Backing state showed the source lost both launch-provenance fields while the new tab received the same pair and the agent status moved to the new pane key.

The expanded sidebar below shows the working Cursor entry on the detached Terminal 1; the idle Cursor entry is the separately preserved live mirrored-title state covered by the non-regression above.

Expanded Orca sidebar after pane detach

This branch has not been deployed

No deployments
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.

[Bug]: Launched Cursor agents vanish from the sidebar after they set a conversation title

1 participant