Skip to content

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

Closed
siddqamar wants to merge 3 commits into
stablyai:mainfrom
siddqamar:fix/6355-stale-agent-branding
Closed

siddqamar wants to merge 3 commits into
stablyai:mainfrom
siddqamar:fix/6355-stale-agent-branding

Conversation

@siddqamar

Copy link
Copy Markdown
Contributor

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

@coderabbitai

coderabbitai Bot commented Jun 27, 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: 1b937aac-29ef-47ef-ab33-7957da5a2236

📥 Commits

Reviewing files that changed from the base of the PR and between 3acdb99 and 96d3f1b.

📒 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 coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ed22d0fc-26aa-4a1f-839a-559d1dba0a36

📥 Commits

Reviewing files that changed from the base of the PR and between 360ce67 and 57a6bcd.

📒 Files selected for processing (5)
  • src/renderer/src/components/terminal-pane/use-notification-dispatch.test.ts
  • src/renderer/src/components/terminal-pane/use-notification-dispatch.ts
  • src/renderer/src/lib/terminal-title-agent-type.ts
  • src/renderer/src/lib/use-tab-agent.test.ts
  • src/renderer/src/lib/use-tab-agent.ts

@siddqamar

Copy link
Copy Markdown
Contributor Author

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.

- let explicit terminal identity override stale launchAgent metadata once the pane shows newer activity
- stop reusing fresh-but-stale agent completion snapshots when the current title names a different agent
- extract shared terminal-title agent identity parsing to keep tab icon and notification logic aligned
- add regressions covering Codex -> Claude pane reuse for both tab branding and completion notifications
- require matching agent type before reusing explicit-title snapshots

- map MiMo Code titles to the MiMo agent id
- add a typed helper for reading notification dispatch mock calls

- keep agent snapshot regression tests passing under web typecheck
@brennanb2025

Copy link
Copy Markdown
Contributor

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.

@siddqamar
siddqamar deleted the fix/6355-stale-agent-branding branch August 9, 2026 14:39
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.

[Bug]: Thinks my project is running codex but it is claude?

2 participants