Skip to content

fix(sidebar): spin the status dot for a hand-started agent with a providerless title - #15777

Merged
nwparker merged 1 commit into
stablyai:mainfrom
heyramzi:fix/sidebar-claude-working-dot
Nov 27, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
heyramzi:fix/sidebar-claude-working-dot

Conversation

@heyramzi

@heyramzi heyramzi commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

If you type claude yourself in a plain Orca terminal, the sidebar row already says "Claude Code / Running", but the little status dot for the workspace (and the tab, and Cmd+J) stayed on plain "Active" instead of spinning. Now the dot spins too, because it uses the same "which program is actually running in this pane" check the row already uses.

What Changed

Before: a tab started by hand has no launchAgent. While Claude works, its title is a spinner frame plus its session summary, e.g. ◐ Install cursor plugins. titleStatusIsAgentAttributable (worktree-status.ts) only trusted a spinner title when the title named a provider or the tab had a launchAgent. So the workspace, tab-bar and Cmd+J dots stayed active unless the summary happened to contain "claude". This shows most when hooks are silent; fresh hooks already spin the dot through hasLiveWorking.

After: the dot also accepts a pane whose live process read (paneForegroundAgentByPaneKey with agentEvidence: 'process-read') names an agent. The title-derived row builder already uses this evidence.

