fix(desktop): reopen a chat on the browser tab the user left it on - #7793
fix(desktop): reopen a chat on the browser tab the user left it on#7793waleedlatif1 wants to merge 6 commits into
Conversation
The resource strip pushed its own last-tab fallback onto the desktop app whenever a chat opened without an explicit selection, overriding the tab the desktop remembers the user was on. The shared desktop-tab hook now switches the native tab only for an explicit selection, adopts the desktop's active tab when the strip is on its fallback, and defers a selected tab that has not landed yet until it does. Chat hydration no longer writes a browser or terminal tab into the URL as a fallback.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
…lection Review round on the reopen fix. A late first report of the desktop app's active tab carries the tab it remembers, not a switch the user made, so it is adopted rather than claimed and agent activity can still take the view on chat open. A move away from a tab the desktop was already showing stays the user's own. Adoption now waits for the chat history to be applied, so the arrival order of the tab list and the history no longer decides which resource a chat opens on, and it skips a tab the strip has already dropped, so closing the shown tab cannot write the closed id back. Closing the shown tab selects its neighbour the way the desktop app picks the next native tab, instead of flashing through the strip's last tab. The two wrapper hooks now share one options type with the strip, and the adopt rule lives in a single helper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139YonWmiZUnPMTHoH4PtAJ
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
The effect that shows an explicitly selected tab was keyed on the selection alone, so a selection made before the desktop app published its tab list was dropped rather than applied when the tab arrived. It is now keyed on that tab being live as well, which covers the late arrival without a retry ref to arm and disarm. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139YonWmiZUnPMTHoH4PtAJ
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…store-on-chat-switch
…mbing Quality pass on the reopen fix. The late-arrival adoption now carries the same guards as the hydrated one, so a first report of the desktop app's active tab can no longer override a selection the user made before the tab list arrived. Both guards are pinned by tests that fail when either is removed. The predicate the adopt and claim paths share moved into one helper, so the single difference between them — adoption needs the tab to still be in the strip, following the user does not — is stated once. Removes a ref nothing read and an options interface with no second consumer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139YonWmiZUnPMTHoH4PtAJ
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
The test hosts took their props through a type alias derived from the hook signature. The repo asks for an interface, and the hook already exports one that is exactly this shape, so the hosts use it directly instead of restating it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139YonWmiZUnPMTHoH4PtAJ
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Note for reviewers
Adoption is gated on
hydrated(resolvedChatId === undefined || !isChatHistoryPending) because adopting writes the tab intoactiveResourceId, the single place the surface reads as the shown resource. Without the gate, whichever of the tab list and the chat history arrived first would decide what the chat opens on. The gate is computed by the caller, so if chat hydration ever moves into a queryselect, this is the flag to revisit.Type of Change
Testing
apps/simsuite green: 3,543 files, 50,870 tests.bun run type-checkacross all workspaces,bun run lint,bun run check:audits(46 audits),check:migrations, anddocs-manifest:checkall pass.Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_0139YonWmiZUnPMTHoH4PtAJ