You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(automations): accept Pi model and thinking extra arguments - #38020
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.
#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.
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.
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: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
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
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 checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: allowing Pi automations to accept model and thinking extra arguments.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
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.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pi automations now accept
--modeland--thinkingas extra arguments. Before this, Pi was not on the extra arguments allowlist, so saving them failed.EXTRA_AGENT_ARG_OPTIONS) with two declarative option fields.valueslimits--thinkingto the existingPI_THINKING_LEVELS, because Pi only warns on an unknown level and then runs at its default.separateValueturns--model=xinto--model x, because Pi's parser reads--model=xas an unknown extension flag and ignores it.agentRequiredValueOptionstable. Removal and the--terminator then treat dash-leading values (for example--system-prompt --model) as values, not flags.--provideris never removed. Pi looks a model up within that provider, soopenai/gpt-xunder--provider openaiand the gateway IDanthropic/claude-xunder--provider openrouterboth keep their provider and key. No credentials are dropped.--api-keyanywhere, because a Command can wrap Pi in any shell. It is also refused when Arguments contain--api-keyand the last--provideris missing or empty. Pi uses the last--provider, and without one it sends the key to whichever provider the new model selects.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.
removeAgentArgOptionandagentArgTerminatorIndexwithout Pi-specific branches.x/ynames a provider or a gateway model.=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.tsgo through the real launch entry point (resolveAgentStartupPlanInputsandbuildAgentStartupPlan). Each one failed before its fix:pi --api-key keywith a model override is refused, including when--nameswallows--providerwhen the--providerbelongs to another shell command, and when Pi runs insidesh -c.--provider(--provider '', or--provider openai --provider '') beside--api-keyare refused.--system-prompt --modeldefaults keep their operand.Other checks:
.spec.tstables.pnpm tc:nodeis 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-statefails because SQLite cannot open its file under /tmp on this machine. An earlier run also hitacp-chat-worker-error-escalation, a load-budget test that passes when run alone.Fixes STA-13421