Skip to content

feat(mobile): add independent split panes and session continuity - #33210

Closed
zytakeshi wants to merge 2 commits into
stablyai:mainfrom
zytakeshi:feat/mobile-split-panes
Closed

zytakeshi wants to merge 2 commits into
stablyai:mainfrom
zytakeshi:feat/mobile-split-panes

Conversation

@zytakeshi

@zytakeshi zytakeshi commented Oct 24, 2026 •

Copy link
Copy Markdown

ELI5

When two terminals are visible on a phone or tablet, either one should respond when you touch it. You should also be able to choose their direction and keep the same workspace when the screen changes size. This is the supporting PR for the Duo workspace series in #33221.

Latest series status

Contribution Current head Review scope
Main Duo workspace and controls, #33221 b82ca3f5cd5e5c52bef4f4c9578917bb8a860b11 Includes the companion plus the latest Duo refinements
Split panes and session continuity, #33210 f1e64ef830690f0914437ecde16ab49ac010963b Generic mobile/tablet prerequisite

The main PR includes narrow-header actions in …, removal of the synthetic top band and Duo input-dock bottom reservation, and keyboard alignment scoped to the visible terminal dock. Native chat, browser, Markdown and file views retain their existing keyboard clearance. Review the companion first, then the Duo-only comparison.

The recent Duo refinements are reviewed in #33221. This prerequisite continues to own independent pane interaction, layout selection, per-pane sizing and workspace continuity.

What Changed

Supporting PR feature Behavior
Layout choice One terminal, Auto, Side by side, Stacked
Sidebar freedom Side by side remains available with the sidebar open
Direct interaction Tap, swipe, wheel and type into either visible terminal
Third-tab selection Keep a useful pair instead of collapsing the split
Per-pane sizing Independent viewport/refit and subscription state
Rotation and resizing Retain the document, workspace and active terminal
Navigation Working tab/sidebar controls and width-independent session exit
Mixed versions Negotiate new preference keys; retain old page ownership rules
  • Add explicit One terminal, Auto, Side by side and Stacked choices, independent of whether the workspace sidebar is open.
  • Let a direct tap or scroll select and control that pane, so interacting with the second pane does not require a tab switch first.
  • Preserve the intended visible pair and active-pane relationship when another terminal tab is selected.
  • Preserve workspace navigation and active-terminal state across rotation and responsive sidebar transitions, and keep top tab/sidebar controls responsive. Use explicit split-pair and pane-viewport ownership in the existing session controller. The host-area route opts into continuity across layout classes; older routes retain their original ownership rules.

Why

A split that only accepts input on the selected tab behaves like a preview. It makes users switch tabs before scrolling or typing into the other pane. An automatic layout also should not prevent a deliberate side-by-side arrangement just because the sidebar is visible.

These state and interaction changes are separated from Duo-specific geometry, native reserved regions and the right-side control rail. They can be reviewed and used by other mobile/tablet layouts. The main PR #33221 depends on this PR; review this one first. This PR targets main independently; the Duo overview includes these commits as its dependency.

Linked Issue

Fixes #33201.

Contributes to #22597 without closing its broader foldable device/accessibility/IME acceptance scope. Main workspace/controls PR: #33221.

Visual Proof

The following media show the community implementation before the public port. The earlier and later simulator prototypes use neutral local fixtures. They are neither a matched comparison against current upstream main nor final-head acceptance evidence. Final-branch validation is listed separately below.

Motion overview (actual simulator captures with labeled explanatory motion graphics):

orca-duo-x.mp4

Earlier and later split prototypes

Earlier prototype split Later prototype: explicit layout chooser
Earlier prototype split terminals with the old toolbar arrangement Later prototype offers One terminal, Auto, Side by side and Stacked

The builds, fixture output and sidebar state differ. This illustrates the available controls; it is not an upstream-main pixel comparison or proof of pane interaction.

Both directions with the sidebar open

Side by side Stacked
Later prototype with side-by-side terminals and the sidebar open Later prototype with stacked terminals and the sidebar open

Static images demonstrate the layouts. Input, scrolling, third-tab pairing and rotation require the interaction evidence below.

All prototype media and provenance.

Testing

Latest contributor device feedback

On October 25, 2026, Takeshi Matsumoto (@zytakeshi) checked the latest combined implementation on his physical iPhone Duo and reported that the layout looks good after the added edge gaps were removed. This is contributor-reported layout feedback for the combined implementation. It does not establish exhaustive touch, home-gesture, rotation or keyboard acceptance, or a separate native run of the rebased public branch.

  • Final public branch manually tested locally. Automated local coverage is listed below; the rebased public branch has not been manually exercised in a native app.
  • Initial public-port automated checks completed. Initial implementation/review head: 2fefde5f5dc9836c79d177ccef06f1c130ee2839 (base 41d25c07).