Mechanism:

  • worktree-status.ts takes a new optional paneForegroundAgentByPaneKey. For a providerless spinner title on a tab with no launchAgent, it builds a slot-to-leaf map once per tab, only when it is first needed (collectProcessReadLeafIdsBySlot). The map covers the same slots the row builder maps: a lone leaf (first live slot), or dense live ids 1..n in replay creation order. So a process-attributed spin always has a matching row (fix(sidebar): attribute spinner-only pane titles to the launched agent #9647). Sparse ids, parked negative slots and the tab-title fallback get no process identity and behave as before. makePaneKey is guarded by isTerminalLeafId.
  • processReadAgent is shared by the dot and resolveTitleDerivedPaneAgent. It applies the process-read evidence rule and lets an exit title retire a stale read. launch-record entries never count, and the tracker publishes agent: null on exit.
  • liveSlotIdsAreDense (shared/runtime-pane-title-leaf-id.ts) replaces three identical inline checks: the dot, the row builder and the runtime pane title patch.
  • Wiring: the sidebar card memo reuses the existing per-worktree selectPaneForegroundAgentsForWorktree record. The tab-bar per-tab selector adds the map to its memo key. The Cmd+J dot selects only its own worktree's entries, so it passes the whole-hot-map-selector ratchet.

Why

The sidebar row and the dot disagreed about the same pane. Reusing the row builder's evidence rule and slot mapping keeps them consistent, with no new tracking, IPC or process reads. The original PR added a separate foreground index and a tab-bar cache. It counted any entry.agent without checking evidence, including launch-record entries that can outlive the process, and it no longer applied to current main. So the fix was rebuilt around the same core idea.

Known remaining gap: after an app restart, a hand-started agent whose pane has no title or process read yet still shows Active until both arrive. Closing it would mean reading every hidden pane's process at startup, which costs subprocess work, so this PR only references the issue.

Linked Issue

Refs #15776

Visual Proof

N/A. No recording was captured. A live repro needs a logged-in Claude started by hand with hooks off, and this change adds no new UI. It only changes which existing status (working or active) the existing dot shows. It was checked at the selector and render level, using the same functions the sidebar, tab bar and Cmd+J call (see Testing).

Testing

  • Repro: a scratch selector test with a tab that has a live PTY, UUID leaves and the foreground entry {agent: 'claude', agentEvidence: 'process-read'}. On main, 4 of 12 cases fail (Expected "working", Received "active"): lone leaf, lone leaf after closing a split, dense split with claude on pane 2, and the tab-bar resolveTerminalTabActivityStatus. On this branch all 12 pass. The cases that must stay active also pass: no process evidence, launch-record only, a sibling pane's agent next to a shell spinner, sparse ids in a 3-leaf split, a stale parked busy title, a fresh hook row, and a dead PTY (inactive).

  • A scratch render test of PaletteLiveStatusProvider and PaletteWorktreeStatusDot: the dot spins for a providerless spinner title with a process-read Claude, stops when the entry goes away, comes back when it returns, and ignores another worktree's entry.

  • bot-sidebar-attention.test.ts, WorktreeCardStatusSlot.test.tsx, legacy-status-title-row-key.test.ts and bot-sidebar-attention.performance.test.ts pass (22 + 3 tests).

  • Clean on the 9 touched files: oxfmt, oxlint, anti-slop oxlint, code-quality native plugins, ast-grep, the changed-code quality gate and the whole-hot-map-selector ratchet.

  • Platform: macOS, unit level. The logic is platform-neutral.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below (no committed test: there is no worktree-status unit suite and this is a UI status heuristic; the scratch tests above cover it)

  • Every added test fails without this change and avoids the test anti-patterns (no committed tests)

Performance

Touched paths: the sidebar card status selector (memoized, runs per visible card on store writes), the tab-bar per-tab selector, and the Cmd+J dot while the palette is open. There is no IPC, polling, subprocess or sync I/O. The extra work runs only for providerless spinner titles on tabs without launchAgent, and only when a foreground map exists.

Interleaved micro-bench of getWorktreeStatus, main vs this branch, us/call as median / min. Load average was about 17. A second copy of the branch code, run in the same bench, varied by about 5% from the first, so treat smaller gaps as noise.

case main this PR
typical: 5 tabs, shell titles 3.21 / 2.90 3.41 / 2.96
typical: 5 tabs x 2, provider-named working 5.46 / 5.03 6.08 / 5.17
typical: 5 tabs x 2, shell titles, fg map present 4.76 / 4.61 4.82 / 4.51
bug case: 5 tabs, providerless spinner + fg 4.26 / 3.54 3.02 / 2.67
dense split: 5 tabs x 2, providerless spinner + fg 7.01 / 6.55 4.21 / 3.91
adversarial: 50 tabs x 8, providerless spinners, no fg 269 / 253 420 / 385
adversarial: same, fg on every pane 268 / 243 130 / 118
  • A selectPaneForegroundAgentsForWorktree cache hit (the added per-card cost) is 0.01 us. A rebuild for a 400-pane map takes about 0.2 ms. It happens only on foreground writes (OSC 133 boundaries or agent detection), and per-worktree records keep their identity when unchanged.
  • The worst case is about 0.4 ms for 400 spinner panes with no process match, far below a 16 ms frame. The typical cases on min are within noise.

Risk

Level: Low

The riskiest part is the dot spinning for a pane whose process read is stale. That is bounded by the process-read-only rule, exit-title retirement and the tracker clearing agent on exit. Only slots that also get a matching sidebar row are attributed. If it went wrong, a workspace dot would show Working instead of Active. A plain revert backs it out; no saved data or settings are touched.

Review

Original fix by @heyramzi in #15777. This version was rebuilt on current main and credits their authorship with Co-authored-by.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: no new endpoints or data flows. Cross-platform: pure renderer logic. Remote SSH and mobile: unchanged unless the remote tracker publishes process reads. Mixed versions: the new input is optional.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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)

@coderabbitai

coderabbitai Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Worktree status resolution now uses pane foreground-process reads to attribute spinner titles to agents when no launchAgent is set. Runtime pane slots map to terminal leaves only for a single-leaf layout or dense slots matching the layout leaf count. The foreground map now flows through sidebar and terminal-tab status paths, and changes to the map invalidate cached activity status.

Merge Risk: Minimal · up to 5b4e2

Worktree, tab-bar and Cmd+J status dots now show Working for hand-started agents whose busy titles don't name the provider, matching the sidebar row. The reviewed paths show no concrete regression. The author notes that a hand-started agent can still appear Active after restart until its pane has a title or a process read. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and the affected surface: it makes the status dot spin for a hand-started agent whose title has no provider name. The changeset adds process-read foreground-agent attribution t…
Description check Passed The description follows the repository template closely. It has ELI5, What Changed (before/after and mechanism), Why (with alternatives and the rebuild rationale), Linked Issue (Refs #15776), Visual P…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix and the affected surface: it makes the status dot spin for a hand-started agent whose title has no provider name. The changeset adds process-read foreground-agent attribution to the worktree dot gate (worktree-status.ts) and passes the map through the sidebar, tab-bar, and Cmd+J selectors, which matches the title. It is specific and conventional, but at 84 characters it is slightly long.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed (before/after and mechanism), Why (with alternatives and the rebuild rationale), Linked Issue (Refs #15776), Visual Proof (N/A with reason), Testing, Performance (with micro-benchmarks), Risk (Low, with revert path), Review credit, and a checklist. Gaps: the Linked Issue uses 'Refs' rather than 'Fixes', and the template asks for an actual issue link, which the author provides only as a reference. The Performance line also uses the template's 'None, because' opener but then gives a detailed analysis, which is acceptable. The final lint/typecheck/test/build checklist item is unchecked, and the author reports manual testing was not completed. The AI Disclosure section is blank. These are minor and do not block the description.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ca75ad2-8dc1-480d-8b9d-ee672907df00
Commits

Reviewing files that changed from the base of the PR and between 8f83455 and 5b4e27e.

Files selected for processing: 2

  • src/renderer/src/components/cmd-j/palette-live-status.tsx
  • src/renderer/src/lib/workspace/activity/worktree-status.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@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: 1

🧹 Nitpick comments (1)
src/renderer/src/lib/worktree-status.ts (1)

122-126: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the new TypeScript comments.

Replace long rationale and issue-history comments with one concise non-obvious sentence. Remove test comments when the test name already states the intent.

  • src/renderer/src/lib/worktree-status.ts#L122-L126: reduce the process-identity rationale to one sentence.
  • src/renderer/src/lib/worktree-status-foreground-agent.test.ts#L41-L46: remove or reduce the narrative because the describe and test names state the case.
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts#L107-L109: reduce the process-identity rationale to one sentence.
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.ts#L173-L175: reduce the forwarding rationale to one sentence.
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.test.ts#L393-L394: remove the explanatory comment.
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.test.ts#L284-L286: remove or reduce the narrative because the test name states the case.

As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b6b3000-0c88-4c08-817a-0218af95f0df

📥 Commits

Reviewing files that changed from the base of the PR and between 4fd93ea and d158eb227afdc60949cca3448633c95a9447b9ef.

📒 Files selected for processing (10)
  • src/renderer/src/components/sidebar/use-worktree-activity-status.ts
  • src/renderer/src/components/sidebar/use-worktree-activity-statuses.test.ts
  • src/renderer/src/components/sidebar/use-worktree-activity-statuses.ts
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.test.ts
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts
  • src/renderer/src/components/tab-bar/SortableTab.tsx
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.test.ts
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.ts
  • src/renderer/src/lib/worktree-status-foreground-agent.test.ts
  • src/renderer/src/lib/worktree-status.ts

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

Comment thread src/renderer/src/lib/worktree-status.ts Resolved

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

🧹 Nitpick comments (1)
src/renderer/src/lib/worktree-status.ts (1)

84-88: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reduce the added comment blocks.

Keep each rationale to one concise line. Remove the test comment if the test name provides sufficient context.

  • src/renderer/src/lib/worktree-status.ts#L84-L88: replace the five-line fallback explanation with one concise rationale.
  • src/renderer/src/lib/worktree-status.ts#L108-L110: replace the tab-wide attribution explanation with one concise rationale.
  • src/renderer/src/lib/worktree-status.ts#L130-L134: replace the process-evidence explanation with one concise rationale.
  • src/renderer/src/lib/worktree-status-foreground-agent.test.ts#L107-L109: remove or reduce the repeated fallback explanation.

As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b15635f-4cfc-488e-87e9-1512a110dfa4

📥 Commits

Reviewing files that changed from the base of the PR and between d158eb227afdc60949cca3448633c95a9447b9ef and 07757c47edaa23f33d11193526348a7f0653f2dd.

📒 Files selected for processing (4)
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.ts
  • src/renderer/src/lib/worktree-status-foreground-agent.test.ts
  • src/renderer/src/lib/worktree-status.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.ts

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

@S-jooyoung

Copy link
Copy Markdown

Confirming the underlying bug still reproduces on 1.4.184 — differential repro posted at #15776 (comment). Three Claude panes mid-turn in one snapshot, all reported working by orca worktree ps --json, and only the row whose generated summary is literally Claude Code spins in the sidebar.

One thing that landed after this PR was opened and makes it more load-bearing, not less: #13925 widened the busy-spinner glyph set to Claude Code's quarter circles. containsAgentSpinnerGlyph is now always true for a busy Claude pane, so

return containsAgentSpinnerGlyph(title) && Boolean(launchAgent)

is decided purely by the launchAgent half. The process-table source this PR adds is now the only remaining way to attribute a busy Claude pane whose summary doesn't happen to name the provider.

On the conflicts — I checked locally with git merge-tree --write-tree upstream/main <pr-head>, and it is a single file:

CONFLICT (content): src/renderer/src/components/sidebar/use-worktree-activity-status.ts

The other six files in the PR auto-merge clean, so this looks like a small rebase rather than a rewrite.

Happy to do that rebase and hand you the resolved diff, or push a branch you can pull from — not looking to take the PR over, just to unblock it. Let me know either way.

@heyramzi
heyramzi force-pushed the fix/sidebar-claude-working-dot branch from 07757c4 to 2f72cfb Compare August 25, 2026 10:14
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@heyramzi

Copy link
Copy Markdown
Contributor Author

Rebased and pushed — the use-worktree-activity-status.ts conflict was a clean union of the two additions, no rewrite needed, so thanks for saving me the merge-tree run. The other six files auto-merged as you said.

Your #13925 note is the important half: with the busy-glyph set widened to Claude Code's quarter circles, containsAgentSpinnerGlyph(title) is always true for a busy Claude pane, so the old gate reduced to Boolean(launchAgent) — and that is null for anything the user started by hand. The process table is now the only thing left that can attribute those panes, which is what this PR adds.

Also trimmed the added comments to one line each per CodeRabbit's nitpick. Tests are green (73 across the four touched files) and the branch is mergeable again.

@nwparker
nwparker force-pushed the fix/sidebar-claude-working-dot branch from 2f72cfb to 8f83455 Compare November 26, 2026 23:07
@nwparker nwparker changed the title fix(sidebar): spin the dot for an agent the user started by hand fix(sidebar): spin the status dot for a hand-started agent with a providerless title Nov 26, 2026
@nwparker nwparker closed this Nov 27, 2026
@nwparker nwparker reopened this Nov 27, 2026
@nwparker nwparker closed this Nov 27, 2026
@nwparker nwparker reopened this Nov 27, 2026
…ss title

An agent started by hand has no tab.launchAgent, so a busy title like
"◐ Install cursor plugins" (Claude's spinner plus its session summary) was
not attributable and the workspace, tab-bar and Cmd+J dots stayed Active
while the sidebar row already said Running.

Accept the pane's live process read (agentEvidence 'process-read') as
attribution, for the slots the title-derived row builder maps the same
way (lone leaf, dense live ids in replay creation order), so a
process-attributed spin always has a matching row. Sparse and parked
slots keep the previous behaviour. The slot-to-leaf map is built lazily,
once per tab, and only for providerless spinner titles.

The dot gate and the row builder share processReadAgent (the process-read
evidence rule, including exit-title retirement) and liveSlotIdsAreDense.
Cmd+J reads only this worktree's foreground agents.

Refs stablyai#15776

Co-authored-by: ramzi <[email protected]>
@nwparker
nwparker force-pushed the fix/sidebar-claude-working-dot branch from 8f83455 to 5b4e27e Compare November 27, 2026 03:35
@nwparker
nwparker merged commit c49e4ca into stablyai:main Nov 27, 2026
57 checks passed
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.

3 participants