Repository navigation
The phone hides a closed tab with the same record as the desktop - #27563
Draft
brennanb2025 wants to merge 9 commits into
Draft
brennanb2025 wants to merge 9 commits into
brennanb2025 wants to merge 9 commits into
Conversation
…g-close record The phone kept its own 10 s close tombstone map. It now records an accepted close in the shared SessionTabCloseLedger (partition = worktree id), filters every applied tab list through it, and keeps its 2 s poll keyed on pending closes. A close now ends 20 s after acceptance when no list confirms it, and a pane close hides only that pane while a whole-tab close hides all its panes.
…nto brennanb2025/tab-close-phone-ledger
Keep local close effects with the active host and workspace, honor the shared refusal policy, and stop close-driven polling when its pending record expires.
…2025/tab-close-phone-ledger
…2025/tab-close-phone-ledger
…2025/tab-close-phone-ledger
…2025/tab-close-phone-ledger
Contributor
Author
|
Closed phone tabs could return when the desktop published an older tab list. The review also found that a late reply could hide a replacement host’s tab, some refused closes were treated as success, and close-driven recovery could continue after its temporary need ended. The phone now shares the desktop’s bounded close rules. Refused tabs stay visible, late replies cannot change a replacement screen, and recovery reads stop when their close record expires. Existing text drafts and unsent image attachments survive navigation.
Owned QA processes and terminals are stopped, the remote QA worktree is removed, and private evidence is preserved. This PR remains a draft; it was not marked ready or merged. |
8 tasks done
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
A phone could re-show a closed tab when the computer sent an older tab list. The phone maintained its own hiding rules, separate from the desktop. It also mistook some refused closes for success, and a close reply arriving after a host switch could hide a tab on the new host.
The phone now uses the desktop's shared close rules. A live tab stays visible when its host refuses the close, and a reply from the previous host cannot change the screen you have switched to. Close-related background reads also stop when that temporary need ends, even if the reads keep failing.
What Changed
Stacked on #27561. Review this PR against that parent; the changes here are mobile only.
The phone still waits for the host to accept a close before removing a tab. Accepted closes use the shared record, scoped to the host and workspace. Every incoming tab list passes through that record; absence confirms removal, and an unconfirmed accepted close has the shared 20-second fallback instead of the phone's previous 10 seconds. Closing one terminal pane hides only that pane; a whole-tab close covers its panes. A healthy tab stream requests recovery only while a live reason remains; a failed recovery read no longer creates an obligation that outlives the close record. Explicit refreshes and fallback for an unhealthy stream keep their existing retry behavior.
Each close captures the host, workspace and client that started it. An accepted close is recorded under that host and workspace, while its screen changes run only if the captured owner still belongs to the current screen. Switching away and back retires the old screen operation. This reuses the ownership mechanism already used for resume actions and preserves the existing controller, text drafts and unsent image attachments. Close-result interpretation comes from the same shared function the desktop uses, including older success replies.
Why
Reusing the existing lifecycle removes a second implementation and gives both clients the same refusal and expiry rules. One captured owner protects the complete local close transaction while preserving composer state across navigation.
The phone retains its existing removal-after-acceptance behavior. Intended compatibility limit: existing hosts do not return a tab-list revision with a close reply, so confirmation remains observed absence plus a time bound. This PR adds no wire fields or capabilities and makes no claim to solve every host publication or reopen race; the host changes remain separate.
Linked Issue
Part of the tab-close lifecycle series beginning with #27561; no separate issue.
Visual Proof
Native iPhone 17 Pro Simulator, iOS 26.5, paired with a hidden desktop on M4Air, using a real Claude session. The rows ran on
90af3963. The latest parent merge changes surrounding runtime code; the complete 29-file phone patch and core close, refusal, ownership and recovery files remain unchanged. Native QA was not repeated on that later merge.Phone closes a busy real Claude chat
The desktop recorded the agent working 0.7 seconds before the close. The host accepted it; the phone became empty within 3 seconds and stayed empty through 42.8 seconds, with the desktop also empty.
Desktop closes a real Claude chat
Host refuses a pinned chat close; phone retains the tab
The phone dropped the desktop-closed chat within about 3.9 seconds and stayed empty for 43.6 seconds across 12 samples. Sampling does not rule out sub-second flashes. The native refusal was a host error for a pinned tab; the separate successful-reply refusal shape is covered by unit tests, rather than this native run.
Capture limitation: Orca’s Simulator accessibility screenshot command failed despite granted permissions. These are unchanged originals captured read-only from the exact Simulator window with
screencapture; that Orca screenshot checklist did not pass. Phone input used Orca emulator and desktop input used hidden CDP. Android and physical devices were not tested.Testing
Final integrated head:
fff3c7e7adf2f5d6ff9d1e0d54327b95e05ef774, stacked on parenta26946013e1ea2fb7c825ec178c63d56e46177b3. Fresh checks on this head pass: 1,947 mobile tests across 33 explicit files, 183 desktop/shared tests across 18 files, mobile production types, the mobile test typecheck ratchet, main-process and renderer types, the changed-file writer gate and additional CI lint. The full local checker completed 21/23; its failures are five inherited import-cycle warnings in unchanged files and local Bun 1.3.14 lacking the CI compiler command. GitHub CI passes on this final head, including static analysis/typechecks, the mobile bundle and verification. Skipped end-to-end, packaging and cross-version jobs remain unverified.Coverage includes stale inventories, pane matching, refusals inside successful replies, legacy replies, host/workspace/client switches during a close, returning to the original host, unmount, background completion, retained text/image drafts, expiry despite failed/stale/unusable inventories, explicit refresh retries and existing resume behavior.
Review
Four correctness rounds, architecture challenges at the start and after round three, final readiness, and independent reviews of the parent integrations are complete. The final integration verdict is KEEP, with no new meaningful phone-branch finding. The loop fixed late reply ownership, refusal handling and recovery reads continuing after close expiry while preserving text drafts and unsent attachments.
Deferred compatibility limit: observed absence is not a causal close receipt; a repeated identifier can return after omission or expiry, and startup clears the record. Host follow-ups remain #27565, #27583 and #27586. This PR makes no permanent or cross-navigation suppression guarantee.
Agent skill upstream boundary
Notes
Client-only change: new phones use the close replies and tab lists old hosts already send; old phones see no host publication change from this PR. Host execution, folder workspace identifiers, Git provider support and platform APIs remain unchanged.
Checklist
This PR remains a draft.