Skip to content

fix(automations): accept Pi model and thinking extra arguments - #38020

Merged
Jinwoo-H merged 8 commits into
mainfrom
fix/pi-automation-extra-args
Nov 4, 2026
Merged

Jinwoo-H merged 8 commits into
mainfrom
fix/pi-automation-extra-args

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Pi automations now accept --model and --thinking as extra arguments. Before this, Pi was not on the extra arguments allowlist, so saving them failed.

  • Pi is added to the existing allowlist (EXTRA_AGENT_ARG_OPTIONS) with two declarative option fields. values limits --thinking to the existing PI_THINKING_LEVELS, because Pi only warns on an unknown level and then runs at its default. separateValue turns --model=x into --model x, because Pi's parser reads --model=x as an unknown extension flag and ignores it.
  • Pi has no launch catalog. For agents without one, the matching default flags are now removed using the allowlisted aliases themselves, so the extras replace the defaults instead of stacking on them.
  • Pi's options that take a value are added to the shared agentRequiredValueOptions table. Removal and the -- terminator then treat dash-leading values (for example --system-prompt --model) as values, not flags.
  • A default --provider is never removed. Pi looks a model up within that provider, so openai/gpt-x under --provider openai and the gateway ID anthropic/claude-x under --provider openrouter both keep their provider and key. No credentials are dropped.
  • A model override is refused when the custom Command text contains --api-key anywhere, because a Command can wrap Pi in any shell. It is also refused when Arguments contain --api-key and the last --provider is missing or empty. Pi uses the last --provider, and without one it sends the key to whichever provider the new model selects.
  • Pi's value-taking options in the shared table match Pi 1.5.0's parseArgs, including --name/-n.

Compared with #37320

#37320 targets the same allowlist but adds a lot of Pi-only wiring around it. This PR keeps the same safeguards in less code.

  • Same operand handling, done by adding Pi to the existing shared table. The merge reuses removeAgentArgOption and agentArgTerminatorIndex without Pi-specific branches.
  • One credential rule (an inline key needs a provider pin) checked in one small helper. This replaces Support Pi extra arguments in automations #37320's separate refusals for Arguments and Command plus its model-prefix provider matching. The provider pin always wins, so this PR does not need to guess whether x/y names a provider or a gateway model.
  • Splitting the = form and checking allowed values are generic option fields. There are no unrelated changes to the control-character check.

Testing

Three new cases in agent-startup-default-lifetime.test.ts go through the real launch entry point (resolveAgentStartupPlanInputs and buildAgentStartupPlan). Each one failed before its fix:

  • A pinned gateway provider and its key are kept with a qualified model, and an unknown thinking level is rejected.
  • A custom Command pi --api-key key with a model override is refused, including when --name swallows --provider when the --provider belongs to another shell command, and when Pi runs inside sh -c.
  • Arguments with an empty last --provider (--provider '', or --provider openai --provider '') beside --api-key are refused.
  • --system-prompt --model defaults keep their operand.

Other checks:

  • Related suites pass: startup, agent-session options, Pi main, CLI extras, automations renderer, and the extras .spec.ts tables.
  • pnpm tc:node is clean.
  • pnpm check:changed: 20 of 21 checks pass. The unit-test check failed only on tests this PR does not touch: omp-draft-launch-shell (fish) fails because the local fish profile sources a missing file; persisted-profile-state fails because SQLite cannot open its file under /tmp on this machine. An earlier run also hit acp-chat-worker-error-escalation, a load-budget test that passes when run alone.

Fixes STA-13421

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​49

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Pi now supports --model and --thinking through automation extra arguments. The parser validates thinking values, emits separate flag and value tokens for these options, and handles overridden defaults when no launch catalog exists. Tests cover these behaviors and dash-leading operands. The CLI specification and automation guides now document Pi support and the default provider behavior.

Merge Risk: High · up to 5b163

Pi automation model overrides can expose configured API keys to the selected provider or submit them as startup prompts, while the documentation omits the restrictions users need to avoid this. These security issues should be fixed before merge.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the implementation, motivation, linked issue, testing, and known test failures. However, it does not follow the required template and omits or does not clearly provide ELI5, W… Rewrite the description using the repository template. Add the missing required headings and content, especially the user-facing before/after explanation, rationale, visual-proof N/A statement, risk and rollback plan, upstream-boundary stat…
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 with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing Pi automations to accept model and thinking extra arguments.
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 implementation, motivation, linked issue, testing, and known test failures. However, it does not follow the required template and omits or does not clearly provide ELI5, What Changed, Why, Visual Proof with an N/A justification, Risk, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the Checklist.

Resolution

