Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1d6940f
fix(cli): keep model switches session-scoped
zjunothing Jul 9, 2026
77da2b8
Merge branch 'main' into fix/model-session-default
wenshao Jul 10, 2026
c044a02
fix(cli): add model command translations
zjunothing Jul 10, 2026
bf724cc
Merge branch 'main' into fix/model-session-default
wenshao Jul 10, 2026
a6e995d
Merge branch 'main' into fix/model-session-default
wenshao Jul 10, 2026
b6e9b58
Merge branch 'main' into fix/model-session-default
wenshao Jul 11, 2026
a36e33d
Merge branch 'main' into fix/model-session-default
wenshao Jul 11, 2026
4044ff7
Merge branch 'main' into fix/model-session-default
wenshao Jul 12, 2026
60cc536
Merge branch 'main' into fix/model-session-default
wenshao Jul 12, 2026
0a01d89
Merge branch 'main' into fix/model-session-default
wenshao Jul 18, 2026
d57bdf0
Merge branch 'main' into fix/model-session-default
wenshao Jul 23, 2026
7b7cb51
Merge branch 'main' into fix/model-session-default
wenshao Jul 23, 2026
02b23fc
Merge branch 'main' into fix/model-session-default
wenshao Jul 23, 2026
d6e7252
merge(main): combine --default and --image flags in model command
qwen-code-dev-bot Jul 26, 2026
ff7e91d
Merge branch 'main' into fix/model-session-default
wenshao Jul 26, 2026
1adfab3
fix(cli): preserve model command persistence semantics
zjunothing Jul 29, 2026
d1c23dc
Merge branch 'main' into fix/model-session-default
wenshao Jul 30, 2026
ded4336
fix(cli): address review feedback on /model --default (#6579)
Aug 1, 2026
6e81163
chore(cli): merge main into fix/model-session-default
Aug 1, 2026
9cbc430
Merge branch 'main' into fix/model-session-default
qwen-code-dev-bot Aug 1, 2026
fdac9fd
test(cli): cover resolved config baseUrl in default model picker
qwen-code-dev-bot Aug 1, 2026
f893109
fix(cli): restrict --default flag parsing to leading positions (#6579)
qwen-code-ci-bot Aug 1, 2026
991395a
test(cli): cover selectedType persistence for --default with explicit…
qwen-code-ci-bot Aug 1, 2026
5b12caf
test(cli): cover --voice and --vision in --default mutual-exclusion g…
qwen-code-ci-bot Aug 1, 2026
db59eb8
test(cli): cover --default --global direct-switch and trailing-flag f…
qwen-code-ci-bot Aug 1, 2026
78df51b
fix(cli): show inline-prompt rejection before scope guard in /model (…
qwen-code-ci-bot Aug 2, 2026
ed0ac4f
fix(cli): point inline-prompt rejection hint at working --default com…
qwen-code-ci-bot Aug 2, 2026
9246bbf
fix(cli): address review feedback on --default model persistence (#6579)
qwen-code-ci-bot Aug 2, 2026
237b2ed
fix(cli): align model persistence docs and locales (#6579)
zjunothing Aug 3, 2026
44be9d7
fix(cli): detect trailing --default after whitespace runs and aux fla…
qwen-code-ci-bot Aug 3, 2026
a90f499
Merge branch 'main' into fix/model-session-default
qwen-code-ci-bot Aug 3, 2026
c50a114
Merge remote-tracking branch 'origin/main' into fix/model-session-def…
qwen-code-ci-bot Aug 3, 2026
56d62ff
Merge branch 'main' into fix/model-session-default
qwen-code-dev-bot Aug 3, 2026
5152271
fix(cli): align --default docs and rejections with persistence behavi…
qwen-code-ci-bot Aug 3, 2026
7e9cc4d
Merge branch 'fix/model-session-default' of https://github.com/zjunot…
qwen-code-dev-bot Aug 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/users/configuration/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ After launching Qwen Code, use the `/model` command to switch between all config
/model
```

The picker will show all models from your `modelProviders` configuration, grouped by their protocol (e.g. `openai`, `anthropic`, `gemini`). Your selection is persisted across sessions.
The picker will show all models from your `modelProviders` configuration, grouped by their protocol (e.g. `openai`, `anthropic`, `gemini`). A selection from the ordinary `/model` picker applies only to the current session. To persist a selection for future sessions, use `/model --default <model-id>` or open the picker with `/model --default` and select a model.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] docs/users/features/commands.md was not updated for the new persistence semantics — Failure scenario: a user upgrading from the pre-PR behavior (plain /model <id> persisted the model) opens the command reference to find how to persist a default model and sees the /model, /model --fast, /model --voice, /model --vision rows with no --default anywhere on the page — concluding the persist capability was removed rather than moved behind a flag.

That page contains zero --default mentions at this commit (grep-verified), and no note that plain /model switches are now session-scoped, while this diff updated three other docs pages (auth.md — this hunk, model-providers.md, settings.md) for exactly this change. The maintainer review (item 6) asked for a docs line because this is an intentional breaking change to behavior people rely on; the file is not touched by any commit in this PR.

Suggested fix: add a /model --default row next to the existing /model row (e.g. | → --default | Persist the main model for future sessions | /model --default <model-id>, /model --default --project <model-id> |) and note in the /model row that plain switches are session-scoped.

中文说明

[Suggestion] docs/users/features/commands.md 没有针对新的持久化语义更新 —— 失败场景:从旧行为(普通 /model <id> 会持久化模型)升级的用户打开命令参考,想找到持久化默认模型的方法,却只看到 /model/model --fast/model --voice/model --vision 行,整页没有任何 --default —— 会以为持久化能力被移除了,而不是挪到了标志后面。

该页面在当前提交中没有出现任何 --default(已用 grep 验证),也没有说明普通 /model 切换现在是会话级的;而本 diff 为同一语义变更更新了另外三个文档页面(auth.md —— 即本行、model-providers.md、settings.md)。维护者评审(第 6 项)要求补一行文档,因为这是用户依赖的行为上有意的破坏性变更;该文件不在本 PR 的任何提交中。

建议修复:在现有 /model 行旁增加 /model --default 行(例如 | → --default | 为后续会话持久化主模型 | /model --default <model-id>、/model --default --project <model-id> |),并在 /model 行注明普通切换仅作用于当前会话。

— qwen3.8-max via Qwen Code /review (v0.21.3)


You can also switch models directly with a command-line argument, which is convenient when working across multiple terminals.

Expand Down
2 changes: 1 addition & 1 deletion docs/users/configuration/model-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,5 +675,5 @@ The snapshot:
>
> Define `modelProviders` in the user-scope `~/.qwen/settings.json` whenever possible and avoid persisting credential overrides in any scope. Keeping the provider catalog in user settings prevents merge/override conflicts between project and user scopes and ensures `/auth` and `/model` updates always write back to a consistent scope.

- `/model` and `/auth` persist `model.name` (where applicable) and `security.auth.selectedType` to the closest writable scope that already defines `modelProviders`; otherwise they fall back to the user scope. This keeps workspace/user files in sync with the active provider catalog.
- Plain `/model <model-id>` commands and selections from the ordinary `/model` picker apply only to the current session. `/model --default <model-id>` persists `model.name` (it selects by id only and clears any persisted `model.baseUrl` disambiguator; an explicit auth-type suffix also persists `security.auth.selectedType`). Selecting a model from the picker opened by `/model --default` additionally persists the disambiguating `model.baseUrl` and the selected provider's `security.auth.selectedType`. `/auth` continues to persist its selected authentication type. Persistent selections use the closest writable scope that already defines `modelProviders`; otherwise they fall back to the user scope.
- Without `modelProviders`, the resolver mixes CLI/env/settings layers, creating Runtime Models. This is fine for single-provider setups but cumbersome when frequently switching. Define provider catalogs whenever multi-model workflows are common so that switches stay atomic, source-attributed, and debuggable.
2 changes: 1 addition & 1 deletion docs/users/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Settings are organized into categories. Most settings should be placed within th
| -------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `model.name` | string | The Qwen model to use for conversations. | `undefined` |
| `model.reasoningEffort` | enum | How hard reasoning-capable models think, applied across all providers. Set with the [`/effort`](../features/commands) command (`low`, `medium`, `high`, `xhigh`, `max`). Each provider maps and clamps this to what the active model supports (e.g. Gemini caps at `high`; Anthropic clamps tiers a model lacks). Leave unset to use the model/provider default. | `undefined` |
| `model.baseUrl` | string | Persisted automatically by the model picker to disambiguate when multiple `modelProviders` entries share the same model id. Not intended to be set by hand — use the `/model` picker or a `modelProviders` entry instead; a stale hand-edited value can silently route requests to a different same-id provider. | `undefined` |
| `model.baseUrl` | string | Persisted with a default model selection made through the picker opened with `/model --default` to disambiguate when multiple `modelProviders` entries share the same model id. The `/model --default <model-id>` argument form selects by id only and clears any persisted disambiguator. Plain model switches are session-scoped. Not intended to be set by hand — use the default-model picker or a `modelProviders` entry instead; a stale hand-edited value can silently route requests to a different same-id provider. | `undefined` |
| `model.sessionTokenLimit` | number | Maximum recorded prompt token count allowed before sending the next message. `-1` means unlimited; `0` is also treated as unlimited (unlike `model.maxToolCalls`, where `0` disallows all calls). When the recorded prompt count exceeds the limit, the next send is dropped (the session is not aborted). | `-1` |
| `model.maxSessionTurns` | integer | Maximum number of user/model/tool turns to keep in a session. -1 means unlimited. | `-1` |
| `model.maxWallTimeSeconds` | number | Wall-clock budget for headless / unattended runs, in seconds. `-1` means unlimited. Overridable per-invocation via `--max-wall-time`, which requires a positive duration (`90`, `30s`, `5m`, `1h`, `1.5h`); the minimum is 1 second — sub-second values (`500ms`, `0.5`) are rejected as typos. Omit the flag to fall back to this setting. Aborts with exit code 55 when exceeded. | `-1` |
Expand Down
3 changes: 2 additions & 1 deletion docs/users/features/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ Commands for managing AI tools and models.
| → `auto-edit` | Auto-approve edits (trusted environment) | `/approval-mode auto-edit` |
| → `auto` | Classifier-evaluated approval (autonomous) | `/approval-mode auto` |
| → `yolo` | Auto-approve everything (quick prototyping) | `/approval-mode yolo` |
| `/model` | Switch model used in current session | `/model`, `/model <model-id>` (switch immediately) |
| `/model` | Switch model used in current session (session-scoped, not persisted) | `/model`, `/model <model-id>` (switch immediately) |
| → `--default` | Persist the main model for future sessions | `/model --default <model-id>`, `/model --default --project <model-id>` |
| `/model --fast` | Set a lighter model for prompt suggestions | `/model --fast qwen3-coder-flash` |
| `/model --voice` | Set the model used for voice transcription | `/model --voice <model-id>` |
| `/model --vision` | Set the vision-bridge model used to transcribe images for a text-only main model | `/model --vision <model-id>` |
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/i18n/locales/ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -2539,6 +2539,10 @@ export default {
"Persistir la selecció de model a la configuració del projecte (àmbit de l'espai de treball)",
'Persist the model selection to the user settings (global scope)':
"Persistir la selecció de model a la configuració d'usuari (àmbit global)",
'Persist to project settings (requires --default for the main model)':
'Persistir a la configuració del projecte (requereix --default per al model principal)',
'Persist to user settings (requires --default for the main model)':
"Persistir a la configuració d'usuari (requereix --default per al model principal)",
'Select Fast Model': 'Selecciona el model ràpid',
'Select Vision Model': 'Seleccionar el model de visió',
'Select Voice Model': 'Seleccionar el model de veu',
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,8 @@ export default {
'Switch the model for this session (--fast for suggestion model, --voice for voice transcription model, --vision for the vision bridge model, --project to persist to project settings, --global to persist to user settings, [model-id] to switch immediately, or [model-id] [prompt] to run a one-off prompt on another model; the inline prompt is sent verbatim without @file expansion).',
'Switch the model for this session (--fast for suggestion model, --voice for voice transcription model, --vision for the vision bridge model, --compaction for chat compression model, --image for the image generation model, --project to persist to project settings, --global to persist to user settings, [model-id] to switch immediately, or [model-id] [prompt] to run a one-off prompt on another model; the inline prompt is sent verbatim without @file expansion).':
'Switch the model for this session (--fast for suggestion model, --voice for voice transcription model, --vision for the vision bridge model, --compaction for chat compression model, --image for the image generation model, --project to persist to project settings, --global to persist to user settings, [model-id] to switch immediately, or [model-id] [prompt] to run a one-off prompt on another model; the inline prompt is sent verbatim without @file expansion).',
'Switch the model for this session (--default to persist the main model for future sessions, --fast for suggestion model, --voice for voice transcription model, --vision for the vision bridge model, --compaction for chat compression model, --image for the image generation model, --project to persist to project settings, --global to persist to user settings, [model-id] to switch immediately, or [model-id] [prompt] to run a one-off prompt on another model; the inline prompt is sent verbatim without @file expansion).':
'Switch the model for this session (--default to persist the main model for future sessions, --fast for suggestion model, --voice for voice transcription model, --vision for the vision bridge model, --compaction for chat compression model, --image for the image generation model, --project to persist to project settings, --global to persist to user settings, [model-id] to switch immediately, or [model-id] [prompt] to run a one-off prompt on another model; the inline prompt is sent verbatim without @file expansion).',
"Inline one-shot override isn't supported in this mode — run '/model {{model}}' first, then send your prompt.":
"Inline one-shot override isn't supported in this mode — run '/model {{model}}' first, then send your prompt.",
"Inline one-shot override can't switch providers. '{{model}}' belongs to a different provider — run '/model {{model}}' first, then send your prompt.":
Expand All @@ -1523,6 +1525,10 @@ export default {
'Persist the model selection to the project settings (workspace scope)',
'Persist the model selection to the user settings (global scope)':
'Persist the model selection to the user settings (global scope)',
'Persist to project settings (requires --default for the main model)':
'Persist to project settings (requires --default for the main model)',
'Persist to user settings (requires --default for the main model)':
'Persist to user settings (requires --default for the main model)',
'Select Fast Model': 'Select Fast Model',
'Select Vision Model': 'Select Vision Model',
'Select Image Model': 'Select Image Model',
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/i18n/locales/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,10 @@ export default {
'Persister la sélection du modèle dans les paramètres du projet (étendue workspace)',
'Persist the model selection to the user settings (global scope)':
'Persister la sélection du modèle dans les paramètres utilisateur (étendue globale)',
'Persist to project settings (requires --default for the main model)':
'Persister dans les paramètres du projet (nécessite --default pour le modèle principal)',
'Persist to user settings (requires --default for the main model)':
'Persister dans les paramètres utilisateur (nécessite --default pour le modèle principal)',
'API Key': 'API Key',
'(default)': '(par défaut)',
'(not set)': '(non défini)',
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/i18n/locales/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,10 @@ export default {
'モデルの選択をプロジェクト設定に永続化(ワークスペーススコープ)',
'Persist the model selection to the user settings (global scope)':
'モデルの選択をユーザー設定に永続化(グローバルスコープ)',
'Persist to project settings (requires --default for the main model)':
'プロジェクト設定に永続化(メインモデルには --default が必要)',
'Persist to user settings (requires --default for the main model)':
'ユーザー設定に永続化(メインモデルには --default が必要)',
'API Key': 'API Key',
'(default)': '(デフォルト)',
'(not set)': '(未設定)',
Expand Down
Loading
Loading