Skip to content

Prevent tab icons from briefly showing the wrong agent - #5860

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/codex-tab-icon-flash
Jun 20, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/codex-tab-icon-flash

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Resolves terminal tab agent identity from authoritative signals first: local foreground process, focused/primary structured hook status, and Orca-owned launchAgent.
  • Demotes terminal-title agent detection to legacy/unknown-session fallback only, and blocks generic Claude status-only prefixes from claiming Claude unless the title explicitly names Claude.
  • Separates focused vs sibling live/completed hook identity so split panes do not let sibling state override unresolved focused launch metadata.
  • Treats paired runtime remote: PTYs as remote-like for foreground polling and makes web-session mirrored launchAgent host-authoritative.

Design Review

  • Scratch design doc: /tmp/orca-tab-agent-identity-design.md.
  • Design review completed clean after two iterations. Key decisions preserved: local title text must not clear launchAgent; title identity is legacy fallback only; remote/runtime paths may keep completed-hook fallback when foreground polling is unavailable.

Implementation Notes

  • tab-agent.ts now exposes focused/sibling resolvers for live and completed hook identity.
  • use-tab-agent.ts ignores title identity while launchAgent exists, suppresses generic Claude status prefixes, avoids arbitrary split-pane PTY foreground sampling when focus is unknown, and distinguishes remote-like runtime PTYs from local PTYs.
  • web-session-tabs-sync.ts no longer resurrects stale mirrored launchAgent when the host snapshot omits it.
  • No product-authored agent prompt text or external-side-effect instructions were added.

Completeness Verification

  • Dedicated completeness pass reported the implementation complete against the reviewed design.
  • Follow-up review findings were fixed for paired web/mobile launch cleanup, completed-hook lifecycle evidence, missing-layout hooks, generic dot/star status prefixes, runtime remote: PTYs, missing-layout fallback PTYs, and sibling completed-hook cleanup.

Code Review Loop

  • Round 1: two reviewers found lifecycle/web sync issues; fixed.
  • Round 2: one clean, one found missing-layout and generic status-prefix issues; fixed.
  • Round 3: reviewers found runtime remote: PTY and missing-layout PTY edge cases; fixed.
  • Round 4: one clean, one found sibling completed-hook cleanup issue; fixed.
  • Round 5: both reviewers returned clean. Residual noted risk: inherited display-title fallback can still be less precise than raw PTY title, but this PR narrows title use rather than expanding it.

Brennan Test Changes

  • Verdict after lint catalog repair landed on main: landable.
  • Electron launched from /Users/thebr/orca/workspaces/orca/runner; identity verified as branch brennanb2025/codex-tab-icon-flash and the correct root.
  • Test target: demo-project at /Users/thebr/source/repos/Stably/demo-project; no Orca repo/project data was used as the target.
  • Screenshots:
    • /tmp/orca-tab-agent-validation.hiTiXa/screenshots/tab-agent-icons-start.png
    • /tmp/orca-tab-agent-validation.hiTiXa/screenshots/tab-agent-icons-end.png

Manual Runtime Evidence

  • Generic braille title + launchAgent: codex rendered Codex, not Claude.
  • Generic braille title without launch/hook rendered shell icon.
  • Explicit ✳ Claude Code rendered Claude.
  • Focused split hook beat launch metadata.
  • Sibling hook did not override unresolved focused launch.
  • Missing layout used same-tab hook identity.
  • Shell title alone did not clear launch identity.
  • Completed sibling hook did not clear focused launch.
  • remote:web-env-1@@terminal-1 skipped foreground polling and used completed-hook fallback.
  • Live renderer web-session sync dropped mirrored launchAgent when the host snapshot omitted it.

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/use-tab-agent.test.ts src/renderer/src/lib/tab-agent.test.ts src/renderer/src/runtime/web-session-tabs-sync.test.ts src/renderer/src/lib/agent-status.test.ts
  • pnpm run typecheck:web
  • pnpm run typecheck
  • pnpm run lint
  • changed-file oxlint
  • git diff --check
  • Electron validation with screenshots and app identity verification

