Repository navigation
fix(mobile): show the server's terminal theme on phones paired to a headless orca serve - #44457
Conversation
…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]>
304664a to
23f58e6
Compare
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
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.What Changed
orca serveor orcad host), no row carried aterminalTheme, so the phone fell back to its fixed dark palette (DEFAULT_TERMINAL_THEME). A server set totheme: "light"with Builtin Tango Light still showed dark terminals on the phone.terminalThemefrom its own saved settings for any terminal row no window has themed. Rows a desktop window publishes keep the window's theme, as before.mobile-terminal-theme.ts) tosrc/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), usestab.terminalTheme ?? host.hostTerminalTheme().hostMobileTerminalThemecaches 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.systemresolves 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
terminalThemefrom 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-builtorca servewith no window, using the samesession.tabs.listRPC the phone calls:terminalThemeon the terminal row#1a1b26)theme: system)mode: dark, Ghostty Default Style Dark, background#282c34theme: light, Builtin Tango Lightmode: light, background#ffffff, foreground#2e3434Testing
Built main and preload from this branch and ran
electron out/main/index.js --servewith a scratch profile and HOME,--password-store=basic --use-mock-keychain, no desktop window. Added a folder repo, created a terminal withsession.tabs.createTerminaland readsession.tabs.list. The created-terminal reply and the list both carried the server palette (table above). Then I stopped the serve, settheme: lightin 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:changedpasses (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.
terminalThemeis 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.terminalThemeon rows.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
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)