Skip to content

fix(automations): store the approved setup hash and skip setup when a run's branch differs - #37979

Merged
nwparker merged 3 commits into
mainfrom
nwparker/setup-trust-automations
Nov 7, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/setup-trust-automations

Conversation

@nwparker

@nwparker nwparker commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Automations that create workspaces with "run setup" now remember which setup commands were approved when the automation was saved. If a run's branch has different commands, setup is skipped for that run (and logged) instead of running something that wasn't approved.

Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​301 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​299
Prod 21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​191 $\color{#cf222e}{\Huge{\mathbf{−}}}$​47 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​144

What Changed

  • Saving an automation with setup = run stores the approved hash next to setupDecision (type, persistence normalisation, RPC params, editor save).
  • Headless, chat and desktop-dispatched runs pass it on create; mismatch → setup skipped, host logs a warning.
  • Any write that sets the setup decision without a hash (e.g. CLI --setup run) clears the stored hash.
  • The skip is visible: the run records setupSkippedReason: 'setup-changed' for headless, chat and desktop-dispatched runs, the note survives the completion update, and the run page shows "Setup didn't run…" with what to do. Desktop-dispatched runs also get the created-workspace review prompt from fix(hooks): run a created worktree's setup once its own content is approved #37978.

Stacked on #37978.

Why

Automations replayed a stored "run" decision with no record of what was approved.

Linked Issue

N/A (maintainer).

Visual Proof

Adds a one-line notice on the run details page, using the existing status-warning tokens; a render test covers it. There's no other UI change.

Testing

  • Stored hash round-trips; mismatch skips; hash cleared on hashless decision writes; automations without a hash behave as today.
  • pnpm tc, oxlint, quality gate; 6,700 related tests pass.

Risk

Level: Low. Automations saved before this change have no hash and behave as before, as does any write without a hash (CLI, mobile). A run only skips setup when the branch's orca.yaml setup or default-tab commands really differ from what was approved at save time. Hashing is the same as in #37977 (parity and pinned-digest tests), and the run page now shows the skip instead of only logging it. What users may notice: an automation keeps skipping setup after the repo's orca.yaml setup changes until it's saved again. The run page tells them this. setupSkippedReason is an optional field on run records, so older readers ignore it. Plain revert.

AI Disclosure

Written with Claude Code.

@nwparker
nwparker force-pushed the nwparker/setup-trust-run-created-setup branch from c0e1382 to f1b9f4e Compare November 6, 2026 09:16
@nwparker
nwparker force-pushed the nwparker/setup-trust-automations branch from 23aa08c to e9d014c Compare November 6, 2026 09:16
@nwparker
nwparker force-pushed the nwparker/setup-trust-run-created-setup branch from f1b9f4e to edbb3bb Compare November 6, 2026 09:34
@nwparker
nwparker force-pushed the nwparker/setup-trust-automations branch from e9d014c to d3ee33f Compare November 6, 2026 09:34
@nwparker
nwparker force-pushed the nwparker/setup-trust-run-created-setup branch from edbb3bb to 618041b Compare November 6, 2026 09:48
@nwparker
nwparker force-pushed the nwparker/setup-trust-automations branch from d3ee33f to 3f4591e Compare November 6, 2026 09:48
@nwparker
nwparker force-pushed the nwparker/setup-trust-run-created-setup branch from 618041b to b23fdb7 Compare November 6, 2026 10:09
@nwparker
nwparker force-pushed the nwparker/setup-trust-automations branch from 3f4591e to abc2161 Compare November 6, 2026 10:09
@nwparker
nwparker force-pushed the nwparker/setup-trust-run-created-setup branch 2 times, most recently from 0d56136 to 87e0e91 Compare November 6, 2026 23:21
@nwparker
nwparker changed the base branch from nwparker/setup-trust-run-created-setup to main November 6, 2026 23:37
@coderabbitai

coderabbitai Bot commented Nov 6, 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 11 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: 3ffb3b39-c8be-4b1d-9473-123e8618ff92
Commits

Reviewing files that changed from the base of the PR and between 490a5c0 and 161fa64.

Files selected for processing: 26

  • src/main/automations/automation-chat-agent-launch.ts
  • src/main/automations/automation-run-setup-skip.test.ts
  • src/main/automations/automation-run-setup-skip.ts
  • src/main/automations/headless-dispatch-runner.ts
  • src/main/automations/headless-dispatch.ts
  • src/main/automations/headless-workspace-create.test.ts
  • src/main/automations/headless-workspace-create.ts
  • src/main/automations/runtime-automation-service.ts
  • src/main/automations/service.test.ts
  • src/main/persistence/applying-settings/persistence-automation-setup-trust.test.ts
  • src/main/persistence/scheduling-automations/automation-context-migration.ts
  • src/main/persistence/scheduling-automations/automation-definition-operations.ts
  • src/main/persistence/scheduling-automations/automation-run-operations.ts
  • src/main/runtime/runtime-automation-controller.ts
  • src/main/runtime/runtime-automation-patch-keys.ts
  • src/main/runtime/workspaces/creation/runtime-local-worktree-setup.ts
  • src/renderer/src/components/automations/AutomationRunDetailsPage.setup-skipped.test.tsx
  • src/renderer/src/components/automations/AutomationRunDetailsPage.tsx
  • src/renderer/src/components/automations/automation-orca-save.ts
  • src/renderer/src/components/automations/automation-page-parts.tsx
  • src/renderer/src/components/automations/automations-page-test-harness.tsx
  • src/renderer/src/hooks/automation-dispatch-handler.ts
  • src/renderer/src/hooks/automation-dispatch-workspace.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/automations-types.ts
  • src/shared/rpc-contract/automation-params.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

… run's branch differs

Saving an automation with setup run records the hash of the content the user
approved; headless, chat and desktop-dispatched runs send it with the create,
so a branch whose setup differs skips setup (logged on the host). Writes that
set the decision without a hash (CLI --setup run) and older automations keep
today's behaviour.
…branch differs

Runs record setupSkippedReason 'setup-changed' when the new workspace's
orca.yaml setup differs from the hash saved with the automation (headless,
chat and desktop-dispatched runs), and the run page says so with what to do.
The note survives the run's completion update.
@nwparker
nwparker force-pushed the nwparker/setup-trust-automations branch from abc2161 to 161fa64 Compare November 6, 2026 23:39
@nwparker
nwparker merged commit a745884 into main Nov 7, 2026
64 checks passed
@nwparker
nwparker deleted the nwparker/setup-trust-automations branch November 7, 2026 00:26
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