Skip to content

[Feature]: pi agent has no launch-time model selection — add a pi session-option catalog (--model / --thinking) #434

Closed

Description

@nplez1

What

Orca has no launch-time model selection for the pi agent. --model/--effort are refused outright instead of being applied, and the refusal is a capability gap rather than a user error, so every caller that wants a pi worker on a named model has to bypass orca agent launch entirely.

Repro (Orca 1.4.214-np.50, macOS, pi 1.4.0 / Pi-Bolt 1.0.7)

$ orca-np agent launch --agent pi --model deepseek/deepseek-flash-auto --effort high \
    --worktree name:some-worktree --prompt hi --json
{
  "id": "local",
  "ok": false,
  "error": {
    "code": "invalid_argument",
    "message": "Agent pi does not support launch-time model selection. Omit --model to run the model from its own config."
  },
  "_meta": { "runtimeId": null }
}

Same for orca worktree create --agent pi --model …: the flag is accepted by the parser and then refused by the capability check.

Worse: it used to fail silently. On 1.4.214-np.45 the same command returned ok: true and started the agent on pi's own settings.json default (verified from the resulting pi session: {"provider":"isoquant","modelId":"deepseek-v4.1-flash-1017-fast"} while --model deepseek/deepseek-flash-auto was requested). So callers can be pinned to neither an error nor the requested behaviour depending on host version.

Where it comes from (fork source, HEAD 3babb8f5f8)

  • src/shared/agent-session-option-catalog.ts:35 — CATALOGS covers antigravity, claude, codebuddy, codex, gemini, cursor, grok, muse, omp. No pi entry, so getAgentSessionOptionLaunchCatalog('pi') is null.
  • src/shared/agent-launch-model-preferences.ts:50-57 — checkAgentLaunchModelPreferences refuses any agent whose catalog is missing (or has no modelApply.launchArgs), which is that error string.
  • src/shared/automation-extra-agent-args.ts:32-46 — the extra-arguments allowlist has no pi either (omp: [MODEL_OPTION] is the closest example), so there is no second path to pass a model.
  • src/shared/agent-session-option-catalog-omp.ts:20 — OMP, which is pi-compatible and consumes the same PI_CODING_AGENT_DIR/extension contract (src/shared/pi-agent-kind.ts), does have --model.

What pi's CLI actually supports

pi --model <provider/id>      # also "<provider/id>:<thinking>" shorthand
pi --thinking <level>         # off | minimal | low | medium | high | xhigh | max

So both halves of a launch pin map onto real flags; nothing has to be composed or typed into the TUI.

