Skip to content

fix(wsl-host): stopped-host follow-ups — no stuck Start card, card-rule retry and dot, SSH pin - #35822

Merged
nwparker merged 3 commits into
mainfrom
nwparker/wsl-stopped-host-ux-followup
Oct 29, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/wsl-stopped-host-ux-followup

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​59 $\color{#cf222e}{\Huge{\mathbf{−}}}$​12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47

ELI5

This is a follow-up to #35732, the "a terminal on a stopped WSL distro shows Start" fix. It closes three small gaps the reviewers found:

  • the "stopped" card could get stuck on a host that was already back;
  • a pane with no server yet wasn't retried when the host came back;
  • a workspace with a terminal on a different, still-running server showed no live terminals.

It also adds a test that pins SSH behaviour.

What Changed

  • e9-reviewer's race:
    • A runtime call that finds the distro stopped publishes distro-stopped. That publish could land after liveness had already reconnected and published ready, leaving the Start card on a working host with no automatic recovery.
    • Now, once a running list confirms the distro runs, the deferred un-park re-reads the host (resumeAfterStop in wsl-host-runtime-call.ts). If its connection already answers, it publishes ready from that live connection. Otherwise it reconnects open work with noBoot, as before.
  • fix-reviewer-2's note 1: useRetryPanesWhenWslHostReturns picks panes by the Start card's own rule (paneEnvironmentId == null || === owner). A pane whose create failed before it reached the host is retried too, and a pane on another server never is.
  • e9-reviewer's dot nit: for a workspace on a stopped host, the activity status now drops only the panes the card treats as ended: no server yet, or on the stopped host. A pane bound to another, running server keeps the dot live.
  • SSH pin: the toast unwrap from fix(wsl-host): a terminal that meets its stopped distro shows Start, and comes back with it #35732 removes only Electron's runtimeEnvironments:* wrapper. An SSH host's refusal words, and other IPC channels' wrappers, are left as they were.

Why

  • Re-reading on un-park, rather than skipping the stopped publish while the board says ready. The board's ready is exactly what's stale in the original bug, right after an external terminate. So the check happens later, when the distro is known running.
  • Liveness can't be asked to re-check here. The supervisor has no verify entry point from the service. A liveness live verdict also wouldn't re-publish a state it never changed, so the service publishes ready from the live connection itself.

Linked Issue

Internal: follow-up to #35732 (verify-7 part 2, item 1).

Visual Proof

N/A. No new UI; this corrects the existing card's and dot's states.

Testing

  • Automated tests added or updated:
    • wsl-host-service-runtime-call-stop.test.ts: a stop published after the host was already back says ready again when the distro runs, with no connect. This fails without the fix. The refusal stays a plain final Error with the same words.
    • use-wsl-host-return-retry.test.ts: a pane with no server is retried, and one on another server isn't.
    • use-worktree-activity-status.test.tsx: a pane on another, running server keeps the workspace active while its own host is stopped. This fails without the fix.
    • TerminalErrorToast.test.ts: SSH words and other channels' wrappers are unchanged.
  • pnpm tc, src/main/wsl, the terminal-pane portal, toast and retry suites, the activity-status test and pane-title-update-global-scan-budget.test.tsx (1,030 tests) pass. oxlint and check:code-quality:changed pass.

User risk: WSL hosts only.

  • A host that came back before Orca noticed it had stopped no longer keeps a stale Start card.
  • A pane with no server yet comes back with its host.
  • A workspace with a terminal on another, running server keeps its live dot while its WSL host is stopped.

AI Disclosure

Review

e9-reviewer and fix-reviewer-2.

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: behaviour unchanged, and now pinned by a test. The host status, the retry and the dot are WSL-only.
  • Flag-off: without WSL hosts, nothing here runs.

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)

nwparker and others added 3 commits October 29, 2026 00:47
…gain; retry the card's panes

- e9-reviewer: a runtime call's stop could land after liveness had already reconnected and said
  ready, leaving Start on a working host. Once the distro runs, the deferred un-park re-reads the
  host and says ready from the live connection, or reconnects open work as before.
- fix-reviewer-2: the return retry picks panes by the Start card's rule, so a pane whose create
  failed before it reached the host is retried too.
- Pins that the refusal stays a plain, final Error with the same words for the move and automation
  callers.

Co-Authored-By: Claude <[email protected]>
… live

e9-reviewer: match the Start card's rule; only a pane with no server or on the stopped host ended.

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

coderabbitai Bot commented Oct 29, 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 7 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: 96e255c7-ea17-4dcd-8399-e446b51ae276
Commits

Reviewing files that changed from the base of the PR and between bf4b011 and 74cecba.

Files selected for processing: 8
  • src/main/wsl/wsl-host-runtime-call.ts
  • src/main/wsl/wsl-host-service-runtime-call-stop.test.ts
  • src/main/wsl/wsl-host-service.ts
  • src/renderer/src/components/sidebar/use-worktree-activity-status.test.tsx
  • src/renderer/src/components/sidebar/use-worktree-activity-status.ts
  • src/renderer/src/components/terminal-pane/TerminalErrorToast.test.ts
  • src/renderer/src/components/terminal-pane/use-wsl-host-return-retry.test.ts
  • src/renderer/src/components/terminal-pane/use-wsl-host-return-retry.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.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes reach WSL host recovery and workspace activity displays.

Fix the unstable activity snapshot before merging so split terminals cannot break sidebar rendering.

Findings

  1. P1 Split terminals break sidebar rendering ▶

Summary

This PR repairs recovery after a WSL host stops and adds tests for pane retries, activity dots, and SSH error wording.

  • Stopped WSL hosts return to ready when their existing connection is live.
  • Workspace cards stay active when a terminal runs on another server.
  • WSL host return retries panes that have not reached a server yet.
  • SSH refusal messages keep their existing wording.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Runtime call finds stopped distro] --> B[Publish stopped and park host]
  B --> C[Running list confirms distro runs]
  C --> D{Existing connection available?}
  D -->|Yes| E[Publish ready]
  D -->|No, visible work| F[Retry without booting distro]
  E --> G[Retry matching or unbound panes]
Loading

Reviews (1) · Last reviewed commit: "test(terminal): pin that the host-refusa..." · Reviewed by Greptile

})
// Same array when nothing dropped, so useShallow keeps the card from re-rendering.
if (kept.length > 0) {
live[tabId] = kept.length === ptyIds.length ? ptyIds : kept

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Split terminals break sidebar rendering

When one split tab contains both a stopped host's PTY and another server's live PTY, withoutStoppedHostPtys returns a fresh filtered array on every call—even for the same store state. useShallow compares these arrays by reference, so the store hook cannot return a stable snapshot. This can trigger repeated React updates and the sidebar's recovery screen.

Cache the filtered result by input array and stopped host. Add a mounted test with both PTYs in the same tab; the current mocked, server-rendered test cannot catch this.

@nwparker
nwparker merged commit 1f13ec6 into main Oct 29, 2026
59 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