Skip to content

fix(commands): handle "/model default" as reset to configured default#13993

Closed
0xRaini wants to merge 1 commit intoopenclaw:mainfrom
0xRaini:fix/model-default-reset
Closed

fix(commands): handle "/model default" as reset to configured default#13993
0xRaini wants to merge 1 commit intoopenclaw:mainfrom
0xRaini:fix/model-default-reset

Conversation

@0xRaini
Copy link

@0xRaini 0xRaini commented Feb 11, 2026

Problem

/model default is interpreted as a model name, resolving to anthropic/default which fails the allowlist check:

Model "anthropic/default" is not allowed. Use /models to list providers, or /models <provider> to list models.

Users expect /model default to reset their model override back to the configured default.

Fixes #13982

Solution

Add an early return in resolveModelDirectiveFromInline() that handles "default" (case-insensitive) by returning the configured default provider and model with isDefault: true, which clears the model override.

This matches the existing behavior of session_status tool with model=default.

AI Disclosure

This PR was authored with AI assistance.

Greptile Overview

Greptile Summary

This PR adjusts chat /model directive parsing so that /model default is treated as “reset to configured default” rather than a literal model name (which previously resolved to anthropic/default and failed allowlist validation). The change is implemented as an early return in resolveModelSelectionFromDirective, returning the configured default provider/model with isDefault: true so session overrides are cleared (matching the existing session_status tool behavior for model=default).

Main gap: the new behavior isn’t covered by the existing directive-handling tests, so it’s easy for a future refactor to regress back to the allowlist error path.

Confidence Score: 4/5

  • This PR is likely safe to merge once basic regression coverage is added.
  • The code change is small, consistent with existing session_status semantics, and uses the existing isDefault mechanism to clear overrides. The main risk is behavioral regression without tests for /model default (including case-insensitivity).
  • src/auto-reply/reply/directive-handling.model.ts (add/adjust tests in src/auto-reply/reply/directive-handling.model.test.ts)

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +339 to +342
// "/model default" resets to the configured default model
if (raw.toLowerCase() === "default") {
return {
modelSelection: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing regression test

This adds new user-facing parsing behavior for /model default (case-insensitive) that clears the model override via isDefault: true, but there’s no corresponding test in src/auto-reply/reply/directive-handling.model.test.ts. Please add coverage for /model default (and ideally /model DEFAULT) to ensure future changes don’t reintroduce the allowlist error path.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/directive-handling.model.ts
Line: 339:342

Comment:
**Missing regression test**

This adds new user-facing parsing behavior for `/model default` (case-insensitive) that clears the model override via `isDefault: true`, but there’s no corresponding test in `src/auto-reply/reply/directive-handling.model.test.ts`. Please add coverage for `/model default` (and ideally `/model DEFAULT`) to ensure future changes don’t reintroduce the allowlist error path.

How can I resolve this? If you propose a fix, please make it concise.

TWFBusiness added a commit to TWFBusiness/openclaw-tw that referenced this pull request Feb 11, 2026
…pstream fixes

- Remove Discord, Telegram, Slack, Signal, iMessage, BlueBubbles extensions
- Remove @buape/carbon, grammy, and other gateway-specific dependencies
- Add session-based login system (cookie auth, rate limiting)
- Add type stubs for optional deps (baileys, ciao, qrcode-terminal)
- Apply upstream PRs: XSS fix (openclaw#13952), orphan tool_results (openclaw#13974),
  Anthropic tool ID sanitization (openclaw#13976), BM25 score fix (openclaw#14005),
  redaction fix (openclaw#14006), subagent timeout (openclaw#13996), context window
  guard (openclaw#13986), model default reset (openclaw#13993), cache token accounting (openclaw#13853)
- Fix all TypeScript compilation errors from channel removal

Co-Authored-By: Claude Opus 4.6 <[email protected]>
When users type "/model default" to reset their model override,
the directive handler passes "default" to resolveModelRefFromString
which resolves it as "anthropic/default" — a non-existent model.
This fails the allowlist check with an unhelpful error.

Add an early return for "default" that resolves to the configured
default provider and model, matching the behavior of session_status
model=default.

Fixes #13982
@0xRaini

This comment was marked as spam.

@thewilloftheshadow
Copy link
Member

Banning user due to spam/slop + copying other users PRs and pinging users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/model default resolves to 'anthropic/default' instead of resetting to configured default model

2 participants

Comments