Skip to content

feat(wsl-host): a chat on a stopped WSL distro says so and offers Start - #34681

Merged
nwparker merged 2 commits into
mainfrom
nwparker/wsl-host-chat-stopped
Oct 28, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/wsl-host-chat-stopped

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​173 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​160
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​85 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​63

ELI5

When the WSL distro behind a chat stops, the chat tab used to look normal. You only found out when sending failed. Now the chat says "Ubuntu is stopped" above the composer and offers a Start button, and Start brings the chat back.

What Changed

  • use-native-chat-host-outage.ts. A chat whose host is a WSL host now reads that host's own status (wslHostStatuses). When main reports distro-stopped, the outage kind is the new stopped, and it takes precedence over the transport-based "reconnecting" and "offline". A WSL host that is only idle reconnects on its own when the chat is used, so it shows nothing new.
  • use-native-chat-host-outage-notice.ts. The stopped kind shows "{{distro}} is stopped" with a Start action. Start calls wslHosts.connect, which is the explicit connect that is allowed to boot a distro (E9). After that, it runs the same connect-and-reload as the existing Reconnect. If the start fails, a toast shows main's message and the chat doesn't try to reconnect. Other hosts' notices are unchanged.
  • en.json: two new keys, hostOutage.stopped and hostOutage.start.
  • tests/e2e/wsl-host-chat.spec.ts.
    • After the distro stops, the spec asserts that the chat shows "Ubuntu is stopped" and that nothing booted the distro.
    • It clicks Start and checks that exactly that click boots the distro, that the notice clears, and that a new message gets a reply.
    • It then stops the distro a second time and keeps the existing focus-boot path: switching away and back starts it, and the chat continues.

Why

The stopped-state screenshot from #34573's CI run showed a normal-looking chat with no hint that its distro was down. The existing "Reconnect" can't help. A runtime call never boots a parked WSL distro, which is E9, so Reconnect would just fail. Start has to go through the WSL host's explicit connect. I reused the existing host-outage notice row rather than adding a new banner.

Linked Issue

N/A (maintainer).

Visual Proof

Before and after screenshots follow in a comment once this PR's e2e run produces the after shot.

Testing

  • New NativeChatStructuredSession.wsl-host-stopped.test.tsx covers three cases:

    • the stopped notice shows the Start action, which calls wslHosts.connect and then reconnects, and the notice clears once the host is ready;
    • a failed start doesn't reconnect;
    • an idle WSL host shows no Start.
  • The existing host-outage and notice suites pass (179 tests).

  • pnpm tc, typecheck:ci, the e2e-typecheck ratchet, base, native-plugin, type-aware and anti-slop oxlint, check:code-quality:changed, ratchets, the ast-grep gates and the localization catalog checks all pass.

  • The e2e spec runs in CI's changed-e2e job.

  • I manually tested these changes locally

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

Review

Flag-off: there are no WSL hosts without ORCA_INTERNAL_WSL_HOSTS, so wslHostStatuses stays empty and chats behave exactly as before. User risk is limited to chats on a WSL host.

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

SSH and paired hosts keep their Reconnect notice. Only a WSL host's distro-stopped status changes the wording and the action.

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)

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 1 minute.

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: 2112a42c-badb-436c-a0c6-c7d80b9ea4c5
Commits

Reviewing files that changed from the base of the PR and between a626e3f and c6fbd08.

Files selected for processing: 6
  • src/main/ipc/wsl-host-handlers.ts
  • src/main/wsl/wsl-host-connect-request.test.ts
  • src/main/wsl/wsl-host-connect-request.ts
  • src/preload/api/wsl-hosts-api.ts
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.wsl-host-stopped.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-host-outage-notice.ts
Walkthrough

The change detects when a WSL distro is stopped and displays a notice with a Start action. Starting the host triggers a runtime connection and project reload; a start error displays a toast and prevents the reconnect flow. English labels and component and end-to-end tests cover the stopped-host behavior.

Priority: Normal

Merge Risk: Low · previous review a626e

The change is mergeable with a minor error-message issue: failed starts may show technical IPC text before the useful detail.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% 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 primary user-facing change: showing a stopped WSL distro notice and offering a Start action.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, testing, scope, and compatibility considerations. Visual proof is not yet attached, and the full checklist is not mar…
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: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, testing, scope, and compatibility considerations. Visual proof is not yet attached, and the full checklist is not marked complete, but the description is otherwise mostly complete and relevant.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% 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 3 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

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

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.

@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

Nitpick comments: 1
src/renderer/src/components/native-chat/NativeChatStructuredSession.wsl-host-stopped.test.tsx: 1

93-101: Trivial · Maintainability & Code Quality · Quick win

Assert the start error in the rejected-start test.

The test checks only that reconnect is skipped. It does not check the error the user sees. If a change removed the toast.error call on a rejected start and kept the reconnect guard, this test would still pass. Add an assertion for the error message that the start path shows.


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: 5addf5a6-3fad-4824-a551-516f4dbceebe
Commits

Reviewing files that changed from the base of the PR and between 4cd62c4 and a626e3f.

Files selected for processing: 5
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.wsl-host-stopped.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-host-outage-notice.ts
  • src/renderer/src/components/native-chat/use-native-chat-host-outage.ts
  • src/renderer/src/i18n/locales/en.json
  • tests/e2e/wsl-host-chat.spec.ts

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

try {
await window.api.runtimeEnvironments.wslHosts?.connect({ environmentId })
} catch (error) {
toast.error(error instanceof Error ? error.message : String(error))

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.

Minor · Functional Correctness · Quick win

Show the WSL start error without the IPC wrapper.

If wslHosts.connect rejects through Electron IPC, error.message can start with Error invoking remote method 'wslHosts:connect'. The toast then puts that wrapper before the actionable error. Use readIpcErrorDetail(error) with a fallback for other error values. (raw.githubusercontent.com)

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