diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index b74bfb33c..dc726321d 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -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 diff --git a/packages/coding-agent/docs/cli.md b/packages/coding-agent/docs/cli.md index 8e1300390..832642aa8 100644 --- a/packages/coding-agent/docs/cli.md +++ b/packages/coding-agent/docs/cli.md @@ -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 `
- Restricts `--model` lookup to one provider. + Restricts `--model` lookup to one provider. It requires `--model`. - `--model `
Selects by exact ID or fuzzy ID/name match. It accepts `provider/id` and an optional `:` suffix. - `--api-key `
diff --git a/packages/coding-agent/src/cli/args.ts b/packages/coding-agent/src/cli/args.ts index 17f27513f..b3d58d7cb 100644 --- a/packages/coding-agent/src/cli/args.ts +++ b/packages/coding-agent/src/cli/args.ts @@ -286,7 +286,7 @@ ${chalk.bold("Commands:")} ${APP_NAME} --help Show help for install/remove/uninstall/update/list/config/auth/mcp ${chalk.bold("Options:")} - --provider Provider name (default: google) + --provider Provider to search for --model (requires --model) --model Model pattern or ID (supports "provider/id" and optional ":") --api-key API key (defaults to env vars) --system-prompt System prompt (default: coding assistant prompt) diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts index ee2679a43..d9c6ce33c 100644 --- a/packages/coding-agent/src/main.ts +++ b/packages/coding-agent/src/main.ts @@ -466,6 +466,12 @@ function buildSessionOptions( // Model from CLI // - supports --provider --model // - supports --model / + if (parsed.provider && !parsed.model) { + diagnostics.push({ + type: "error", + message: `--provider requires --model (for example: --provider ${parsed.provider} --model )`, + }); + } if (parsed.model) { const resolved = resolveCliModel({ cliProvider: parsed.provider,