Expected

  1. A pi session-option catalog (mirroring the OMP one) so orca agent launch --agent pi --model <provider/id> --effort <level> (and orca worktree create --agent pi --model …) starts pi with --model <provider/id> --thinking <level>.
  2. --effort → --thinking for pi specifically (pi's flag is --thinking, not --effort), with pi's valid levels accepted and anything else refused.
  3. When the host cannot apply a model, keep the explicit refusal (as np.50 does) rather than dropping the flag — the silent version is what made this expensive to notice.

Why it matters

Any orchestration caller that needs a specific model per worker is locked out: orca-np refuses, so automation has to launch agents through orca terminal create --command "pi --model … --thinking …" and hand-deliver the prompt, which loses agent launch's prompt plumbing, title/conversation naming and operation replay. In this lab that is the agent:auto driver (nplez1/homelab, automation/agent-driver): it resolves an implementer model from ~/.config/pi-config/model-roles.json and had to move from --model to a terminal command because of this.

Workaround in use today

orca-np terminal create --worktree path:<worktree> --command \
  'pi --model deepseek/deepseek-flash-auto --thinking high "$(cat .agent-brief.md)"'

Verified: the session starts on deepseek/deepseek-flash-auto at thinkingLevel: high, and Orca does register the pane as an agent row (agentType: "pi", paneKey, state transitions) — so process detection is fine; only the launch argument path is missing.

Activity

  1. added
    enhancement
    agent:auto
    on Nov 16, 2026
  2. lab-agent-np commented on Nov 17, 2026

    @lab-agent-np

    Picked up in workspace auto-434.

  3. nplez1 commented on Nov 17, 2026

    @nplez1
    OwnerAuthor

    Plan (Opus planner, claude/opus, high reasoning, tool enabled)

    Finding first: the feature already landed, and shipped

    The two halves the issue asks for are both on main, and both are ancestors of this branch:

    • 3e0b7f791a2 feat(pi): offer a thinking level for Pi terminal launches (#41006) — --effort → --thinking.
    • d0882ca38c2 fix(pi): accept --model/--effort for Pi agent launch and worker-start (#42255) — supportsWorkerLaunchPreferences: true, isPiModelOptionId, the provider/id refusal, and the host capability agent.launch.pi-model.v1.

    git tag --contains d0882ca38c2 → v1.4.214-np.56. The repro in this issue is against 1.4.214-np.50, whose base is 3babb8f5f8 (2026-10-17) — older than both commits. So the repro no longer reproduces on np.56 or on main; orca agent launch --agent pi --model <provider/id> --effort <level> compiles to --model <provider/id> --thinking <level>, orca worktree create --agent pi --model … goes through the same validator, and the extra-arguments allowlist now carries pi: [--model, --thinking].

    What is actually missing

    The regression coverage stablyai#42255 shipped was deleted by an unrelated sweep. b9b4a115c53 test: remove low-value CLI dashboard and browser examples (#42316) removed:

    • the whole of src/shared/agent-launch/choices/agent-launch-model-preferences.test.ts (pi accepts --model/--effort and compiles to --model … --thinking …; non-provider/id models are refused);
    • the 30-line refuses a Pi model on a host that would start Pi on its default model case in src/cli/index-agent-launch.test.ts — the only guard on expected behaviour 3 of this issue.

    Nothing else in the suites asserts pi --thinking, pi model acceptance, or the capability refusal (rg AGENT_LAUNCH_PI_MODEL_RUNTIME_CAPABILITY returns only the implementation and the contract file).

    Approach

    A test-only PR: restore both deleted pi tests, adapted to the current layout, plus one assertion for expected behaviour 2 ("anything else refused"). No production code changes.

    The one candidate code change I considered and rejected: gating a federated orchestration worker-start --agent pi --model … on the remote's agent.launch.pi-model.v1. It is redundant. The execution host already resolves the alias and runs the same validator during orchestration.federationAttachStart — legacy-remote/federation.ts:65 → prepareFederationWorkerLaunchOnHost (worker-opencode-model-preflight.ts:21) → prepareFederationConfiguredWorkerStart (worker-configured-agent-preflight.ts:29) → resolveWorkerStartAgent (worker-start-validation.ts:153) → resolveWorkerLaunchPreferences → checkAgentLaunchModelPreferences, which refuses when its own pi catalog lacks supportsWorkerLaunchPreferences (agent-launch-model-preferences.ts:56-61). That check runs before any worktree is created (federation.ts:65 precedes :70), and isKnownRemoteStartFailure treats invalid_argument as a known failure (federated-worker-start-receipts.ts:3-12), so the home host records a failed dispatch and reports it. There is no silent-drop window on worker-start, and a home-side agent === 'pi' test would also miss alias-mapped pi agents, whose aliases only the remote can resolve.

    File map

    File Change
    src/shared/agent-launch/choices/agent-launch-model-preferences.test.ts (new) The deleted unit test, with the resolveAgentSessionOptionLaunch import moved to ../../agent-session/options/launch/agent-session-option-launch, plus an out-of-range effort refusal.
    src/cli/index-agent-launch.test.ts Re-add the capability-refusal case and its imports (okFixture; both pi constants).

    Risks

    • Production behaviour: none — no source file changes.
    • Upstream sync: one new test file under an upstream-owned path, and ~30 lines in an upstream test that upstream deleted on purpose. Conflict surface is small.
    • Global-input classification: a new file under src/shared/** counts as a global input, so the unit gate applies.

    Acceptance criteria

    1. checkAgentLaunchModelPreferences({agent:'pi', model:'deepseek/deepseek-flash', effort:'xhigh'}) returns the preferences, and resolveAgentSessionOptionLaunch('pi', …).args is ['--model','deepseek/deepseek-flash','--thinking','xhigh'].
    2. sonnet, /sonnet, anthropic/ and an effort outside pi's levels are refused invalid_argument.
    3. orca agent launch --agent pi --model … against a host without agent.launch.pi-model.v1 exits 1 with incompatible_runtime and makes no launch call.
    4. Reverting supportsWorkerLaunchPreferences: true or the --thinking apply turns 1 red; deleting the pi branch in callAgentLaunch (agent-launch-request.ts:146-155) turns 3 red.

    Test strategy

    pnpm test src/shared/agent-launch/choices/agent-launch-model-preferences.test.ts, pnpm test src/cli/index-agent-launch.test.ts, pnpm tc, pnpm check:code-quality:changed main, and the unit gate for the global-input classification. Each restored test is re-checked against the repo's "do not add tests by default" rule: it fails if the behaviour is reverted, its expected values are literals rather than read from the catalog, and it runs at the single layer that owns the behaviour.

    Product calls

    • Reuse agent.launch.pi-model.v1 for orchestration rather than minting an orchestration.* id — moot now that the orchestration gate is dropped; if it were ever wanted, the existing capability means exactly "this host's pi catalog applies --model/--thinking", and a new id would be false on every currently paired host.
    • Leave alias resolution to the execution host rather than testing agent === 'pi' on the home host.
    • Pi model rows in the in-app launcher picker are a follow-up, not this PR. Pi's catalog seeds no models because they depend on each user's configured providers, and listing them needs a host-side listModels probe plus a change to agentPickerListsCliModels; thinking levels already appear in the launcher since feat(pi): offer a thinking level for Pi terminal launches stablyai/orca#41006.
  4. nplez1 commented on Nov 17, 2026

    @nplez1
    OwnerAuthor

    Outcome: the feature is already on main and shipped in v1.4.214-np.56, so this is version skew rather than a missing capability.

    What was missing was the regression coverage: b9b4a115c53 (stablyai#42316, "remove low-value CLI dashboard and browser examples") deleted agent-launch-model-preferences.test.ts and the agent.launch.pi-model.v1 refusal case in index-agent-launch.test.ts as collateral of an examples sweep. The branch restores those cases in surviving suites (per local/sync/convergence-ledger.md § "Test inventories retired upstream") and records the decision there.

    Two constraints the issue did not state, both resolved in the branch's favour of "no code change":

    • A federated orca orchestration worker-start --agent pi --model … needs no new capability gate: the execution host already runs the same validator during orchestration.federationAttachStart and refuses before any worktree is created, and a home-side agent === 'pi' test would miss alias-mapped Pi agents.
    • The in-app launcher picker still lists no Pi models (Pi's catalog seeds none, because they depend on each user's configured providers), though it does offer thinking levels since feat(pi): offer a thinking level for Pi terminal launches stablyai/orca#41006. That needs a host-side listModels probe and is a separate change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:autoenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions