Skip to content

Let automations pass extra agent arguments on each run - #26659

Merged
AmethystLiang merged 7 commits into
mainfrom
automation-allow-saving-args
Oct 8, 2026
Merged

AmethystLiang merged 7 commits into
mainfrom
automation-allow-saving-args

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1155 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1147
Prod 48 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​819 $\color{#cf222e}{\Huge{\mathbf{−}}}$​62 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​757

ELI5

Each automation can now choose its own model or reasoning effort without changing the host's defaults for every other run.

What Changed

  • Add Extra agent arguments under Advanced in the automation editor and --extra-agent-args to CLI create/edit commands. Save the text with the automation and display it in automation details, with translations for all supported locales.
  • Validate saved arguments and validate again at launch. Allow only supported model/effort options and Claude's --add-dir; reject permission, prompt, session, and unrelated configuration options.
  • Replace default model/effort options when extras override them, append the remaining extras, and verify that shell quoting preserves the validated arguments.
  • Require fresh sessions and check host support before saving or migrating extras, so older local or SSH hosts cannot silently discard them.

Why

Previously, choosing a different model for one automation required changing host settings that affected every run. Per-automation extras keep those defaults intact. A narrow allowlist and the existing launch-option catalog avoid exposing arbitrary agent configuration or duplicating option-handling rules.

Linked Issue

No linked issue.

Visual Proof

Before/after screenshots are pending. This changes the automation editor's Advanced section and the saved-arguments display; rendered Electron UI validation has not been performed in this session.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

On macOS, ran the eight focused extra-agent-arguments test files covering CLI, parsing/merging, startup inputs, RPC validation, persistence, SSH migration, editor capability checks, and background launches: 109 tests passed.

Earlier commit-blocker validation passed pnpm exec lint-staged, pnpm tc:cli, and 15 CLI tests. Later commits changed validation, display, and translations, so those earlier checks do not cover every final change. Full lint, typecheck, build, and platform checks remain for CI. No live Windows, Linux, or SSH-host run was performed.

Review

Fresh-session enforcement, unsupported-host rejection, allowlisting, and shell argument round trips are covered by focused tests. Visual review and live cross-platform checks remain pending.

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

The new optional stored/RPC field is guarded by a runtime capability when writing to a host. Argument quoting uses the existing shell-specific launch path. Older hosts reject saves/migrations with extras instead of silently dropping the user's choice.

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)

Automations could only use the host's default agent Arguments, so a
per-automation choice such as a different model needed a settings change
that affected every run. Automations can now save extra arguments that
are appended to the host's defaults on each fresh run. Extras are
allowlisted to model, effort, and Claude's --add-dir, and are refused for
permission, config, prompt, and session options.

- Add the field through the CLI (`automations create/edit
  --extra-agent-args`), the RPC contract, the automation store, and the
  editor's Advanced section, with validation at save and at launch.
- Merge extras over the defaults by replacing a model or effort option
  the defaults already set, then re-tokenize to confirm the launch argv
  matches what was validated.
- Gate writes behind a new runtime capability, and refuse to save or
  migrate extras to a host that would silently drop them.
- Require a fresh session, since reused sessions cannot take new
  arguments.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 580e1b74-a164-4ba1-aade-a612fde55d35
📥 Commits

Reviewing files that changed from the base of the PR and between 1658153 and f06c728.

📒 Files selected for processing (4)
  • src/shared/automation-runtime-capabilities.ts
  • src/shared/orcad-migration-dormant-automation-validation.ts
  • src/shared/orcad-migration-manifest.test.ts
  • src/shared/protocol-version.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/shared/orcad-migration-dormant-automation-validation.ts

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


📝 Walkthrough

Walkthrough

Automations now support saved extra agent arguments. The change adds argument validation and merging, persistence, CLI and editor controls, and forwarding into fresh agent launches. Runtime capability checks guard supported write and migration paths. Documentation and translations describe the option, its constraints, and how to clear it.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to f06c7

Automations gain validated per-run agent arguments, with unsupported-host writes and migrations guarded. No concrete merge-blocking risk is identified; proceed subject to normal CI checks.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, rationale, testing, compatibility considerations, and implementation scope. However, it does not provide the required linked issue, and the required visual proof f… Add an actual linked issue under “Linked Issue” and attach before-and-after screenshots or a video for the automation editor and details UI. Update the checklist after completing the required validation or state that CI will cover it.
Docstring Coverage ⚠️ Warning Docstring coverage is 37.04% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 54 functions across 52 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: allowing automations to pass extra agent arguments on each run.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, rationale, testing, compatibility considerations, and implementation scope. However, it does not provide the required linked issue, and the required visual proof for the UI change is still pending.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e49329a4-79a4-4583-b6a8-2c0538b16f31
📥 Commits

