Skip to content

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

Merged
lab-agent-np[bot] merged 3 commits into
mainfrom
nplez1/issue-434
Nov 17, 2026
Merged

lab-agent-np[bot] merged 3 commits into
mainfrom
nplez1/issue-434

Conversation

@lab-agent-np

@lab-agent-np lab-agent-np Bot commented Nov 17, 2026

Copy link
Copy Markdown

Fixes #434

Summary

The launch-time model selection this issue asks for already shipped on main, and the repro is version skew rather than a missing feature:

  • 3e0b7f791a2 — feat(pi): offer a thinking level for Pi terminal launches (#41006) adds the effort → --thinking option to PI_LAUNCH_OPTION_CATALOG.
  • d0882ca38c2 — fix(pi): accept --model/--effort for Pi agent launch and worker-start (#42255) adds supportsWorkerLaunchPreferences: true, isPiModelOptionId + the provider/id refusal, the pi entry in the extra-arguments allowlist, and the host capability agent.launch.pi-model.v1 that makes an old host refuse instead of starting Pi on its default model.
  • git tag --contains d0882ca38c2 → v1.4.214-np.56. The issue's base is 3babb8f5f8 (2026-10-17), which predates both commits; 1.4.214-np.50 therefore refuses exactly as reported.

So orca agent launch --agent pi --model <provider/id> --effort <level> compiles to pi --model <provider/id> --thinking <level>, orca worktree create --agent pi --model … goes through the same validator, and a host that cannot apply a Pi model refuses with incompatible_runtime instead of dropping the flag.

What was actually missing is the coverage: b9b4a115c53 (test: remove low-value CLI dashboard and browser examples (#42316)) deleted every test that pinned those behaviours — the whole of agent-launch-model-preferences.test.ts and the agent.launch.pi-model.v1 refusal case in index-agent-launch.test.ts. Nothing else in the suites asserted Pi --thinking, Pi model acceptance, or the capability refusal.

This PR restores that coverage, in surviving suites rather than by restoring the retired file, and records the decision in the sync ledger:

  • src/shared/agent-session/options/catalog-providers/agent-session-option-catalog.test.ts — a pi launch catalog block: the pi launch catalog resolves, {model, effort} is accepted and compiles to ['--model', …, '--thinking', 'xhigh']; a model without a provider/id and a thinking level Pi does not list are both refused invalid_argument.
  • src/cli/index-agent-launch.test.ts — orca agent launch --agent pi --model … against a host without agent.launch.pi-model.v1 exits 1 with incompatible_runtime and makes no agent.launch, agent.launchReplay or worktree.create call.
  • local/sync/convergence-ledger.md — a 2026-11-17 addendum under § "Test inventories retired upstream" recording the re-homing, so a future sync does not re-litigate it.

No production code changes.

Verification

Command Result
pnpm test src/shared/agent-session/options/catalog-providers/agent-session-option-catalog.test.ts --maxWorkers=2 5 passed
pnpm test src/cli/index-agent-launch.test.ts --maxWorkers=2 3 passed
pnpm tc exit 0
pnpm check:code-quality:changed main 0 new findings across 2 changed files; "Changed-code quality gate passed since ff98047"
orca-queue node local/gate-unit.mjs Unit gate @e8cbcc000e (clean): PASS — 26392 passed; 1 failed (0 allowlisted, 0 unexpected); 1 flaky re-run passed; 0 unhandled error headline(s); 240 s

The diff touches src/shared/** and src/cli/**, so the full unit gate applies and was run on the pushed revision. The one failure was FLAKY, not ours: src/main/network/best-effort-socket-type-of-service.test.ts › installBestEffortSocketTypeOfService reproduces the native EINVAL on a reset macOS socket — it passed on the gate's isolation re-run, and it is unrelated to this diff.

Discrimination was checked by reverting each behaviour and re-running, then restoring:

  • removing supportsWorkerLaunchPreferences: true from agent-session-option-catalog-pi.ts fails launches Pi on a chosen model and thinking level;
  • removing the provider/id refusal from agent-launch-model-preferences.ts fails refuses a Pi model without a provider;
  • removing the Pi branch in callAgentLaunch fails the CLI case with expected 'runtime_error' to be 'incompatible_runtime'.

Decisions

  1. Test-only, no production change. The issue's three expected behaviours all hold on main and in v1.4.214-np.56; the honest fix for the report is the release note plus restored regression coverage. The PR body states this so the reporter is pointed at np.56.
  2. Re-home into surviving suites rather than restore agent-launch-model-preferences.test.ts. local/sync/convergence-ledger.md:922, :2223 and :2594 all say the same thing — a deleted upstream test file is not restored; the assertion goes into a surviving suite next to the code. Re-adding the file would have re-paid sync churn for coverage upstream retired, and the new ledger addendum records why this coverage is worth keeping anyway (the feature it pins is live, and #42316 deleted it as collateral of an examples sweep).
  3. No assertions on refusal copy. The round-2 review suggested pinning the two refusal cases by message. docs/agents-md-refs/test-antipatterns.md:16 lists "Assert copy or translations" as an anti-pattern, and message is English copy while the only structured field this contract exposes is code. The cases assert refusal.code, which is the observable contract at this layer, and each still fails when the behaviour it names is reverted (verified above).
  4. No agent.launch.pi-model.v1 gate on federated orchestration worker-start. A federated start already refuses on the execution host: legacy-remote/federation.ts:65 → prepareFederationWorkerLaunchOnHost → prepareFederationConfiguredWorkerStart → resolveWorkerStartAgent → resolveWorkerLaunchPreferences → checkAgentLaunchModelPreferences, which refuses when that host's Pi catalog lacks supportsWorkerLaunchPreferences, before any worktree is created. isKnownRemoteStartFailure treats invalid_argument as a known failure, so the home host records and reports it. There is no silent-drop window, and a home-side agent === 'pi' test would miss alias-mapped Pi agents, whose aliases only the remote resolves.
  5. Pi model rows in the in-app launcher picker are a separate change. Pi's catalog seeds no models because they depend on each user's configured providers (models: []), and listing them needs a host-side listModels probe plus a change to agentPickerListsCliModels. Thinking levels already appear in the launcher since #41006. This is noted here rather than folded in, since it is renderer and host work outside a CLI launch issue.

Reviewed by claude/opus, high: R1 clean after 1 SHOULD-FIX and 1 MINOR fixed, R2 clean with its one MINOR applied

@lab-agent-np

lab-agent-np Bot commented Nov 17, 2026

Copy link
Copy Markdown
Author

The gatekeeper did not merge (it never merges on a failed gate).

  • the branch is behind main; rebase on it and push

@lab-agent-np

lab-agent-np Bot commented Nov 17, 2026

Copy link
Copy Markdown
Author

The gatekeeper did not merge (it never merges on a failed gate).

  • the branch is behind main; rebase on it and push

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.
…#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.
… fail (#434)

Round-2 review: getAgentSessionOptionLaunchCatalog returns null, never undefined, so toBeDefined() could not fail when the pi branch was deleted.
@lab-agent-np
lab-agent-np Bot merged commit 5437d9a into main Nov 17, 2026
7 checks passed
@lab-agent-np
lab-agent-np Bot deleted the nplez1/issue-434 branch November 17, 2026 10:18
@lab-agent-np

lab-agent-np Bot commented Nov 17, 2026

Copy link
Copy Markdown
Author

Merged as 5437d9a0600f by the auto driver.

Gate — clean worktree at b195d2d2f243

  • typecheck ok
  • tests ok
  • code-quality ok
  • focused tests: 2 file(s)
  • base: main

Review — approve from claude/opus (product decisions reviewed: True)

Decisions

  1. Test-only, no production change. The issue's three expected behaviours all hold on main and in v1.4.214-np.56; the honest fix for the report is the release note plus restored regression coverage. The PR body states this so the reporter is pointed at np.56.
  2. Re-home into surviving suites rather than restore agent-launch-model-preferences.test.ts. `local/sync/convergence-ledger.md

Workspace auto-434 deleted, branch deleted by the squash merge, agent:auto kept on the closed issue as the audit record.

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]: pi agent has no launch-time model selection — add a pi session-option catalog (--model / --thinking)

1 participant