openclaw - ✅(Solved) Fix /model default does not reset session model override (parsed as literal model name) [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#78182Fetched 2026-05-06 06:16:14
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1referenced ×1

Typing /model default in chat does not reset the session's model override to the configured default. Instead, the literal string "default" is passed to the model resolver, which either errors with Unrecognized model "default" or fuzzy-matches an unrelated model. As a workaround users currently have to type the configured primary explicitly (e.g. /model google/gemini-3-pro-preview or its alias).

Error Message

  1. Observe error / unexpected fuzzy match instead of "Model reset to default".

Root Cause

In src/auto-reply/reply/directive-handling.model-selection.ts (built file: dist/directive-handling.model-selection-ckRDelDT.js), resolveModelSelectionFromDirective passes the raw token straight into resolveModelRefFromString / resolveModelDirectiveSelection. There is no special-case for the string "default", so it is treated as either a bare model id or a fuzzy fragment.

Fix Action

Fix / Workaround

Summary

Typing /model default in chat does not reset the session's model override to the configured default. Instead, the literal string "default" is passed to the model resolver, which either errors with Unrecognized model "default" or fuzzy-matches an unrelated model. As a workaround users currently have to type the configured primary explicitly (e.g. /model google/gemini-3-pro-preview or its alias).

Related (separate, not fixed by this)

Even after clearing the session's own override, resolveStoredModelOverride walks up to parentSessionKey and re-applies the parent's override. So in spawned/forked sessions, /model default will appear to do nothing on the next turn. Worth filing a follow-up issue or addressing in the same change with a "no-inherit" sentinel on the entry. Happy to send a PR for either or both.

PR fix notes

PR #78271: fix: /model default now resets to configured default model

Description (problem / solution / changelog)

Problem

Running /model default in chat passes the literal string "default" to the model resolver, which errors with Unrecognized model "default" or fuzzy-matches an unrelated model. Users have to type the full configured model name to reset.

Fix

Added a special-case check in resolveModelSelectionFromDirective that early-returns a default model selection (isDefault: true) when the trimmed, lowercase raw token is "default" or "primary". This composes correctly with the existing applyModelOverrideToSessionEntry logic, which deletes providerOverride/modelOverride when selection.isDefault is true, producing the existing "Model reset to default" ack.

Testing

  • 2 new tests: /model default and /model primary both return the configured default model with isDefault: true
  • All 51 tests in directive-handling.model.test.ts pass
✓ src/auto-reply/reply/directive-handling.model.test.ts (51 tests)

Fixes #78182

Changed files

  • src/auto-reply/reply/directive-handling.model-selection.ts (modified, +13/-0)
  • src/auto-reply/reply/directive-handling.model.test.ts (modified, +30/-0)

Code Example

const rawLower = raw.toLowerCase();
if ((rawLower === "default" || rawLower === "primary") && params.defaultProvider && params.defaultModel) {
  return { modelSelection: {
    provider: params.defaultProvider,
    model: params.defaultModel,
    isDefault: true,
  }};
}
RAW_BUFFERClick to expand / collapse

Summary

Typing /model default in chat does not reset the session's model override to the configured default. Instead, the literal string "default" is passed to the model resolver, which either errors with Unrecognized model "default" or fuzzy-matches an unrelated model. As a workaround users currently have to type the configured primary explicitly (e.g. /model google/gemini-3-pro-preview or its alias).

Repro

  1. In any session, run /model gemini-flash (or any non-default model) to set an override.
  2. Run /model default to try to reset.
  3. Observe error / unexpected fuzzy match instead of "Model reset to default".

Expected

/model default (and ideally /model primary) should be a recognized reset token that clears providerOverride/modelOverride on the session entry and returns the session to the configured default model — same effect as applyModelOverrideToSessionEntry receiving a selection with isDefault: true.

Root cause

In src/auto-reply/reply/directive-handling.model-selection.ts (built file: dist/directive-handling.model-selection-ckRDelDT.js), resolveModelSelectionFromDirective passes the raw token straight into resolveModelRefFromString / resolveModelDirectiveSelection. There is no special-case for the string "default", so it is treated as either a bare model id or a fuzzy fragment.

Suggested fix

Early-return a default selection when the trimmed lowercase raw equals "default" (and optionally "primary"):

const rawLower = raw.toLowerCase();
if ((rawLower === "default" || rawLower === "primary") && params.defaultProvider && params.defaultModel) {
  return { modelSelection: {
    provider: params.defaultProvider,
    model: params.defaultModel,
    isDefault: true,
  }};
}

This composes correctly with the existing applyModelOverrideToSessionEntry logic, which deletes providerOverride/modelOverride when selection.isDefault is true, and produces the existing "Model reset to default" ack.

Related (separate, not fixed by this)

Even after clearing the session's own override, resolveStoredModelOverride walks up to parentSessionKey and re-applies the parent's override. So in spawned/forked sessions, /model default will appear to do nothing on the next turn. Worth filing a follow-up issue or addressing in the same change with a "no-inherit" sentinel on the entry. Happy to send a PR for either or both.

Environment

  • macOS / OpenClaw installed via Homebrew, dist/ JS bundles (verified against current installed version).
  • Reproduces in webchat and main session contexts.

extent analysis

TL;DR

The issue can be fixed by adding a special case in the resolveModelSelectionFromDirective function to handle the string "default" and return the configured default model selection.

Guidance

  • Add an early return statement in the resolveModelSelectionFromDirective function to check if the trimmed lowercase raw input equals "default" or "primary" and return the default model selection if so.
  • Verify that the applyModelOverrideToSessionEntry logic correctly deletes the providerOverride and modelOverride when selection.isDefault is true.
  • Test the fix in both webchat and main session contexts to ensure it works as expected.
  • Consider filing a follow-up issue to address the related problem of spawned/forked sessions re-applying the parent's override after clearing the session's own override.

Example

const rawLower = raw.toLowerCase();
if ((rawLower === "default" || rawLower === "primary") && params.defaultProvider && params.defaultModel) {
  return { modelSelection: {
    provider: params.defaultProvider,
    model: params.defaultModel,
    isDefault: true,
  }};
}

Notes

The suggested fix only addresses the issue of resetting the session's model override to the configured default when typing "/model default". It does not fix the related issue of spawned/forked sessions re-applying the parent's override.

Recommendation

Apply the suggested workaround by adding the early return statement in the resolveModelSelectionFromDirective function, as it correctly handles the "default" string and returns the configured default model selection.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix /model default does not reset session model override (parsed as literal model name) [1 pull requests, 1 comments, 2 participants]