Skip to content

A layout-owner server tells a paired desktop it takes layout changes (dark, layout-owner build only) - #31131

Merged
Jinwoo-H merged 3 commits into
mainfrom
fd/h5a-server-layout-intents
Oct 20, 2026
Merged

Jinwoo-H merged 3 commits into
mainfrom
fd/h5a-server-layout-intents

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​232 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​232
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25

ELI5

When a desktop is paired to an Orca server, the desktop needs a way to ask "does this server's own background process decide tab and pane layout?" before it starts sending layout changes there. This PR makes such a server say "yes" when asked, and only in the internal test build where that new layout model is turned on. Nothing changes in any build we ship.

What Changed

  • Before: a server's status reply never said whether it takes layout changes from a paired desktop. The layout stream and layout-change methods existed, but nothing told a desktop it could rely on them.
  • After: in a build made with ORCA_LAYOUT_OWNER=main, the server's status reply lists layout.intents.v1. Shipped builds never list it, and they behave exactly as before.

Mechanism:

  • A new file, src/shared/workspace-layout/layout-intents-capability.ts, defines the name and the contract it versions:
    • the layout stream sends a snapshot first, then one numbered update per change; a reader that sees a missing number or a new stream id asks for a fresh snapshot;
    • the layout-change method only ever gains new optional fields; a new kind of command needs a new capability, because an older server refuses kinds it doesn't know;
    • a desktop that does not see the name keeps today's tab-mirror path, which the server still serves.
  • orca-runtime-get-status.ts adds the capabilities that build switches turn on, from a new file, dark-switch-runtime-capabilities.ts. The existing unread-flag capability moved there unchanged. The status file was at its line limit, and this keeps the switch points together.

Paired desktops could already reach the layout methods: their pairing grants the permission those methods declare, and the methods are not on the phone allow list. No access rule changed.

Design note for the follow-up PRs (not in this one): which group a client is showing is that client's own fact, never shared layout. The server will keep it per connection. It will open a file from the CLI or phone in the group of the most recently active client, else in the saved view. Today the server keeps one value, reported by its own window. The desktop's report of this fact joins the same contract before the switch is flipped.

Why

  • Paired desktops and servers update on their own schedules, so a desktop must not send layout changes to a server that cannot apply them.
  • A capability in the status reply is how Orca already negotiates this; the unread-flag handover uses the same pattern.
  • Versioning the frame shape and the command contract under one name gives the desktop a single question to ask. Probing each method separately would answer only part of it.
  • Later PRs make the desktop read the stream from such a server and send its layout changes there. Until then nothing reads this capability.

Linked Issue

Part of the terminal-layout final design (paired desktop to a server). No separate issue.

Visual Proof

N/A: no interface or behaviour change. The capability exists only in a build made with the layout-owner switch on, and no client reads it yet.

Testing

  • New src/main/runtime/rpc/methods/workspace-layout-paired-desktop.test.ts. It was written first, and the capability test failed before the change. It checks that:

    • the capability is advertised only with the switch on, and names methods that build registers;
    • layout.subscribe, layout.unsubscribe and layout.apply admit a paired desktop and refuse a phone; a paired desktop can subscribe, receive a snapshot, unsubscribe, and get the end frame;
    • an older desktop, one that does not send the new capability, still reaches every session.tabs change it sends today (activate, move, pane layout, tab properties, close, lifecycle close, new terminal) on a switch-on server; reorder and rename run end to end on the windowless server path.
  • Ran the status, scope, allow-list and layout-method suites with the switch on and off: 31 files pass both ways.

  • Ran the pre-push gate: changed-code quality, pnpm tc, type-aware oxlint, layout-writer ratchets, the paired-server guard and unit routing tests.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

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

  • Compatibility: the change only adds a name to the status reply, and only in switch-on builds. Older desktops ignore names they don't know. The server keeps serving every request an older desktop sends.
  • No change for SSH, mobile, Windows or Linux; a phone still cannot call the layout methods.

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)
  • 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)

E2E Test and others added 3 commits October 20, 2026 09:14
…paired desktop's layout intents (dark)

status.get adds layout.intents.v1 only in an ORCA_LAYOUT_OWNER=main build. It versions the
layout.subscribe frame shape and the layout.apply contract a paired desktop will rely on.
Tests pin the layout methods open to a paired desktop and closed to phones, and that an older
desktop still reaches every session.tabs mutation on such a server.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d800e147-bc02-4363-9233-38b5e8c7a7e6
📥 Commits

Reviewing files that changed from the base of the PR and between 1bbd636 and 0f390d5.

📒 Files selected for processing: 3
  • src/main/runtime/rpc/methods/workspace-layout-paired-desktop.test.ts
  • src/main/runtime/rpc/methods/workspace-layout.ts
  • src/shared/workspace-layout/layout-intents-capability.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • src/main/runtime/rpc/methods/workspace-layout.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

📝 Walkthrough

Runtime status now publishes workspace-unread and layout-intents capabilities according to dark-build switches and the older-host override. Tests cover layout access for paired desktops, restrictions for phones, subscriptions, and legacy tab mutations. The layout RPC documentation now describes desktop access through the layout-intents capability.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 0f390

No actionable merge-blocking risk was identified in this change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: a layout-owner server advertises layout-change support to paired desktops in the dark layout-owner build.
Description check Passed The description follows the template and explains the user impact, mechanism, rationale, testing, compatibility, and checklist status. The Linked Issue section states that no separate issue exists, so…
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.
Full details: Description check

Explanation

The description follows the template and explains the user impact, mechanism, rationale, testing, compatibility, and checklist status. The Linked Issue section states that no separate issue exists, so it does not provide the actual issue link requested by the template, but the description is otherwise complete and focused.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H merged commit 1bfb456 into main Oct 20, 2026
49 checks passed
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