Repository navigation
fix(sidebar): spin the status dot for a hand-started agent with a providerless title - #15777
Conversation
|
Note Reviews pausedIt 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
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/renderer/src/lib/worktree-status.ts (1)
122-126: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten 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 thedescribeand 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.tssrc/renderer/src/components/sidebar/use-worktree-activity-statuses.test.tssrc/renderer/src/components/sidebar/use-worktree-activity-statuses.tssrc/renderer/src/components/sidebar/worktree-agent-activity-summary.test.tssrc/renderer/src/components/sidebar/worktree-agent-activity-summary.tssrc/renderer/src/components/tab-bar/SortableTab.tsxsrc/renderer/src/components/tab-bar/terminal-tab-activity-status.test.tssrc/renderer/src/components/tab-bar/terminal-tab-activity-status.tssrc/renderer/src/lib/worktree-status-foreground-agent.test.tssrc/renderer/src/lib/worktree-status.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/worktree-status.ts (1)
84-88: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce 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.tssrc/renderer/src/components/tab-bar/terminal-tab-activity-status.tssrc/renderer/src/lib/worktree-status-foreground-agent.test.tssrc/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.
|
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 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. return containsAgentSpinnerGlyph(title) && Boolean(launchAgent)is decided purely by the On the conflicts — I checked locally with 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. |
07757c4 to
2f72cfb
Compare
|
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. |
|
Rebased and pushed — the Your #13925 note is the important half: with the busy-glyph set widened to Claude Code's quarter circles, 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. |
2f72cfb to
8f83455
Compare
…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]>
8f83455 to
5b4e27e
Compare
ELI5
If you type
claudeyourself 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 alaunchAgent. So the workspace, tab-bar and Cmd+J dots stayedactiveunless the summary happened to contain "claude". This shows most when hooks are silent; fresh hooks already spin the dot throughhasLiveWorking.After: the dot also accepts a pane whose live process read (
paneForegroundAgentByPaneKeywithagentEvidence: 'process-read') names an agent. The title-derived row builder already uses this evidence.Mechanism:
worktree-status.tstakes a new optionalpaneForegroundAgentByPaneKey. For a providerless spinner title on a tab with nolaunchAgent, 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.makePaneKeyis guarded byisTerminalLeafId.processReadAgentis shared by the dot andresolveTitleDerivedPaneAgent. It applies the process-read evidence rule and lets an exit title retire a stale read.launch-recordentries never count, and the tracker publishesagent: nullon 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.selectPaneForegroundAgentsForWorktreerecord. 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.agentwithout checking evidence, includinglaunch-recordentries 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 (
workingoractive) 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-barresolveTerminalTabActivityStatus. On this branch all 12 pass. The cases that must stayactivealso pass: no process evidence,launch-recordonly, 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
PaletteLiveStatusProviderandPaletteWorktreeStatusDot: 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.tsandbot-sidebar-attention.performance.test.tspass (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.selectPaneForegroundAgentsForWorktreecache 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.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
agenton 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
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)