Repository navigation
fix(wsl-mover): undo's host checks fail closed with one deadline; label moved automations - #34686
Conversation
… label moved automations Follow-ups from the #34059 undo review, stacked on it: - A host workspace's terminal count reads as zero only when the host says it no longer has the workspace (selector_not_found); any other error, or an answer it cannot read, now counts as the host not answering, so undo refuses. - The exit wait keeps one wall-clock deadline for the whole stop instead of counting polls, so a slow host can no longer stretch it many times over. - A test for D1b-7a's hydration purge rule: a moved project's chats survive, a stale worktree still goes. - A moved project's local automation reads "Runs on the <distro> host" in the list, where it read Enabled though this computer never runs it.
…xit after the last sleep A slow but healthy host with many workspaces could spend the whole stop budget sleeping them and then read as still running on the first exit check. The exit wait now runs at least 5 s past the last sleep, within or beyond the overall deadline.
faa04bd to
1d2d4bb
Compare
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Use a controlled clock in this test. · wsl-move-host-copy-stop.test.ts:28
src/main/persistence/moving-wsl-projects/wsl-move-host-copy-stop.test.ts:28
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick winUse a controlled clock in this test.
The new five-second minimum makes this test spin for five real seconds because
port().waitresolves immediately. Both mocks also retain every call, increasing memory use throughout the loop. (vitest.dev)Advance a fake clock in
wait, as the slow-host tests do. Based on learnings: time-dependent tests should use a controlled clock.Source: Learnings

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:
644ce08a-ddef-4a9f-a674-1e8cc7394d7c
Files selected for processing: 11-
src/main/ipc/wsl-move-undo-wiring.test.tssrc/main/ipc/wsl-move-undo-wiring.tssrc/main/persistence/moving-wsl-projects/wsl-move-host-copy-stop.test.tssrc/main/persistence/moving-wsl-projects/wsl-move-host-copy-stop.tssrc/renderer/src/components/automations/AutomationListLocalRow.tsxsrc/renderer/src/components/automations/AutomationListLocalRows.test.tsxsrc/renderer/src/components/automations/AutomationListStatusCell.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/store/repos/wsl-moved-project-automation.test.tssrc/renderer/src/store/repos/wsl-moved-projects.tssrc/renderer/src/store/slices/worktrees-hydration-purge.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
| return 'stopped' | ||
| } | ||
| if (waited >= exitWaitMs) { | ||
| if (now() >= exitDeadline) { |
There was a problem hiding this comment.
Enforce the deadline during host calls.
The deadline is checked only after every preflight, sleep, and exit check completes. For ten workspaces whose terminal checks each take nine seconds, preflight and one exit sweep alone take about three minutes. RPC queueing and WSL setup also occur outside the request timeout. (raw.githubusercontent.com)
Enforce the budget between checks and bound in-flight calls. Preserve the five-second post-sleep exit window and handle cancellation safely.
| : translate('auto.components.automations.enablement.paused', 'Paused') | ||
| const isSelected = isSelectedLocal && selectedRowKey === row.key | ||
| const movedToDistro = useAppStore( | ||
| (state) => wslMovedProjectForAutomation(state.wslMovedProjects, automation)?.distro ?? null |
There was a problem hiding this comment.
Limit the moved-host label to the retained desktop row.
When the host catalog lists the host’s copy of a moved automation, that row can also have executionTargetType: 'local' and the same project ID. This lookup ignores row.catalogRef, so the host-owned row receives movedToDistro too. A paused host-owned automation then displays “Runs on the Ubuntu host” instead of “Paused.” Check the row’s originating authority before applying the retained-copy label. (raw.githubusercontent.com)
ELI5
Four small follow-ups to the WSL project mover (#34059). Two make "Use on this computer again" (undo) refuse instead of guessing when the WSL host gives odd answers or is slow. One adds a missing test. One stops the automations list from calling a moved project's automation "Enabled" on this computer, when the WSL host is the one that runs it.
Base:
main(rebased onto 1eaaf85, where #34059 landed). Everything here is behindORCA_INTERNAL_WSL_HOSTS, like the mover.What Changed
selector_not_found) counts as 0. Anything else counts as the host not answering, and undo refuses with the existing "host isn't answering" message.hydrated-worktree-purge.tsand had no test. The new test fails if the rule is removed.Why
Linked Issue
N/A (maintainer follow-up to #34059).
Visual Proof
The automations list row text changes from "Enabled" to "Runs on the Ubuntu host" for a moved project's local automation only. It's gated behind
ORCA_INTERNAL_WSL_HOSTS, so with the flag off the list is unchanged. A render test covers it, and the WSL verify run on awin will screenshot it.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New tests:
Local checks:
pnpm lintpass.Review
Agent skill upstream boundary
Notes
selector_not_foundfor a missing workspace now makes undo refuse rather than proceed. That's the intended fail-closed behavior.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)