Rewrite the description using the repository template. Add the missing required headings and content, especially the user-facing before/after explanation, rationale, visual-proof N/A statement, risk and rollback plan, upstream-boundary status, compatibility notes, self-review checklist, and test checklist.

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 with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 5 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
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
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: 58af0a33-d167-4281-af6c-11a05eedc4d1
Commits

Reviewing files that changed from the base of the PR and between 3d6ce6a and 5b1637e.

Files selected for processing: 4
  • docs/site/content/docs/cli/automations.mdx
  • skill-guides/orca-cli/references/automations.md
  • src/cli/bundled-skill-guides.ts
  • src/shared/agent-launch/startup/automation-pi-extra-agent-args.test.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.

@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.

Additional comments: 1
src/shared/agent-launch/startup/automation-extra-agent-args.ts-263-265: 1

263-265: Major · Stability & Availability · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Preserve Pi defaults when a slash does not change the provider.

If the host configures --provider openrouter --api-key key and an automation selects another OpenRouter model with --model openrouter/moonshotai/kimi, this branch removes the only configured key. The automation can then fail authentication. A slash can also be part of a model ID rather than a provider prefix. Determine whether the selected provider changes before removing --provider or --api-key. (raw.githubusercontent.com)

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: bcbc7fb4-dd7c-4ba3-a688-c81dae92ac47
Commits

Reviewing files that changed from the base of the PR and between da96fad and 4feb23d.

Files selected for processing: 6
  • docs/site/content/docs/cli/automations.mdx
  • skill-guides/orca-cli/references/automations.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/specs/automations.ts
  • src/shared/agent-launch/startup/agent-startup-default-lifetime.test.ts
  • src/shared/agent-launch/startup/automation-extra-agent-args.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.

@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
  • 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: 623fd24f-28b8-4e3d-afac-3454986868e3
Commits

Reviewing files that changed from the base of the PR and between da96fad and 98efac3.

Files selected for processing: 9
  • docs/site/content/docs/cli/automations.mdx
  • skill-guides/orca-cli/references/automations.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/specs/automations.ts
  • src/shared/agent-launch/startup/agent-startup-default-lifetime.test.ts
  • src/shared/agent-launch/startup/automation-extra-agent-args.ts
  • src/shared/agent-launch/startup/pi-inline-api-key-pin.ts
  • src/shared/agent-launch/startup/tui-agent-launch-command.ts
  • src/shared/agent-session/options/agent-session-option-agent-args.ts

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

@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: 2

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: 2d0ca6cc-f644-46d8-9ff3-7dc7192dd7ba
Commits

Reviewing files that changed from the base of the PR and between 98efac3 and a415975.

Files selected for processing: 7
  • docs/site/content/docs/cli/automations.mdx
  • skill-guides/orca-cli/references/automations.md
  • src/cli/bundled-skill-guides.ts
  • src/shared/agent-launch/startup/agent-startup-default-lifetime.test.ts
  • src/shared/agent-launch/startup/pi-inline-api-key-pin.ts
  • src/shared/agent-launch/startup/tui-agent-launch-command.ts
  • src/shared/agent-session/options/agent-session-option-agent-args.ts
Files skipped from review as they are similar to previous changes: 1
  • src/cli/bundled-skill-guides.ts

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

@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: 2

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: 58abeb98-45bd-4886-a135-2d2e5f674555
Commits

Reviewing files that changed from the base of the PR and between a415975 and 6c8e69e.

Files selected for processing: 2
  • src/shared/agent-launch/startup/agent-startup-default-lifetime.test.ts
  • src/shared/agent-launch/startup/pi-inline-api-key-pin.ts

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

Check the Pi key pin on the merged Arguments, remove overridden defaults with
Pi's required-operand rule, clarify the Pi docs, and move the Pi extras tests
out of the test file main deleted.
Pi already sends an unpinned inline key to the chosen model's provider and warns;
the user typed both the key and the model, so Orca does not refuse it.

@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
  • 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: a33f44a1-538c-4ab7-931b-209a648dbba1
Commits

Reviewing files that changed from the base of the PR and between 6c8e69e and 3d6ce6a.

Files selected for processing: 7
  • docs/site/content/docs/cli/automations.mdx
  • skill-guides/orca-cli/references/automations.md
  • src/cli/bundled-skill-guides.ts
  • src/shared/agent-launch/startup/automation-extra-agent-args.ts
  • src/shared/agent-launch/startup/automation-pi-extra-agent-args.test.ts
  • src/shared/agent-launch/startup/tui-agent-launch-command.ts
  • src/shared/agent-session/options/agent-session-option-agent-args.ts

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

@Jinwoo-H
Jinwoo-H merged commit 9658ec4 into main Nov 4, 2026
58 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