Skip to content

Explain Git Bash console exhaustion when terminal startup fails - #36422

Merged
brennanb2025 merged 19 commits into
mainfrom
brennanb2025/git-bash-console-cli
Oct 30, 2026
Merged

brennanb2025 merged 19 commits into
mainfrom
brennanb2025/git-bash-console-cli

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2175 $\color{#cf222e}{\Huge{\mathbf{−}}}$​150 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2025
Prod 69 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​892 $\color{#cf222e}{\Huge{\mathbf{−}}}$​213 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​679

When Git Bash reaches its PC-wide limit of 128 consoles, new terminals can fail while existing terminals keep working. Orca detected the message only in the app window, so CLI, orchestration and paired callers could receive a generic startup error and the daemon log omitted the cause.

The process owner now recognizes the existing marker in its original first 4,096 UTF-16 code units. A confirmed natural positive exit carries that observation through existing failed-start paths. Callers receive an explanation and a request to close some Git Bash terminals and retry; the daemon records only the allowlisted reason, exit status and terminal identity. Internal error codes, launch uncertainty and cleanup remain intact. The running-terminal default stays unchanged.

The implementation follows the common pattern: the process owner retains bounded startup evidence and the actual fresh-start producer classifies the existing failure before sharing it. Intended adaptations preserve mixed-version generic fallback, exact terminal incarnations, ordinary/reused-terminal generic errors and the existing later-registration output drain. Constructor-time observed death rejects creation before publication. The ordinary renderer overlay still depends on bytes delivered to that view; structured launch failures carry the reason separately. The independent overlay retention correction is tracked in #16991.

Review path: full (process lifecycle, failure handling and additive daemon/IPC error details). Five source review rounds, the design settlement, final reference comparison and bounded-work audit completed. No saved diagnostic field, new operation, cap or default change. Subsequent CI integration repairs affect tests only. CI supplies lint and typecheck.

Windows QA used an isolated real Git Bash process with failure bytes derived from the installed DLL's exact format; this was not a capture of physical exhaustion. Native observation, allowlisted daemon diagnosis, a fresh worker's failed-start consumer, normal recovery and two genuine prompts/replies each with Claude and Codex were exercised. The fresh-worker result surfaced the actionable failure at its existing 60-second deadline, with no Task dispatched. Ordinary Windows creation returned before the fast fixture exited, so native ordinary-create early rejection was not exercised. Production admission/error-transport tests cover that contract; renderer tests and separate component screenshots cover copy and wrapping. These proofs are distinct.

The 128-console limit itself was not reached in QA: it is PC-wide and would stop every terminal on the shared test PCs; the failure was reproduced with Git Bash's exact output.

The English and Chinese component screenshots show three isolated real-component cells at a narrow width. They prove rendering only, not native/producer/RPC delivery. The toast uses a pre-appended sample environment footer to avoid real environment lookup, so the pictured footer appears before the issue link; production loads it asynchronously after the link. The Claude recovery screenshot captures its first reply; retained stage data proves the second. Baseline graceful-stop evidence is a console transcript, not the unavailable original receipt. Scoped cleanup evidence is retained. One real config hash changed on the shared machine; attribution is unknown and no contents were read. A QA lead disclosed deleting its own package-copy log with a prohibited variable-built path; the audited evidence packet remains intact, and the original remote log's retention is lead-attested.

Main's known-exit wait fix #36457 is included through the authorized integration merge 5622a42. Independent narrow review agreed with the integration and the two test-only expectation repairs at final head 3111931. All 161 tests in the four focused files passed, including the six previously failing readiness cases; normal pre-commit passed. CI passed on final head 3111931, including all twelve unit shards, enabled typecheck compilation, Windows persistence/package/D7 and WSL. The full review loop and required evidence are complete; merge approval remains pending.

Component rendering evidence (sample footer pre-appended; not native delivery):

terminal-pane__TerminalStartFailureNotices--englishNarrow.dark.png

terminal-pane__TerminalStartFailureNotices--chineseNarrow.dark.png

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39c65737-2eb0-4879-8f95-02d0880b4e69
Commits

Reviewing files that changed from the base of the PR and between e56588f and 4037c47.

Files selected for processing: 46
  • src/main/agent-launch/agent-launch-executor.ts
  • src/main/agent-launch/agent-launch-prompt-delivery.ts
  • src/main/agent-launch/agent-launch-surface-factories.ts
  • src/main/automations/headless-automation-agent-launch.test.ts
  • src/main/automations/headless-automation-agent-launch.ts
  • src/main/ipc/pty/pane/agent-session-owners.ts
  • src/main/ipc/pty/pane/complete-pane-adoption.ts
  • src/main/ipc/pty/pane/spawn-registration.ts
  • src/main/ipc/pty/pty-controller-spawn-admission.test.ts
  • src/main/ipc/pty/runtime/spawn-commit-run-facts.test.ts
  • src/main/ipc/pty/spawn-commit-assembly.ts
  • src/main/ipc/pty/spawn-execute.ts
  • src/main/ipc/pty/spawn-outcome.ts
  • src/main/persistence/loading-store/pty-spawn-exit-durability.test.ts
  • src/main/runtime/agent-transcript-pane-test-harness.ts
  • src/main/runtime/launch-agent-terminal-followup.test.ts
  • src/main/runtime/launched-agent-composer-readiness.ts
  • src/main/runtime/rpc/methods/agent-launch-prompt-carry.test.ts
  • src/main/runtime/rpc/methods/agent-launch-surfaces.ts
  • src/main/runtime/rpc/methods/agent-launch-terminal-prompt.ts
  • src/main/runtime/rpc/methods/agent-launch-worktree-creation.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-mode-selection.test.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federated-worker-agent-launch.test.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federated-worker-agent-launch.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation-launched-agent-readiness.test.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation.ts
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-agent-placement.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-launch-executor-parity.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-topology.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-worktree-creation.ts
  • src/main/runtime/runtime-folder-worktree-create.test.ts
  • src/main/runtime/runtime-folder-worktree-create.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.test.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.ts
  • src/main/runtime/runtime-managed-worktree-create-types.ts
  • src/main/runtime/runtime-worktree-startup-readiness.ts
  • src/main/runtime/terminal-list-pending-pty-registration.test.ts
  • src/main/runtime/terminal-start-failure-readiness.test.ts
  • src/main/runtime/terminal/launch/terminal-create-deduplication.ts
  • src/main/runtime/terminal/lifecycle/pty-registration.ts
  • src/main/runtime/workspaces/workspace-activation.ts
  • src/main/runtime/workspaces/workspace-creation.ts
  • src/renderer/src/components/terminal-pane/agent-launch-pane-notice.test.ts
  • src/shared/terminal-start-failure.test.ts
  • src/shared/terminal-start-failure.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

The change detects Git Bash console-capacity output during Windows ConPTY startup and records the diagnostic with terminal exit details. Startup failures carry this metadata through daemon and PTY admission, RPC responses, and readiness handling. Launch notices, localized text, and CLI error output provide Git Bash capacity guidance. Tests cover detection boundaries, exit-cause handling, metadata propagation, and resulting messages.

Merge Risk: Minimal · up to 4037c

No actionable merge-blocking issue is established. The planned Windows run remains useful validation before release.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 22.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… 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: explaining Git Bash console exhaustion when terminal startup fails.
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.
Description check Passed The description is detailed, on-topic, and covers the user impact, implementation, rationale, testing, platform coverage, visual proof, limitations, and review status. It does not use the template’s s…
Full details: Description check

Explanation

The description is detailed, on-topic, and covers the user impact, implementation, rationale, testing, platform coverage, visual proof, limitations, and review status. It does not use the template’s section headings and omits explicit checklist items, AI disclosure, and a direct linked issue for this PR, but the core required information is present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 22.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 58 functions across 92 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
⚔️ Resolve merge conflicts: 💡
  • Resolve merge conflict in branch brennanb2025/git-bash-console-cli
  • 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.

@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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ebd25195-7845-4f28-8a0e-c83c7f421e57
Commits

Reviewing files that changed from the base of the PR and between 61ba624 and a34432f.

Files selected for processing: 21
  • src/main/daemon/daemon-pty-adapter-replacement-exit-race.test.ts
  • src/main/daemon/daemon-pty-adapter-test-harness.ts
  • src/main/daemon/session-initial-output.ts
  • src/main/daemon/terminal-host-agent-session-claim.ts
  • src/main/daemon/terminal-host-agent-session.test.ts
  • src/main/daemon/terminal-start-failure.test.ts
  • src/main/ipc/pty/pane/agent-session-owners.ts
  • src/main/ipc/pty/pane/complete-pane-adoption.ts
  • src/main/ipc/pty/pty-agent-launch-pane-attach.test.ts
  • src/main/ipc/pty/pty-controller-spawn-admission.test.ts
  • src/main/ipc/pty/runtime/spawn-commit-run-facts.test.ts
  • src/main/ipc/pty/spawn-commit-assembly.ts
  • src/main/ipc/pty/spawn-execute.ts
  • src/main/ipc/pty/spawn-outcome.ts
  • src/main/runtime/launched-agent-composer-readiness.ts
  • src/main/runtime/rpc/methods/agent-launch-replay.test.ts
  • src/main/runtime/terminal-list-pending-pty-registration.test.ts
  • src/main/runtime/terminal-start-failure-readiness.test.ts
  • src/main/runtime/terminal/launch/terminal-create.ts
  • src/main/runtime/terminal/lifecycle/pty-registration.ts
  • src/shared/terminal-start-failure.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Comment thread src/main/ipc/pty/spawn-execute.ts Resolved
@brennanb2025

brennanb2025 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Git Bash can reject new terminals at its PC-wide 128-console limit while existing terminals keep working. Previously the app window alone recognized the message, leaving CLI, orchestration and paired callers with generic startup failures.

The process owner now retains the original first 4,096 UTF-16 code units and attaches only an allowlisted observation to a confirmed natural positive exit. Actual fresh-start producers classify that failure before sharing it, so existing consumers can explain what happened and ask users to close some Git Bash terminals and retry. Ordinary/reused-terminal waits remain generic; uncertainty, exact incarnation handling, cleanup and the running-terminal default remain unchanged. Observed death before publication rejects creation, and later registration retains its existing real output-before-exit drain.

Five source review rounds completed. Repairs addressed raw-prefix ordering, fresh readiness after an observed exit, actual producer freshness through joiners/recovery, retained history closures, and workspace warning presentation. Final reference comparison and bounded-work review agreed with the common pattern and the settled intended adaptations. Later CI integration repairs change tests only; the captured-output fixture preserves its exact bytes on Windows. Normal pre-commit checks passed. Real renderer tests cover the ordinary toast and not-started/unconfirmed notices, including the async footer order separately.

Windows QA exercised actual native output/cause, the allowlisted daemon diagnosis, a fresh worker consumer failing before Task dispatch at its existing 60-second deadline, ordinary recovery, carried state and two real prompts/replies each with Claude and Codex. The failure bytes came from the installed DLL's exact format; they were not captured by exhausting the PC. Ordinary Windows create returned before the fast fixture exited, so native ordinary-create prepublication/registration rejection was NOT EXERCISED. Production admission/control/error-transport tests prove that contract. Component screenshots prove copy/wrapping only, not native/producer/RPC delivery; the sample pre-appended footer appears before the issue link, unlike the ordinary async footer path.

The 128-console limit itself was not reached in QA: it is PC-wide and would stop every terminal on the shared test PCs; the failure was reproduced with Git Bash's exact output.

Evidence limitations: Claude's recovery image captures its first reply; retained stage data proves its second. The original baseline graceful-stop receipt was unavailable; its provenance is a console transcript. Worker-to-PTY correlation combines source enforcement with timing/uniqueness rather than a serialized direct join. Cleanup receipts are scoped to their retained timestamps. A shared-machine real-config hash changed with unknown attribution and without contents being read. A QA lead disclosed a prohibited variable-built deletion of its own package-copy log; the audited packet remains intact and remote original retention is lead-attested.

Main's known-exit wait correction #36457 is now included through merge5622a42aa692d0f3763b1c0be4a414de81554efe. Independent narrow integration review agrees that main's neutral lifetime/error builder and this PR's actual creation classification are preserved. The two stale generic/reused test expectations were corrected without runtime changes, and the same independent auditor agreed with that final delta. All161 tests in the four focused files passed, including the six original readiness failures; normal pre-commit passed. CI on final head 31119318b8fad16e5dc4d38602e93918285ad253 passed, including all twelve unit shards, actual enabled typecheck compilation, Windows persistence/package/D7, and WSL. The branch is clean, out of draft, conflict-free, and has no unresolved review threads. No in-scope findings remain.

Reviewed source head: 3111931. Windows QA runtime head: 227a8e6 (baseline f22a7d4); retained across main integration 5622a42 and the non-shipped commits 675593f, b1e10dc,36d3c97b,216f5f69,38e30714,c3995ea4,4365fa0f,31119318. Component screenshots rendered c399 shipped code, unchanged by later test-only commits and the inspected merge seams. No changed run flow was shown broken, so evidence carries under the main-merge rule.

For Brennan's review:

Baseline and branch both show the existing overlay after accepted creation; these are not early-rejection proof.

main-capacity.png

Branch existing overlay, same fixture.

branch-capacity.png

CLI terminal creation was accepted then exited.

branch-cli-terminal-pane.png

CLI agent argv handoff was accepted then exited; this does not assert readiness.

branch-cli-agent-pane.png

Fresh worker reports one actionable failure at the existing deadline; no Task dispatched.

worker-start-after.png

Claude normal recovery: image shows first reply; stage data separately records second.

branch-claude-recovery.png

Codex normal recovery and genuine replies.

branch-codex-recovery.png

State created by the baseline before upgrade.

00-base-carried-state-before-upgrade.png

Carried state after restart/upgrade.

09-carried-state.png

English real component fixtures at narrow width: not started, unconfirmed with Copy prompt, ordinary toast. Sample footer pre-appended; rendering only.

terminal-pane__TerminalStartFailureNotices--englishNarrow.dark.png

Chinese real components: translated uncertainty/Copy prompt/issue link with current English capacity fallback. Sample footer; rendering only.

terminal-pane__TerminalStartFailureNotices--chineseNarrow.dark.png

Judgment spots: producer classification, prepublication rejection, physical-PTY exit settlement.

Initial main sync b85f734 preceded QA227. The later main merge5622a42 was the authorized blocking-main-fix integration for #36457, independently reviewed on the final head; successful readiness policy and the QA'd run flows remain unchanged.

brennan-ready --force --pr 36422: READY on final head31119318; factory corrected the test-fixture-only checkout-metadata carry classification. No source or CI change was needed.

@brennanb2025
brennanb2025 merged commit 37ef6e9 into main Oct 30, 2026
78 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/git-bash-console-cli branch October 30, 2026 23:40
nwparker added a commit that referenced this pull request Nov 2, 2026
…aky tests

The ConPTY prelude mock delivered its DA1 query on a microtask, which reached only
the physical owner's early onData listener (added in #36422); the startup watch
subscribes after an await, never saw it, and every Windows-path spawn waited out
CONPTY_STARTUP_DECISION_LIMIT_MS (5 s). Deliver it on a macrotask like real output.

Also give two fixtures the readiness their production peers provide, and fix the
counter-file race in structured-agent-shell-environment and the async sign-in
marker race in claude-status-sign-in.
nwparker added a commit that referenced this pull request Nov 2, 2026
…aky tests (#37362)

The ConPTY prelude mock delivered its DA1 query on a microtask, which reached only
the physical owner's early onData listener (added in #36422); the startup watch
subscribes after an await, never saw it, and every Windows-path spawn waited out
CONPTY_STARTUP_DECISION_LIMIT_MS (5 s). Deliver it on a macrotask like real output.

Also give two fixtures the readiness their production peers provide, and fix the
counter-file race in structured-agent-shell-environment and the async sign-in
marker race in claude-status-sign-in.
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