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

推荐订阅源

N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
人人都是产品经理
人人都是产品经理
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog
WordPress大学
WordPress大学
小众软件
小众软件
IT之家
IT之家
腾讯CDC
月光博客
月光博客
量子位
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

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): use endpoint context limits (#86041) · o...
clawsweeper · 2026-05-24 · via Recent Commits to openclaw:main
1-

import { mkdtempSync, rmSync } from "node:fs";

1+

import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";

22

import { tmpdir } from "node:os";

33

import { join } from "node:path";

44

import { importFreshModule } from "openclaw/plugin-sdk/test-fixtures";

@@ -92,6 +92,112 @@ describe("openrouter-model-capabilities", () => {

9292

});

9393

});

949495+

it("uses endpoint-specific OpenRouter context length when top_provider reports one", async () => {

96+

await withOpenRouterStateDir(async () => {

97+

vi.stubGlobal(

98+

"fetch",

99+

vi.fn(

100+

async () =>

101+

new Response(

102+

JSON.stringify({

103+

data: [

104+

{

105+

id: "nvidia/nemotron-3-super-120b-a12b:free",

106+

name: "Nemotron 3 Super 120B Free",

107+

architecture: { modality: "text->text" },

108+

context_length: 1_000_000,

109+

top_provider: {

110+

context_length: 262_144,

111+

max_completion_tokens: 262_144,

112+

},

113+

pricing: { prompt: "0", completion: "0" },

114+

},

115+

],

116+

}),

117+

{

118+

status: 200,

119+

headers: { "content-type": "application/json" },

120+

},

121+

),

122+

),

123+

);

124+125+

const module = await importOpenRouterModelCapabilities("top-provider-context-length");

126+

await module.loadOpenRouterModelCapabilities("nvidia/nemotron-3-super-120b-a12b:free");

127+128+

expect(

129+

module.getOpenRouterModelCapabilities("nvidia/nemotron-3-super-120b-a12b:free"),

130+

).toMatchObject({

131+

contextWindow: 262_144,

132+

maxTokens: 262_144,

133+

});

134+

});

135+

});

136+137+

it("does not reuse older disk caches with precomputed OpenRouter context windows", async () => {

138+

await withOpenRouterStateDir(async (stateDir) => {

139+

const modelId = "nvidia/nemotron-3-super-120b-a12b:free";

140+

const cacheDir = join(stateDir, "cache");

141+

mkdirSync(cacheDir, { recursive: true });

142+

writeFileSync(

143+

join(cacheDir, "openrouter-models.json"),

144+

JSON.stringify({

145+

version: 2,

146+

models: {

147+

[modelId]: {

148+

name: "Nemotron 3 Super 120B Free",

149+

input: ["text"],

150+

reasoning: false,

151+

contextWindow: 1_000_000,

152+

maxTokens: 262_144,

153+

cost: {

154+

input: 0,

155+

output: 0,

156+

cacheRead: 0,

157+

cacheWrite: 0,

158+

},

159+

},

160+

},

161+

}),

162+

);

163+164+

const fetchSpy = vi.fn(

165+

async () =>

166+

new Response(

167+

JSON.stringify({

168+

data: [

169+

{

170+

id: modelId,

171+

name: "Nemotron 3 Super 120B Free",

172+

architecture: { modality: "text->text" },

173+

context_length: 1_000_000,

174+

top_provider: {

175+

context_length: 262_144,

176+

max_completion_tokens: 262_144,

177+

},

178+

pricing: { prompt: "0", completion: "0" },

179+

},

180+

],

181+

}),

182+

{

183+

status: 200,

184+

headers: { "content-type": "application/json" },

185+

},

186+

),

187+

);

188+

vi.stubGlobal("fetch", fetchSpy);

189+190+

const module = await importOpenRouterModelCapabilities("old-context-window-cache");

191+

await module.loadOpenRouterModelCapabilities(modelId);

192+193+

expect(fetchSpy).toHaveBeenCalledTimes(1);

194+

expect(module.getOpenRouterModelCapabilities(modelId)).toMatchObject({

195+

contextWindow: 262_144,

196+

maxTokens: 262_144,

197+

});

198+

});

199+

});

200+95201

it("preserves explicit OpenRouter tool support metadata", async () => {

96202

await withOpenRouterStateDir(async () => {

97203

vi.stubGlobal(