Repository navigation
Conversation
There was a problem hiding this comment.
Important
The asarUnpack change breaks four existing packaging tests and turns the worker-thread hang-watchdog guard into a vacuous pass — details inline. The terminal-color plumbing itself reads correct.
Reviewed changes
- Forward terminal colors into remote agent create/resume — new optional
terminalColorQueryRepliesonRuntimeCreateAgentSessionRequest/RuntimeEnsureAgentSessionRequestand both RPC schemas, threaded throughcreateTerminaland both operation fingerprints (a changed color set under the sameclientOperationIdnow raisesagent_session_operation_conflict). - Answer color queries after the startup window on daemon-host PTYs —
PtyStartupIngressgainspersistentColorQueries, holdingqueryOpenopen after handoff/expiry and answering each probe with a fresh answered-slot set; enabled only whenctx.isDaemonHostSpawn. - Source colors on the paired web/mobile client — new
webRuntimeAgentSessionLaunchOptionsresolves the mobile terminal theme (honoringterminalColorOverrides) with a built-in dark/light fallback before settings hydrate;web-runtime-terminal-create-operation.tsspreads it into the ensure/create params. - Collapse
asarUnpacktoout/main/**— replaces the enumerated main-module list with one glob.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe change adds optional terminal color replies to agent-session create and ensure requests and registers a runtime capability for them. Renderer launch paths derive colors from terminal themes and include them when the runtime supports the capability. Runtime create and ensure paths forward the replies to terminal creation. Create-operation fingerprints now include the replies, and tests cover capability negotiation, forwarding, and conflicts when startup colors differ. Merge Risk: 🔵 Low · up to An early legacy Codex launch can still miss its prompt background. The gap is narrow, so the PR is mergeable with owner awareness; forwarding colors through the capability-gated legacy path would close it. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e9a8bc85-bd1f-4b24-9146-c12e7fe73ef8
📥 Commits
Reviewing files that changed from the base of the PR and between dac82f6 and bf1e8f0bb3815a0a8414b3c46c86960daf2b08f8.
📒 Files selected for processing (19)
config/electron-builder.config.cjssrc/main/ipc/pty/runtime/spawn-options.tssrc/main/ipc/terminal-startup-color-query-replies.test.tssrc/main/ipc/terminal-startup-color-query-replies.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-create-agent-session.tssrc/main/runtime/orca-runtime-get-agent-session-execution-namespace.tssrc/main/runtime/remote-agent-session-host-authority.integration.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/runtime/web-runtime-agent-session-launch-options.tssrc/renderer/src/runtime/web-runtime-session-terminal-host-authority.test.tssrc/renderer/src/runtime/web-runtime-terminal-create-operation.tssrc/shared/agent-session-host-authority.tssrc/shared/pty-startup-ingress-intent.tssrc/shared/pty-startup-ingress.test.tssrc/shared/pty-startup-ingress.tssrc/shared/rpc-contract/agent-session-params.tssrc/shared/rpc-contract/terminal-unary-params.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| return { | ||
| worktree: toRuntimeWorktreeSelector(args.worktreeId), | ||
| agent, | ||
| ...(foreground && background ? { terminalColorQueryReplies: { foreground, background } } : {}), |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- changed file ---'
cat -n src/renderer/src/runtime/web-runtime-agent-session-launch-options.ts
printf '%s\n' '--- relevant symbols and files ---'
rg -n --glob '!node_modules' 'runRemoteAgentSessionLaunch|agent-session\.host-authority|terminalColorQueryReplies|remote-runtime-pty-transport|explicit.?ensure|create.*session' src | head -240
printf '%s\n' '--- diff stat and focused diff ---'
git diff --stat dac82f61bc710324f8883b11788869b6cf8a0ce2 bf1e8f0bb3815a0a8414b3c46c86960daf2b08f8
git diff --unified=25 dac82f61bc710324f8883b11788869b6cf8a0ce2 bf1e8f0bb3815a0a8414b3c46c86960daf2b08f8 -- src/renderer/src/runtime/web-runtime-agent-session-launch-options.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
printf '%s\n' '--- repository knowledge ---'
trueRepository: stablyai/orca
Length of output: 41294
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions
Length of output: 27671
🏁 Script executed:
set -eu
cat -n src/renderer/src/runtime/web-runtime-agent-session-launch-options.ts
rg -n --glob '!node_modules' 'runRemoteAgentSessionLaunch|agent-session\.host-authority|terminalColorQueryReplies|remote-runtime-pty-transport|explicit.?ensure|create.*session' src | head -240
git diff --unified=25 dac82f61bc710324f8883b11788869b6cf8a0ce2 bf1e8f0bb3815a0a8414b3c46c86960daf2b08f8 -- src/renderer/src/runtime/web-runtime-agent-session-launch-options.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tsRepository: stablyai/orca
Length of output: 41545
🏁 Script executed:
pwd && sed -n '1,220p' src/renderer/src/runtime/web-runtime-agent-session-launch-options.ts && rg -n --glob '!node_modules' 'runRemoteAgentSessionLaunch|agent-session\.host-authority|terminalColorQueryReplies|remote-runtime-pty-transport|explicit.?ensure' src | head -300Repository: stablyai/orca
Length of output: 40958
🏁 Script executed:
set -eu
printf '%s\n' '--- changed helper ---'
cat -n src/renderer/src/runtime/web-runtime-agent-session-launch-options.ts
printf '%s\n' '--- bound symbols ---'
rg -n --glob '!node_modules' 'runRemoteAgentSessionLaunch|agent-session\.host-authority|terminalColorQueryReplies|remote-runtime-pty-transport|explicit.?ensure' src
printf '%s\n' '--- diff ---'
git diff --unified=25 dac82f61bc710324f8883b11788869b6cf8a0ce2 bf1e8f0bb3815a0a8414b3c46c86960daf2b08f8 -- src/renderer/src/runtime/web-runtime-agent-session-launch-options.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tsRepository: stablyai/orca
Length of output: 41409
🏁 Script executed:
set -eu
printf '%s\n' '--- launch helper ---'
cat -n src/renderer/src/runtime/remote-agent-session-launch.ts
printf '%s\n' '--- resume capability ---'
cat -n src/renderer/src/runtime/agent-resume-host-authority-capability.ts
printf '%s\n' '--- shared host authority contracts ---'
sed -n '90,150p' src/shared/agent-session-host-authority.ts
printf '%s\n' '--- strict RPC schemas ---'
sed -n '110,175p' src/shared/rpc-contract/agent-session-params.ts
sed -n '160,195p' src/shared/rpc-contract/terminal-unary-params.ts
printf '%s\n' '--- focused host-authority test assertions ---'
sed -n '100,270p' src/renderer/src/runtime/web-runtime-session-terminal-host-authority.test.ts
sed -n '1,230p' src/renderer/src/runtime/remote-agent-session-launch.test.ts
printf '%s\n' '--- capability-focused transport tests ---'
sed -n '1,230p' src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-outcome-recovery.test.tsRepository: stablyai/orca
Length of output: 32587
🏁 Script executed:
set -eu
cat -n src/renderer/src/runtime/remote-agent-session-launch.ts
cat -n src/renderer/src/runtime/agent-resume-host-authority-capability.ts
printf '%s\n' '--- current schema lines ---'
nl -ba src/shared/rpc-contract/agent-session-params.ts | sed -n '118,170p'
nl -ba src/shared/rpc-contract/terminal-unary-params.ts | sed -n '172,190p'
printf '%s\n' '--- base schema comparison ---'
git show dac82f61bc710324f8883b11788869b6cf8a0ce2:src/shared/rpc-contract/agent-session-params.ts | nl -ba | sed -n '118,170p'
git show dac82f61bc710324f8883b11788869b6cf8a0ce2:src/shared/rpc-contract/terminal-unary-params.ts | nl -ba | sed -n '172,190p'Repository: stablyai/orca
Length of output: 11284
Gate terminalColorQueryReplies on a host capability.
webRuntimeAgentSessionLaunchOptions adds this field whenever both theme colors exist. The transport forwards it to both terminal.createAgentSession and terminal.ensureAgentSession. The base host schemas omit the field and use strict Zod objects, so older agent-session.host-authority.v1 hosts reject these requests with validation errors.
runRemoteAgentSessionLaunch falls back only for agent_session_legacy_required and method_not_found. It rethrows validation errors such as invalid_argument, so the agent launch can fail instead of using the legacy path.
Add a dedicated capability for color-query replies. Send terminalColorQueryReplies only when that capability is advertised, including both structured transport calls.
| @@ -137,7 +139,7 @@ export class PtyStartupIngress { | |||
| this.releaseQueryPending() | |||
| } | |||
| if (this.ownerBackend !== 'windows-conpty') { | |||
| this.queryOpen = false | |||
| this.queryOpen = this.persistentColorQueries | |||
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,360p' src/shared/pty-startup-ingress.ts
sed -n '1,180p' src/shared/pty-startup-ingress.test.tsRepository: stablyai/orca
Length of output: 21494
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- focused implementation ---'
cat -n src/shared/pty-startup-ingress.ts | sed -n '105,285p'
printf '%s\n' '--- parser ---'
cat -n src/shared/pty-startup-query.ts
printf '%s\n' '--- relevant tests ---'
rg -n -C 5 'persistent|closeQueryAuthority|expire|close-query|split|queryPending|partial' src/shared/pty-startup-ingress.test.ts src/shared/pty-startup-query.test.ts src/shared
printf '%s\n' '--- change versus requested base ---'
git diff --unified=25 dac82f61bc710324f8883b11788869b6cf8a0ce2 bf1e8f0bb3815a0a8414b3c46c86960daf2b08f8 -- src/shared/pty-startup-ingress.ts src/shared/pty-startup-query.tsRepository: stablyai/orca
Length of output: 45443
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- ingress consumers ---'
rg -n -C 8 'new PtyStartupIngress|onEmission:|PtyIngressEmission|answerLiveQueryReply|persistentColorQueries' src
printf '%s\n' '--- relevant contracts and delivery ---'
fd -i 'pty-startup-ingress*|terminal-query-reply-delivery*|pty-startup-query*' src --type f --exec sh -c 'echo --- "$1"; cat -n "$1"' sh {}
printf '%s\n' '--- boundary tests ---'
rg -n -C 12 'closeQueryAuthority|persistentColorQueries|deadline|advanceTimersByTime|split.*close|close.*split|expire' src --glob '*test*'Repository: stablyai/orca
Length of output: 45541
🏁 Script executed:
rg -n -C 10 'new PtyStartupIngress|PtyIngressEmission|onEmission|persistentColorQueries' srcRepository: stablyai/orca
Length of output: 42731
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- parser ---'
cat -n src/shared/pty-startup-query.ts
printf '%s\n' '--- relay emission path ---'
cat -n src/relay/pty-handler.ts | sed -n '930,975p'
printf '%s\n' '--- daemon session output path ---'
cat -n src/main/daemon/session.ts | sed -n '55,105p'
printf '%s\n' '--- responder parser bindings ---'
rg -n -C 8 'responderParser|install.*Responder|answer.*Query|OSC 10|OSC 11|persistentColorQueries' src/main src/relay src/shared --glob '!*.test.ts'
printf '%s\n' '--- focused ingress tests ---'
rg -n -C 12 'persistent|closeQueryAuthority|expire|close-query' src/shared/pty-startup-ingress.test.ts src/shared/pty-startup-ingress-*.test.tsRepository: stablyai/orca
Length of output: 41935
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- terminal capability responder ---'
fd -i 'terminal-capability-replies*|*capability*reply*' src/renderer src/main src/shared --type f
rg -n -C 12 'OSC 10|OSC 11|color.*query|terminal-capability-replies|installTerminalCapabilityReplyHandlers|Terminal\.write|writeToPty|deliver\(' src/renderer/src/components/terminal-pane src/main src/shared --glob '!*.test.ts'
printf '%s\n' '--- exact parser and ingress boundaries ---'
cat -n src/shared/pty-startup-query.ts
cat -n src/shared/pty-startup-ingress.ts | sed -n '132,165p;220,315p'Repository: stablyai/orca
Length of output: 42773
Retain partial OSC 10/11 queries across persistent boundaries.
closeQueryAuthority() and expire keep queryOpen true in persistent mode, but they release queryPending. The ingress then emits the prefix, and the later suffix does not reach answerQuery().
An attached renderer can reassemble the ordered bytes and answer the query through its OSC 10/11 handlers. This does not guarantee a response for a headless daemon session, which does not install the view-attribute responder. Retain only partial color queries in queryPending. Keep echoPending separate: preserve its existing close-boundary hold, and release it independently on expiry.
bf1e8f0 to
189d751
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the four commits pushed since the prior pullfrog review (bf1e8f0), which narrow the PR to supplying colors at launch time and add capability negotiation.
- Removed the broad
asarUnpackcollapse — theout/main/**glob and its commit were dropped entirely, restoring the enumerated unpack list, the packaging tests, and the worker-thread hang-watchdog guard. - Removed the persistent post-startup OSC responder —
persistentColorQueriesis gone fromPtyStartupIngress, its intent parser,spawn-options, and their tests; the fix now relies solely on colors supplied at startup. - Gated color fields behind a new host capability — added
agent-session.color-query-replies.v1(advertised inRUNTIME_CAPABILITIES) and acreateAgentSessionColorOptionsnegotiator that both the desktop transport and the paired web create path consult before sendingterminalColorQueryRepliesto create/ensure. - Extracted web agent launch options —
webRuntimeAgentSessionLaunchOptionscentralizes worktree/agent/agentArgs/launchPreferences plus the theme-derived colors, with a built-in dark/light fallback when settings have not hydrated. - Added capability-matrix coverage — transport and web host-authority tests now iterate color-supported true/false, and a fingerprint test asserts changed startup colors conflict under the same create operation.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the single commit pushed since the prior incremental review (189d751).
- Separated launch colors from the wire launch options —
webRuntimeAgentSessionLaunchOptionsnow returns{ launchOptions, terminalColors }instead of merging colors into the object that callers spread into create/ensure params, so the raw color values can no longer reach the wire except through the capability-gatedcreateAgentSessionColorOptions. Both host-authority call sites and the hydrated-settings test were updated to match; no behavioral change.
I reran the focused web and transport host-authority suites at 81fb8d9 (44 tests) and they pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Forward negotiated colors through the legacy… · web-runtime-terminal-create-operation.ts:161-162
src/renderer/src/runtime/web-runtime-terminal-create-operation.ts:161-162
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winForward negotiated colors through the legacy create contract.
mustUseLegacyAgentCreatemust remain active forafterTabIdandpreparedAgentCommand. The legacy request currently dropsterminalColors, and its schema and handler do not accept or forwardterminalColorQueryReplies. A legacy, runtime-owned launch before the first renderer attribute push can therefore lack OSC 10/11 replies.Extend the legacy request and runtime option chain with
terminalColorQueryReplies, then use the existing capability-gated helper in this request. Do not add the field unconditionally. Older strict hosts reject unknown terminal color fields.Suggested renderer change
params: { worktree: toRuntimeWorktreeSelector(args.worktreeId), afterTabId: args.afterTabId ? toHostSessionTabId(args.afterTabId) : undefined, targetGroupId: args.targetGroupId, command: args.command, cwd: args.cwd, ...(args.env ? { env: args.env } : {}), ...(args.envToDelete ? { envToDelete: args.envToDelete } : {}), startupCommandDelivery: args.startupCommandDelivery, ...(args.launchConfig ? { launchConfig: args.launchConfig } : {}), ...(args.launchToken ? { launchToken: args.launchToken } : {}), ...(args.agent ? { agent: args.agent } : {}), ...(args.launchAgent ? { launchAgent: args.launchAgent } : {}), ...(args.viewMode ? { viewMode: args.viewMode } : {}), + ...(await colorOptions(environmentId)), // Why: old hosts understand activate:false; new hosts use select/navigation for caller-local focus. activate: false,
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 5caba5d6-ad2b-4248-902a-3f7ad9fb5090
📥 Commits
Reviewing files that changed from the base of the PR and between bf1e8f0bb3815a0a8414b3c46c86960daf2b08f8 and 81fb8d9.
📒 Files selected for processing (7)
src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/runtime/agent-session-color-capability.tssrc/renderer/src/runtime/web-runtime-agent-session-launch-options.tssrc/renderer/src/runtime/web-runtime-session-terminal-host-authority.test.tssrc/renderer/src/runtime/web-runtime-terminal-create-operation.tssrc/shared/protocol-version.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Closing as superseded by #23925, which is merged and present on I checked this PR's scope and discussion against the merged implementation. The replacement explicitly supersedes this PR and covers its requested behavior. Thanks for the contribution; the branch is preserved. |

ELI5
When Orca starts Codex on a headless remote host, Codex can ask for terminal colors before the desktop viewer attaches. It then draws the prompt without its gray background. Sending the viewer's colors with the launch request lets the host answer during startup.
What Changed
agent-session.color-query-replies.v1before sending the new fields to strict host-owned create/ensure schemas. Older hosts receive the original request shape.The earlier broad
asarUnpackchange and persistent post-start OSC responder were removed after review. Neither is required for first-launch colors.Why
The headless host starts the agent before a viewer can answer OSC 10/11. An already attached terminal works because its viewer can answer those queries. Supplying colors at creation time lets the existing five-second startup ingress answer them. The capability gate prevents a newer client from sending unknown fields to an older host's strict schemas.
Linked Issue
Fixes #22500. Related to #16832, which covered queries from an already published terminal snapshot.
Visual Proof
The headless runtime A/B result is in #22500. Without color fields, the Codex prompt is present and its PTY snapshot contains no SGR background. With viewer colors in the create request, its snapshot contains
48;2;64;67;75(the gray background). A desktop user confirmed that a new remote Codex tab shows the band and accepts typing with the earlier patched client. The narrowed PR was validated through tests; it has not been installed over the user's running sessions.Testing
typecheck:web,typecheck:node, andcheck:code-quality:changedpassed againstdac82f61(zero new findings).AI Disclosure
OpenAI Codex (GPT-6) assisted with diagnosis, implementation, tests, and this PR description. A human verified the visible behavior on the paired desktop and headless setup with the earlier patched client.
Review
Agent skill upstream boundary
Notes
Desktop and headless runtime versions can differ. New agent color fields are sent only when the host advertises support. The legacy terminal-create path retains its existing color handling. The startup fallback uses a built-in theme only while settings are unavailable.
Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildrun. Focused gates above passed.