Skip to content

fix(sidebar): attribute spinner-only pane titles to the launched agent - #9647

Merged
AmethystLiang merged 2 commits into
stablyai:mainfrom
choihjin:fix/sidebar-launch-agent-spinner-identity
Jul 21, 2026
Merged

AmethystLiang merged 2 commits into
stablyai:mainfrom
choihjin:fix/sidebar-launch-agent-spinner-identity

Conversation

@choihjin

@choihjin choihjin commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #9646.

On SSH hosts, a worktree with a working Codex session showed no sidebar agent activity row at all, while Claude worktrees on the same host showed theirs. All three identity signals fail for Codex over SSH: its OSC titles are spinner + cwd with no agent name, its status hooks are dead remotely (#8711), and the foreground-process fallback only scans the local process table.

The title-derived sidebar fallback (worktree-title-derived-agent-rows.ts) classified the spinner title as working but then dropped the row, because resolveTitleDerivedAgentType correctly refuses to attribute a bare braille spinner to Claude (CLAUDE_AGENT_TOKEN_RE gate). The tab already knows who it launched — tab.launchAgent is stamped by the agent launcher and worktree create --agent, and survives the remote path — but this was the one sidebar path that never consulted it.

Fix: when the title resolver yields no identity and the title carries a braille spinner, fall back to tab.launchAgent for the row's agent type (and label it with formatAgentTypeLabel). This mirrors the precedence the hook-row path (resolveRowAgentType in worktree-agent-rows.ts) already gives launch identity.

Scope guards, all preserved by existing tests:

Screenshots

Verified live: dev build connected to an SSH host, workspace created with worktree create --agent codex, Codex mid-task. Renderer state at capture time: tab.launchAgent === 'codex', agentStatusByPaneKey empty (no hooks, #8711), pane title ⠸ <repo-name> (no identity token).

Codex row shown for a hook-less SSH pane

Counter-check observed in the same session: when Codex went idle (title back to the bare repo name, no spinner), the row disappeared — idle panes without identity keep the existing no-row behavior.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added a regression test that fails without the fix

New tests in worktree-title-derived-agent-rows.test.ts:

  • "attributes a spinner-only title to the launched agent when the title has no identity" — codex-launched tab, live PTY, title ⠼ demo-repo → exactly one row ['codex', 'working', 'Codex', '⠼ demo-repo']. Confirmed red before the fix (no row) and green after.
  • "keeps explicit title identity over the launched agent" — claude-launched tab with ⠋ Codex title stays a Codex row (pins the precedence).

Full suite: 30,679 tests pass.

AI Review Report

Reviewed by Claude (Fable 5, author).

  • Root cause verified live, not guessed: with a remote Codex mid-task, the renderer store showed launchAgent: 'codex' on the tab, an empty agentStatusByPaneKey, and a spinner-only pane title — exactly the state the row builder drops today.
  • Blast radius: the fallback triggers only when (a) the title resolver returned no identity — which happens solely for generic status claims — (b) the title contains a braille spinner, and (c) the tab has launch metadata. All other title shapes and all hook-backed panes are untouched.
  • Known tradeoff: launchAgent is tab-scoped, so a second split pane in an agent-launched tab whose process emits a braille-spinner title would be attributed to the launched agent. This mirrors the existing tab-scoped use of launchAgent in the hook-row path; spinner-titled non-agent processes are rare (most CLIs don't set OSC titles).
  • Not covered (documented): agents started by manually typing codex in a plain terminal have no launchAgent; their identity lives in pane-connection-local commandInferredAgent, which the sidebar cannot reach today. That belongs to the pane-owner-resolver slice deliberately deferred in pane-agent-evidence.ts.
  • Cross-platform (macOS/Linux/Windows): pure renderer logic; no platform branches, no Git commands, no provider-specific naming.
  • SSH/remote/local: verified over SSH (the motivating case); local panes behave identically — locally Codex hooks usually produce authoritative rows first, which keep precedence.

Security Audit

No new input handling, IPC, auth, command execution, or path handling. The change reads two existing renderer-state fields (tab.launchAgent, the already-scraped pane title) to pick a display label and icon. No secrets or logging affected.

Notes

A braille-spinner terminal title proves activity but carries no agent
identity, so the title-derived sidebar row resolver dropped it. Agents
without working status hooks — Codex over SSH (stablyai#8711) — only ever emit
spinner+cwd titles, so their worktrees showed no agent row at all while
Claude (hook-backed) rows appeared.

Fall back to the tab's launch identity (tab.launchAgent) for
spinner-only titles, mirroring the precedence the hook-row path already
uses. Explicit title identity still wins, Claude-specific prefixes
(✳ / '. ' / '* ') are unaffected, and panes without launch metadata
keep the existing no-row behavior.
@choihjin
choihjin force-pushed the fix/sidebar-launch-agent-spinner-identity branch from 8e2059b to 1adc8e0 Compare July 21, 2026 02:04
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated title-derived sidebar agent rows to fall back to the launched agent when runtime titles contain only a spinner. Explicit identities in runtime titles continue to take precedence. Added tests covering fallback attribution, explicit identity handling, and spinner-only titles without an available identity.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: attributing spinner-only pane titles to the launched agent.
Description check ✅ Passed The description includes all required sections and provides summary, screenshots, testing, review, security, and notes.
Linked Issues check ✅ Passed The change matches #9646 by falling back to tab.launchAgent for spinner-only titles while preserving explicit identity and hook precedence.
Out of Scope Changes check ✅ Passed The changes stay within the issue scope, adding the targeted fallback and regression coverage without unrelated feature work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@AmethystLiang
AmethystLiang self-requested a review July 21, 2026 02:46
@AmethystLiang

Copy link
Copy Markdown
Contributor

thanks for the PR! will review it soon

…ane residual

Adds a regression test asserting a spinner-only title with no tab launch
identity produces no row, pinning the `launchAgent ?? null` gate that the two
existing tests do not exercise. Expands the fallback comment to record why it is
spinner-gated (vs the hook path's unconditional launchAgent fallback) and the
split-pane braille-title residual.

Co-authored-by: Orca <[email protected]>

@AmethystLiang AmethystLiang 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.

Reviewed via multi-agent code review. Correct, well-scoped fix that makes the title-derived sidebar path consistent with the hook path's existing launchAgent fallback. Added a guard test (spinner-only + no launchAgent -> no row) and comments recording the spinner-gating rationale and split-pane residual. Tests/lint/typecheck green.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts (1)

146-159: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Treat unknown as an unresolved title identity.

resolveTitleDerivedAgentType explicitly returns 'unknown' for unmapped labels, but the nullish check treats that string as resolved. Consequently, spinner-only titles may never fall back to tab.launchAgent, and titles without launch metadata can still produce a generic row. Use a resolved-type check that excludes 'unknown' for both agentType and rowLabel.

Suggested fix
   const titleAgentType = isClaudeAgentsTitle ? 'claude' : resolveTitleDerivedAgentType(title, label)
+  const hasResolvedTitleAgentType = titleAgentType !== null && titleAgentType !== 'unknown'
   const agentType =
-    titleAgentType ?? (containsBrailleSpinner(title) ? (args.tab.launchAgent ?? null) : null)
+    (hasResolvedTitleAgentType ? titleAgentType : null) ??
+    (containsBrailleSpinner(title) ? (args.tab.launchAgent ?? null) : null)
   if (!agentType) {
     return null
   }
-  const rowLabel = titleAgentType ? label : formatAgentTypeLabel(agentType)
+  const rowLabel = hasResolvedTitleAgentType ? label : formatAgentTypeLabel(agentType)

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b510ca15-5ed2-4bdd-aeb9-eb20ea72845e

📥 Commits

Reviewing files that changed from the base of the PR and between 1adc8e0 and a315c14.

📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts

@AmethystLiang
AmethystLiang merged commit bf4b2e3 into stablyai:main Jul 21, 2026
1 check passed
heyramzi added a commit to heyramzi/orca that referenced this pull request Aug 25, 2026
The workspace status dot only trusted a title-derived `working`/`permission`
when the title itself named a provider, or when a spinner glyph was paired
with `tab.launchAgent`. Claude Code's busy OSC title is a status frame plus
its own generated session summary, and that summary names Claude only by
accident — so `◐ Claude status missing from to-do workspaces` spun the dot
while `◐ Orca automatic session title renaming`, the identical pane one turn
later, fell through to the quiet emerald `active` dot, the same glyph as
`done`. `tab.launchAgent` could not rescue it: it is cleared when an agent
exits and persists as `null`, so a long-lived pane, a restored session, or a
`claude` typed into a plain terminal has no launch identity at all.

`orca worktree ps` and mobile already report `working` for those panes — they
run `detectAgentStatusFromTitle` with no attribution gate — so the desktop
sidebar was the only surface calling a busy Claude idle.

Feed the gate the process-table identity Orca already keeps. The
`paneForegroundAgentByPaneKey` slice exists for exactly this case ("covers
agents that emit neither hooks nor titles"), is read at OSC 133 command
boundaries and when a pane's PTY becomes visible, and is pane-scoped, so it
survives a restart and does not let one pane brand its sibling in a split.
When a pane's foreground process is a recognized agent, ownership is settled
and the title only has to carry the activity.

The `stablyai#9647` guard still holds: a spinner in a pane with no agent process and
no launch identity cannot spin the dot, and a dead PTY still reads inactive.
The tab-bar dot runs the same resolver and gets the same fix.

Co-authored-by: Claude Opus 5 <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
stablyai#9647)

* fix(sidebar): attribute spinner-only pane titles to the launched agent

A braille-spinner terminal title proves activity but carries no agent
identity, so the title-derived sidebar row resolver dropped it. Agents
without working status hooks — Codex over SSH (stablyai#8711) — only ever emit
spinner+cwd titles, so their worktrees showed no agent row at all while
Claude (hook-backed) rows appeared.

Fall back to the tab's launch identity (tab.launchAgent) for
spinner-only titles, mirroring the precedence the hook-row path already
uses. Explicit title identity still wins, Claude-specific prefixes
(✳ / '. ' / '* ') are unaffected, and panes without launch metadata
keep the existing no-row behavior.

* test(sidebar): pin spinner fallback no-launchAgent gate; note split-pane residual

Adds a regression test asserting a spinner-only title with no tab launch
identity produces no row, pinning the `launchAgent ?? null` gate that the two
existing tests do not exercise. Expands the fallback comment to record why it is
spinner-gated (vs the hook path's unconditional launchAgent fallback) and the
split-pane braille-title residual.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Jinjing <[email protected]>
Co-authored-by: Orca <[email protected]>
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.

Worktrees running Codex over SSH show no sidebar agent activity row — spinner-only titles carry no identity and launch identity is never consulted

2 participants