Repository navigation
fix(automations): keep a desktop automation's dispatch token off a runtime host's create - #34525
Conversation
…ntime host's create A desktop-scheduled automation whose project lives on a managed Orca server sent its dispatch token to the server, which never minted it and rejected every run with "Invalid automation provenance request". The token now goes only to this desktop's own create. Fixes #34433
|
No actionable comments were generated in the recent review.
|
…lowlist - Restore #34525's worktree-create payload and captured-host test, reverted by accident in the first commit. - Check the allowlist in execFileCapture, the choke point for WSL Git, gh and worker-thread captures, and before the WSL git-read probe, the Codex hook path canonicalization and the CLI login spawn. The WSL watcher now spawns through process-host. - Stop scanning wsl.exe argv at the first positional argument, which wsl.exe runs in the default distro. - check-process-host-imports fails on any direct wsl.exe exec outside process-host that does not call assertWslDistroAllowed.
…r distros on shared test boxes (#34539) * feat(wsl): internal distro allowlist for WSL execs on shared test boxes ORCA_INTERNAL_WSL_DISTRO_ALLOWLIST (comma-separated distro names) keeps every wsl.exe call out of distros not on the list: process-host's resolveSpawn, the main and daemon node-pty spawns, and the two codex-accounts calls that bypass process-host. Pure list/status/version calls stay allowed; any other form must name an allowlisted distro, and --shutdown or a default-distro exec is refused. A malformed value refuses every distro and logs once. Unset, the check reads the variable and returns, so behavior is identical to today. * fix(wsl): cover every direct wsl.exe exec with the internal distro allowlist - Restore #34525's worktree-create payload and captured-host test, reverted by accident in the first commit. - Check the allowlist in execFileCapture, the choke point for WSL Git, gh and worker-thread captures, and before the WSL git-read probe, the Codex hook path canonicalization and the CLI login spawn. The WSL watcher now spawns through process-host. - Stop scanning wsl.exe argv at the first positional argument, which wsl.exe runs in the default distro. - check-process-host-imports fails on any direct wsl.exe exec outside process-host that does not call assertWslDistroAllowed. * fix(wsl): check the distro allowlist where resolveCommand produces the wsl.exe form Every Git, gh and glab path into a distro resolves through resolveCommand, so gitExecFileSync, gitSpawn, git stream reads and wslAwareSpawn are covered too; the execFileCapture check is now redundant and removed. The import check also treats buildWslExecArgs as a wsl.exe exec and accepts resolveCommand as covered.
…tomation run (#35978) A desktop older than #34525 still sends the host its own dispatch token, which only that desktop can verify, so the host rejected every run with "Invalid automation provenance request". A runtime host now ignores a provenance request for an automation it does not own and creates a plain workspace; requests for its own automations are still verified. Refs #34433
ELI5
When the desktop app runs a scheduled automation for a project on a managed Orca server (an SSH or WSL host), it sent the server a one-time pass that only the desktop itself can check. The server could never recognize it, so it rejected every run. The desktop now keeps that pass to itself.
What Changed
dispatch_failedwith "Invalid automation provenance request". No workspace or terminal was created, but the schedule kept advancing, so the automation looked healthy.worktree.createno longer receives it. The dispatch token is minted in the desktop's main process and lives only there, so a runtime host had no way to accept it.Why
The host checks the request against its own automation store and token table. A desktop-owned automation is in neither, so the check fails every time. The other option was to make the host accept or ignore requests it can't verify. That would not help a new desktop talking to an already-deployed host, and it would loosen a check that is correct for the host's own automations. This change is client-only, so it works with every host version.
Trade-off: a workspace created this way on a managed server doesn't carry the "created by automation" metadata on the host. It has no automation badge, and its run pane closes when the run finishes instead of going to sleep. Before this change the run failed outright. Persisting that metadata on the host would need a new capability-gated field, which is a separate change.
Linked Issue
Fixes #34433
Thanks to @nm7-jp for the detailed report, including where the check runs on the host and the recreate-on-host workaround.
Visual Proof
N/A: no UI change. The run now dispatches instead of failing.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New case in
worktrees-create-captured-host.test.ts: the local create still carries the provenance request, and a runtime-host create does not. It fails onorigin/mainand passes with the fix.Ran every test file that imports the changed create modules (56 files).
WorktreeList.status-lane-lineage-drop.test.tsxhits the same hook timeout on unmodifiedorigin/main.The full static job (lint, format, type-aware lint, typecheck, ratchets, localization) passes locally.
Mixed versions: no new fields. The client just omits an optional one, so old and new hosts both accept the request.
Not run: the Docker managed-orcad lane (no SSH, managed-server, or terminal code changed; orcad scope check reports false), and a live Windows + WSL repro.
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)