Skip to content

Start a startup terminal while Orca's window is hidden instead of waiting for it to be shown - #28351

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/settle-skip-hidden-window
Oct 13, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/settle-skip-hidden-window

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you start an agent from the "+" menu and then switch to another app (so Orca is covered or minimized), the agent doesn't start until you come back to Orca. While it waits, Orca shows a false error: "Couldn't launch Claude — the terminal did not start." This PR lets the agent start right away even when Orca isn't on screen.

What Changed

The problem. A new terminal that runs a command at startup (an agent from "+", for example) first waits until the terminal's size stops changing, so the agent isn't drawn at a temporary size and left with leftover drawing on screen. This wait was added by #6940 ("Fix Codex skill preview terminal artifacts"). It counts screen refreshes (animation frames). A covered, minimized or hidden Orca window gets no screen refreshes, so the count never moves and the terminal never starts until Orca is visible again. Measured on main: "+" > Claude in a covered window started only when it was uncovered (about 65 s later), and in the meantime showed the false "terminal did not start" toast.

Panes that are hidden inside Orca (a background tab) already skip this wait. A hidden window gets nothing from the wait either: nothing is painted, so there is nothing to keep clean.

User-facing change.

  • Before: "+" > an agent, in a covered or minimized Orca, starts only when Orca is visible again, with a false "Couldn't launch … — the terminal did not start." toast while it waits.
  • After: the agent starts while Orca is covered or minimized, the false toast is gone, and the agent redraws at the real size once the window is visible again.
  • Visible windows are unchanged: the startup wait from Fix Codex skill preview terminal artifacts #6940 still runs.

Mechanism (pty-resize-geometry.ts):

  • The rule that decides whether a startup terminal waits now also checks that the window is visible, next to the existing hidden-pane check. It uses the app's existing window-visibility check (getWindowParkVisible), which also handles the macOS case where the window wrongly stays marked hidden after display sleep.
  • If the window becomes hidden while the wait is already running (you click "+" and switch apps right away), the wait ends at once and the terminal starts at the last measured size. This listens to the existing window-visibility event, with no timer.

Size while hidden. Measured on a main build with the window hidden (no screen refreshes): a new terminal measures 135×58, the same as when visible. So the terminal starts at its real size; no fallback size is needed. The wait's own measurement uses the same fit.

Why

The wait exists only to avoid visible drawing glitches, and a hidden window draws nothing. Extending the existing hidden-pane skip to the hidden window is the smallest change that removes the stall. A time limit on the wait was rejected: it would still delay every hidden launch, and it puts a guessed number on something the window's visibility already tells us.

Limits (what this does not change):

  • A window that the operating system still reports as visible while it slows its screen refreshes keeps waiting for the startup wait. Earlier Windows test runs of a hidden window saw this: about 13 s, until the wait's 12-frame limit. This PR only acts on a window reported as hidden.
  • Same as main: macOS can wrongly leave a window marked hidden while it is on screen, so Orca treats a click or key press in a "hidden" window as proof that the window is really visible. If that window is then covered without the system sending a new visibility change, Orca still treats it as visible and the startup wait keeps waiting until the next real visibility change.

Linked Issue

None (maintainer change). It lands before #28209 and #28210, which make AI-button tabs start their agent in their own terminal and so put them on this same startup wait.

Visual Proof

Hidden test window, "+" > Claude clicked while the window was hidden. Screenshots taken after the window was shown again.

main: the terminal only starts when the window is shown, and the false toast is on screen this PR: Claude already started while hidden, no toast
settle-hidden-main-covered-plus-claude.png settle-hidden-pr-covered-plus-claude.png

Testing

  • New test (fails on main, passes here): a startup terminal in a hidden window starts without waiting for screen refreshes, at the measured size, both when the window is hidden before the wait starts and when it becomes hidden during the wait.
  • Existing startup-wait tests from Fix Codex skill preview terminal artifacts #6940 and the setup-split tests stay green.
  • pnpm tc:web, oxlint on the changed files.
  • Live QA, macOS, Orca built from main and from this PR, in a test window that is never shown on the desktop. Each row starts from a visible window, which is then hidden so that it gets no screen refreshes. No input reaches the window while it is hidden.
row main this PR
"+" > Claude, window hidden before the click No terminal while hidden; "Couldn't launch Claude — the terminal did not start." toast; starts only when the window is shown again (~48 s) Terminal at 0.9 s, Claude running while hidden, 58×135, no toast
"+" > Claude, window hidden within milliseconds after the click Same as above (~42 s) Terminal 0.1 s after the click, Claude running while hidden, 58×135, no toast
AI button "Explain changes", hidden right after the click Starts while hidden; prompt pasted once and answered; no toast Same
Visible window, "+" > Codex, screenshots every 120 ms for 8 s Codex drawn at full width from the first frame; no leftover drawing Same: the startup wait from #6940 still protects visible windows
  • After the window is shown again, the PR's terminals are 58×135, the same size a visible launch gets.

