Skip to content

/model should switch only the current session unless the user explicitly sets a default #4331

Description

@qqqys

What happened?

/model is described as switching the model "for this session", but the current implementation also persists the selected model as the default for future sessions.

From source inspection on current main/local checkout:

  • packages/cli/src/ui/commands/modelCommand.ts calls persistSetting(settings, 'model.name', ...) from the immediate /model <model-id> path.
  • Provider-qualified selections also persist security.auth.selectedType.
  • packages/cli/src/ui/components/ModelDialog.tsx persists model.name and security.auth.selectedType after selecting a model from the picker.

This makes a session-scoped model switch leak into later sessions. It also makes it hard to temporarily try another model without changing the configured default.

What did you expect to happen?

/model <model-id> and ordinary model-picker selection should switch only the active session.

Persisting a default model for new sessions should require an explicit action, for example:

  • a dedicated picker shortcut/action such as d / "set as default";
  • or a separate command flag such as /model --default <model-id>.

/model --fast <model-id> can remain persistent because that setting controls the suggestion/speculative fast model rather than the active session's main model.

Client information

Client Information

Source-inspection report rather than a runtime /about report.

Repository: QwenLM/qwen-code
Local commit inspected: 5d56f11b85a71dc51293e2bd8785e2a728dbb95b
Platform: macOS Darwin arm64
Node requirement from repository docs: >=22

Relevant files:

packages/cli/src/ui/commands/modelCommand.ts
packages/cli/src/ui/components/ModelDialog.tsx

Login information

Not authentication-provider specific. The issue is in CLI settings persistence around model selection.

Anything else we need to know?

Claude Code 2.1.144 recently changed /model to affect only the current session and uses an explicit default-setting action in the model picker. Qwen Code's command text already says "for this session", so aligning the behavior would match the current UX contract and avoid surprising settings changes.

Suggested acceptance criteria:

  • /model <model-id> updates the runtime Config / active content generator for the current session only.
  • The picker can switch the active session without writing model.name or security.auth.selectedType.
  • A clearly explicit default-setting path persists model.name and auth type.
  • Tests cover that a plain /model <id> does not call settings.setValue(...), while the explicit default path does.

Metadata

Metadata

Assignees

Labels

category/cliCommand line interface and interactionscope/model-switchingModel selection and switchingscope/settingsSettings and preferencesstatus/needs-triageIssue needs to be triaged and labeledtype/bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions