惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
IT之家
IT之家
博客园 - 叶小钗
雷峰网
雷峰网
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
博客园 - 【当耐特】
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: map google adaptive thinking dynamically · openclaw/...
steipete · 2026-04-25 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -82,6 +82,7 @@ Docs: https://docs.openclaw.ai

8282

- Agents/sessions: persist the runtime-resolved context budget from embedded agent runs, so Codex GPT-5.5 sessions keep the catalog/runtime context cap instead of falling back to the generic 200k status value. Fixes #71294. Thanks @tud0r.

8383

- Agents/tools: fail runs before model submission when explicit tool allowlists resolve to no callable tools, preventing text-only hallucinated tool results for missing tools such as plugin commands that were not registered. Fixes #71292. Thanks @steipete.

8484

- Agents/embedded: skip provider submission when an embedded run has no prompt, replay history, or prompt-local images, preventing empty OpenAI Responses requests from surfacing provider errors into user channels. Fixes #71130. Thanks @steipete.

85+

- Providers/Google: map `/think adaptive` to Gemini dynamic thinking instead of a fixed medium/high budget, using Gemini 3's provider default and Gemini 2.5's `thinkingBudget: -1`. Fixes #71316. Thanks @steipete.

8586

- Providers/MiniMax: keep M2.7 chat model metadata text-only so image tool requests route through `MiniMax-VL-01` instead of the Anthropic-compatible chat endpoint. Fixes #71296. Thanks @ilker-cevikkaya.

8687

- Discord/replies: run `message_sending` plugin hooks for Discord reply delivery, including DM targets, so plugins can transform or cancel outbound Discord replies consistently with other channels. Fixes #59350. (#71094) Thanks @wei840222.

8788

- Control UI/commands: carry provider-owned thinking option ids/labels in session rows and defaults so fresh sessions show and accept dynamic modes such as `adaptive`, `xhigh`, and `max`. Fixes #71269. Thanks @Young-Khalil.

Original file line numberDiff line numberDiff line change

@@ -14,7 +14,7 @@ title: "Thinking levels"

1414

- medium → “think harder”

1515

- high → “ultrathink” (max budget)

1616

- xhigh → “ultrathink+” (GPT-5.2+ and Codex models, plus Anthropic Claude Opus 4.7 effort)

17-

- adaptive → provider-managed adaptive thinking (supported for Claude 4.6 on Anthropic/Bedrock and Anthropic Claude Opus 4.7)

17+

- adaptive → provider-managed adaptive thinking (supported for Claude 4.6 on Anthropic/Bedrock, Anthropic Claude Opus 4.7, and Google Gemini dynamic thinking)

1818

- max → provider max reasoning (currently Anthropic Claude Opus 4.7)

1919

- `x-high`, `x_high`, `extra-high`, `extra high`, and `extra_high` map to `xhigh`.

2020

- `highest` maps to `high`.

@@ -27,6 +27,7 @@ title: "Thinking levels"

2727

- Anthropic Claude Opus 4.7 maps `/think xhigh` to adaptive thinking plus `output_config.effort: "xhigh"`, because `/think` is a thinking directive and `xhigh` is the Opus 4.7 effort setting.

2828

- Anthropic Claude Opus 4.7 also exposes `/think max`; it maps to the same provider-owned max effort path.

2929

- OpenAI GPT models map `/think` through model-specific Responses API effort support. `/think off` sends `reasoning.effort: "none"` only when the target model supports it; otherwise OpenClaw omits the disabled reasoning payload instead of sending an unsupported value.

30+

- Google Gemini maps `/think adaptive` to Gemini's provider-owned dynamic thinking. Gemini 3 requests omit a fixed `thinkingLevel`, while Gemini 2.5 requests send `thinkingBudget: -1`; fixed levels still map to the closest Gemini `thinkingLevel` or budget for that model family.

3031

- MiniMax (`minimax/*`) on the Anthropic-compatible streaming path defaults to `thinking: { type: "disabled" }` unless you explicitly set thinking in model params or request params. This avoids leaked `reasoning_content` deltas from MiniMax's non-native Anthropic stream format.