Check Observed result
Mobile Vitest: session/terminal regression group 105 passed, 16 files
cd mobile && ORCA_BACKGROUND_LAUNCH=1 ./node_modules/.bin/vitest run src/mobile-web-shell 1,336 passed, 99 files
ORCA_BACKGROUND_LAUNCH=1 ./node_modules/.bin/vitest run config/scripts/mobile-web-page-routes.test.mjs src/shared/mobile-web-bundle/manifest-contract.test.ts 53 passed, 2 files
cd mobile && ./node_modules/.bin/tsc --noEmit --pretty false Exit 0
Mobile check-tests-typecheck-ratchet.mjs through TSX/source conditions Exit 0; 111 existing grandfathered error files, no new failures
Upstream changed-code quality (all seven scans), Oxfmt and diff checks on 63 paths Exit 0; zero new findings
ORCA_BACKGROUND_LAUNCH=1 node config/scripts/build-mobile-web-app-bundle.mjs Exit 0; 16 routes, 144 assets

Five regression controls failed with the relevant repairs removed, then passed: direct second-pane swipe ownership, per-pane grid refit, legacy init storage acceptance, document continuity through rotation, and narrow workspace-picker rendering. Full repository CI is pending.

Reviewer exercise: open at least three terminal tabs; choose Side by side with the sidebar open; scroll and type into each pane directly; select the third tab and verify the pair remains useful; switch to Stacked; repeatedly hide/show the sidebar, rotate, and open/dismiss the keyboard; verify tabs and top actions still respond and the workspace remains selected.

Takeshi Matsumoto (@zytakeshi) exercised the earlier implementation on his physical iPhone Duo and reported the original pane, tab and rotation problems that drove these fixes. Final public-branch device results are not implied by that earlier report.

Automated checks ran on Apple Silicon macOS. The generic page/controller paths were exercised in tests and a production web bundle. A fresh native app build, physical public-head validation, Windows/Linux/Android and live SSH acceptance were not run in this port. Folder workspaces use the same controller path; no git-only assumption was introduced.

CodeRabbit follow-up

Current reviewed head: f1e64ef830690f0914437ecde16ab49ac010963b. This follow-up requires both host-area flags on one matching route and lifts every visible split pane above the keyboard using that pane's own metrics. Legacy wide-only ownership, hidden panes and single-pane behavior are retained. Overlapping-route and owner-to-real-pane regressions failed before repair and pass afterward.

Current follow-up check Observed result
Complete mobile web-shell suite plus selected session/terminal regressions (exact selection below) 1,440 passed, 117 files
Production mobile TypeScript (tsc --noEmit --project mobile/tsconfig.json) Exit 0
Changed-code quality, formatting and diff check for the four follow-up paths Exit 0; zero findings
Current production web bundle Exit 0; 16 routes, 144 assets
Fresh independent standards and behavior reviews No actionable findings

The initial-port results above are retained as historical evidence; these rows describe the current follow-up. This remains the prerequisite for main PR #33221, whose Duo-only comparison excludes this commit.

Exact current mobile test selection
cd mobile
ORCA_BACKGROUND_LAUNCH=1 ./node_modules/.bin/vitest run src/mobile-web-shell src/components/terminal-shortcut-settings-custom-keys.test.tsx src/layout/side-safe-area.test.tsx src/navigation/route-handoff-host-area.web.test.tsx src/platform/keyboard-occlusion.test.tsx src/session/MobileSessionTabStrip.test.tsx src/session/TerminalPaneView.test.tsx src/session/mobile-session-preference-startup.test.ts src/session/mobile-session-terminal-frame-layout.test.tsx src/session/mobile-terminal-layout-choice.test.tsx src/session/mobile-terminal-pane-layout.test.ts src/session/mobile-terminal-split-gestures.test.tsx src/session/mobile-terminal-split-input.test.tsx src/session/use-mobile-session-keyboard-state.test.tsx src/session/use-mobile-session-terminal-subscription.test.tsx src/session/use-terminal-split-layout.test.tsx src/terminal/terminal-accessory-layout.test.ts src/terminal/terminal-cell-box-refit.test.tsx src/terminal/terminal-foreground-recovery.test.ts src/transport/mobile-web-bundle-reply-schemas.test.ts src/session/mobile-session-connection-retry.test.tsx

AI Disclosure

Implementation assistance: Codex GPT-6 Astra (high) during device iteration, Codex GPT-6.1 Sol (xhigh) during upstream preparation, and Claude Code Opus 5.5 (high) on the public continuity/storage port. Independent public-diff review and motion graphics: Claude Code Opus 5.5 (xhigh).

The standalone public diff at 2fefde5f was independently reviewed in a fresh Claude Code Opus 5.5 session at xhigh. No actionable defect was found. The source review did not execute tests; execution results are listed separately above.

Review

Fresh Opus xhigh review covered both the standalone split PR and the aggregate Duo proposal, including input ownership, lifecycle ordering, cross-layout routing, manifest producer/consumer compatibility, and storage negotiation across host rebuilds/new documents. The standalone split PR had no actionable finding.

Agent skill upstream boundary

  • Not applicable; this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

New optional route ownership is opt-in. An old page retains wide-only ownership, and an old native shell safely ignores the new ready metadata. The split preference is filtered from legacy init readers, including its oversize marker. On an older native shell, the layout choice applies to the mounted session; persistence of the new setting requires its updated allowlist. Existing per-terminal refit, stream and RPC paths are reused.

The original community Duo foundation is credited to @larskghf in #32733. This supporting PR's scope is pane interaction, layout selection and continuity; the complete Duo controls are reviewed in the main PR.

Checklist

  • This PR is focused on split panes and layout continuity
  • Explained the user-facing behavior and why
  • Prototype before/after screenshots and video attached with provenance
  • Final public diff self-reviewed and independently reviewed
  • Cross-platform, SSH/remote, folder-workspace and compatibility impact considered
  • Required lint, typecheck, test and build checks pass, with exact results above

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 9da93e4a-0f1f-4789-bc90-a64e8bcdc270
Commits

Reviewing files that changed from the base of the PR and between 2fefde5 and f1e64ef.

Files selected for processing: 4
  • mobile/src/mobile-web-shell/host-area-session.test.ts
  • mobile/src/mobile-web-shell/page-route-policy.ts
  • mobile/src/session/MobileSessionActiveContent.tsx
  • mobile/src/session/TerminalPaneView.test.tsx
Files skipped from review as they are similar to previous changes: 2
  • mobile/src/mobile-web-shell/host-area-session.test.ts
  • mobile/src/mobile-web-shell/page-route-policy.ts

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

Walkthrough

The change adds cross-layout host-area ownership for mobile web routes and updates shell routing and host-root rendering. It also adds two-terminal split layouts, pane focus and interaction handling, per-pane subscriptions and viewport refitting, and persistent layout preferences. Bridge messages negotiate storage keys so the host can filter storage sent to page readers. Tests cover routing, layout selection, pane behavior, input, and viewport recovery.

Priority: Normal

Merge Risk: Minimal · up to f1e64

The supplied changes show no outstanding issue that should prevent merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 22.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 50 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 and concisely describes the primary change: independent mobile split panes and session continuity.
Linked Issues check Passed Directly linked issue #33201 is open and active. Its coding requirements are assessed below. Non-coding items (device validation, native build, Windows/Linux/Android, live SSH) are excluded.

1. Layou…
Out of Scope Changes check Passed Each changed area maps to an objective of #33201 or supports its tests:
- Layout state and control: use-terminal-split-layout.ts, preferences.ts, MobileSessionTabStrip.tsx, MobileSessionTabStrip.test.…
Description check Passed The pull request description is complete and follows the required template. It explains the user impact, changes, rationale, linked issues, visual evidence, testing results, AI use, compatibility note…
Full details: Linked Issues check

Explanation

Directly linked issue #33201 is open and active. Its coding requirements are assessed below. Non-coding items (device validation, native build, Windows/Linux/Android, live SSH) are excluded.

  1. Layout choice (One terminal, Auto, Side by side, Stacked) independent of sidebar state [#33201]: MobileSessionTabStrip.tsx at head shows the layout button and sheet. Its choices are disabled only when !canSplitTerminals && !terminalSplitActive. use-mobile-session-terminal-webview.ts at head defines canSplitTerminals from activeHandle, terminals, and showNativeChat. It does not read sidebar state. Tests in mobile-terminal-layout-choice.test.tsx cover layout selection and persistence.

  2. Tap, swipe, and wheel select and control a visible pane without a tab switch [#33201]: surface-touch-gestures.ts, mouse-click-drag.ts, and wheel-scroll.ts emit terminal-interaction. handleTerminalInteraction calls switchTab only for a visible handle. mobile-terminal-split-gestures.test.tsx asserts that touch, wheel, mouse, and tap each activate the pane before input, and that hidden handles are ignored. Scrolling does not focus the terminal. handleTerminalTap, which focuses the terminal, runs only from the tap path. Keyboard suppression during scroll is verified by this proxy, not by a device test.

  3. Third-terminal selection keeps a useful pair; per-pane viewport and subscription [#33201]: use-mobile-session-tab-switching.ts and mobile-terminal-pane-layout.ts keep the selected terminal and one companion. Per-handle viewport state is kept in terminalPaneViewportsRef. Visible-terminal subscription logic is in use-mobile-session-terminal-webview.ts. Tests in use-mobile-session-terminal-subscription.test.tsx, terminal-cell-box-refit.test.tsx, and mobile-terminal-layout-choice.test.tsx cover separate grids and pairing after a third-tab switch.

  4. Rotation and responsive sidebar transitions keep document, workspace, and active terminal [#33201]: canOwnHostAreaAcrossLayouts is added to the manifest schema, the route declaration for /h/[hostId], and page-route-policy.ts. The host-area layout-class and host-root responsive tests cover the same session across width changes for opted-in routes.

  5. Leaving a session reaches the workspace picker at either width, including cold detail links [#33201]: MobileWebShellScreen.tsx uses isHostRouteOf at both widths. host-area-leave-session.test.tsx expects a cold detail route to be replaced, not pushed.

  6. Layout persistence without unsupported keys to older readers; safe fallback for old shells [#33201]: preferences.ts adds orca:terminalSplitLayout. page-storage-keys.ts sends that key only when the page declares it in ready.storageKeys. bridge-envelope.ts validates the declaration. page-storage-keys-negotiation.test.ts covers legacy pages, malformed declarations, and older shells.

All six objectives have implementation and automated tests at the reviewed head. The contribution to #22597 is not assessed as a requirement, per the PR scope.

Full details: Out of Scope Changes check

Explanation

Each changed area maps to an objective of #33201 or supports its tests:

  • Layout state and control: use-terminal-split-layout.ts, preferences.ts, MobileSessionTabStrip.tsx, MobileSessionTabStrip.test.tsx.
  • Pane interaction: surface-touch-gestures.ts, mouse-click-drag.ts, wheel-scroll.ts, terminal-webview-contract.ts, terminal-webview-notification-dispatch.ts, use-terminal-webview-controller.ts, TerminalPaneView.tsx.
  • Pane state and pairing: mobile-terminal-pane-layout.ts, use-mobile-session-tab-switching.ts, use-mobile-session-tab-application.ts, use-mobile-session-terminal-runtime.ts, use-mobile-session-terminal-subscription.ts, use-mobile-session-terminal-webview.ts.
  • Refit and recovery: terminal-viewport-refit.ts, terminal-viewport-refit-options.ts, terminal-foreground-recovery.ts, use-mobile-session-keyboard-state.ts, use-mobile-session-presentation.ts, use-mobile-session-lifecycle.ts.
  • Route ownership and continuity: mobile-web-page-routes.mjs, build-mobile-web-app-bundle.mjs, manifest-contract.ts, mobile-web-bundle-reply-schemas.ts, page-route-policy.ts, host route page index.web.tsx, MobileWebShellScreen.tsx.
  • Storage negotiation: page-storage-keys.ts, bridge-host.ts, bridge-host-back.ts, bridge-client-init-handshake.ts, bridge-envelope.ts.
  • Tests: the listed test files cover the same objectives.

The reviewed summary shows no Duo-specific geometry, native reserved-region code, or right-side control rail change. The manifest and build-script changes are needed for the opt-in cross-layout ownership flag. No unrelated feature or refactor was found.

Uncertainty: the review used the whole-PR summary and three focused reads. The reads did not cover every changed file. No contrary evidence was found.

Full details: Description check

Explanation

The pull request description is complete and follows the required template. It explains the user impact, changes, rationale, linked issues, visual evidence, testing results, AI use, compatibility notes, and review scope. It clearly states that native final-branch validation and full repository CI remain pending.

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

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

Actionable comments posted: 2


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: c9a107ba-33b7-4c06-b75b-4131c102520f
Commits

Reviewing files that changed from the base of the PR and between 5c447fb and 2fefde5.

Files selected for processing: 63
  • config/scripts/build-mobile-web-app-bundle.mjs
  • config/scripts/mobile-web-page-routes.mjs
  • config/scripts/mobile-web-page-routes.test.mjs
  • mobile/app/h/[hostId]/index.web.tsx
  • mobile/src/mobile-web-shell/MobileWebShellScreen.tsx
  • mobile/src/mobile-web-shell/bridge-host-back.ts
  • mobile/src/mobile-web-shell/bridge-host.ts
  • mobile/src/mobile-web-shell/bridge/bridge-back-round-trip.test.ts
  • mobile/src/mobile-web-shell/bridge/bridge-client-init-handshake.ts
  • mobile/src/mobile-web-shell/bridge/bridge-envelope.ts
  • mobile/src/mobile-web-shell/bridge/bridge-rpc-client-frames.test.ts
  • mobile/src/mobile-web-shell/host-area-layout-class-change.test.tsx
  • mobile/src/mobile-web-shell/host-area-leave-session.test.tsx
  • mobile/src/mobile-web-shell/host-area-session.test.ts
  • mobile/src/mobile-web-shell/host-area-sidebar-matrix.test.tsx
  • mobile/src/mobile-web-shell/host-root-responsive-content.test.tsx
  • mobile/src/mobile-web-shell/page-route-policy.ts
  • mobile/src/mobile-web-shell/page-storage-keys-negotiation.test.ts
  • mobile/src/mobile-web-shell/page-storage-keys.ts
  • mobile/src/navigation/route-handoff-host-area.web.test.tsx
  • mobile/src/session/MobileSessionActiveContent.tsx
  • mobile/src/session/MobileSessionTabStrip.test.tsx
  • mobile/src/session/MobileSessionTabStrip.tsx
  • mobile/src/session/TerminalPaneView.test.tsx
  • mobile/src/session/TerminalPaneView.tsx
  • mobile/src/session/mobile-session-terminal-frame-layout.test.tsx
  • mobile/src/session/mobile-terminal-layout-choice.test.tsx
  • mobile/src/session/mobile-terminal-pane-layout.test.ts
  • mobile/src/session/mobile-terminal-pane-layout.ts
  • mobile/src/session/mobile-terminal-split-gestures.test.tsx
  • mobile/src/session/mobile-terminal-split-input.test.tsx
  • mobile/src/session/use-mobile-session-controller.ts
  • mobile/src/session/use-mobile-session-keyboard-state.test.tsx
  • mobile/src/session/use-mobile-session-keyboard-state.ts
  • mobile/src/session/use-mobile-session-lifecycle.ts
  • mobile/src/session/use-mobile-session-presentation.ts
  • mobile/src/session/use-mobile-session-screen-state.ts
  • mobile/src/session/use-mobile-session-startup.ts
  • mobile/src/session/use-mobile-session-tab-application.ts
  • mobile/src/session/use-mobile-session-tab-switching.ts
  • mobile/src/session/use-mobile-session-terminal-runtime.ts
  • mobile/src/session/use-mobile-session-terminal-stream-display.ts
  • mobile/src/session/use-mobile-session-terminal-subscription.test.tsx
  • mobile/src/session/use-mobile-session-terminal-subscription.ts
  • mobile/src/session/use-mobile-session-terminal-webview.ts
  • mobile/src/session/use-terminal-split-layout.test.tsx
  • mobile/src/session/use-terminal-split-layout.ts
  • mobile/src/storage/preferences.ts
  • mobile/src/terminal/document/mouse-click-drag.ts
  • mobile/src/terminal/document/surface-touch-gestures.ts
  • mobile/src/terminal/document/wheel-scroll.ts
  • mobile/src/terminal/terminal-cell-box-refit.test.tsx
  • mobile/src/terminal/terminal-foreground-recovery.test.ts
  • mobile/src/terminal/terminal-foreground-recovery.ts
  • mobile/src/terminal/terminal-viewport-refit-options.ts
  • mobile/src/terminal/terminal-viewport-refit.ts
  • mobile/src/terminal/terminal-webview-contract.ts
  • mobile/src/terminal/terminal-webview-notification-dispatch.ts
  • mobile/src/terminal/use-terminal-webview-controller.ts
  • mobile/src/transport/mobile-web-bundle-reply-schemas.test.ts
  • mobile/src/transport/mobile-web-bundle-reply-schemas.ts
  • src/shared/mobile-web-bundle/manifest-contract.test.ts
  • src/shared/mobile-web-bundle/manifest-contract.ts

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

AmoabaKelvin added a commit that referenced this pull request Oct 30, 2026
…d half-fold layout (#35177)

Carries over #33221 and #33210. Replaces our #34484 Duo support with the community design, on top of main's rebuilt terminal key bar (#36166).

Fixes #33200

Co-authored-by: Takeshi Matsumoto <zytakeshi520@gmail.com>
Co-authored-by: Lars Keggenhoff <lars@kghf.io>
@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thank you! This landed in #35177 with your commits intact, merged with main's newer terminal key bar. The Duo rail keeps your design and D-pad, and now lists that bar's keys.

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.

Mobile: add independent terminal splits and retain workspace across resizing

2 participants