Skip to content

perf(terminal): a clean WSL bridge exit skips the boot-id read - #35138

Merged
nwparker merged 1 commit into
mainfrom
nwparker/wsl-bridge-clean-exit-skip
Oct 28, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/wsl-bridge-clean-exit-skip

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7

ELI5

When you type exit in a WSL terminal opened from a \\wsl.localhost\… project, Orca checks whether the distro was restarted before closing the tab. Part of that check runs an extra wsl.exe (0.2–1 s, at most 5 s). A clean exit can't come from the distro being shut down, so Orca now skips that extra step for it, and the tab closes sooner.

What Changed

  • Before (since fix(terminal): a WSL bridge pane keeps its session when its distro is booted again before the check #35050): every bridge exit that the running list called "running" read the distro's boot id once more, including a normal exit.
  • After: a bridge exit with code exactly 0 skips the boot-id read. Its verdict is the same as before that read existed: a normal exit, and the tab closes. A non-zero exit code still gets the full check.
  • Mechanism: DaemonPtyAdapter.finishWslBridgeExit passes classifyWslBridgeExit a reboot check that answers "no" at once when exit.code === 0. The running-list check is unchanged. The verdict log line still names the code.

Why

Flag-off: not behind the WSL hosts gate. This is WSL bridge-pane behaviour, the same with the gate on or off. Native, SSH and hosted-WSL panes are unaffected.

User risk: very low. A clean exit gets today's pre-#35050 verdict, a normal exit, with one less process spawn. If a future WSL version ever exited a terminated pane with 0, that pane would close as before #35050 rather than being kept.

Linked Issue

Follow-up to #35050 (latency from reviewer A; exit-code evidence from awin).

Visual Proof

N/A.

Testing

  • daemon-pty-adapter-wsl-distro-loss.test.ts: a code-0 exit stays a normal exit even when the boot id changed, and reads the boot id only once, at spawn. The test fails without the skip.
  • pnpm tc:node, oxlint, pnpm run check:code-quality:changed and the ast-grep gate pass. src/main/daemon: 3,139 passed.

AI Disclosure

Written with Claude Code.

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.

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)

On awin a wsl --terminate exited each bridge pane with -1, while exit and exit 0 gave 0, so a
terminate never yields 0. A clean exit keeps today's verdict without the extra wsl.exe spawn.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 8e0c5d5e-310b-4f9e-9755-fd6f4a4974a0
Commits

Reviewing files that changed from the base of the PR and between 3fd9283 and 61ddaee.

Files selected for processing: 2
  • src/main/daemon/daemon-pty-adapter-wsl-distro-loss.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • 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.

@nwparker
nwparker merged commit 2a3fc83 into main Oct 28, 2026
45 checks passed
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