3132

- Z.AI (`zai/*`) only supports binary thinking (`on`/`off`). Any non-`off` level is treated as `on` (mapped to `low`).

3233

- Moonshot (`moonshot/*`) maps `/think off` to `thinking: { type: "disabled" }` and any non-`off` level to `thinking: { type: "enabled" }`. When thinking is enabled, Moonshot only accepts `tool_choice` `auto|none`; OpenClaw normalizes incompatible values to `auto`.

Original file line numberDiff line numberDiff line change

@@ -180,6 +180,40 @@ describe("google provider plugin hooks", () => {

180180

runCase(cliProvider, "google-gemini-cli");

181181

});

182182
183+

it("advertises adaptive thinking for Gemini dynamic thinking", async () => {

184+

const { providers } = await registerProviderPlugin({

185+

plugin: googleProviderPlugin,

186+

id: "google",

187+

name: "Google Provider",

188+

});

189+

const provider = requireRegisteredProvider(providers, "google");

190+

expect(provider.resolveThinkingProfile).toBeDefined();

191+

const resolveThinkingProfile = provider.resolveThinkingProfile!;

192+

const gemini3Profile = resolveThinkingProfile({

193+

provider: "google",

194+

modelId: "gemini-3.1-pro-preview",

195+

} as never);

196+

const gemini25Profile = resolveThinkingProfile({

197+

provider: "google",

198+

modelId: "gemini-2.5-flash",

199+

} as never);

200+
201+

expect(gemini3Profile?.levels).toEqual([

202+

{ id: "off" },

203+

{ id: "low" },

204+

{ id: "adaptive" },

205+

{ id: "high" },

206+

]);

207+

expect(gemini25Profile?.levels).toEqual([

208+

{ id: "off" },

209+

{ id: "minimal" },

210+

{ id: "low" },

211+

{ id: "medium" },

212+

{ id: "adaptive" },

213+

{ id: "high" },

214+

]);

215+

});

216+
183217

