Skip to content

A chat started in a server workspace drawn from the server's layout stays where you opened it (switch-on builds only) - #32003

Merged
Jinwoo-H merged 17 commits into
mainfrom
fd/l270-chat-place-on-core
Oct 22, 2026
Merged

Jinwoo-H merged 17 commits into
mainfrom
fd/l270-chat-place-on-core

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor

ELI5

With the layout-owner build switch on (off in every shipped build), a desktop paired to an Orca server draws that server's workspaces from the server's layout updates ("frames"). Starting a chat in such a workspace showed the new chat's tab where you asked, then any frame that arrived before the server saved the chat removed it, and it came back at the end of the group: a flicker and a jump. Now the tab stays where you opened it, and the server saves it there.

Builds on L273-core (#31853, merged), whose "created on this desktop" hold this reuses.

What Changed

  • The server takes the place (agentSession.create). A new optional tabPlacement (groupId, afterTabId, in the server's own ids) tells the server where the creating client put the chat. One rule decides the tab's place for both the switch-on layout queue and the switch-off windowless save (chatTabLayoutCommand): the client's group if the workspace still has it, else the remembered active group; after afterTabId only if that tab is in the chosen group.
    • The create's params are a strict object, so the field is sent only to a host advertising the new capability agentSession.create.tab-placement.v1.
    • The place is a display hint, kept out of the create's fingerprint, so a retry that names a place that moved still replays the same create.
  • The desktop keeps its provisional tab and names its place (frame-drawn-chat-tab-placement.ts, switch-on only, in a workspace a paired server's frames draw):
    • The provisional chat tab is noted in L273-core's created-here record, so frames keep it inside the server's groups until the server lists the chat (the record then releases it), or the tab closes.
    • As the create is sent, the desktop reads the tab's group and the server tab before it (skipping this desktop's own held tabs, and mapping terminal tab ids back to the server's), and adds them as tabPlacement when the host has the capability.
    • That read is synchronous: it uses the capability the launch's earlier host checks already cached, rather than asking the host again. An await at that point would let a chat whose source is retiring (an eager History joiner) drop its create; the create's params are typed so an async placement cannot compile. An unknown cached capability sends no place, which is today's behaviour.
  • The schema's tab fields move to their own file, and an e2e helper that two specs each copied (reading a server's own layout) becomes one shared helper.

Why

The server owns the layout of its workspaces, so the place has to travel with the create rather than be fixed up on the desktop afterwards. Reusing the created-here hold keeps one mechanism for "a tab this desktop made that the server does not list yet" instead of a second chat-only hold.

Linked Issue

Internal (terminal-layout final design; ledger L270).

Visual Proof

N/A: dark path behind a build switch that is off in shipped builds. Covered by the e2e spec and unit tests below.

Testing

  • E2e: headless-serve-chat-tab-placement.spec.ts (new), run switch-on: a client's create naming the first of two terminals lands the chat between them. It passes at head and fails at base, where the host advertises no placement capability. The two specs moved to the shared helper (paired-desktop-server-layout-frames, paired-desktop-server-file-open-group) pass at head.

  • Unit: the placement rule (3 of 4 tests fail without it), the create handler forwarding the place outside the fingerprint, and the desktop side (frame-drawn-chat-tab-placement.test.ts: group plus preceding server tab skipping held tabs; group alone; capability false or unknown; not frame-drawn; the hold).

  • Eager History joiner: cli-chat-resume-run.test.ts runs the "terminal closes before create, then an eager History joiner" case on the frame-drawn path too, and checks its create is sent with the place. It failed when the placement awaited the host and passes now.

  • Switch-off pin: a switch-off windowless host saving a chat with no client place puts it at the end of the remembered active group, as before (passes at base and head).

  • Server specs (switch-on build at head 36bd87c): tab-composition, layout-frames, focused-terminal-create, layout-intents, client-hosted-browser and the new chat-placement spec all pass.

  • Per-test comparison (src/main/runtime, src/shared/rpc-contract, src/renderer/src/lib, src/renderer/src/runtime/server-layout-apply, src/renderer/src/components/tab-bar; run-vitest with the pinned Bun 1.4.3), head d73d889 against base main 4dd97f0:

    • switch-on: base 22,305 tests, head 22,320; no test passing at base fails at head; files that ran no tests 0; 7 failing at each side, the same. The one ABSENT test is the eager-joiner case, now split into frame-drawn false and true (both pass).
    • switch-off: no test passing at base fails at head; files that ran no tests 0; the same ABSENT rename. Head fails 2 tests in orca-runtime.test.ts, which fail at base too.
  • After merging main e710e89 (the only overlap was the e2e workflow's spec list; both additions kept): typecheck, the static gate, and the 727 tests around the changed files pass switch-on and switch-off.

  • Static gate: every pr.yml static step passes.

  • I manually tested these changes locally

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

Review

Independent reviews: no correctness bugs. A later review found the eager History joiner could lose its create on the frame-drawn path (the placement awaited the host); fixed by reading the cached capability synchronously, with a test. The main merge's resolution was reviewed clean.

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

  • Switch-off: switch-off behaviour changes only when a newer, switch-on client sends a placement (agentSession.create.tab-placement.v1); a switch-off host with no placement saves the chat exactly as before.
  • Remote and wire: agentSession.create is a strict object, so an older host refuses a create carrying an unknown field. The desktop therefore sends tabPlacement only to a host advertising agentSession.create.tab-placement.v1 (a failed probe counts as unsupported); an older host without the capability gets today's placement. Older clients never send it.
  • Hosts without the capability: the desktop still holds the tab, so it no longer flickers, but it moves to the group's end once the server saves the chat.
  • SSH and folder workspaces: only paired-server workspaces drawn from frames send a place; SSH and local workspaces are unchanged. Folder workspaces work the same as git worktrees (the e2e uses a folder workspace).

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)

…drawn workspace survive the server's frames (switch-on)

A tab the server's layout never lists (a client-hosted browser tab today; any kind recorded the
same way) used to vanish on the server's next frame rebuild. This desktop now records such tabs by
server and workspace, in its localStorage only (never a session field nor sent), and the server's
frame builds keep them as drawn, inside the server's own groups:
- A held tab drawn in a group the server lacks moves to the nearest server group; it shows there
  only if the user was on it, and the user's group follows it. The group tree stays the server's.
- The record forgets an id once the server's frame lists it, on close, and on worktree removal,
  and prunes ids the restored session no longer has before the first frame after a reload.
- A held tab's drag moves it here only (no session.tabs.move); it offers no new split, and a
  server tab sharing its group counts only the server's tabs for split no-ops.
- Client-hosted staging records its tab (both ids) in layout-owner builds; restage takes the
  worktree from its caller instead of scanning the store.
…tch off; clearer names

- With the switch off the record is never read, kept or written (a single gate in the record).
- The frame-drawn check is isDesktopCreatedTabInFrameDrawnServerWorkspace in
  frame-drawn-desktop-created-tabs.ts: "held" stays the frame hold's word.
- The held-tab placement drops its unread activeGroupId; the group follow derives it.
…ens a created chat's tab where the creating client asked, in its own group and tab ids
…client place at the end of the remembered active group, as before (test only)
…ut: the frames hold its provisional tab until the server lists it, and the create names its group and the server tab before it (layout-owner build only)
…named; the server-layout read moves to one e2e helper (test only)
…yout rule's comment names the client's place first
… and the windowless save passes its chat through, so no file passes its line limit; the placement test types its mocks without assertions
…chat-place-on-core

# Conflicts:
#	src/renderer/src/components/tab-group/tab-group-layout-owner-commands.ts
#	src/renderer/src/runtime/server-layout-frames-held-tabs.test.ts
…chat-place-on-core

# Conflicts:
#	tests/e2e/paired-desktop-server-layout-frames.spec.ts
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8ed9d463-56db-405b-aefe-6eb6fa3614c6
📥 Commits

Reviewing files that changed from the base of the PR and between d73d889 and 36bd87c.

📒 Files selected for processing: 1
  • .github/workflows/layout-owner-e2e.yml

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

📝 Walkthrough

The change adds optional group and anchor hints to structured agent-session creation. In supported frame-drawn workspaces, the renderer derives these hints from the chat tab’s group and preceding server-mapped tab. The runtime forwards the hints to tab publication and applies them when creating the layout command. Tests cover placement selection, fallback behavior, capability checks, publication, and server layout order.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 36bd8

No actionable merge risk was identified in the reviewed change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 21 files. (1 skipped:… 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 behavior change: preserving chat placement in server-layout workspaces, with the switch-on scope stated.
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.
Description check Passed The pull request description is complete and follows the repository template. It clearly explains the user impact, implementation, rationale, testing, compatibility considerations, review status, and …
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It clearly explains the user impact, implementation, rationale, testing, compatibility considerations, review status, and checklist completion. The Linked Issue section provides an internal reference but does not include a conventional issue link or Fixes # reference.

Full details: Docstring Coverage

Explanation

Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 21 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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

…e, which also skips tabs the server's frames do not hold
… snapshot still names its group; the layout-owner e2e list runs the placement spec
… tab place, so every other create keeps its timing (the eager History joiner after an early terminal close opens again)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments: 1
tests/e2e/headless-serve-chat-tab-placement.spec.ts: 1

72-93: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Run this assertion through the paired Electron chat-launch path.

The test calls host.client.call('agentSession.create', ...) and supplies tabPlacement itself. It therefore bypasses renderer group lookup, server-tab projection, capability gating, and placement injection. A regression in those steps can leave this test passing.

Launch the paired Electron client with launchPairedElectronClient, arrange the frame-drawn workspace, then use the tab-bar agent menu's chat row. QuickLaunchAgentMenuItems invokes launchAgentInNewTab with the selected group and chat surface. Keep the server-layout assertion, but remove the direct RPC and caller-supplied tabPlacement.


ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cfb81180-c86e-45bd-bc53-ba59f666db82
📥 Commits

Reviewing files that changed from the base of the PR and between e8aa9bb and cc82d81.

📒 Files selected for processing: 2
  • src/renderer/src/lib/frame-drawn-chat-tab-placement.ts
  • src/renderer/src/lib/structured-agent-session-launch-create-call.ts

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

@Jinwoo-H
Jinwoo-H merged commit 24f5c57 into main Oct 22, 2026
53 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