Skip to content

fix(pi): accept --model/--effort for Pi agent launch and worker-start - #42255

Merged
nwparker merged 1 commit into
stablyai:mainfrom
lucas-wu-wakakak:fix/pi-worker-launch-preferences
Nov 14, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
lucas-wu-wakakak:fix/pi-worker-launch-preferences

Conversation

@lucas-wu-wakakak

@lucas-wu-wakakak lucas-wu-wakakak commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

If you asked Orca to start the Pi agent on a specific AI model or thinking level from the command line, Orca refused and told you to set it in Pi's own config. The desktop launcher could already do this. Now orca agent launch and orca orchestration worker-start can too. You write the model as provider/model. If the computer that runs Pi has an older Orca that can't apply your choice, you get a clear "update Orca" message. Pi does not quietly start on the wrong model.

What Changed

Before: orca agent launch --agent pi --model anthropic/claude-sonnet-4-5 --effort low (and worker-start --agent pi --model ...) failed with invalid_argument: Agent pi does not support launch-time model selection. Nothing was started.

After: both commands accept Pi's --model <provider/id> and --effort <level>. Pi starts with --model <id> --thinking <level>.

How it works:

  • PI_LAUNCH_OPTION_CATALOG now sets supportsWorkerLaunchPreferences: true. That flag is what checkAgentLaunchModelPreferences, the shared gate behind agent launch and worker-start, checks. Every other cataloged agent already set it.
  • New isPiModelOptionId in agent-session-option-catalog-pi.ts, which parsePiModelOptionId now also uses. The gate refuses Pi models that are not provider/id (sonnet, /x, a/) with invalid_argument. This happens before any worktree or worker is created. Without it, the request would only fail later, inside the Pi chat.
  • New host capability agent.launch.pi-model.v1. callAgentLaunch is used by agent launch and worktree create --agent pi. It refuses a Pi launch that carries --model/--effort with incompatible_runtime when the host does not advertise this capability, so an older host never silently drops the model.
  • Updated the help text for both commands and docs/site/content/docs/cli/orchestration.mdx.

Why

#41005 and #41006 gave Pi a launch catalog and wired it into the desktop launcher, but the catalog never opted into launch-time preferences, so both CLI paths kept refusing. The opt-in is the root-cause fix. The provider/id check and the host capability make mixed-version and chat-surface cases fail early and clearly instead of starting Pi on its default model. getAgentSessionOptionCatalog('pi') stays null. Pi chats keep their own RPC model list.

Linked Issue

Fixes #36544

Visual Proof

N/A. This changes CLI argument handling and process launch only. Nothing in the UI renders differently.

Testing

  • Reproduced on main: with the non-test sources reverted to the merge base, the regression tests and a probe failed 4 of 8 cases with "Agent pi does not support launch-time model selection". That included worker-start resolveWorkerLaunchPreferences({ agent: 'pi', model: 'anthropic/claude-sonnet-4-5', effort: 'high' }). All pass on this branch.

  • agent-launch-model-preferences.test.ts: the gate accepts a Pi model and effort and resolves them to ['--model', M, '--thinking', 'xhigh']. It refuses sonnet, /sonnet and anthropic/.

  • index-agent-launch.test.ts: an older host without agent.launch.pi-model.v1 gets a Pi model refused before any launch or create call. I confirmed this test fails when the gate is disabled.

  • Targeted suites (src/cli/agents, src/cli/specs, src/main/pi, src/shared/agent-session/options, src/shared/agent-launch, worker and agent-launch RPC methods): 100 files / 571 tests pass on macOS.

  • oxlint, oxfmt, anti-slop oxlint, native-plugin oxlint, ast-grep, and the changed-code quality gate all pass on the touched files.

  • End-to-end by the original author: a branch-built CLI ran worktree create --agent pi --model deepseek/deepseek-flash --effort high, and the Pi session showed deepseek-flash • high on its status line.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Risk

The riskiest part is mixed-version behavior. The new CLI refuses a Pi --model/--effort on any host that does not advertise agent.launch.pi-model.v1. That includes v1.4.258-era hosts, which could actually apply the model. This errs toward refusing, never toward silently dropping the model. Users on those hosts see "Update Orca on the execution host, or omit --model." Pi --model now needs an exact provider/id. Pi's CLI fuzzy matching of bare names is not available through Orca, and the docs already say provider/id. Federated worker-start still uses the existing orchestration.worker-launch-preferences.v1 gate, and the remote host rechecks with its own catalog. A plain revert backs this out. No data or settings are migrated.