it("shares Gemini replay and stream hooks across Google provider variants", async () => {

184218

const { providers } = await registerProviderPlugin({

185219

plugin: googleProviderPlugin,

Original file line numberDiff line numberDiff line change

@@ -12,8 +12,15 @@ export const GOOGLE_GEMINI_PROVIDER_HOOKS = {

1212

resolveThinkingProfile: ({ modelId }: ProviderDefaultThinkingPolicyContext) =>

1313

({

1414

levels: isGoogleGemini3ProModel(modelId)

15-

? [{ id: "off" }, { id: "low" }, { id: "high" }]

16-

: [{ id: "off" }, { id: "minimal" }, { id: "low" }, { id: "medium" }, { id: "high" }],

15+

? [{ id: "off" }, { id: "low" }, { id: "adaptive" }, { id: "high" }]

16+

: [

17+

{ id: "off" },

18+

{ id: "minimal" },

19+

{ id: "low" },

20+

{ id: "medium" },

21+

{ id: "adaptive" },

22+

{ id: "high" },

23+

],

1724

}) satisfies ProviderThinkingProfile,

1825

wrapStreamFn: createGoogleThinkingStreamWrapper,

1926

};

Original file line numberDiff line numberDiff line change

@@ -1,6 +1,7 @@

11

export {

22

createGoogleThinkingPayloadWrapper,

33

createGoogleThinkingStreamWrapper,

4+

isGoogleGemini25ThinkingBudgetModel,

45

isGoogleGemini3FlashModel,

56

isGoogleGemini3ProModel,

67

isGoogleGemini3ThinkingLevelModel,

Original file line numberDiff line numberDiff line change

@@ -10,7 +10,7 @@ describe("google thinking policy", () => {

1010

["minimal", "LOW"],

1111

["low", "LOW"],

1212

["medium", "HIGH"],

13-

["adaptive", "HIGH"],

13+

["adaptive", undefined],

1414

["high", "HIGH"],

1515

["xhigh", "HIGH"],

1616

] as const)("maps Gemini 3 Pro thinking level %s to %s", (thinkingLevel, expected) => {

@@ -40,7 +40,7 @@ describe("google thinking policy", () => {

4040

["minimal", "MINIMAL"],

4141

["low", "LOW"],

4242

["medium", "MEDIUM"],

43-

["adaptive", "MEDIUM"],

43+

["adaptive", undefined],

4444

["high", "HIGH"],

4545

["xhigh", "HIGH"],

4646

] as const)("maps Gemini 3 Flash thinking level %s to %s", (thinkingLevel, expected) => {

@@ -53,7 +53,7 @@ describe("google thinking policy", () => {

5353

});

5454
5555

it.each([

56-

[-1, "MINIMAL"],

56+

[-1, undefined],

5757

[0, "MINIMAL"],

5858

[2048, "LOW"],

5959

[8192, "MEDIUM"],

@@ -98,6 +98,43 @@ describe("google thinking policy", () => {

9898

});

9999

});

100100
101+

it("keeps Gemini 3 adaptive thinking provider-dynamic instead of forcing a fixed level", () => {

102+

const payload = {

103+

generationConfig: {

104+

thinkingConfig: { thinkingBudget: 8192, includeThoughts: true },

105+

},

106+

};

107+
108+

sanitizeGoogleThinkingPayload({

109+

payload,

110+

modelId: "gemini-3-flash-preview",

111+

thinkingLevel: "adaptive",

112+

});

113+
114+

expect(payload.generationConfig.thinkingConfig).toEqual({

115+

includeThoughts: true,

116+

});

117+

});

118+
119+

it("maps Gemini 2.5 adaptive thinking to dynamic thinkingBudget", () => {

120+

const payload = {

121+

config: {

122+

thinkingConfig: { thinkingBudget: 8192, includeThoughts: true },

123+

},

124+

};

125+
126+

sanitizeGoogleThinkingPayload({

127+

payload,

128+

modelId: "gemini-2.5-flash",

129+

thinkingLevel: "adaptive",

130+

});

131+
132+

expect(payload.config.thinkingConfig).toEqual({

133+

includeThoughts: true,

134+

thinkingBudget: -1,

135+

});

136+

});

137+
101138

it("maps Gemma 4 thinking mode without sending thinkingBudget", () => {

102139

const payload = {

103140

config: {

Original file line numberDiff line numberDiff line change

@@ -1,6 +1,7 @@

11

export {

22

createGoogleThinkingPayloadWrapper,

33

createGoogleThinkingStreamWrapper,

4+

isGoogleGemini25ThinkingBudgetModel,

45

isGoogleGemini3FlashModel,

56

isGoogleGemini3ProModel,

67

isGoogleGemini3ThinkingLevelModel,

Original file line numberDiff line numberDiff line change

@@ -444,6 +444,44 @@ describe("google transport stream", () => {

444444

});

445445

});

446446
447+

it("keeps adaptive Gemini 3 thinking on provider dynamic defaults", () => {

448+

const params = buildGoogleGenerativeAiParams(

449+

buildGeminiModel({ id: "gemini-3-flash-preview" }),

450+

{

451+

messages: [{ role: "user", content: "hello", timestamp: 0 }],

452+

} as never,

453+

{

454+

reasoning: "adaptive",

455+

} as never,

456+

);

457+
458+

expect(params.generationConfig).toMatchObject({

459+

thinkingConfig: { includeThoughts: true },

460+

});

461+

expect(params.generationConfig).not.toMatchObject({

462+

thinkingConfig: { thinkingLevel: expect.any(String) },

463+

});

464+

expect(params.generationConfig).not.toMatchObject({

465+

thinkingConfig: { thinkingBudget: expect.any(Number) },

466+

});

467+

});

468+
469+

it("maps adaptive Gemini 2.5 thinking to dynamic thinkingBudget", () => {

470+

const params = buildGoogleGenerativeAiParams(

471+

buildGeminiModel({ id: "gemini-2.5-flash" }),

472+

{

473+

messages: [{ role: "user", content: "hello", timestamp: 0 }],

474+

} as never,

475+

{

476+

reasoning: "adaptive",

477+

} as never,

478+

);

479+
480+

expect(params.generationConfig).toMatchObject({

481+

thinkingConfig: { includeThoughts: true, thinkingBudget: -1 },

482+

});

483+

});

484+
447485

it("normalizes explicit Gemini 3 Pro thinking levels", () => {

448486

const params = buildGoogleGenerativeAiParams(

449487

buildGeminiModel({ id: "gemini-3.1-pro-preview" }),

Original file line numberDiff line numberDiff line change

@@ -25,6 +25,7 @@ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtim

2525

import { parseGeminiAuth } from "./gemini-auth.js";

2626

import { normalizeGoogleApiBaseUrl } from "./provider-policy.js";

2727

import {

28+

isGoogleGemini25ThinkingBudgetModel,

2829

isGoogleGemini3FlashModel,

2930

isGoogleGemini3ProModel,

3031

resolveGoogleGemini3ThinkingLevel,

@@ -238,6 +239,10 @@ function getGoogleThinkingBudget(

238239

return undefined;

239240

}

240241
242+

function isAdaptiveReasoningLevel(value: unknown): value is "adaptive" {

243+

return value === "adaptive";

244+

}

245+
241246

function resolveGoogleThinkingConfig(

242247

model: GoogleTransportModel,

243248

options: GoogleTransportOptions | undefined,

@@ -268,6 +273,17 @@ function resolveGoogleThinkingConfig(

268273

if (!options?.reasoning) {

269274

return getDisabledThinkingConfig(model.id);

270275

}

276+

if (isAdaptiveReasoningLevel(options.reasoning)) {

277+

if (isGoogleGemini3ProModel(model.id) || isGoogleGemini3FlashModel(model.id)) {

278+

return { includeThoughts: true };

279+

}

280+

if (isGoogleGemini25ThinkingBudgetModel(model.id)) {

281+

return normalizeGoogleThinkingConfig(model.id, {

282+

includeThoughts: true,

283+

thinkingBudget: -1,

284+

});

285+

}

286+

}

271287

if (isGoogleGemini3ProModel(model.id) || isGoogleGemini3FlashModel(model.id)) {

272288

return {

273289

includeThoughts: true,

Original file line numberDiff line numberDiff line change

@@ -97,7 +97,7 @@ describe("sanitizeGoogleThinkingPayload — gemini-2.5-pro zero budget", () => {

9797

});

9898

});

9999
100-

it("fills thinkingLevel for Gemini 3 Flash negative budgets", () => {

100+

it("rewrites Gemini 3 Flash negative budgets when a fixed thinking level is explicit", () => {

101101

const payload = {

102102

config: {

103103

thinkingConfig: { thinkingBudget: -1, includeThoughts: true },

@@ -113,4 +113,37 @@ describe("sanitizeGoogleThinkingPayload — gemini-2.5-pro zero budget", () => {

113113

thinkingLevel: "MEDIUM",

114114

});

115115

});

116+
117+

it("keeps Gemini 3 adaptive thinking on provider dynamic defaults", () => {

118+

const payload = {

119+

config: {

120+

thinkingConfig: { thinkingBudget: 8192, includeThoughts: true },

121+

},

122+

};

123+

sanitizeGoogleThinkingPayload({

124+

payload,

125+

modelId: "gemini-3-flash-preview",

126+

thinkingLevel: "adaptive",

127+

});

128+

expect(payload.config.thinkingConfig).toEqual({

129+

includeThoughts: true,

130+

});

131+

});

132+
133+

it("maps Gemini 2.5 adaptive thinking to thinkingBudget=-1", () => {

134+

const payload = {

135+

config: {

136+

thinkingConfig: { thinkingBudget: 8192, includeThoughts: true },

137+

},

138+

};

139+

sanitizeGoogleThinkingPayload({

140+

payload,

141+

modelId: "gemini-2.5-flash",

142+

thinkingLevel: "adaptive",

143+

});

144+

expect(payload.config.thinkingConfig).toEqual({

145+

includeThoughts: true,

146+

thinkingBudget: -1,

147+

});

148+

});

116149

});