Skip to content

fix(mobile): show the server's terminal theme on phones paired to a headless orca serve - #44457

Merged
AmoabaKelvin merged 1 commit into
mainfrom
fix/host-agent-launch-submit-and-terminal-theme
Nov 20, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
fix/host-agent-launch-submit-and-terminal-theme

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

If your phone is paired to a machine running only orca serve, with no desktop window open, every terminal on the phone used the phone's built-in dark colours and ignored the theme set on that machine. Now the server sends its own terminal theme, so the phone draws the same palette the desktop would.

Files Added Deleted Net
Test 0 0 0 0
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​142 $\color{#cf222e}{\Huge{\mathbf{−}}}$​70 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​72

What Changed

  • Before: only the desktop window worked out the phone's terminal palette and stamped it on each terminal row it published. With no window (a headless orca serve or orcad host), no row carried a terminalTheme, so the phone fell back to its fixed dark palette (DEFAULT_TERMINAL_THEME). A server set to theme: "light" with Builtin Tango Light still showed dark terminals on the phone.
  • After: the server fills terminalTheme from its own saved settings for any terminal row no window has themed. Rows a desktop window publishes keep the window's theme, as before.
  • Mechanism:
    • The resolver moves from the renderer (mobile-terminal-theme.ts) to src/shared/terminal-themes/mobile-terminal-theme.ts. It takes settings instead of the renderer store, and the renderer now calls the shared one, so desktop and server resolve the palette with the same code.
    • projectRuntimeMobileSessionTabs, which builds every frame a phone gets (list, subscription push, create reply), uses tab.terminalTheme ?? host.hostTerminalTheme().
    • hostMobileTerminalTheme caches the resolved palette per settings object. When a settings change alters it, it re-sends the phone frames, because a phone keeps the last palette it was sent.
    • With no window there is no OS appearance to read, so system resolves as dark. That is the same rule the headless host already uses to answer OSC 10/11 colour queries (terminal-view-attributes-ipc.ts), so what TUIs on that host are told about the background matches what the phone draws.

Why

The window was the only place the palette got resolved, so the fix belongs on the host, at the one projection every phone frame passes through. Each headless row builder could have stamped the theme itself (#10419 does that in three builders), but filling it in at the projection covers every builder in one place, including ones added later.

This builds on the idea in #10419 by @bbingz: the host stamps its own theme, with dark for system. That PR is stacked on the #10421 phone theme picker and is based on old file paths, so this redoes it at the current owner. Co-authored-by credit is on the commit.

Linked Issue

Fixes #23139

Visual Proof

N/A for screenshots: the phone code is unchanged and already applies terminalTheme from rows (that is how it gets a desktop host's palette today). The change is what the server puts on the wire. I captured it from a worktree-built orca serve with no window, using the same session.tabs.list RPC the phone calls:

Server settings terminalTheme on the terminal row
main, any settings absent (phone uses its dark fallback, background #1a1b26)
this branch, defaults (theme: system) mode: dark, Ghostty Default Style Dark, background #282c34
this branch, theme: light, Builtin Tango Light mode: light, background #ffffff, foreground #2e3434

Testing

  • Built main and preload from this branch and ran electron out/main/index.js --serve with a scratch profile and HOME, --password-store=basic --use-mock-keychain, no desktop window. Added a folder repo, created a terminal with session.tabs.createTerminal and read session.tabs.list. The created-terminal reply and the list both carried the server palette (table above). Then I stopped the serve, set theme: light in its saved settings and restarted: the row carried Tango Light.

  • Focused runtime tests that project phone session rows pass: session-tabs-inventory-chat-status, session-tabs-inventory-census-race, orca-runtime-mobile-markdown-tab-routes, orca-runtime-mobile-agent-status-title-truthfulness, orca-runtime-terminal-retirement (32 tests).

  • pnpm check:changed passes (typecheck, lint, related unit tests).

  • Platforms: macOS. The change has no platform branches.

  • I manually tested these changes locally

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

  • Every added test fails without this change and avoids the test anti-patterns

No test added. The behaviour is a field the host fills in when a row lacks it. The live serve check above covers it end to end, and a projection unit test would need a fake for the whole projection host.

Risk

The riskiest part is the change in what a phone shows for servers on default settings. Their terminals move from the phone's Tokyonight-style fallback to Orca's default dark terminal theme, the same one the desktop shows. A server set to light now shows light terminals on the phone, which is what #23139 asks for.

  • Desktop hosts with a window: rows keep the window's own theme. The host value is only used for rows the window has not themed yet, which before this change got the phone fallback.
  • Version skew: no new field or RPC. terminalTheme is an existing optional row field that every shipped phone already reads, so old phones pick up the server theme from a new server. A new phone on an old server sees what it sees today.
  • Desktop clients paired to a server ignore terminalTheme on rows.
  • Back out with a plain revert.

Level: Low

AI Disclosure

Review

Codex and a Claude subagent reviewed the change (review-loop, one round): no P0/P1/P2. Left as is (P3): a palette change on a desktop host with a window re-sends phone frames once even though window rows already carry the theme. The settings listener lives as long as the runtime, the same as the sibling settings listeners in the runtime constructor.

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

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Performance: the palette is resolved once per settings object and cached. Each projected row does one cached lookup.
  • SSH: SSH workspaces are projected by the desktop host, whose window themes the rows, so nothing changes there.

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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)

…ublishes one

A phone paired to a headless orca serve drew every terminal in its fixed
dark fallback, because only the desktop renderer resolved the phone
palette. Move that resolver to src/shared and let the host's phone
projection fill terminalTheme from its own settings for rows no window
themed. System reads as dark, as the host's OSC 10/11 replies do, and a
palette change re-sends the rows.

Co-authored-by: bbingz <[email protected]>
@AmoabaKelvin
AmoabaKelvin force-pushed the fix/host-agent-launch-submit-and-terminal-theme branch from 304664a to 23f58e6 Compare November 20, 2026 14:16
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The shared resolver now builds mobile terminal themes from settings, and renderer code uses it. The host projection adapter validates and caches a theme from runtime settings. Terminal tab projections use the tab’s theme when available and otherwise use the host theme.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 23f58

Phones paired to a headless server now receive the server's terminal palette, with desktop-themed rows keeping their own theme. No actionable merge risk was found. No tests were added for the new behavior, but the author reported manual verification.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the server now sends its own terminal theme to phones paired to a headless orca serve. The changeset adds server-side theme resolution, a host terminal-theme adapter, …
Description check Passed The description follows the repository template and covers each required section: ELI5, What Changed, Why, Linked Issue (Fixes #23139), Visual Proof (N/A with a reason and a before/after table of serv…
Linked Issues check Passed Linked issue #23139 requires that a phone paired to a windowless orca serve host receive the host terminal palette instead of the phone's DEFAULT_TERMINAL_THEME fallback. The change set addresses …
Out of Scope Changes check Passed All changed areas support the #23139 fix. The changes are: (1) moving resolveMobileTerminalTheme from the renderer (src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts) to the sha…
Full details: Title check

Explanation

The title names the main change: the server now sends its own terminal theme to phones paired to a headless orca serve. The changeset adds server-side theme resolution, a host terminal-theme adapter, and projection fallback that match this title. The title uses the conventional fix(mobile) prefix and is specific.

Full details: Description check

Explanation

The description follows the repository template and covers each required section: ELI5, What Changed, Why, Linked Issue (Fixes #23139), Visual Proof (N/A with a reason and a before/after table of server output), Testing, Risk (Level: Low, with version skew and back-out steps), Review, and the checklist. The AI Disclosure section is empty. The template says to fill it in unless the author is a StablyAI team member, and the description does not state whether the author is one, so this is a minor gap. The Visual Proof and Testing sections describe reproduction steps and platforms (macOS only), which meets the template's request for platform details.

Full details: Linked Issues check

Explanation

Linked issue #23139 requires that a phone paired to a windowless orca serve host receive the host terminal palette instead of the phone's DEFAULT_TERMINAL_THEME fallback. The change set addresses this in the shared projection path. projectRuntimeMobileSessionTabs (src/main/runtime/session-lifecycle/projection/runtime-mobile-session-projection.ts) now uses tab.terminalTheme ?? host.hostTerminalTheme?.(), so rows that lack a window theme receive the host palette. hostMobileTerminalTheme (host-mobile-terminal-theme.ts) resolves the palette from runtime settings through the shared resolveMobileTerminalTheme (src/shared/terminal-themes/mobile-terminal-theme.ts). It caches the result per settings object and calls onChanged when the resolved value changes. The PR description reports live checks on a windowless serve. The created-terminal reply and session.tabs.list carried the server palette for default settings (mode: dark) and for theme: light with Builtin Tango Light (mode: light). Rows that a desktop window themes keep the window theme, so the desktop-host case is not regressed. The issue does not require automated tests, and no coding requirement beyond the projection fix is stated. Limitation: the assessment relies on the diff summary and PR-reported manual checks. I did not re-read the shared resolver or the projection hunks in the repository.

Full details: Out of Scope Changes check

Explanation

All changed areas support the #23139 fix. The changes are: (1) moving resolveMobileTerminalTheme from the renderer (src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts) to the shared module, so the renderer and host use one resolver; (2) updating sync-key.ts to resolve from state.settings, which follows the moved resolver; (3) adding hostMobileTerminalTheme with its settings listener and cache, which is needed so the host palette tracks settings changes and re-sends phone frames; (4) wiring hostTerminalTheme through prune-mobile-session-tab-group-layout.ts and the projection-host contract; and (5) the one-line projection fallback. The PR does not add new RPCs or fields, and it does not change phone code. The shared-resolver move is a refactor required to reuse the same logic on the host. No unrelated feature or platform change is evident in the summary.

  • 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

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: fae358b3-5077-4f3a-9f46-7b4b2b5b2981
Commits

Reviewing files that changed from the base of the PR and between 3731b48 and 23f58e6.

Files selected for processing: 7

  • src/main/runtime/session-lifecycle/projection/host-mobile-terminal-theme.ts
  • src/main/runtime/session-lifecycle/projection/prune-mobile-session-tab-group-layout.ts
  • src/main/runtime/session-lifecycle/projection/runtime-mobile-session-projection-contract.ts
  • src/main/runtime/session-lifecycle/projection/runtime-mobile-session-projection.ts
  • src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts
  • src/renderer/src/runtime/sync-runtime-graph/sync-key.ts
  • src/shared/terminal-themes/mobile-terminal-theme.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.

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.

[Bug]: Phone paired to a headless orca serve host always gets the dark fallback terminal palette, ignoring the host terminal theme

1 participant