fix(coding-agent): require --model when --provider is given

--provider without --model was ignored and the default model from
another provider ran instead. It now fails with an error. Also fixes
the outdated "(default: google)" in the --help text.

closes #10236
This commit is contained in:
David Brailovsky 2026-10-01 10:24:55 +02:00
parent 70c036211d
commit 0c453048bd
4 changed files with 9 additions and 2 deletions

View file

@ -11,6 +11,7 @@
- Fixed MCP OAuth sign-in accepting an authorization response whose `iss` parameter names another authorization server; the code is now rejected before it is exchanged (RFC 9207).
- Fixed MCP OAuth sign-in failing with `Invalid scope` when the token response contains `"scope": ""`, and similar failures for other empty or `null` optional OAuth fields ([#10266](https://github.com/earendil-works/pi/issues/10266)).
- Fixed the sign-in URL printed by `/mcp login` not being clickable when it wraps ([#10186](https://github.com/earendil-works/pi/issues/10186)).
- Fixed `--provider` without `--model` being silently ignored and running the default model from another provider; it now fails with an error ([#10236](https://github.com/earendil-works/pi/issues/10236)).
## [0.99.2] - 2026-09-30

View file

@ -61,7 +61,7 @@ pi --model sonnet:high
See [Choose a Model](models.md) for model selection and [Provider Authentication](providers.md) for credentials.
- `--provider <name>`<br>
Restricts `--model` lookup to one provider.
Restricts `--model` lookup to one provider. It requires `--model`.
- `--model <pattern>`<br>
Selects by exact ID or fuzzy ID/name match. It accepts `provider/id` and an optional `:<thinking>` suffix.
- `--api-key <key>`<br>

View file

@ -286,7 +286,7 @@ ${chalk.bold("Commands:")}
${APP_NAME} <command> --help Show help for install/remove/uninstall/update/list/config/auth/mcp
${chalk.bold("Options:")}
--provider <name> Provider name (default: google)
--provider <name> Provider to search for --model (requires --model)
--model <pattern> Model pattern or ID (supports "provider/id" and optional ":<thinking>")
--api-key <key> API key (defaults to env vars)
--system-prompt <text> System prompt (default: coding assistant prompt)

View file

@ -466,6 +466,12 @@ function buildSessionOptions(
// Model from CLI
// - supports --provider <name> --model <pattern>
// - supports --model <provider>/<pattern>
if (parsed.provider && !parsed.model) {
diagnostics.push({
type: "error",
message: `--provider requires --model (for example: --provider ${parsed.provider} --model <pattern>)`,
});
}
if (parsed.model) {
const resolved = resolveCliModel({
cliProvider: parsed.provider,