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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
T
Tailwind CSS Blog
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
博客园 - 叶小钗
N
Netflix TechBlog - Medium
罗磊的独立博客
量子位
MyScale Blog
MyScale Blog
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
B
Blog
腾讯CDC
爱范儿
爱范儿
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
F
Fortinet All Blogs
雷峰网
雷峰网
G
Google Developers Blog
Google DeepMind News
Google DeepMind News

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: validate deepinfra model metadata numbers · openclaw...
steipete · 2026-05-29 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -436,6 +436,50 @@ describe("discoverDeepInfraSurfaces (per-surface bucketing)", () => {

436436

});

437437

});

438438
439+

it("drops malformed live numeric metadata", async () => {

440+

const mockFetch = vi.fn().mockResolvedValue({

441+

ok: true,

442+

json: () =>

443+

Promise.resolve({

444+

data: [

445+

makeAgentModelEntry({

446+

id: "bad/chat",

447+

metadata: {

448+

description: "bad chat",

449+

context_length: -1,

450+

max_tokens: 1.5,

451+

pricing: { input_tokens: 3, output_tokens: 15 },

452+

tags: ["chat"],

453+

},

454+

}),

455+

makeAgentModelEntry({

456+

id: "bad/image",

457+

metadata: {

458+

description: "bad image",

459+

pricing: { per_image_unit: 0.003 },

460+

tags: ["image-gen"],

461+

default_width: Number.POSITIVE_INFINITY,

462+

default_height: 1024.5,

463+

default_iterations: 0,

464+

},

465+

}),

466+

],

467+

}),

468+

});

469+
470+

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

471+

const catalog = await discoverDeepInfraSurfaces();

472+
473+

expect(catalog.chat[0]).toMatchObject({ id: "bad/chat" });

474+

expect(catalog.chat[0]?.contextWindow).toBeUndefined();

475+

expect(catalog.chat[0]?.maxTokens).toBeUndefined();

476+

expect(catalog.imageGen[0]).toMatchObject({ id: "bad/image" });

477+

expect(catalog.imageGen[0]?.defaultWidth).toBeUndefined();

478+

expect(catalog.imageGen[0]?.defaultHeight).toBeUndefined();

479+

expect(catalog.imageGen[0]?.defaultIterations).toBeUndefined();

480+

});

481+

});

482+
439483

it("returns the manifest static fallback (live=false) when no API key is configured", async () => {

440484

const mockFetch = vi.fn();

441485
Original file line numberDiff line numberDiff line change

@@ -4,6 +4,7 @@ import { fetchWithTimeout } from "openclaw/plugin-sdk/provider-http";

44

import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared";

55

import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";

66

import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";

7+

import { asPositiveSafeInteger } from "openclaw/plugin-sdk/string-coerce-runtime";

78

import manifest from "./openclaw.plugin.json" with { type: "json" };

89
910

const log = createSubsystemLogger("deepinfra-models");

@@ -131,15 +132,12 @@ function entryToSurfaceModel(entry: DeepInfraAgentModelEntry): DeepInfraSurfaceM

131132

name: id,

132133

description: metadata.description ?? undefined,

133134

tags,

134-

contextWindow:

135-

typeof metadata.context_length === "number" ? metadata.context_length : undefined,

136-

maxTokens: typeof metadata.max_tokens === "number" ? metadata.max_tokens : undefined,

135+

contextWindow: asPositiveSafeInteger(metadata.context_length),

136+

maxTokens: asPositiveSafeInteger(metadata.max_tokens),

137137

pricing,

138-

defaultWidth: typeof metadata.default_width === "number" ? metadata.default_width : undefined,

139-

defaultHeight:

140-

typeof metadata.default_height === "number" ? metadata.default_height : undefined,

141-

defaultIterations:

142-

typeof metadata.default_iterations === "number" ? metadata.default_iterations : undefined,

138+

defaultWidth: asPositiveSafeInteger(metadata.default_width),

139+

defaultHeight: asPositiveSafeInteger(metadata.default_height),

140+

defaultIterations: asPositiveSafeInteger(metadata.default_iterations),

143141

};

144142

}

145143