Repository navigation
A CLI or phone file on a layout-owner server opens in the tab group a paired desktop shows (switch-on builds only) - #31264
Conversation
…s in the group a paired desktop shows Each paired desktop reports, through a new layout.reportView (served only by layout.intents.v1 servers, never to phones), the group it shows in each workspace the server's frames draw. The server keeps reports per connection beside the window's, opens files in the latest one's group, and drops a connection's reports when it closes, falling back to the saved view.
… paired desktop shows
…ion, as sidebarInputs.reportView does
…outranks another desktop's live report layout.reportView takes an optional refresh flag. The desktop's first report of each workspace after a stream snapshot carries it; the server ranks such entries below every live report, while they still replace the connection's own earlier entries and beat the saved view.
… when its control connection to the server comes up on a new socket The server drops a connection's view reports when it closes, and the layout stream can stay up across that, so the desktop watches the shared control diagnostics for a new socket.
…reporting to a server without layout.reportView A same-connection resubscribe re-sends its view as a refresh, which demoted the connection's own live report below an older desktop's. Ranks are now an explicit live/refresh tier. A pre-PR switch-on server answers method_not_found; the desktop then stops sending for that stream.
… a refresh, never a live report The snapshot resend read the store before the sync applied the snapshot, so the flush's group change reached the store subscription as the user's. Writes made by the frame sync now report as refreshes, and the snapshot resend runs after the flush.
…; the frame-write mark survives nested writes
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
ELI5
When you open a file from the command line or a phone on an Orca server, the server opens it in "the tab group you're looking at". A paired desktop never told the server which group it was looking at, so the file landed in whatever group was saved last. Now the desktop tells the server, and the file lands where you're looking. This only happens in the internal test build with the new layout model turned on, against a server that supports it. Nothing changes in any build we ship.
What Changed
Mechanism:
src/main/runtime/view-facts/active-group-view-facts.ts): the group each workspace shows is now kept per source, meaning the server's own window plus each paired client connection. The newest report wins, else the saved view. When a client connection closes, its reports are dropped. The window's reports behave as before.layout.reportView { activeGroupByWorkspace, refresh?: true }.layout.intents.v1never has it.src/renderer/src/runtime/server-layout-view-report.ts, wired intoserver-layout-frames.ts): for each workspace a server's layout frames draw, the desktop reports the active group when it changes. After each stream snapshot it sends everything again withrefresh: true, because a reopened stream can mean a new connection.refresh: a re-sent report ranks below every live report. A desktop that just reconnected never takes "the group you're looking at" away from another desktop the user is actively using, but it still replaces its own earlier report and beats the saved view.Why
refreshis separate: without it, a reconnect would count as the user's latest action and override a desktop that is actually in use.Frame-applied changes: a group change that comes from applying the server's own frames (a snapshot, or the server closing the shown group) is sent as
refresh, never as a live report, so a desktop never echoes the server's state back as a user choice.Unsupported servers: after a server's first "method not found" for
layout.reportView(a switch-on build from before this PR), the desktop stops reporting to it for that stream's lifetime and logs once.Reconnects: the desktop sends its reports again, with
refresh, after every layout-stream snapshot and whenever the shared-control connection to that server becomes ready on a new socket. That uses the existing shared-control diagnostics event, not a timer.By design: a desktop that only looks at a workspace, without switching groups, does not outrank an older report from the server's own window. It takes over on the user's next real switch.
Linked Issue
Part of the terminal-layout final design (H5c-v, paired desktop to a server). No separate issue.
Visual Proof
N/A: no change in any shipped build. The path exists only in a build with the layout-owner switch on, against a server that advertises the capability.
Testing
Server unit:
refresh: desktop A changes its group, then desktop B re-sends with refresh, and A still wins; without the flag B wins. These tests fail with the flag ignored.Wire: a phone is refused and a desktop is admitted. Bad params are rejected, including
refresh: false. A call with no connection is refused. A switch-off build does not register the method.Desktop: it reports frame-drawn workspaces only, and sends again only on a change. A failed send is not retried. A new snapshot re-sends with refresh, and so does a control-connection reconnect while the stream stays up. Nothing goes to an old server.
E2E (switch-on desktop and switch-on
orca serve):tests/e2e/paired-desktop-server-file-open-group.spec.ts. The desktop switches between groups B, A and B, and a server-side file open lands in each. It is on the switch-on leg. With desktop reporting disabled, the spec fails at its first step.Gates:
pnpm tc: clean.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with AI coding agents; reviewed by an independent AI review pass.
Review
An independent review, then delta reviews after each fix round. The findings fixed were: a desktop's own resend lowering its own rank; frame-applied group changes counting as live; an explicit live/refresh rank; and the stop after a method-not-found.
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)