Skip to content

Fix Windows Git Bash console-capacity failures - #16045

Merged
OrcaWin merged 3 commits into
mainfrom
OrcaWin/windows-conpty-capacity-errors
Aug 23, 2026
Merged

OrcaWin merged 3 commits into
mainfrom
OrcaWin/windows-conpty-capacity-errors

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Aug 23, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​321 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​317
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​340 $\color{#cf222e}{\Huge{\mathbf{−}}}$​58 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​282

ELI5

When Git Bash cannot allocate another console, Orca now keeps the failed terminal and its error on screen. The user can close unused terminals, then restart the failed pane in place.

What Changed

  • Propagate real PTY exit codes into pane lifecycle handling.
  • Preserve failed local terminal panes—including split panes—and their scrollback.
  • Detect Git Bash's exact 128-console MSYS failure across PTY chunks.
  • Show localized Restart / Close recovery actions.
  • Retry capacity failures with the original startup request, including coding agents; restart other failures as a shell.
  • Track failures per pane so simultaneous split-pane failures remain independently recoverable.
  • Keep clean exits and SSH/remote teardown behavior unchanged.

Why

Git for Windows hardcodes MAX_CONS_DEV to 128 in its MSYS2 runtime. This is not a Windows ConPTY, CPU, or RAM limit and Orca cannot safely tune it per user. Raising it requires a forked msys-2.0.dll, with shared-runtime layout and Git-for-Windows update compatibility risk. Preserving the failure and providing recovery is the safe product behavior.

Linked Issue

STA-4903

Visual Proof

Prior behavior: the failed terminal disappeared immediately, so there was no durable failure state to capture.

Failure retained with recovery actions:

Failed terminal retained with Restart and Close actions

After in-place restart and a successful echo ORCA_RESTART_OK:

Terminal working after in-place restart

Testing

  • Manually tested on Windows through Electron/CDP: exit 7 retained output, Restart spawned a working shell in place, and ORCA_RESTART_OK rendered.
  • Automated coverage added for chunked capacity detection, sole and split-pane failure retention, exit-code propagation, overlay actions, startup selection, clean exits, and SSH behavior.
  • 75 focused tests pass locally.
  • Full pnpm typecheck and pnpm build pass locally.
  • pnpm run typecheck:web, max-lines, localization, and direct normal/type-aware/React Doctor Oxlint scans pass.
  • Cross-platform CI covers the broader suite; any failures will be resolved before merge.

AI Disclosure

Review

Please focus on local-vs-remote exit ownership, split-pane recovery, and original startup preservation.

Agent skill upstream boundary

  • Not applicable; this change contains no skill-installer or upstream skill content.

Notes

  • Renderer-local behavior only; no RPC params, stream frames, opcodes, or host-published wire content changed.
  • No new filesystem, command-construction, credential, or network surface.
  • Local cleanup closed 24 stale/orphaned Orca Git Bash sessions through lifecycle APIs: OpenConsole.exe dropped from 133 to 109 (112 after validation spawned three consoles). No worktrees or files were removed.
  • pnpm run check:code-quality:changed hits the repository's Windows wrapper bug spawnSync pnpm.cmd EINVAL; its three underlying Oxlint scans pass directly.

Checklist

  • This PR is small and focused.
  • I explained what changed and why, including ELI5.
  • Before/after interaction proof is attached.
  • Self-reviewed for correctness, security, performance, and concurrent split-pane failures.
  • Cross-platform, SSH/remote, folder-workspace, and backwards-compatibility impact considered.
  • Local focused tests and typecheck pass; full lint/test/package gates are covered by CI and must be green before merge.

@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner August 23, 2026 07:22
@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae4664f1-3d89-441b-af8d-f9e1ef57046b

📥 Commits

Reviewing files that changed from the base of the PR and between 9e62e9f and 1fedd69.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/pty-connection-pty-exit-teardown.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change propagates PTY exit codes through transport and connection handling. Local process failures now report structured pane exit data, including Git Bash console-capacity detection. TerminalPane stores these exits and renders a localized overlay with restart and close actions. Restart can reuse the original startup configuration for Git Bash capacity failures. Tests cover detection, exit routing, overlay behavior, and exit-code propagation across supported locales.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
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.
Title check ✅ Passed The title clearly and concisely summarizes the PR's primary change: fixing Windows Git Bash console-capacity failures.
Description check ✅ Passed The description includes all required sections, explains the change and rationale, links the issue, provides visual proof, and documents testing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 377fe452-c347-4888-b73a-4f4b2ee36313

📥 Commits

Reviewing files that changed from the base of the PR and between 1375c57 and 4dbdc20fa2d323f5c3282f62b4f6b5e20f19e1ba.

📒 Files selected for processing (19)
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx
  • src/renderer/src/components/terminal-pane/TerminalProcessExitOverlay.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalProcessExitOverlay.tsx
  • src/renderer/src/components/terminal-pane/git-bash-console-capacity.test.ts
  • src/renderer/src/components/terminal-pane/git-bash-console-capacity.ts
  • src/renderer/src/components/terminal-pane/pty-connection-pty-exit-teardown.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-transport-detach-attach-handoff.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-handler-suspension.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-reattach-admission.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@OrcaWin
OrcaWin force-pushed the OrcaWin/windows-conpty-capacity-errors branch from 4dbdc20 to 9e62e9f Compare August 23, 2026 07:41
@OrcaWin

OrcaWin commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cba93a03-03b6-45d4-bd87-33b343b3be4f

📥 Commits

Reviewing files that changed from the base of the PR and between 4dbdc20fa2d323f5c3282f62b4f6b5e20f19e1ba and 9e62e9f.

📒 Files selected for processing (7)
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx
  • src/renderer/src/components/terminal-pane/TerminalProcessExitOverlay.test.tsx
  • src/renderer/src/components/terminal-pane/pty-connection-pty-exit-teardown.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/terminal-process-exit-restart.test.ts
  • src/renderer/src/components/terminal-pane/terminal-process-exit-restart.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@OrcaWin
OrcaWin merged commit 4c984d4 into main Aug 23, 2026
50 checks passed
CodeHourra pushed a commit to CodeHourra/orca that referenced this pull request Aug 23, 2026
* fix(terminal): retain failed local console panes

* fix(terminal): preserve failed pane restart context

* fix(terminal): scope capacity recovery to PTY binding

---------

Co-authored-by: OrcaWin <[email protected]>
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 25, 2026
* fix(terminal): retain failed local console panes

* fix(terminal): preserve failed pane restart context

* fix(terminal): scope capacity recovery to PTY binding

---------

Co-authored-by: OrcaWin <[email protected]>
(cherry picked from commit 4c984d4)
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
* fix(terminal): retain failed local console panes

* fix(terminal): preserve failed pane restart context

* fix(terminal): scope capacity recovery to PTY binding

---------

Co-authored-by: OrcaWin <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(terminal): retain failed local console panes

* fix(terminal): preserve failed pane restart context

* fix(terminal): scope capacity recovery to PTY binding

---------

Co-authored-by: OrcaWin <[email protected]>
brennanb2025 added a commit that referenced this pull request Oct 30, 2026
…ailures (#16991)

* fix(terminal): only the Windows console-limit failure keeps a dead terminal open

#16045 retained every non-zero local PTY exit and only used the Git Bash
console-capacity marker to pick the overlay's label, so an ordinary shell
exiting after a failed command left a dead pane behind on macOS and Linux too.

Claim the exit for the capacity overlay only when all of it holds: a native
local Windows ConPTY pane, a non-zero code, the same PTY whose fresh spawn was
observed, no user input on that PTY (an unsettled write counts), and the exact
MSYS marker in that PTY's own output. Every other exit falls through to the
unchanged teardown path.

Per-PTY interaction rides on the existing per-PTY process-exit record, marked at
the input-forward chokepoint so a late write acknowledgement can never label a
replacement PTY.

STA-5604

* test(terminal): pin the two unpinned arms of the Git Bash capacity gate

Gate-level ablation of the six-clause capacity condition found the six
conjuncts each individually pinned, but two neighbouring arms free:

- the `session.deps.onPaneProcessDied` presence check. The callback is
  optional on PaneConnectionDeps; without the guard a capacity exit calls
  `undefined` and throws out of the exit handler, leaving the pane neither
  retained nor torn down.
- the per-PTY keying in `noteTerminalInputForPty`. A generation installs its
  exit state when its callbacks are captured, before the transport rebinds
  its PTY id; a write in that window would be credited to the incoming PTY
  and silently suppress its capacity overlay.

Both new tests fail with their own arm reverted and pass with it restored.
No production change.

* Preserve startup input intent across terminal connection

* Keep terminal input attempts with their launch across remounts

* Load the real capacity-test transport during suite setup

* Match the paste-input test result type to its API
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