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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
量子位
S
SegmentFault 最新的问题
博客园 - 聂微东
博客园 - 【当耐特】
J
Java Code Geeks
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
V
V2EX
人人都是产品经理
人人都是产品经理
博客园 - Franky
罗磊的独立博客
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research

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
test(e2e): fix kitchen sink crabbox coverage (#76287) · o...
vincentkoc · 2026-05-03 · via Recent Commits to openclaw:main

@@ -1,5 +1,9 @@

11

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

22

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

3+

import {

4+

fetchWithSsrFGuard,

5+

ssrfPolicyFromHttpBaseUrlAllowedHostname,

6+

} from "openclaw/plugin-sdk/ssrf-runtime";

37

import {

48

normalizeLowercaseStringOrEmpty,

59

normalizeOptionalString,

@@ -533,77 +537,94 @@ export async function discoverChutesModels(accessToken?: string): Promise<ModelD

533537

}

534538535539

try {

536-

let response = await fetch(`${CHUTES_BASE_URL}/models`, {

537-

signal: AbortSignal.timeout(10_000),

538-

headers,

540+

let guardedFetch = await fetchWithSsrFGuard({

541+

url: `${CHUTES_BASE_URL}/models`,

542+

init: {

543+

signal: AbortSignal.timeout(10_000),

544+

headers,

545+

},

546+

policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(CHUTES_BASE_URL),

547+

auditContext: "chutes-model-discovery",

539548

});

549+

let response = guardedFetch.response;

540550541551

if (response.status === 401 && trimmedKey) {

552+

await guardedFetch.release();

542553

effectiveKey = "";

543-

response = await fetch(`${CHUTES_BASE_URL}/models`, {

544-

signal: AbortSignal.timeout(10_000),

554+

guardedFetch = await fetchWithSsrFGuard({

555+

url: `${CHUTES_BASE_URL}/models`,

556+

init: {

557+

signal: AbortSignal.timeout(10_000),

558+

},

559+

policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(CHUTES_BASE_URL),

560+

auditContext: "chutes-model-discovery",

545561

});

562+

response = guardedFetch.response;

546563

}

547564548-

if (!response.ok) {

549-

if (response.status !== 401 && response.status !== 503) {

550-

log.warn(`GET /v1/models failed: HTTP ${response.status}, using static catalog`);

565+

try {

566+

if (!response.ok) {

567+

if (response.status !== 401 && response.status !== 503) {

568+

log.warn(`GET /v1/models failed: HTTP ${response.status}, using static catalog`);

569+

}

570+

return staticCatalog();

551571

}

552-

return staticCatalog();

553-

}

554572555-

const body = (await response.json()) as OpenAIListModelsResponse;

556-

const data = body?.data;

557-

if (!Array.isArray(data) || data.length === 0) {

558-

log.warn("No models in response, using static catalog");

559-

return staticCatalog();

560-

}

573+

const body = (await response.json()) as OpenAIListModelsResponse;

574+

const data = body?.data;

575+

if (!Array.isArray(data) || data.length === 0) {

576+

log.warn("No models in response, using static catalog");

577+

return staticCatalog();

578+

}

561579562-

const seen = new Set<string>();

563-

const models: ModelDefinitionConfig[] = [];

580+

const seen = new Set<string>();

581+

const models: ModelDefinitionConfig[] = [];

564582565-

for (const entry of data) {

566-

const id = normalizeOptionalString(entry?.id) ?? "";

567-

if (!id || seen.has(id)) {

568-

continue;

569-

}

570-

seen.add(id);

583+

for (const entry of data) {

584+

const id = normalizeOptionalString(entry?.id) ?? "";

585+

if (!id || seen.has(id)) {

586+

continue;

587+

}

588+

seen.add(id);

571589572-

const lowerId = normalizeLowercaseStringOrEmpty(id);

573-

const isReasoning =

574-

entry.supported_features?.includes("reasoning") ||

575-

lowerId.includes("r1") ||

576-

lowerId.includes("thinking") ||

577-

lowerId.includes("reason") ||

578-

lowerId.includes("tee");

590+

const lowerId = normalizeLowercaseStringOrEmpty(id);

591+

const isReasoning =

592+

entry.supported_features?.includes("reasoning") ||

593+

lowerId.includes("r1") ||

594+

lowerId.includes("thinking") ||

595+

lowerId.includes("reason") ||

596+

lowerId.includes("tee");

579597580-

const input: Array<"text" | "image"> = (entry.input_modalities || ["text"]).filter(

581-

(i): i is "text" | "image" => i === "text" || i === "image",

582-

);

598+

const input: Array<"text" | "image"> = (entry.input_modalities || ["text"]).filter(

599+

(i): i is "text" | "image" => i === "text" || i === "image",

600+

);

583601584-

models.push({

585-

id,

586-

name: id,

587-

reasoning: isReasoning,

588-

input,

589-

cost: {

590-

input: entry.pricing?.prompt || 0,

591-

output: entry.pricing?.completion || 0,

592-

cacheRead: 0,

593-

cacheWrite: 0,

594-

},

595-

contextWindow: entry.context_length || CHUTES_DEFAULT_CONTEXT_WINDOW,

596-

maxTokens: entry.max_output_length || CHUTES_DEFAULT_MAX_TOKENS,

597-

compat: {

598-

supportsUsageInStreaming: false,

599-

},

600-

});

601-

}

602+

models.push({

603+

id,

604+

name: id,

605+

reasoning: isReasoning,

606+

input,

607+

cost: {

608+

input: entry.pricing?.prompt || 0,

609+

output: entry.pricing?.completion || 0,

610+

cacheRead: 0,

611+

cacheWrite: 0,

612+

},

613+

contextWindow: entry.context_length || CHUTES_DEFAULT_CONTEXT_WINDOW,

614+

maxTokens: entry.max_output_length || CHUTES_DEFAULT_MAX_TOKENS,

615+

compat: {

616+

supportsUsageInStreaming: false,

617+

},

618+

});

619+

}

602620603-

return cacheAndReturn(

604-

effectiveKey,

605-

models.length > 0 ? models : CHUTES_MODEL_CATALOG.map(buildChutesModelDefinition),

606-

);

621+

return cacheAndReturn(

622+

effectiveKey,

623+

models.length > 0 ? models : CHUTES_MODEL_CATALOG.map(buildChutesModelDefinition),

624+

);

625+

} finally {

626+

await guardedFetch.release();

627+

}

607628

} catch (error) {

608629

log.warn(`Discovery failed: ${String(error)}, using static catalog`);

609630

return staticCatalog();