Repository navigation
Conversation
Greptile SummaryAdds a per-automation
Confidence Score: 5/5Safe to merge — the new field is optional everywhere, legacy automations without The change is additive and narrowly scoped: a new nullable string field propagated through the existing create→persist→dispatch→launch pipeline. The null/empty fallback logic is covered by regression tests, the Zod validator reuses an established helper, and all four draft initializers in the GUI account for the field. The previous reviewer's flag-duplication concern does not exist in the current HEAD (the flag appears in Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/shared/automations-types.ts | Adds `agentArgs: string |
| src/renderer/src/lib/launch-agent-background-session.ts | Core logic: uses a three-way guard (!== undefined && !== null && trim().length > 0) before preferring args.agentArgs over resolveTuiAgentLaunchArgs; handles null, undefined, and whitespace-only strings correctly to preserve global defaults for legacy automations. |
| src/renderer/src/hooks/useAutomationDispatchEvents.ts | Forces a fresh session when agentArgs is non-empty (so the override is actually honoured), and threads agentArgs through to launchAgentBackgroundSession; the ?.trim() guard handles null/undefined for legacy automations correctly. |
| src/main/persistence.ts | Stores agentArgs: input.agentArgs ?? null on create; update relies on ...updates spread which preserves the existing value when the key is absent (serialized through IPC/JSON, so undefined keys are dropped). No migration needed for the JSON persistence layer. |
| src/cli/specs/automations.ts | Adds 'agent-args' to AUTOMATION_STATE_FLAGS only; both create and edit already spread the whole array, so there is no duplication in allowedFlags. The previous-reviewer concern about a duplicate entry does not apply to the current HEAD. |
| src/cli/handlers/automations.ts | getOptionalAgentArgsFlag correctly distinguishes flag-absent (→ undefined, preserves existing value on edit) from flag-present-but-empty (→ null, clears stored value) and flag-with-value (→ trimmed string). |
| src/main/runtime/rpc/methods/automations.ts | Adds agentArgs: OptionalNullablePlainString to both AutomationCreate and AutomationUpdateFields Zod schemas, reusing the same validator already used for baseBranch. |
| src/renderer/src/components/automations/AutomationEditorDialogFooter.tsx | Adds the "Agent args" Input field wired to draft.agentArgs with proper i18n keys, placeholder, and aria-label. |
| src/renderer/src/components/automations/AutomationsPage.tsx | All four draft initializers add agentArgs; two new-automation paths use '', the edit-existing path uses latest.agentArgs ?? '' to handle legacy nulls, and the Hermes template path uses ''. On save both create and update paths use `draft.agentArgs.trim() |
| src/renderer/src/lib/launch-agent-background-session.test.ts | New tests verify per-automation args produce the expected shell command and launchConfig, and that null/''/whitespace-only all fall back to the global --dangerously-skip-permissions default. |
| src/renderer/src/hooks/useAutomationDispatchEvents.test.ts | New tests confirm agentArgs is forwarded to the background session launch and that a reusable session is bypassed when agentArgs is non-empty. |
Sequence Diagram
sequenceDiagram
participant UI as AutomationEditorDialog
participant Page as AutomationsPage
participant RPC as automation.create/update RPC
participant Store as persistence.ts (Store)
participant Dispatch as useAutomationDispatchEvents
participant Launch as launchAgentBackgroundSession
UI->>Page: "onDraftChange({ agentArgs: "--yolo" })"
Page->>RPC: "{ agentArgs: draft.agentArgs.trim() || null }"
RPC->>RPC: OptionalNullablePlainString validates
RPC->>Store: createAutomation / updateAutomation
Store->>Store: agentArgs: input.agentArgs ?? null
Note over Dispatch: Automation run dispatched
Dispatch->>Dispatch: "reuseSession && !agentArgs?.trim() => skip session reuse if agentArgs set"
Dispatch->>Launch: "{ agentArgs: automation.agentArgs }"
Launch->>Launch: agentArgs truthy? use agentArgs else resolveTuiAgentLaunchArgs
Launch->>Launch: buildAgentStartupPlan(agentArgs)
Launch-->>Dispatch: session launched
Reviews (2): Last reviewed commit: "fix(automations): address PR review feed..." | Re-trigger Greptile
📝 WalkthroughWalkthroughAutomations now support nullable per-automation agent arguments across shared types, RPC schemas, persistence, CLI commands, and the renderer editor. CLI and UI inputs trim blank values to Merge Risk: ⚪ Minimal · up to The PR adds per-automation agent arguments while preserving existing defaults. The remaining concern is limited to using the shared input styling in the editor, which is a localized consistency follow-up and does not present an actionable merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/hooks/useAutomationDispatchEvents.ts (1)
519-525: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftDo not ignore
agentArgswhen a reusable session is selected.When
automation.reuseSessionfinds a reusable session, execution returns beforelaunchAgentBackgroundSessionruns. The currentautomation.agentArgsis then not applied. An automation changed from empty arguments to--yolocan continue using a session created with the old arguments.Include normalized
agentArgsin reusable-session compatibility, or start a fresh session when the configured arguments differ. Add a regression test for the reuse path.This follows the PR objective that non-empty values override global defaults.
🧹 Nitpick comments (2)
src/cli/specs/automations.ts (1)
54-55: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the duplicate
agent-argsentries.
AUTOMATION_STATE_FLAGSalready contains'agent-args'. The explicit entries add the same flag twice to bothallowedFlagsarrays. Remove the explicit entries, or deduplicate the list before generating help and validation metadata.Proposed fix
...AUTOMATION_SCHEDULE_FLAGS, - 'agent-args', ...AUTOMATION_STATE_FLAGSApply the same change to the
automations editspecification.Also applies to: 87-88
src/renderer/src/lib/launch-agent-background-session.test.ts (1)
624-646: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover whitespace-only overrides.
The implementation uses
trim().length > 0, so whitespace-only values are part of the fallback contract. This test coversnulland''only. Add a launch withagentArgs: ' 'and assert that the global default remains in the spawned command.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 85bba80e-a48c-475b-b6a1-eb238c49fdb9
📥 Commits
Reviewing files that changed from the base of the PR and between 402e492 and 7bade8ecf8861c201b22c835be30383764da4dda.
📒 Files selected for processing (20)
src/cli/format.test.tssrc/cli/handlers/automations.tssrc/cli/specs/automations.tssrc/cli/workspace-format.tssrc/main/automations/headless-workspace-create.test.tssrc/main/persistence.tssrc/main/runtime/orca-runtime-automations.test.tssrc/main/runtime/rpc/methods/automations.tssrc/renderer/src/components/automations/AutomationEditorDialog.tsxsrc/renderer/src/components/automations/AutomationEditorDialogFooter.tsxsrc/renderer/src/components/automations/AutomationSchedulePicker.test.tssrc/renderer/src/components/automations/AutomationsPage.tsxsrc/renderer/src/hooks/useAutomationDispatchEvents.test.tssrc/renderer/src/hooks/useAutomationDispatchEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/agent-background-session-contract.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/shared/automation-run-identity.test.tssrc/shared/automations-types.ts
Review of #11873 — built and measured against
|
92cd0f2 to
9acecc5
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)
21226-21232: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider an options object for
buildStartupForAgent's growing parameter list.
buildStartupForAgentnow takes 5 positional parameters, withlaunchPreferencesandagentArgsboth optional and adjacent. Both current call sites pass arguments in the correct order, but a future caller can silently swaplaunchPreferencesandagentArgs(both acceptundefined) without a type error, since neither parameter's type discriminates from the other'sundefinedcase.Convert the trailing optional parameters to a single options object to make call sites self-documenting and remove the ordering risk.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a52972b3-1c3c-46bc-8ea4-126f6241a6b4
📥 Commits
Reviewing files that changed from the base of the PR and between 04f7123 and 9acecc56e0f4d5c34c466320c14076ef81a4e5a8.
📒 Files selected for processing (28)
src/cli/args.test.tssrc/cli/args.tssrc/cli/format.test.tssrc/cli/handlers/automations.tssrc/cli/specs/automations.tssrc/cli/workspace-format.tssrc/main/automations/headless-workspace-create.test.tssrc/main/automations/headless-workspace-create.tssrc/main/index.tssrc/main/persistence.tssrc/main/runtime/orca-runtime-automations.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/automations.tssrc/renderer/src/components/automations/AutomationEditorDialog.tsxsrc/renderer/src/components/automations/AutomationEditorDialogFooter.tsxsrc/renderer/src/components/automations/AutomationSchedulePicker.test.tssrc/renderer/src/components/automations/AutomationsPage.tsxsrc/renderer/src/components/automations/automation-host-client.test.tssrc/renderer/src/components/automations/automation-run-view-state.test.tssrc/renderer/src/components/automations/automation-target-availability.test.tssrc/renderer/src/hooks/useAutomationDispatchEvents.test.tssrc/renderer/src/hooks/useAutomationDispatchEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/agent-background-session-contract.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/shared/automation-run-identity.test.tssrc/shared/automations-types.ts
🚧 Files skipped from review as they are similar to previous changes (18)
- src/main/runtime/orca-runtime-automations.test.ts
- src/renderer/src/components/automations/AutomationSchedulePicker.test.ts
- src/renderer/src/components/automations/AutomationEditorDialog.tsx
- src/shared/automation-run-identity.test.ts
- src/renderer/src/lib/launch-agent-background-session.test.ts
- src/cli/format.test.ts
- src/cli/handlers/automations.ts
- src/main/runtime/rpc/methods/automations.ts
- src/cli/workspace-format.ts
- src/renderer/src/lib/launch-agent-background-session.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/hooks/useAutomationDispatchEvents.test.ts
- src/renderer/src/hooks/useAutomationDispatchEvents.ts
- src/cli/specs/automations.ts
- src/renderer/src/components/automations/AutomationEditorDialogFooter.tsx
- src/renderer/src/components/automations/AutomationsPage.tsx
- src/renderer/src/lib/agent-background-session-contract.ts
- src/shared/automations-types.ts
|
Thanks for the thorough review and testing! I've rebased the branch on the latest 1. Blocker — the runtime drops
|
…r scheduled runs Adds agentArgs to the Automation model, CLI create/edit --agent-args flag, and a GUI field in the automation editor. Params flow through RPC validation, persistence, and the dispatch pipeline so scheduled runs can pass extra agent CLI flags without changing global defaults. Also surfaces agentArgs in automations show output and registers new i18n keys.
…args are unset The launch fallback treated a stored null agentArgs as an explicit empty override, silently dropping global defaults (e.g. claude --dangerously-skip-permissions) for legacy and empty-field automations. Only a non-empty string now overrides; null/empty falls back to the global defaults. Adds tests covering the override and fallback paths, the dispatch forwarding, and the automations show output.
Removes duplicate --agent-args entries from the create/edit CLI specs (it now appears once, via AUTOMATION_STATE_FLAGS). Treats blank/whitespace agentArgs as unset in automations show output. Skips session reuse when a non-empty agentArgs is configured, since the live session launch flags cannot be verified, and launches fresh instead. Adds a regression test for the reuse path and a whitespace-only fallback case.
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
9acecc5 to
70c9f5a
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a9c0716d-fc8d-42f4-926a-0a2b81d014a0
📒 Files selected for processing (32)
src/cli/args.test.tssrc/cli/args.tssrc/cli/format.test.tssrc/cli/handlers/automations.tssrc/cli/specs/automations.tssrc/cli/workspace-format.tssrc/main/automations/headless-workspace-create.test.tssrc/main/automations/headless-workspace-create.tssrc/main/index.tssrc/main/persistence/scheduling-automations/automation-definition-operations.tssrc/main/runtime/orca-runtime-automations.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/automations.tssrc/renderer/src/components/automations/AutomationEditorDialog.tsxsrc/renderer/src/components/automations/AutomationEditorSettingsSidebar.tsxsrc/renderer/src/components/automations/AutomationListLocalRows.test.tsxsrc/renderer/src/components/automations/AutomationSchedulePicker.render.test.tsxsrc/renderer/src/components/automations/AutomationSchedulePicker.test.tssrc/renderer/src/components/automations/AutomationsPage.tsxsrc/renderer/src/components/automations/automation-host-client.test.tssrc/renderer/src/components/automations/automation-list-last-run.test.tssrc/renderer/src/components/automations/automation-list-view.test.tssrc/renderer/src/components/automations/automation-run-view-state.test.tssrc/renderer/src/components/automations/automation-target-availability.test.tssrc/renderer/src/hooks/useAutomationDispatchEvents.test.tssrc/renderer/src/hooks/useAutomationDispatchEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/agent-background-session-contract.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/shared/automation-run-identity.test.tssrc/shared/automations-types.ts
🚧 Files skipped from review as they are similar to previous changes (26)
- src/renderer/src/components/automations/AutomationEditorDialog.tsx
- src/cli/handlers/automations.ts
- src/main/automations/headless-workspace-create.test.ts
- src/shared/automation-run-identity.test.ts
- src/cli/args.test.ts
- src/cli/args.ts
- src/main/runtime/rpc/methods/automations.ts
- src/main/index.ts
- src/renderer/src/components/automations/automation-run-view-state.test.ts
- src/main/runtime/orca-runtime-automations.test.ts
- src/renderer/src/components/automations/AutomationSchedulePicker.test.ts
- src/renderer/src/components/automations/automation-host-client.test.ts
- src/cli/workspace-format.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/lib/agent-background-session-contract.ts
- src/renderer/src/lib/launch-agent-background-session.test.ts
- src/renderer/src/lib/launch-agent-background-session.ts
- src/renderer/src/hooks/useAutomationDispatchEvents.ts
- src/renderer/src/components/automations/automation-target-availability.test.ts
- src/main/automations/headless-workspace-create.ts
- src/cli/format.test.ts
- src/cli/specs/automations.ts
- src/renderer/src/components/automations/AutomationsPage.tsx
- src/main/runtime/orca-runtime.ts
- src/shared/automations-types.ts
- src/renderer/src/hooks/useAutomationDispatchEvents.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| <input | ||
| value={draft.agentArgs} | ||
| onChange={(event) => | ||
| onDraftChange((current) => ({ ...current, agentArgs: event.target.value })) | ||
| } | ||
| placeholder={translate( | ||
| 'auto.components.automations.AutomationEditorDialog.7d5e8b3f01', | ||
| 'e.g. --yolo' | ||
| )} | ||
| aria-label={translate( | ||
| 'auto.components.automations.AutomationEditorDialog.2c4a9f6e01', | ||
| 'Extra agent launch arguments' | ||
| )} | ||
| className="h-9 w-full min-w-0 rounded-md border border-input bg-input/30 px-3 text-sm shadow-xs outline-none focus-visible:border-ring dark:bg-input/30" |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use the shared shadcn input primitive.
This renderer UI change uses a native <input>. Use the existing input primitive from src/renderer/src/components/ui/ so the field follows the shared styling and behavior.
As per coding guidelines, renderer UI must use shadcn primitives from src/renderer/src/components/ui/.
Source: Coding guidelines
Summary
Adds per-automation agent args so a scheduled automation can pass extra CLI flags (e.g.
--yolo) to its agent without changing the global default args for that agent or project — exactly the request in #11043 ("I want my automation to run as yolo, but i strictly DONT want this as default").New
agentArgsfield on the automation model, settable from:--yolo --verbose)orca automations create/edit --agent-args "--yolo"and visible inorca automations show(agentArgs: <value> | none)When unset, existing behavior is preserved: automations keep the global default args (e.g. claude's
--dangerously-skip-permissions). Only a non-empty value overrides.Screenshots
agentArgs: none/agentArgs: --yolo --verboselines inautomations showTesting
pnpm lint— could not run in sandbox:oxlintcrashes with a Rust allocator panic (reproduces on unmodified code; CI will run it)pnpm typecheck—typecheck:nodeandtypecheck:clipass.typecheck:webwas OOM-killed by the kernel in this 5 GB sandbox (reproduces on unmodified code — environment limit, not a code error)pnpm test— 95 focused tests pass across 8 automation suites (launch, dispatch hook, CLI format, run identity, headless workspace create, runtime automations, schedule picker, service)pnpm build— not run in sandboxlaunch-agent-background-session.test.ts— per-automation args override the global default (claude '--yolo' '--verbose' 'run the automation'+launchConfig), andnull/empty fall back to the global defaultsuseAutomationDispatchEvents.test.ts—automation.agentArgsis forwarded to the background session launchcli/format.test.ts—automations showprintsagentArgs: none/agentArgs: --yolo --verboseAI Review Report
AI review checked: the defaults-fallback contract, the full create→persist→dispatch→launch pipeline, RPC/Zod round-trip, i18n key registration, GUI draft wiring, CLI flag parsing, and multi-flag tokenization/quoting.
Flagged & fixed: the initial launch fallback treated a stored
nullagentArgs(legacy/empty automations) as an explicit empty override, silently dropping global defaults (e.g.--dangerously-skip-permissions). Fixed so only a non-empty string overrides;null/''/unset all fall back to the global defaults, preserving behavior for existing automations. Covered by the new tests.Cross-platform (macOS/Linux/Windows) confirmed: no keyboard shortcuts, shortcut labels, or file paths were touched, and no Electron menu/platform APIs. The new string flows through the existing shared startup-plan builder (
tokenizeStartupCommand+quoteStartupArg), the same shell-quoting used for prompts on every platform — including WSL (wsl.exeshell override) and SSH/remote launches, which route through the identical background-session spawn path with no platform-specific branches added.Security Audit
agentArgsis a free-text string; the RPC layer validates it as a nullable string via the existingOptionalNullablePlainStringZod schema (same helper asbaseBranch). No max length is enforced — consistent with existing free-text fields; a bound could be added later if untrusted users can author automations.promptfield. No raw shell interpolation; multi-flag input (--yolo --verbose) is split into individually quoted tokens.automation.create/automation.update).Notes
--agent-argsflag onautomations create/edit;automations showincludes the field;editwithout the flag leaves the stored value unchanged.en.json;verify-localization-extractionandverify-localization-catalogboth pass.