Skip to content

Let pane-scoped evidence beat stale tab icon identity - #7755

Merged
brennanb2025 merged 4 commits into
mainfrom
brennanb2025/tab-icon-identity-fixes
Jul 8, 2026
Merged

brennanb2025 merged 4 commits into
mainfrom
brennanb2025/tab-icon-identity-fixes

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

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

  • resolveTabAgentFromSignals gains 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 to shellForeground: 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 at trackablePtyId().

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-pty read); 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 🐋

brennanb2025 and others added 2 commits July 6, 2026 17:14
…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]>
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/terminal-title-evidence-phase3 to main July 8, 2026 03:36
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d547cf0d-c657-40b8-a067-5f75ff3122ba

📥 Commits

Reviewing files that changed from the base of the PR and between 2bdafd7 and 4a30bed.

📒 Files selected for processing (1)
  • src/renderer/src/lib/use-tab-agent-sleeping-session.test.ts

📝 Walkthrough

Walkthrough

This 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 sleepingSessionAgent signal into tab agent identity resolution, adding it to resolveTabAgentFromSignals's precedence order between title and launch/hook fallbacks, and wires it in useTabAgent by deriving the value from store state for the focused pane. Both changes are accompanied by new test coverage.

Changes

Cohort / Area Changes
Foreground read gating Broadened pending-read check in onCommandFinished; added tests for leaked 133;D handling and remote/SSH pane exclusion
Sleeping session precedence Added sleepingSessionAgent to resolveTabAgentFromSignals signature and precedence logic; wired derivation in useTabAgent; added test coverage

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,
A sleeping session's name gets fetched,
Precedence shifts, one signal more,
Tests stand watch behind each door.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change but misses required template sections for Screenshots, AI Review Report, Security Audit, and Notes. Rewrite the PR description to match the template and add the missing sections, including Screenshots, Testing checkboxes, AI Review Report, Security Audit, and Notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: pane-scoped evidence now overrides stale tab icon identity.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 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
brennanb2025 merged commit e3eec5c into main Jul 8, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.

1 participant