Reviewing files that changed from the base of the PR and between 5de5391 and 1658153.

📒 Files selected for processing (60)
  • docs/site/content/docs/cli/automations.mdx
  • skill-guides/orca-cli/references/automations.md
  • src/cli/automation-format.ts
  • src/cli/bundled-skill-guides.ts
  • src/cli/flag-help-text.ts
  • src/cli/handlers/automation-extra-agent-args-flag.ts
  • src/cli/handlers/automations.ts
  • src/cli/index-automation-extra-agent-args.test.ts
  • src/cli/specs/automations.ts
  • src/main/automations/headless-workspace-create.test.ts
  • src/main/automations/headless-workspace-create.ts
  • src/main/automations/runtime-automation-service.test.ts
  • src/main/automations/runtime-automation-service.ts
  • src/main/persistence-automation-extra-agent-args.test.ts
  • src/main/persistence/scheduling-automations/automation-context-migration.ts
  • src/main/persistence/scheduling-automations/automation-definition-operations.ts
  • src/main/runtime/orca-runtime-activate-managed-worktree.ts
  • src/main/runtime/orca-runtime-terminal-create-deduplication.ts
  • src/main/runtime/runtime-automation-controller.ts
  • src/main/runtime/runtime-managed-worktree-create-types.ts
  • src/main/runtime/runtime-worktree-agent-startup.test.ts
  • src/main/runtime/runtime-worktree-agent-startup.ts
  • src/main/ssh/orcad-migration-catalog-client-extra-agent-args.test.ts
  • src/main/ssh/orcad-migration-catalog-client.ts
  • src/renderer/src/components/automations/AutomationDetail.tsx
  • src/renderer/src/components/automations/AutomationEditorDialog.tsx
  • src/renderer/src/components/automations/AutomationEditorSettingsSidebar.tsx
  • src/renderer/src/components/automations/AutomationExtraAgentArgsField.tsx
  • src/renderer/src/components/automations/AutomationSchedulePicker.render.test.tsx
  • src/renderer/src/components/automations/AutomationSchedulePicker.test.ts
  • src/renderer/src/components/automations/automation-capability-probe.ts
  • src/renderer/src/components/automations/automation-draft-model.ts
  • src/renderer/src/components/automations/automation-edit-draft.ts
  • src/renderer/src/components/automations/automation-extra-agent-args-capability.test.ts
  • src/renderer/src/components/automations/automation-host-client.ts
  • src/renderer/src/components/automations/automation-orca-save.ts
  • src/renderer/src/components/automations/automation-save-action.ts
  • src/renderer/src/components/automations/automation-scoped-list-client.ts
  • src/renderer/src/components/automations/use-automation-editor-actions.ts
  • src/renderer/src/components/automations/use-automations-page-local-state.ts
  • src/renderer/src/hooks/automation-dispatch-handler.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/agent-background-session-contract.ts
  • src/renderer/src/lib/launch-agent-background-session-extra-args.test.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/shared/agent-startup-plan-inputs-extra-agent-args.test.ts
  • src/shared/agent-startup-plan-inputs.ts
  • src/shared/automation-extra-agent-args-record.ts
  • src/shared/automation-extra-agent-args.test.ts
  • src/shared/automation-extra-agent-args.ts
  • src/shared/automations-types.ts
  • src/shared/orcad-migration-dormant-automation-validation.ts
  • src/shared/protocol-version.ts
  • src/shared/rpc-contract/automation-params-extra-agent-args.test.ts
  • src/shared/rpc-contract/automation-params.ts

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

Dormant automations imported from the migration manifest skipped the extra-args check. A disallowed flag, or Reuse combined with extra args, could persist and then fail every later run. The manifest parser now rejects those rows.

Also move the automation runtime capability constants into `automation-runtime-capabilities.ts`. `protocol-version.ts` re-exports them, so existing imports keep working.
@AmethystLiang
AmethystLiang merged commit 55eb48c into main Oct 8, 2026
18 checks passed
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