fix: clear stale Codex branding when a pane is reused by another agent
Summary
Fixes #6355 by preventing stale Codex branding from sticking to a pane after it is reused by another agent.
- allow explicit terminal identity to override stale
launchAgentmetadata after newer activity is observed - avoid reusing stale stored agent snapshots for completion notifications when the current title names a different agent
- share terminal-title agent parsing between tab branding and notifications
Screenshots
- No visual change
Testing
- [ ]
pnpm lint - [ ]
pnpm typecheck - [ ]
pnpm test - [ ]
pnpm build - [x] Added or updated high-quality tests that would catch regressions, or explained why tests were not needed
Ran:
node config/scripts/ensure-native-runtime.mjs --runtime=node.\node_modules\.bin\vitest.cmd run --config config/vitest.config.ts src/renderer/src/lib/use-tab-agent.test.ts src/renderer/src/ components/terminal-pane/use-notification-dispatch.test.ts
AI Review Report
Reviewed stale agent identity reuse across tab icons and completion notifications. Main risk was Codex metadata outliving the original session and being shown for Claude. Added shared title parsing and regressions for Codex -> Claude pane reuse. Cross-platform impact checked; no platform-specific shortcut, path, shell, or Electron behavior was changed.
Security Audit
Low risk. Reviewed terminal-title parsing, stored agent snapshot selection, and notification dispatch. No new command execution, path handling, auth, secrets, or IPC surface was added.
Notes
- No visual change; this is a state-consistency fix.
- Focused regression tests were run for the touched paths.
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: 1b937aac-29ef-47ef-ab33-7957da5a2236
š„ Commits
Reviewing files that changed from the base of the PR and between 3acdb995e5c37923bfb6ef8655ca4578116d1bbe and 96d3f1bf786ce4052bbe4c8e179c0a9e4c414f67.
š Files selected for processing (1)
src/renderer/src/components/terminal-pane/use-notification-dispatch.test.ts
š§ Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/components/terminal-pane/use-notification-dispatch.test.ts
š Walkthrough
Walkthrough
Adds a shared terminal-title agent-type resolver and uses it in tab-agent resolution and terminal notification dispatch. use-tab-agent now uses explicit title-derived agent types in title foreground keys, precedence decisions, and observed-signal handling. dispatchTerminalNotification now checks explicit terminal-title agent compatibility before reusing stored agent status. Added tests covering Claude title precedence, MiMo Code fallback, and stale status suppression.
š„ Pre-merge checks | ā 4 | ā 1
ā Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ā ļø Warning | Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
ā Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ā Passed | The title clearly describes the main fix: clearing stale Codex branding when a pane is reused by another agent. |
| Description check | ā Passed | The description matches the template and includes summary, screenshots, testing, AI review, security audit, and notes. |
| Linked Issues check | ā Passed | The changes address #6355 by syncing branding and notifications to the current terminal agent and adding Codex-to-Claude regressions. |
| Out of Scope Changes check | ā Passed | The diff stays focused on agent-identity freshness, shared title parsing, and related regression tests. |
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 @coderabbitai help to get the list of available commands.
I addressed the CodeRabbit follow-up by tightening the stale notification guard and adding the missing MiMo Code mapping; I also tested it locally with the focused Vitest suites and typecheck:web, and everything passed.
Thanks for the fix and tests. We landed the maintainer rewrite in #6543, which covers the same stale pane identity issue plus an additional notification snapshot guard, so Iām closing this as superseded.