fix(telegram): preserve agent thinking scope

This commit is contained in:
Dallin Romney
2026-08-20 23:59:11 -07:00
parent 6eddb9fd78
commit bedfd016c3
2 changed files with 37 additions and 0 deletions
@@ -403,6 +403,42 @@ describe("Telegram native command built-ins", () => {
expect(replyMocks.dispatchReplyWithBufferedBlockDispatcher).not.toHaveBeenCalled();
});
it("uses the selected agent-model thinking default", async () => {
const cfg = {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-7" },
models: {
"anthropic/claude-opus-4-7": { params: { thinking: "low" } },
},
},
entries: {
main: {
models: {
"anthropic/claude-opus-4-7": { params: { thinking: "high" } },
},
},
},
},
} as OpenClawConfig;
sessionMocks.sessionStoreEntries.mockReturnValue({});
const { handler, sendMessage } = registerAndResolveCommandHandler({
commandName: "think",
cfg,
allowFrom: ["*"],
});
await handler(createTelegramPrivateCommandContext());
expectSendMessageCall({
sendMessage,
chatId: 100,
textIncludes: "Current thinking level: high.\nChoose level for /think.",
requireReplyMarkup: true,
label: "agent-model thinking menu",
});
});
it("uses per-agent thinking defaults before target model and global thinking defaults", async () => {
const cfg = {
agents: {
@@ -220,6 +220,7 @@ async function resolveTelegramThinkMenuCurrentLevel(params: {
provider: params.provider ?? defaultModel.provider,
model: params.model ?? defaultModel.model,
agentRuntime: params.agentRuntime,
agentId: params.agentId,
loadRuntimeCatalog: async () => params.catalog,
});
}