Level: Low

Review

Cross-platform: values go through the existing launch-catalog serializers and reach Pi as separate argv entries. No shell strings are built. Remote/SSH: covered by the host capability and the existing worker-launch-preferences capability. Folder workspaces: the catalog does not depend on workspace kind. Mobile: no changes.

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

Original fix by @lucas-wu-wakakak in #42255. Their commit was squashed into this one, and their authorship is kept as a Co-authored-by trailer.

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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 (targeted suites and static gates pass locally; full typecheck/test left to CI)

@lucas-wu-wakakak
lucas-wu-wakakak force-pushed the fix/pi-worker-launch-preferences branch from c3bb16d to 31638bd Compare November 14, 2026 02:53
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Pi launch preferences now accept provider-qualified model IDs and map effort options to Pi’s thinking levels. The CLI checks for a runtime capability before launching Pi with session options. Tests cover preference resolution, invalid model IDs, and rejection when the host lacks the capability. CLI documentation describes the Pi options.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 2b711

Pi can now be launched with a chosen model and effort through both agent launch and worker-start, with provider/id validation and a clear error on hosts that lack support. No actionable merge-blocking risk was found. Running the full test suite in CI is the remaining normal check before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed [#36544] requires three things: (1) a thinking level for Pi workers from both worker-start and agent launch, (2) a start receipt that reports the applied value, and (3) unchanged behavior when no …
Out of Scope Changes check Passed All changes relate to the Pi launch-time model and effort objective of [#36544]. Changed areas:
- Catalog opt-in and isPiModelOptionId in agent-session-option-catalog-pi.ts, which enable the launc…
Title check Passed The title names the main change: Pi agent launch and worker-start now accept --model and --effort. It uses the fix(pi) convention and matches the changeset, which adds the supportsWorkerLaunchPreferen…
Description check Passed The description follows the repository template closely. It covers ELI5, What Changed (before and after), Why, Linked Issue (Fixes #36544), Visual Proof (N/A with reason), Testing with reproduction an…
Full details: Linked Issues check

Explanation

[#36544] requires three things: (1) a thinking level for Pi workers from both worker-start and agent launch, (2) a start receipt that reports the applied value, and (3) unchanged behavior when no override is given.

(1) Implemented. PI_LAUNCH_OPTION_CATALOG in agent-session-option-catalog-pi.ts now sets supportsWorkerLaunchPreferences: true. The shared gate checkAgentLaunchModelPreferences therefore accepts Pi model and effort values. The PR maps them to --model and --thinking. The new isPiModelOptionId check limits model IDs to provider/id form. The new capability agent.launch.pi-model.v1 makes callAgentLaunch refuse a Pi launch with a model when the execution host does not advertise it. This refusal is explicit, not a silent fallback to the default.

(2) Partially established. The receipt fields model and effort come from existing shared worker-start code that this PR does not change. The PR reports an end-to-end run that shows the applied values on the Pi status line. I did not inspect the receipt code path in this review. Receipt fidelity rests on that reported run and the shared path.

(3) Preserved. The Pi flags are added only when the user supplies --model or --effort. Without them, the launch path does not change.

No unmet coding requirement was found.

Full details: Out of Scope Changes check

Explanation

All changes relate to the Pi launch-time model and effort objective of [#36544]. Changed areas:

  • Catalog opt-in and isPiModelOptionId in agent-session-option-catalog-pi.ts, which enable the launch path.
  • AGENT_LAUNCH_PI_MODEL_RUNTIME_CAPABILITY in agent-launch-runtime-capability.ts and its gate in agent-launch-request.ts. These stop a silent default start on older hosts.
  • Model-ID validation in agent-launch-model-preferences.ts, with tests.
  • rpc-model-options.ts now uses isPiModelOptionId. This touches Pi chat model parsing. Invalid IDs still throw the existing error, so the change is a validator reuse and does not alter valid chat behavior. I accept it as supporting validation.
  • Tests in index-agent-launch.test.ts, agent-launch-model-preferences.test.ts, and the new Pi catalog test.
  • Help text and orchestration.mdx documentation for the same two commands.

No unrelated change was found. The PR description is stale: it says "4 files + 1 new test file" and does not mention the capability gate or the rpc-model-options.ts change. This does not change the assessment.

Full details: Title check

Explanation

The title names the main change: Pi agent launch and worker-start now accept --model and --effort. It uses the fix(pi) convention and matches the changeset, which adds the supportsWorkerLaunchPreferences opt-in, a provider/id model check, and a host capability for Pi model launch.

Full details: Description check

Explanation

The description follows the repository template closely. It covers ELI5, What Changed (before and after), Why, Linked Issue (Fixes #36544), Visual Proof (N/A with reason), Testing with reproduction and targeted suites, Risk with level and revert path, Review, Agent skill boundary, Notes, and Checklist. The AI Disclosure section is left blank, which the template allows for StablyAI team members. The final checklist item is unchecked and the PR explains why. The Testing section also reports the end-to-end check.

  • 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: ee50dd72-4ad0-4a30-8bc8-155603dfae3b
Commits

Reviewing files that changed from the base of the PR and between 31638bd and 2b711ea.

Files selected for processing: 7

  • src/cli/agents/agent-launch-request.ts
  • src/cli/index-agent-launch.test.ts
  • src/main/pi/rpc/options/rpc-model-options.ts
  • src/shared/agent-launch/choices/agent-launch-model-preferences.test.ts
  • src/shared/agent-launch/choices/agent-launch-model-preferences.ts
  • src/shared/agent-launch/contracts/agent-launch-runtime-capability.ts
  • src/shared/agent-session/options/agent-session-option-catalog-pi.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.

Pi's launch catalog now opts into launch-time model/effort preferences, so
`orca agent launch --agent pi` and `orca orchestration worker-start --agent pi`
accept `--model <provider/id>` and `--effort <level>` instead of refusing.

Pi models without a provider/id shape are refused up front, before a
worktree or worker is created. A new host capability,
`agent.launch.pi-model.v1`, lets the CLI refuse a Pi model/effort on older
execution hosts that would otherwise start Pi on its default model.

Co-authored-by: powerPC <[email protected]>
@nwparker
nwparker force-pushed the fix/pi-worker-launch-preferences branch from 31638bd to 2b711ea Compare November 14, 2026 04:07
@nwparker nwparker changed the title fix(pi): let agent launch and worker-start start Pi on a chosen model and effort fix(pi): accept --model/--effort for Pi agent launch and worker-start Nov 14, 2026
@nwparker
nwparker merged commit d0882ca into stablyai:main Nov 14, 2026
61 checks passed
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the two deleted cases so a reverted catalog flag, a reverted --thinking apply or a dropped capability gate fails again.
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
…#434)

The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the coverage in surviving suites rather than by restoring the retired file, and record the decision in the sync ledger.
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the two deleted cases so a reverted catalog flag, a reverted --thinking apply or a dropped capability gate fails again.
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
…#434)

The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the coverage in surviving suites rather than by restoring the retired file, and record the decision in the sync ledger.
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the two deleted cases so a reverted catalog flag, a reverted --thinking apply or a dropped capability gate fails again.
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
…#434)

The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the coverage in surviving suites rather than by restoring the retired file, and record the decision in the sync ledger.
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the two deleted cases so a reverted catalog flag, a reverted --thinking apply or a dropped capability gate fails again.
nplez1 added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
…#434)

The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the coverage in surviving suites rather than by restoring the retired file, and record the decision in the sync ledger.
lab-agent-np Bot added a commit to nplez1/orca that referenced this pull request Nov 17, 2026
…sion-option catalog (--model / --thinking) (#444)

* test(pi): restore the Pi launch model and thinking coverage (#434)

The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the two deleted cases so a reverted catalog flag, a reverted --thinking apply or a dropped capability gate fails again.

* test(pi): re-home the Pi launch model coverage stablyai#42316 deleted (#434)

The Pi launch catalog, the provider/id refusal and the agent.launch.pi-model.v1 host capability shipped in stablyai#41006 and stablyai#42255, but stablyai#42316 removed every test that pinned them. Restore the coverage in surviving suites rather than by restoring the retired file, and record the decision in the sync ledger.

* test(pi): pin the pi launch catalog lookup with an assertion that can fail (#434)

Round-2 review: getAgentSessionOptionLaunchCatalog returns null, never undefined, so toBeDefined() could not fail when the pi branch was deleted.

---------

Co-authored-by: Nathan Plesnicher <[email protected]>
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.

[Feature]: worker-start / agent launch cannot start a Pi worker on a chosen model or thinking level

2 participants