From 830a72d2eeea2deb30d8be173810901ed97a2c25 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 7 May 2026 22:36:02 +0100 Subject: [PATCH] fix(chat): reset model override with default --- CHANGELOG.md | 1 + .../reply/directive-handling.model-selection.ts | 9 +++++++++ .../reply/directive-handling.model.test.ts | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcee21d6d22..1e887856778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,6 +154,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Chat commands: make `/model default` reset the session model override instead of treating it as a literal model name. Fixes #78182. - Cron: make rejected `payload.model` errors show the configured `agents.defaults.models` allowlist instead of echoing the rejected model twice. Fixes #79058. - Agents/subagents: retry parent wake announces when the announce-summary model run fails with fallback cooldown exhaustion instead of dropping the wake on the first transient provider overload. Refs #78581. - Providers/network: honor IPv4 CIDR and octet-wildcard `NO_PROXY` entries such as `100.64.0.0/10` and `100.64.*` before enabling trusted env-proxy mode for model-provider requests. Fixes #79030. diff --git a/src/auto-reply/reply/directive-handling.model-selection.ts b/src/auto-reply/reply/directive-handling.model-selection.ts index 72cee70f949..153e96ce6c9 100644 --- a/src/auto-reply/reply/directive-handling.model-selection.ts +++ b/src/auto-reply/reply/directive-handling.model-selection.ts @@ -66,6 +66,15 @@ export function resolveModelSelectionFromDirective(params: { } const raw = params.directives.rawModelDirective.trim(); + if (/^default$/i.test(raw)) { + return { + modelSelection: { + provider: params.defaultProvider, + model: params.defaultModel, + isDefault: true, + }, + }; + } const storedNumericProfile = params.directives.rawModelProfile === undefined ? resolveStoredNumericProfileModelDirective({ diff --git a/src/auto-reply/reply/directive-handling.model.test.ts b/src/auto-reply/reply/directive-handling.model.test.ts index 327434ebff1..bc9bbf56be0 100644 --- a/src/auto-reply/reply/directive-handling.model.test.ts +++ b/src/auto-reply/reply/directive-handling.model.test.ts @@ -643,6 +643,21 @@ describe("/model chat UX", () => { }); }); + it("treats /model default as a session model reset", () => { + const resolved = resolveModelSelectionForCommand({ + command: "/model default", + allowedModelKeys: new Set(["anthropic/claude-opus-4-6", "openai/gpt-4o"]), + allowedModelCatalog: [], + }); + + expect(resolved.errorText).toBeUndefined(); + expect(resolved.modelSelection).toEqual({ + provider: "anthropic", + model: "claude-opus-4-6", + isDefault: true, + }); + }); + it("keeps openrouter provider/model split for exact selections", () => { const resolved = resolveModelSelectionForCommand({ command: "/model openrouter/anthropic/claude-opus-4-6",