Repository navigation
fix(automations): a scheduled run never starts a stopped WSL distro - #35857
Conversation
|
Warning Review limit reachedYou'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 38 seconds. View limit details
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. Comment |
[Medium impact] The change reaches scheduled automation runs that use WSL on Windows. Do not merge yet: scheduled runs can still start stopped WSL distros. FindingsSummaryAdds stopped-distro checks before scheduled automation dispatch.
|
| export async function describeStoppedWslDistroRefusal( | ||
| cwd: string | ||
| ): Promise<AutomationRunFailure | null> { | ||
| const blocked = await blockedWslDistroForPath(cwd) |
There was a problem hiding this comment.
describeStoppedWslDistroRefusal uses the gate's default 60-second running lease. If Ubuntu was observed running, then stops without a stop notification before a scheduled run, both new checks can reuse that old observation and allow dispatch. The precheck or worktree creation can then start the stopped distro.
Pass { leaseMs: 0 } to require a fresh running check, and add a test with an old running observation followed by a stopped distro.
| const blocked = await blockedWslDistroForPath(cwd) | |
| const blocked = await blockedWslDistroForPath(cwd, undefined, { leaseMs: 0 }) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Scheduled runs whose target is on a stopped (or unverifiable) WSL distro skip with a coded, retryable wslDistroStopped reason naming the distro, checked at the tick and again at dispatch; repeated ticks fold into one skip. Run now is the user's act and still starts it.
…ate the skip A host-path project whose Git runs in WSL passes its project distro to the stopped-distro check (as #35778 does). wslDistroStopped is translated into the 10 other locales.
7575a2e to
3ba063e
Compare
| ): Promise<AutomationRunFailure | null> { | ||
| let wslDistro: string | undefined | ||
| try { | ||
| wslDistro = getLocalProjectWorktreeGitOptions(store, target.repo).wslDistro |
There was a problem hiding this comment.
Scheduled agents still wake WSL
For a Windows-path project configured with { kind: 'wsl', distro: 'Ubuntu', git: 'windows-host' }, getLocalProjectWorktreeGitOptions returns no distro. Both scheduled checks therefore allow the run without checking Ubuntu. The agent still launches through wsl.exe, which starts Ubuntu even when it is stopped.
Read the project's execution runtime as well as its Git options, and check its WSL distro before dispatch.
ELI5
If an automation is scheduled to run against a project inside a WSL distro, and that distro is stopped, Orca would start the distro just to run it. Nobody asked for that at that moment, and it is the kind of background wake E9 forbids. Now a scheduled run on a stopped distro is skipped with a clear reason, "The WSL distro Ubuntu is stopped…". The next scheduled run tries again. "Run now" is still your own act, so it still starts the distro.
User risk: low. This only affects scheduled runs whose project is on a
\\wsl.localhostpath while that distro is stopped, or while Orca can't confirm it's running.What Changed
describeStoppedWslDistroRefusalasks the existing E9 gate (blockedWslDistroForPath) about the run's target path. For a host-path project whose Git runs in WSL, it also passes the project's distro (getLocalProjectWorktreeGitOptions(store, repo).wslDistro, as fix(wsl): don't start a stopped distro to read a repo's default base ref #35778 does). If the distro is stopped or unverifiable, the run is skipped with a new coded failure,wslDistroStopped, that names the distro.describeScheduledTickRefusal, before a run row is created, so repeated stopped ticks fold into one skip;requestAutomationDispatch, for scheduled runs only, in case the distro stopped in between.wslDistroStoppedis added to the shared English table,en.json,en-runtime-required.jsonand the 10 other locales, each keeping{{distro}}. The renderer translates it by code and fills in the distro.automationRunFailurenow substitutes any{{param}}placeholder; the existing setup-state message is unaffected.Why
The automation itself starts from the window on the desktop, and its precheck and worktree creation reach the distro before any terminal does. So the gate belongs at dispatch, not at terminal spawn. This is one of the follow-ups noted on #35813. The main-side terminal gate is a separate PR.
Linked Issue
N/A (maintainer change; follow-up to #35813)
Visual Proof
N/A: there's no new UI. The skip shows in the automation's run history with the new message.
Testing
automation-wsl-distro-stopped-refusal.test.ts, with a real store and service:verify:localization-catalogs,-catalog,-runtime-catalog,-extraction,-coverage).pnpm tc,pnpm run typecheck:ci,oxlint, the anti-slop lint,check:code-quality:changed, the ast-grep test and gates, and the automation, automation-copy and i18n tests.language-detection-reconciliation, failed once under load and passes alone.Review
Agent skill upstream boundary
Notes
wslDistroForPathis null off Windows, so the check never fires there.errorCodeanderrorParamsare optional fields. Older clients show the stored English.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)