Post-PR Stabilization

  • First post-open sweep: track-community-pr passed, no CodeRabbit reviews/comments had posted, but the PR conflicted with main.
  • Rebased onto origin/main, resolved a localization-catalog conflict by keeping main's translated value, reran focused tests, full typecheck, full lint, and diff hygiene, then force-pushed with lease.
  • Completed required post-push 8-minute wait.
  • Final sweep: PR is mergeable (CLEAN), verify passed, no PR reviews, no inline review comments, and no CodeRabbit comments. Only Stage’s non-actionable chapter summary is present.

Assumptions / Gaps

  • Live SSH/container validation was skipped because changed files are renderer resolver/web-session code, not SSH relay or remote provider transport. SSH behavior was reviewed statically through the remote-like resolver paths.
  • Console/app logs during validation had only validation-tooling noise: one failed exploratory import 404 and one synthetic web-env-1 unknown-environment error from a fake remote PTY.

@ghost

ghost commented Jun 20, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 5 individual chapters for you:

Title
1 Expose focused and sibling tab agent resolvers
2 Refine agent detection from terminal titles
3 Prioritize authoritative signals in agent resolution
4 Verify agent resolution with updated tests
5 Sync launch agent state from host authoritative signals
Open in Stage

Chapters generated by Stage for commit 1e2556f on Jun 20, 2026 1:04am UTC.

@brennanb2025
brennanb2025 force-pushed the brennanb2025/codex-tab-icon-flash branch from fc02231 to 1e2556f Compare June 20, 2026 01:04
@brennanb2025
brennanb2025 marked this pull request as ready for review June 20, 2026 01:48
@coderabbitai

coderabbitai Bot commented Jun 20, 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: 81e285a4-5ada-4424-b489-3eb2258ea2a2

📥 Commits

Reviewing files that changed from the base of the PR and between 6c941d8 and 1e2556f.

📒 Files selected for processing (6)
  • src/renderer/src/lib/tab-agent.test.ts
  • src/renderer/src/lib/tab-agent.ts
  • src/renderer/src/lib/use-tab-agent.test.ts
  • src/renderer/src/lib/use-tab-agent.ts
  • src/renderer/src/runtime/web-session-tabs-sync.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts

📝 Walkthrough

Walkthrough

Four new exported functions (resolveFocusedTabAgent, resolveSiblingTabAgent, resolveFocusedCompletedTabAgent, resolveSiblingCompletedTabAgent) are added to tab-agent.ts, splitting single-tab agent lookup into focused-leaf and sibling-leaf paths. resolveTabAgent and resolveCompletedTabAgent delegate to these helpers. In use-tab-agent.ts, title processing gains braille-spinner detection and generic-Claude-prefix suppression; resolveTabAgentFromSignals is restructured around a four-level priority chain (focused hook → active launch → sibling hook → title). useTabAgent sources focused/sibling hook agents from the store and extends remote detection with parseRemoteRuntimePtyId. In web-session-tabs-sync.ts, mirrored-tab launchAgent no longer falls back to the prior client value when the host snapshot omits it.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is comprehensive and well-structured, covering summary, design review, implementation notes, testing, and manual validation. However, it does not follow the repository's required template structure with dedicated sections for Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes. Restructure the description to match the required template: add a dedicated Screenshots section, format the Testing section as a checklist, add an AI Review Report section summarizing cross-platform compatibility checks, add a Security Audit section, and move platform-specific notes to the Notes section.
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: preventing wrong agent icons from displaying briefly, which directly relates to the PR's core objective of resolving tab agent identity correctly.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@brennanb2025
brennanb2025 merged commit 202827e into main Jun 20, 2026
3 checks 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