Repository navigation
One spawn-options step for both ways Orca opens a terminal, and one first-size rule - #30390
Conversation
…irst-size rule The window lane (pty:spawn) and the host lane (runtime terminal create) each built the provider's spawn options with their own copy of the same steps. Both now call one shared assembly for the env deletions and the shared provider fields; each lane keeps only what is its own (pane reservation, Antigravity prep, agent-session claims). The duplicated provisional-size restore moves to the same module, and the window lane drops its second, identical hidden mark. A terminal's first size now comes from one rule: the caller's measured pane, then the measured group, then a lone group, then 120x40. Host creates accept the caller's measured size for the callers that move onto them next.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
|
Orca prepared terminal launches in two separate places, allowing launch options and starting sizes to drift. This change gives window and host launches one common options assembler and one first-size rule while preserving the behavior of existing callers. The full review loop finished in two rounds on Verified: the full PR workflow passed for this exact head integrated with its recorded base, including the PR checks passed aggregate, static analysis, typecheck, Linux and Windows packaging, and selected Electron checks. The CI logs confirm 3 absent-owner, 13 settings/trust, 60 launch-parity and 20 race-parity tests passed. The PR is out of draft, merge status is CLEAN, and there are zero unresolved review threads. No local tests, builds or apps were run in this final session. The lane owner's real Electron QA on the M4Air passed for this head against main For Brennan's review The first image compares main and this PR for window create, window split, CLI create, CLI split, jcode launch and background CLI create. The second shows the repeated background-create check. Three deliberate boundaries to inspect:
|


ELI5
Orca opens a terminal one of two ways: from the window, or from the host (the CLI, the phone, orchestration, agent launches, worktree startup). Each way had its own copy of the code that prepares the terminal's launch settings, and its own idea of how big the terminal starts. This PR gives both ways one copy and one size rule. Nothing changes for users today. It removes the place where the two copies drifted, and lets the callers that move to the host next keep their pane's real size.
What Changed
Problem. Every terminal launch builds the options handed to the process that starts the shell: which env keys to drop, OpenCode and Codex prep, workspace trust, shell overrides, the session id, the first size and so on. The window lane (
src/main/ipc/pty/ipc/spawn-options.ts) and the host lane (src/main/ipc/pty/runtime/spawn-options.ts) each had about 30 of these steps, copied. The WSL Pi/OMP readiness wait and pane identity (#29884) show how launch preparation can drift between the two paths.The first terminal size had the same problem:
terminal-create.ts);That last gap is the "start size" difference that blocked moving window callers onto the host before (#27173): they'd start at 120x40 and then resize, wrapping their first output.
After this change.
src/main/ipc/pty/spawn-options-assembly.tsbuilds the env deletions and every provider field both lanes share. Each lane passes in the facts it resolves its own way and keeps its own reservation, hidden-delivery and execution steps. The host's Antigravity preparation stays between shared environment deletion and shared launch-option preparation. Host history settings are sampled before preparation; window history settings are sampled after OpenCode preparation. Both paths read trust settings before trust preparation, then shell and Windows settings afterwards.src/main/ipc/pty/pty-first-size.tsholds one rule: the caller's measured pane, then the measured group the tab opens in, then a lone group, then 120x40. Host creates use it.TerminalCreateOptionsgains an optionalinitialSizethat callers pass from their own measured pane. No caller passes it yet; the next steps move window callers onto host creates and use it.User-facing change: no change intended for valid existing callers. Each path preserves its own previous options, settings-read timing and hidden-delivery behavior while using the common assembler. Caller-specific facts remain distinct. Invalid internal size measurements fall through to the next valid candidate as described below. The exact-head CI workflow and real Electron comparison both passed.
Why
The common pattern is one launch assembler in the process that spawns, so a second launch path can't drift. The size policy also follows the common pattern of accepting caller measurements and choosing a fallback in the spawning process. Intended differences: Orca retains its measured target-group and lone-group fallbacks for callers without a pane measurement, and its existing 120x40 default. These preserve today's host launches; the detailed fallback and invalid-input rules are not claimed to match the common pattern exactly.
Considered and not done here:
Differences between the lanes, and what this PR does with each (inert = equal in every reachable case):
requestIsUnmeasured): TEMPORARY per-lane input. The window treats a hidden request as unmeasured; the host never does. The later commit/presentation and begin/execute steps (C5e/C6) decide who seeds size and remove this adapter difference.Testing
c7553d5b00cabc861c5a7cc80270eb51bf56d2fe, integrated with its recorded base. Actual CI logs confirm 3 absent-owner tests, 13 settings/trust tests, 60 launch-parity tests and 20 race-parity tests passed. Static analysis/typecheck, Linux and Windows packaging and selected Electron checks also passed. No tests ran locally; the configured local hook was unavailable, and CI provided the full static gate.QA
PASS on
c7553d5b00cabc861c5a7cc80270eb51bf56d2fe. The lane owner completed real Electron QA on the M4Air using qa-gate ticket 351 and a Codex driver through the Chrome DevTools Protocol. Main26554234df9and this PR used the same build setup and test rig, with hidden test copies and isolated homes.The comparison covered six flows: a new terminal from the window, a window split, a CLI-created terminal before and after showing it, a CLI split, a jcode agent launch, and a background CLI create while another tab held focus. First terminal sizes, hidden-at-start behavior, environment presence, pane and tab identities, tab placement, focus and sidebar status matched. Sizes were 79×52 for window and host terminals, 38×52 for the window split and 79×25 for the host split.
The only observed difference is the intended platform change already described above: macOS host launches omit the two Windows-only WSL and PowerShell fields. A possible missing-character artifact in one screenshot was checked with three repeat runs per side and complete terminal-buffer captures; neither side lost characters, and the original frame differed from its preceding frame only at the blinking cursor.
All six flows, main versus this PR:
Background create repeated three times per side, immediately after return and one second later:
Notes
initialSizeis an internal create option; it isn't sent over theterminal.createwire in this PR.Author: @BrennanKB5