Skip to content

fix(keep-awake): cancel pending WSL inventory connections - #47111

Merged
AmethystLiang merged 1 commit into
mainfrom
AmethystLiang/sta-17134-keep-awake-off
Nov 24, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
AmethystLiang/sta-17134-keep-awake-off

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca stops watching a WSL host for keep-awake, it now cancels a connection that is still opening. Previously, the socket could remain open until the host answered or the connection timed out.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13

What Changed

  • Abort pending WSL inventory connections when the watcher stops. After resolving the host, the opener checks whether the watch was cancelled before it dials.
  • Pass the abort signal to the existing transport so teardown closes sockets waiting for authentication. Established streams close through their stream handle.

Why

The watcher gets a stream handle only after authentication. Reusing the transport's cancellation support covers the time before the handle exists.

Linked Issue

STA-17134. Follow-up to #47266.

Visual Proof

N/A. The change runs during main-process connection setup and teardown.

Testing

  • Reproduced the missing close event with a loopback WebSocket, then verified that teardown closes the socket while authentication is pending.
  • Passed all four WSL keep-awake tests on macOS, including the existing mode and receipt tests.
  • Passed all 27 changed-file checks, including formatting, lint, and typecheck.

Performance

Stopping a watch releases pending connections and handshake timers promptly. Each connection attempt allocates one abort controller.

Risk

Low. A cancellation bug could interrupt WSL keep-awake monitoring or leave a pending socket open. A plain revert restores the previous behavior.

Agent skill upstream boundary

  • Not applicable.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The WSL host watcher now passes an AbortSignal to stream opening and aborts pending openings when a watch ends or stops. The opener passes the signal to the transport and returns unsupported if the signal is already aborted. A new test checks that disposing the watcher closes a connected WebSocket peer.

Merge Risk: Minimal · up to 9fdea

This change cancels pending WSL keep-awake inventory connections when the watcher stops. The behavior is localized and backed by a regression test, so no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(keep-awake): cancel pending WSL inventory connections" matches the main change. The PR cancels pending WSL host connections when the keep-awake watcher stops, and passes an abort signal…
Description check Passed The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (STA-17134, follow-up to #47266), Visual Proof (N/A with reason), Testing, Performance, Risk, and the…
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.
Full details: Title check

Explanation

The title "fix(keep-awake): cancel pending WSL inventory connections" matches the main change. The PR cancels pending WSL host connections when the keep-awake watcher stops, and passes an abort signal through the transport. The title is specific and concise, and it follows a conventional commit style.

Full details: Description check

Explanation

The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (STA-17134, follow-up to #47266), Visual Proof (N/A with reason), Testing, Performance, Risk, and the Agent skill upstream boundary section. The Testing section lists a manual reproduction and test results, but the template's checkboxes are not ticked. The Risk section has no explicit 'Level:' value (Low, Medium, or High), and the Review and Notes sections are not filled in. The Linked Issue section also has no 'Fixes #' issue number. The description needs these small fixes, but it is mostly complete.

Resolution

Optional improvements: set the Risk Level: field to Low, Medium, or High; tick the Testing checklist items that apply; and confirm whether the linked issue STA-17134 should be linked with a 'Fixes #' reference, since the template requests a real issue link for outside contributors.

  • 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

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: 75262c9f-32e6-48ea-b90c-7791241013e7
Commits

Reviewing files that changed from the base of the PR and between 89b7d78 and 9fdea20.

Files selected for processing: 3

  • src/main/ipc/wsl/wsl-host-agent-awake-wiring.ts
  • src/main/power/wsl-host-agent-awake-cancellation.test.ts
  • src/main/power/wsl-host-agent-awake.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.

@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: 8c846515-67ee-4fb7-9176-5f5bfe88b16c
Commits

Reviewing files that changed from the base of the PR and between 2178e7c and f987e02.

Files selected for processing: 3

  • src/main/ipc/wsl/wsl-host-agent-awake-wiring.ts
  • src/main/power/agent-awake-service.ts
  • src/main/power/wsl-host-agent-awake.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/power/wsl-host-agent-awake.ts Resolved
@AmethystLiang AmethystLiang changed the title fix(keep-awake): skip WSL host inventory outside Auto fix(keep-awake): cancel pending WSL inventory connections Nov 23, 2026
@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/sta-17134-keep-awake-off branch from 89b7d78 to 9fdea20 Compare November 23, 2026 17:16
@AmethystLiang
AmethystLiang merged commit ab57a1c into main Nov 24, 2026
55 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