Not verified

  • Linux and Windows were not tested live; the change reuses the same cross-platform visibility check other parts of the app already use.

  • Not reproduced, from review: the macOS case above, where a window is wrongly marked hidden, but before any click or key press. A launch with no input in that state would skip the startup wait (about 100–200 ms of screen refreshes). A click or shortcut launch is itself input, so it does not hit this case.

  • Deferred test nit: the "hidden during the wait" test does not check that the visibility listener is removed.

  • I manually tested these changes locally

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

AI Disclosure

Review

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

  • Cross-platform: the visibility check is the same one the app already uses on macOS, Linux and Windows. On Linux, which has no window-covered tracking, behaviour is unchanged unless the window reports hidden (minimized).
  • SSH / remote: the wait runs in the app window, so SSH terminals get the same fix. Paired-server terminals already skip this wait.
  • Mobile: unchanged.
  • Performance: one visibility listener while a startup terminal is waiting, removed when the wait ends.

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

… the window is hidden

A startup pane waits for its grid to stop changing, counted in animation
frames, so a TUI isn't drawn at a transient size. A covered or minimized
window produces no frames, so the launch waited until Orca was visible
again. Skip the settle while the window is hidden, as hidden panes already
do, and end an in-flight settle when the window becomes hidden.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Status: ready for review

The problem. A new terminal that runs a startup command, such as an agent from "+", waits for its size to settle. That wait counts screen refreshes. A covered, minimized or hidden Orca window gets no screen refreshes, so the agent started only when Orca was visible again. Meanwhile "+" showed a false "Couldn't launch Claude — the terminal did not start." toast.

User-facing change. Agents from "+" now start while Orca is covered or minimized, and the false toast is gone. Visible windows keep the startup wait from #6940, so nothing changes for them.

Review. Round 1 used two reviewers: a fresh Claude reviewer, and a Codex reviewer that also sketched its own design before reading this one. Neither found a proven issue. The Codex reviewer accepted the design: the rule sits where the startup wait is decided, it reuses the app's existing window-visibility check, and the listener for a window hidden during the wait is needed. Deferred items (not changed):

  • A window wrongly marked hidden before any click or key press would skip the wait. This came from reading the code and was not reproduced.
  • A test nit: the test does not check that the listener is removed.

Fixed during the loop. CI's changed-code gate flagged two new type casts in the test. They were replaced with one cast that carries a stated reason (c74b8b1).

Live QA (macOS, main build vs this PR, test window never shown on the desktop):

  • "+" > Claude, window hidden before the click and right after it:
    • main: no terminal until the window is shown, plus the false toast.
    • this PR: the terminal starts within 1 s while hidden, at 58×135, with no toast.
  • AI button: starts while hidden on both builds.
  • Visible "+" > Codex: drawn at full width from the first frame on both builds, with no leftover drawing.

The first QA pass hit a test-window artifact: a click while the test window was already marked hidden made Orca treat it as visible. That pass was rerun from a clean visible window with no input while hidden. The real agent config files were checked by hash before and after every run and did not change.

Readiness.

  • CI is green on c74b8b1.
  • The branch merges cleanly into current main (3a011e4), and none of the files it touches or depends on changed on main since its base.
  • File lengths are under the limits.
  • orca-ci-checks: 21/22 pass. The other one is the local typecheck:ci run, which stops before compiling with a bun "Script not found" error. The typecheck passes in CI and in a local tc:web run.

Not verified. Linux and Windows were not tested live. The case where a window the OS reports as visible slows its screen refreshes (seen in earlier Windows test runs) is out of scope.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 18:06
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ac5050c4-3c93-4add-aa18-119ee1193c26
📥 Commits

Reviewing files that changed from the base of the PR and between 8471b3a and c74b8b1.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/pty-connection-setup-split-spawn.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-resize-geometry.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

Startup-grid settling now runs only when the window is visible and the existing command-pane, pane-visibility, SSH-target, and local-runtime conditions are met. If the window becomes hidden during settling, the flow cancels settling and connects immediately. Tests cover windows hidden before settling and windows hidden after three animation frames.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to c74b8

Terminals launched while the window is hidden now start immediately instead of stalling and showing a false failure toast. No actionable merge-blocking risk remains.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 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 main change: startup terminals now start while Orca's window is hidden instead of waiting for the window to become visible.
Description check Passed The description follows the repository template and includes the user impact, implementation details, rationale, testing, visual proof, limitations, and checklist status. The lack of a linked issue is…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • 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.

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.

1 participant