You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): keep completed launch identity over summary titles - #40085
On the phone, a finished Claude Code tab could show the Antigravity icon just because its auto-generated title mentioned "Agy". Now the phone trusts the agent that actually ran in the tab.
What Changed
Before: on mobile, a Claude Code terminal tab whose turn finished (agentStatus.state === 'done') and whose AI-generated summary title mentions "Agy" (e.g. "Agy status bar item") showed the Antigravity icon. Desktop showed Claude for the same tab.
After: when the tab's own launched agent reports completion (agentStatus.state === 'done' and agentStatus.agentType matches launchAgent), resolveMobileTerminalTabAgentId returns that agent instead of letting the summary title reclaim the tab.
Why
Phones never receive the foreground-process signal desktop uses, and the resolver drops the hook agent once the status is done. With neither signal, the free-form title outranks launchAgent. The host already publishes the right data (launchAgent: "claude", agentStatus: { state: "done", agentType: "claude" }), so the fix belongs in the mobile resolver rather than in title matching or the host projection.
The change is limited to the done + same-agent case. Live (working/waiting) hook precedence and title-based detection for manually launched agents are unchanged.
Before/after iPhone screenshots of the affected tab strip to be attached in a comment.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Added a regression case in mobile/src/terminal/session/mobile-terminal-tab-agent.test.ts: it fails against the current upstream resolver (expected 'antigravity' to be 'claude') and passes with this change.
Verified on a physical iPhone running a mobile build of upstream main plus this fix: the affected tab shows the Claude icon again.
Confirmed on an upstream-main desktop build (macOS) that session.tabs.list returns launchAgent: "claude" and agentStatus: { state: "done", agentType: "claude" } for the tab.
ORCA_CODE_QUALITY_BASE=upstream/main pnpm check:changed (15 checks) and pnpm -C mobile exec tsc --noEmit pass.
Risk
The riskiest part is a tab whose user later starts a different agent by hand in the same terminal: if the hook still reports the launched agent as done, the phone keeps the launched agent's icon instead of reading the title. That requires the hook's own agent type to match launchAgent, so a real switch (which reports a new agent type) is unaffected. Mobile-only, no saved data or protocol changes; a plain revert backs it out.
Level: Low
AI Disclosure
Investigation, fix, and test were written with Claude Code (Claude Opus 5.5), and reviewed by the author.
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Phones get no foreground-process signal, so a done Claude tab whose
AI-generated title names another agent (e.g. "Agy status bar item") let
the title reclaim the pane and showed the Antigravity icon. Desktop avoids
this because its process signal outranks the title. When the launched
agent itself reported completion, trust that identity on mobile.
When status is done and the hook agent matches the launched agent after icon-agent conversion, resolveMobileTerminalTabAgentId returns the hook agent. A test checks that a Claude tab remains identified as Claude when its title mentions “Agy.”
Severity of issue fixed: Medium
Merge Risk: Low · up to cf534
Completed Claude tabs now keep their Claude icon when the summary title mentions another agent. In the uncommon case where a different agent is started manually in the same completed tab, the old icon may persist. This is a bounded edge case and can be handled as a follow-up.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title names the main change: the mobile resolver now keeps the completed launch agent identity instead of a summary title. It uses the conventional fix(mobile) prefix and is specific. It is 63 cha…
Description check
The description follows the template and covers ELI5, What Changed, Why, Linked Issue (Fixes #40084), Visual Proof, Testing, Risk with Level Low and a revert path, AI Disclosure, upstream boundary, an…
Linked Issues check
Issue #40084 requires a completed (done) Claude tab to keep the Claude icon when its summary title names another agent ("Agy"). The change in mobile/src/terminal/session/mobile-terminal-tab-agent.ts a…
Out of Scope Changes check
The whole-PR diff against the merge base changes two files. mobile/src/terminal/session/mobile-terminal-tab-agent.ts gains an 8-line early return limited to the done, same-agent case. mobile/src/termi…
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check
Explanation
The title names the main change: the mobile resolver now keeps the completed launch agent identity instead of a summary title. It uses the conventional fix(mobile) prefix and is specific. It is 63 characters, within a typical length limit.
Full details: Description check
Explanation
The description follows the template and covers ELI5, What Changed, Why, Linked Issue (Fixes #40084), Visual Proof, Testing, Risk with Level Low and a revert path, AI Disclosure, upstream boundary, and Notes. The before and after mechanism is clear. Gaps: the Visual Proof section is a placeholder that says screenshots will be attached in a comment, and two checklist items (screenshots attached, lint/typecheck/test/build passing) remain unchecked.
Resolution
Attach the before and after iPhone screenshots or video to the PR, or write N/A with a reason. Check off the lint, typecheck, test, and build items once they pass, or confirm that CI covers them. Test results are reported in the description; the Visual Proof placeholder and the open checklist items are the remaining gaps.
Full details: Linked Issues check
Explanation
Issue #40084 requires a completed (done) Claude tab to keep the Claude icon when its summary title names another agent ("Agy"). The change in mobile/src/terminal/session/mobile-terminal-tab-agent.ts adds an early return in resolveMobileTerminalTabAgentId. It returns hookAgent when status.state is 'done', hookAgent is set, and agentTypeToIconAgent(hook agentType) equals agentTypeToIconAgent(tab.launchAgent). This bypasses resolveTabAgentFromSignalSnapshot, where the title could otherwise win. Tracing the base code for the issue inputs (title 'Agy status bar item', launchAgent 'claude', done hook 'claude', remote) shows titleReclaimsReusedPane selects the title agent 'antigravity'. That is the reported bug. With the change, the function returns 'claude'. The regression test in mobile-terminal-tab-agent.test.ts encodes this exact case. Live hook precedence is unchanged because the new branch requires state 'done'. The sibling working-tab behavior from the issue is unaffected. Automated test execution was not run in this review. The result rests on source tracing of the base helper in src/shared/tab-agent-from-signals.ts and the diff.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base changes two files. mobile/src/terminal/session/mobile-terminal-tab-agent.ts gains an 8-line early return limited to the done, same-agent case. mobile/src/terminal/session/mobile-terminal-tab-agent.test.ts is a new 14-line regression test for that case. Both changes directly implement issue #40084. No desktop, host, protocol, or persisted-data code is modified. The early return does not alter results for non-done states or for done tabs whose hook agent differs from launchAgent. The author-stated residual risk (a manual agent switch with a stale done hook) is a behavior consequence of the requested fix, not an unrelated change.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Heavy lift
Preserve native title detection after a completed launch.
If a user starts Gemini CLI in a completed Claude tab while agentStatus still reports Claude as done, this branch returns claude before the resolver can identify the new agent from a title such as Gemini CLI. The tab icon and transcript sender can therefore retain the wrong identity for the manual session. Keep the summary-title protection, but allow independent native title evidence to identify a reused tab. Add a test for that transition. (raw.githubusercontent.com)
Thanks @Manho, your report and the trace to resolveMobileTerminalTabAgentId made this quick to pin down. When we dug one level deeper, the host turned out to send the phone the tab's name (Claude's session name, "Agy status bar item") as title, not the terminal's own title ("✳ Agy status bar item", which desktop reads as Claude). So we fixed it by having the phone stop treating a tab's name as title evidence, instead of ranking launch identity above titles. That keeps mobile's reused-pane detection the same as desktop's. It's in #40513, with you credited as co-author. We'll close this one once that merges.
#40513 has merged with the fix for #40084, so I'm closing this one. Thanks again @Manho for the clear report and the trace. It got us to the root cause fast, and you're credited as co-author on the merged commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On the phone, a finished Claude Code tab could show the Antigravity icon just because its auto-generated title mentioned "Agy". Now the phone trusts the agent that actually ran in the tab.
What Changed
Before: on mobile, a Claude Code terminal tab whose turn finished (
agentStatus.state === 'done') and whose AI-generated summary title mentions "Agy" (e.g. "Agy status bar item") showed the Antigravity icon. Desktop showed Claude for the same tab.After: when the tab's own launched agent reports completion (
agentStatus.state === 'done'andagentStatus.agentTypematcheslaunchAgent),resolveMobileTerminalTabAgentIdreturns that agent instead of letting the summary title reclaim the tab.Why
Phones never receive the foreground-process signal desktop uses, and the resolver drops the hook agent once the status is
done. With neither signal, the free-form title outrankslaunchAgent. The host already publishes the right data (launchAgent: "claude",agentStatus: { state: "done", agentType: "claude" }), so the fix belongs in the mobile resolver rather than in title matching or the host projection.The change is limited to the done + same-agent case. Live (working/waiting) hook precedence and title-based detection for manually launched agents are unchanged.
Linked Issue
Fixes #40084
Visual Proof
Before/after iPhone screenshots of the affected tab strip to be attached in a comment.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Added a regression case in
mobile/src/terminal/session/mobile-terminal-tab-agent.test.ts: it fails against the current upstream resolver (expected 'antigravity' to be 'claude') and passes with this change.Verified on a physical iPhone running a mobile build of upstream main plus this fix: the affected tab shows the Claude icon again.
Confirmed on an upstream-main desktop build (macOS) that
session.tabs.listreturnslaunchAgent: "claude"andagentStatus: { state: "done", agentType: "claude" }for the tab.ORCA_CODE_QUALITY_BASE=upstream/main pnpm check:changed(15 checks) andpnpm -C mobile exec tsc --noEmitpass.Risk
The riskiest part is a tab whose user later starts a different agent by hand in the same terminal: if the hook still reports the launched agent as
done, the phone keeps the launched agent's icon instead of reading the title. That requires the hook's own agent type to matchlaunchAgent, so a real switch (which reports a new agent type) is unaffected. Mobile-only, no saved data or protocol changes; a plain revert backs it out.Level: Low
AI Disclosure
Investigation, fix, and test were written with Claude Code (Claude Opus 5.5), and reviewed by the author.
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)