qwen-code/packages/cli
jinye 4ac9ec07c3
fix(cli): recognize OpenAI-compatible providers in qwen auth status (#3623)
* fix(cli): recognize OpenAI-compatible providers in `qwen auth status`

Previously `qwen auth status` treated all `selectedType=openai` setups
as Coding Plan, checking only `BAILIAN_CODING_PLAN_API_KEY`. Users who
configured generic OpenAI-compatible providers (e.g. Xunfei, DeepSeek,
Ollama) via `modelProviders.openai` saw a misleading "Alibaba Cloud
Coding Plan (Incomplete)" even though their provider worked correctly.

Split the USE_OPENAI branch into two paths:
- Coding Plan: detected by `codingPlan.region` or `CODING_PLAN_ENV_KEY`
- Generic OpenAI-compatible: checks API key from modelProviders envKey,
  OPENAI_API_KEY, or settings.security.auth.apiKey; displays provider
  info including model name and base URL.

Closes #3612

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): improve Coding Plan detection and align API key check semantics

Address review feedback:

1. Detect Coding Plan via isCodingPlanConfig(baseUrl, envKey) on the
   active modelProviders entry instead of checking BAILIAN_CODING_PLAN_API_KEY
   env var presence. A stale env key from a previous setup no longer
   misclassifies a generic OpenAI-compatible provider as Coding Plan.

2. When modelProviders entry has an explicit envKey, only check that key
   without falling back to OPENAI_API_KEY or settings.security.auth.apiKey.
   This mirrors hasApiKeyForAuth() semantics in auth.ts, preventing
   status from reporting "configured" when the actual provider key is
   missing.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): fix TS2367 type error in displayRegion comparison

`detectedCodingPlanRegion` is `CodingPlanRegion | false`, so
`!== true` comparison is invalid. Simplify to truthiness check.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): refine model fallback and Coding Plan key detection

- Only fall back to models[0] when model.name is unset; when set but
  not matching any provider entry, treat as unmanaged to avoid binding
  status to an unrelated provider's envKey/baseUrl.
- Simplify hasCodingPlanKey to only check CODING_PLAN_ENV_KEY, not
  activeModelConfig.envKey, preventing a generic provider key from
  being mistaken as Coding Plan credentials when codingPlan.region
  is stale.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): prioritize active model config over stale codingPlan.region

When activeModelConfig exists, trust isCodingPlanConfig() result over
potentially stale codingPlan.region from a previous setup. This prevents
a user who switched from Coding Plan to a generic provider from still
seeing "Alibaba Cloud Coding Plan" in auth status.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): avoid stale Coding Plan fallback in auth status

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: jinye.djy <jinye.djy@alibaba-inc.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-28 09:06:09 +08:00
..
src fix(cli): recognize OpenAI-compatible providers in qwen auth status (#3623) 2026-04-28 09:06:09 +08:00
index.ts feat(core): detect tool validation retry loops and inject stop directive (#3178) 2026-04-18 10:24:46 +08:00
package.json chore(release): bump version to 0.15.2 (#3596) 2026-04-24 19:55:12 +08:00
test-setup.ts fix: prevent bogus shell permission rules in tests 2026-03-20 17:55:33 +08:00
tsconfig.json Merge pull request #2428 from qqqys/feat/mcp_reconnect_error 2026-04-01 16:53:36 +08:00
vitest.config.ts refactor(core): Unify package exports and improve dev experience 2026-02-01 11:59:05 +08:00