diff --git a/src/auto-reply/reply/directive-handling.model.test.ts b/src/auto-reply/reply/directive-handling.model.test.ts index 21fc75efc18..f4b95e6894f 100644 --- a/src/auto-reply/reply/directive-handling.model.test.ts +++ b/src/auto-reply/reply/directive-handling.model.test.ts @@ -281,6 +281,24 @@ describe("/model chat UX", () => { expect(reply?.text).toContain("Active: deepinfra/moonshotai/Kimi-K2.5 (runtime)"); }); + it("uses the active agent context for legacy /model list replies", async () => { + const reply = await resolveModelInfoReply({ + directives: parseInlineDirectives("/model list"), + cfg: { + commands: { text: true }, + agents: { + defaults: { model: { primary: "anthropic/claude-opus-4-6" } }, + list: [{ id: "support", model: "localai/ultra-chat" }], + }, + } as unknown as OpenClawConfig, + activeAgentId: "support", + agentDir: TEST_AGENT_DIR, + }); + + expect(reply?.text).toContain("Providers:"); + expect(reply?.text).toContain("localai"); + }); + it("auto-applies closest match for typos", () => { const directives = parseInlineDirectives("/model anthropic/claud-opus-4-5"); const cfg = { commands: { text: true } } as unknown as OpenClawConfig; diff --git a/src/auto-reply/reply/directive-handling.model.ts b/src/auto-reply/reply/directive-handling.model.ts index 636258e45cf..7f405e26d88 100644 --- a/src/auto-reply/reply/directive-handling.model.ts +++ b/src/auto-reply/reply/directive-handling.model.ts @@ -234,6 +234,11 @@ export async function maybeHandleModelDirectiveInfo(params: { const reply = await resolveModelsCommandReply({ cfg: params.cfg, commandBodyNormalized: "/models", + surface: params.surface, + currentModel: `${params.provider}/${params.model}`, + agentId: params.activeAgentId, + agentDir: params.agentDir, + sessionEntry: params.sessionEntry, }); return reply ?? { text: "No models available." }; }