orca icon indicating copy to clipboard operation
orca copied to clipboard

fix: clear stale Codex branding when a pane is reused by another agent

Open siddqamar opened this issue 5 months ago • 2 comments

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 launchAgent metadata 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.

siddqamar avatar Jun 27 '26 04:06 siddqamar

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: 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.

ā¤ļø Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jun 27 '26 04:06 coderabbitai[bot]

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.

siddqamar avatar Jun 27 '26 07:06 siddqamar

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.

brennanb2025 avatar Jun 29 '26 08:06 brennanb2025