Repository navigation
Let pane-scoped evidence beat stale tab icon identity - #7755
Conversation
…es (title evidence plan, PR 3) Phase 3 of the terminal title evidence plan: the 501-line shared/agent-detection.ts becomes a 34-line compatibility barrel over terminal-title-status.ts (classification + stateful tracker), terminal-title-display.ts (normalization/clearing), and the existing terminal-title-agent-type.ts (identity predicates, glyphs, getAgentLabel). Every moved function body is byte-for-byte verbatim; zero consumer or test edits; dead AGENT_NAMES re-export dropped. Co-authored-by: Orca <[email protected]>
Two tab-icon fixes in the use-tab-agent path (sidebar pipeline untouched): a hibernated pane's sleeping-session record now ranks above launchAgent, so a codex-launched tab reused by claude shows claude while asleep; and a leaked nested-shell OSC 133;D that cancels ANY in-flight identity read (including the reattach/visible recovery probe) re-confirms via a foreground read instead of latching shell-foreground, which permanently hid the icon of an idle reattached agent TUI. Co-authored-by: Orca <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis pull request modifies two independent areas. First, it broadens the pending-read detection in the terminal pane's foreground agent tracker so that any scheduled or active foreground read (not just those tied to command execution) blocks the fast-path publication of shell-foreground status after receiving an OSC 133;D signal. Second, it introduces a new Changes
Sequence Diagram(s)Not applicable — changes are localized logic/precedence updates rather than multi-component interaction flows best captured by a sequence diagram. Estimated code review effort: 3/5 (moderate; involves timing-sensitive gating logic and precedence ordering changes) Related issues: None specified Related PRs: None specified Suggested labels: bug, enhancement, needs-tests Suggested reviewers: None specified 🐰 A prompt once trusted, now double-checked, 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
Co-authored-by: Orca <[email protected]>
Fixes the two live tab-icon misattributions reported on desktop prod v1.4.126 (
term_2004f7af…: Claude session showing a Codex icon;term_db1e47a6…: idle reattached Codex TUI showing a generic terminal icon). Stacked on PR #7612 (pure refactor); retargets to main automatically when that merges.ELI5
The tab icon picks an identity from layered signals: hook row → foreground process → title → what Orca launched. Two holes: (1) a tab launched as Codex and later reused by Claude keeps the Codex icon forever, because Claude's working titles are just a spinner + task text (deliberately not identity) and a hibernated pane has no live hook/process to correct it — while Orca's own hibernation record for that pane knows it's Claude and nobody asked it; (2) an idle agent TUI after reattach can get permanently marked "shell" when a leaked nested-shell prompt marker (OSC 133;D) races the one recovery probe and cancels it — after which the prober trusts the shell mark and never looks again.
Scope guarantee (per Brennan's directive)
The worktree sidebar pipeline is untouched — hooks-only as it stands. Only the tab-icon path changed (
use-tab-agent.ts,pane-foreground-agent-tracker.ts); hooks remain the top of the icon precedence. Sidebar suites (smart-attention,worktree-title-derived-agent-rows,worktree-status,WorktreeCard) pass byte-untouched.What changed
resolveTabAgentFromSignalsgains one slot:hook → process → title → sleeping-session identity → launchAgent → sibling hooks. The sleeping record (sleepingAgentSessionsByPaneKey, already on the renderer store) is pane-scoped proof of reuse and the only live signal while a pane is asleep; it clears on wake, so live signals always retake precedence.pane-foreground-agent-tracker.ts: a 133;D that cancels ANY in-flight identity read (command-start, confirming read, or the reattach/visible recovery probe — previously only the first two) re-confirms via a foreground read instead of fast-pathing toshellForeground: true, which the visible-probe gate then latched forever. Failure direction is one extra bounded RPC in a rare race; remote/SSH panes still bail attrackablePtyId().Tests
445 green across use-tab-agent (new: sleeping-beats-stale-launch, hooks-beat-sleeping, title-beats-sleeping, genuine-tab-keeps-icon, hibernated-reuse store integration), pty-connection (new: leaked-D-during-recovery-probe re-confirms to codex — verified to FAIL with the tracker fix reverted; remote pane never probes), plus the untouched sidebar suites. Typecheck (node+cli+web), oxlint, oxfmt clean.
Residual risk
The reattach bug's field trigger was diagnosed from the one mechanically traceable race (leaked D preempting the
visible-ptyread); if a second trigger exists in foreground recognition for wrapped binaries, that's a separate recognition-layer issue — live validation on the two original fixture terminals after this ships will confirm.Made with Orca 🐋