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

推荐订阅源

C
Check Point Blog
罗磊的独立博客
量子位
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
M
MIT News - Artificial intelligence
月光博客
月光博客
IT之家
IT之家
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
D
Docker
The GitHub Blog
The GitHub Blog
B
Blog
V
Visual Studio Blog
博客园 - Franky
N
Netflix TechBlog - Medium
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
博客园 - 聂微东
U
Unit 42

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(openrouter): preserve deepseek v4 reasoning replay · ...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -219,6 +219,127 @@ describe("openrouter provider hooks", () => {

219219

expect(baseStreamFn).toHaveBeenCalledOnce();

220220

});

221221222+

it("fills DeepSeek V4 reasoning_content for OpenRouter replay turns", async () => {

223+

const provider = await registerSingleProviderPlugin(openrouterPlugin);

224+

let capturedPayload: Record<string, unknown> | undefined;

225+

const baseStreamFn = vi.fn(

226+

(

227+

...args: Parameters<import("@mariozechner/pi-agent-core").StreamFn>

228+

): ReturnType<import("@mariozechner/pi-agent-core").StreamFn> => {

229+

const payload = {

230+

messages: [

231+

{ role: "user", content: "read file" },

232+

{ role: "assistant", tool_calls: [{ id: "call_1", type: "function" }] },

233+

{ role: "tool", content: "ok" },

234+

{ role: "assistant", content: "done" },

235+

],

236+

};

237+

void args[2]?.onPayload?.(payload, args[0]);

238+

capturedPayload = payload;

239+

return { async *[Symbol.asyncIterator]() {} } as never;

240+

},

241+

);

242+243+

const wrapped = provider.wrapStreamFn?.({

244+

provider: "openrouter",

245+

modelId: "deepseek/deepseek-v4-flash",

246+

streamFn: baseStreamFn,

247+

thinkingLevel: "xhigh",

248+

} as never);

249+250+

void wrapped?.(

251+

{

252+

provider: "openrouter",

253+

api: "openai-completions",

254+

id: "deepseek/deepseek-v4-flash",

255+

baseUrl: "https://openrouter.ai/api/v1",

256+

compat: {},

257+

} as never,

258+

{ messages: [] } as never,

259+

{},

260+

);

261+262+

expect(capturedPayload).toMatchObject({

263+

thinking: { type: "enabled" },

264+

reasoning_effort: "max",

265+

messages: [

266+

{ role: "user", content: "read file" },

267+

{

268+

role: "assistant",

269+

tool_calls: [{ id: "call_1", type: "function" }],

270+

reasoning_content: "",

271+

},

272+

{ role: "tool", content: "ok" },

273+

{ role: "assistant", content: "done", reasoning_content: "" },

274+

],

275+

});

276+

expect(baseStreamFn).toHaveBeenCalledOnce();

277+

});

278+279+

it("recognizes full OpenRouter DeepSeek V4 refs but skips custom proxy routes", async () => {

280+

const provider = await registerSingleProviderPlugin(openrouterPlugin);

281+

const payloads: Array<Record<string, unknown>> = [];

282+

const baseStreamFn = vi.fn(

283+

(

284+

...args: Parameters<import("@mariozechner/pi-agent-core").StreamFn>

285+

): ReturnType<import("@mariozechner/pi-agent-core").StreamFn> => {

286+

const payload = {

287+

messages: [{ role: "assistant", tool_calls: [{ id: "call_1", type: "function" }] }],

288+

};

289+

void args[2]?.onPayload?.(payload, args[0]);

290+

payloads.push(payload);

291+

return { async *[Symbol.asyncIterator]() {} } as never;

292+

},

293+

);

294+295+

const fullRef = provider.wrapStreamFn?.({

296+

provider: "openrouter",

297+

modelId: "openrouter/deepseek/deepseek-v4-pro",

298+

streamFn: baseStreamFn,

299+

thinkingLevel: "high",

300+

} as never);

301+

void fullRef?.(

302+

{

303+

provider: "openrouter",

304+

api: "openai-completions",

305+

id: "openrouter/deepseek/deepseek-v4-pro",

306+

baseUrl: "https://openrouter.ai/api/v1",

307+

compat: {},

308+

} as never,

309+

{ messages: [] } as never,

310+

{},

311+

);

312+313+

const customRoute = provider.wrapStreamFn?.({

314+

provider: "openrouter",

315+

modelId: "deepseek/deepseek-v4-pro",

316+

streamFn: baseStreamFn,

317+

thinkingLevel: "high",

318+

} as never);

319+

void customRoute?.(

320+

{

321+

provider: "openrouter",

322+

api: "openai-completions",

323+

id: "deepseek/deepseek-v4-pro",

324+

baseUrl: "https://proxy.example.com/v1",

325+

compat: {},

326+

} as never,

327+

{ messages: [] } as never,

328+

{},

329+

);

330+331+

expect(payloads[0]?.messages).toEqual([

332+

{

333+

role: "assistant",

334+

tool_calls: [{ id: "call_1", type: "function" }],

335+

reasoning_content: "",

336+

},

337+

]);

338+

expect(payloads[1]?.messages).toEqual([

339+

{ role: "assistant", tool_calls: [{ id: "call_1", type: "function" }] },

340+

]);

341+

});

342+222343

it("strips OpenRouter-routed Anthropic assistant prefill when reasoning is enabled", async () => {

223344

const provider = await registerSingleProviderPlugin(openrouterPlugin);

224345

let capturedPayload: Record<string, unknown> | undefined;