Skip to content

Fix mobile tab activation across cutover and usage refresh loops - #8781

Closed
Jinwoo-H wants to merge 1 commit into
mainfrom
Jinwoo-H/mobile-connection-migration-terminal-failures
Closed

Jinwoo-H wants to merge 1 commit into
mainfrom
Jinwoo-H/mobile-connection-migration-terminal-failures

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • retry idempotent mobile terminal focus and session-tab activation once when an authenticated connection cutover interrupts the original request
  • make account subscription refreshes stale-aware so direct/relay reconnect replays cannot queue forced provider fetches continuously
  • single-flight inactive Claude account previews during overlapping subscription replays

Root cause

The stable logical client intentionally rejects in-flight RPCs during connection migration after switching to the authenticated replacement. Mobile tab selection updated local state first, then silently swallowed those expected cutover failures, so the desktop could remain on the old tab and restored pending terminals could remain unactivated.

Separately, every accounts.subscribe replay called the same forced refresh lane used by an explicit user refresh. A replay arriving during an active usage fetch queued another complete cycle. Inactive Claude previews also lacked the in-flight guard already present for Codex previews.

Validation

  • 57 focused desktop rate-limit, account RPC, and remote-connection tests
  • 1,683 mobile tests passed; 2 skipped
  • desktop Node typecheck
  • mobile typecheck
  • changed-file desktop/mobile lint
  • mobile format check
  • max-lines ratchet
  • independent regression review found no remaining scoped risks for direct, relay-disabled, SSH, or older-desktop behavior

Real-device test plan

  • leave the regular phone open on the host/workspace list and verify the desktop usage meter settles instead of continuously refreshing
  • open a workspace with at least three existing terminals and switch tabs while the connection reconnects or migrates; verify the desktop follows each selection and terminal output appears without reload
  • repeat with Relay disabled, then with Relay enabled if available

The usage-loop fix requires the desktop change; the dropped-activation fix requires the mobile change.

Made with Orca 🐋

@coderabbitai

coderabbitai Bot commented Jul 15, 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: a1e48fee-f5e3-4b43-bf98-f6cdef344170

📥 Commits

Reviewing files that changed from the base of the PR and between a4cfc82 and e1de2fa.

📒 Files selected for processing (10)
  • mobile/app/h/[hostId]/session/[worktreeId].tsx
  • mobile/src/session/mobile-session-startup-source.test.ts
  • mobile/src/session/mobile-session-tab-activation.test.ts
  • mobile/src/session/mobile-session-tab-activation.ts
  • src/main/rate-limits/service.test.ts
  • src/main/rate-limits/service.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/remote-runtime-request-connection.integration.test.ts
  • src/main/runtime/rpc/methods/accounts.test.ts
  • src/main/runtime/rpc/methods/accounts.ts

📝 Walkthrough

Walkthrough

The changes add shared mobile terminal focus and session-tab activation helpers with one-time retries for logical client cutovers, then update session switching and pending-tab activation to use them. They also add stale-aware rate-limit refresh handling, prevent overlapping inactive Claude fetches, and introduce a subscriber-specific account refresh path. Account subscription RPC behavior and related mobile activation, rate-limit, runtime, and integration tests are updated accordingly.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description omits required template sections, especially Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections: Screenshots or No visual change, the Testing checklist, AI Review Report, Security Audit, and Notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 summarizes the main changes: mobile tab activation cutover handling and usage refresh loop fixes.
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.
✨ 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.

@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

Superseded by #8789, which includes the full restored-terminal, tab-selection, workspace-visibility, diagnostics, and usage-refresh fixes on a fresh branch from current main.

@Jinwoo-H Jinwoo-H closed this Jul 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