Skip to content

fix(automations): keep a desktop automation's dispatch token off a runtime host's create - #34525

Merged
nwparker merged 1 commit into
mainfrom
fix/34433-ssh-bridge-provenance
Oct 27, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/34433-ssh-bridge-provenance

Conversation

@nwparker

@nwparker nwparker commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

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

  • Before: every desktop-scheduled automation whose project lives on a managed Orca server ended as dispatch_failed with "Invalid automation provenance request". No workspace or terminal was created, but the schedule kept advancing, so the automation looked healthy.
  • After: the run creates its workspace on the server and starts normally.
  • Mechanism: the automation provenance request (automation id, run id, and a dispatch token) is now sent only on the desktop's own create path. A runtime host's worktree.create no 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 on origin/main and passes with the fix.

  • Ran every test file that imports the changed create modules (56 files). WorktreeList.status-lane-lineage-drop.test.tsx hits the same hook timeout on unmodified origin/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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Security: the host keeps its provenance check. It just stops receiving requests it could never verify.
  • Local and folder workspaces are unchanged; they keep the provenance request on the desktop's own create.
  • Paired web clients are unchanged: their local create path already routes to the host that minted their token.

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)

…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
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: 1ee8468f-0fdc-4862-8c35-f2473964f8ff
Commits

Reviewing files that changed from the base of the PR and between 9a51b98 and 375fdc9.

Files selected for processing: 2
  • src/renderer/src/store/slices/worktrees-create-captured-host.test.ts
  • src/renderer/src/store/slices/worktrees/create/worktree-create-payload.ts

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

Walkthrough

Worktree creation no longer includes automationProvenanceRequest in shared payload fields. Local creation arguments include the request when it is truthy. Runtime host parameters omit it. Added tests verify both payload behaviors.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 375fd

The change is mergeable after normal checks. Runtime-host workspaces will not show automation metadata, as described in the PR.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv… 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 main change: preventing a desktop automation dispatch token from being sent to a runtime host.
Description check Passed The description is complete and aligned with the template. It explains the user impact, mechanism, rationale, trade-off, linked issue, visual proof, testing, compatibility, and checklist status. It al…
Linked Issues check Passed For #34433, buildLocalWorktreeCreateArgs still sends automationProvenanceRequest to the desktop API. buildRuntimeWorktreeCreateParams no longer sends that request to worktree.create on a runti…
Out of Scope Changes check Passed The production change is limited to routing automationProvenanceRequest to the desktop create path. The added test verifies this routing and the existing runtime-host behavior. Both changes directly…
Full details: Description check

Explanation

The description is complete and aligned with the template. It explains the user impact, mechanism, rationale, trade-off, linked issue, visual proof, testing, compatibility, and checklist status. It also documents the tests and environments that were not run.

Full details: Linked Issues check

Explanation

For #34433, buildLocalWorktreeCreateArgs still sends automationProvenanceRequest to the desktop API. buildRuntimeWorktreeCreateParams no longer sends that request to worktree.create on a runtime host. The new parameterized test covers local and runtime creation and verifies both behaviors. This addresses the issue's primary expected outcome: existing desktop-owned automations can dispatch without asking the host to validate a desktop token.

Full details: Out of Scope Changes check

Explanation

The production change is limited to routing automationProvenanceRequest to the desktop create path. The added test verifies this routing and the existing runtime-host behavior. Both changes directly support #34433. No unrelated product behavior is shown in the reviewed changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

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.

@nwparker
nwparker merged commit 2bf43b7 into main Oct 27, 2026
33 checks passed
nwparker added a commit that referenced this pull request Oct 27, 2026
…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.
nwparker added a commit that referenced this pull request Oct 27, 2026
…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.
nwparker added a commit that referenced this pull request Oct 29, 2026
…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
@nwparker
nwparker deleted the fix/34433-ssh-bridge-provenance branch October 29, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant