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

推荐订阅源

D
DataBreaches.Net
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Y
Y Combinator Blog
博客园 - 聂微东
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog RSS Feed
小众软件
小众软件
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
B
Blog
H
Help Net Security
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
罗磊的独立博客
月光博客
月光博客
博客园 - 司徒正美

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: bound remote media reference reads [AI] (#88974) · o...
pgondhi987 · 2026-06-02 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1758,6 +1758,9 @@ describe("createImageGenerateTool", () => {

17581758

const defaultLoadOptions = mockCallArg(webMedia.loadWebMedia, 0, "loadWebMedia", 1);

17591759

expect(defaultLoadUrl).toBe("http://198.18.0.153/reference.png");

17601760

expect(requireRecord(defaultLoadOptions, "loadWebMedia options").ssrfPolicy).toBeUndefined();

1761+

expect(requireRecord(defaultLoadOptions, "loadWebMedia options").readIdleTimeoutMs).toBe(

1762+

120_000,

1763+

);

17611764
17621765

const tool = requireImageGenerateTool(

17631766

createImageGenerateTool({

@@ -1782,6 +1785,9 @@ describe("createImageGenerateTool", () => {

17821785

expect(requireRecord(configuredLoadOptions, "loadWebMedia options").ssrfPolicy).toEqual({

17831786

allowRfc2544BenchmarkRange: true,

17841787

});

1788+

expect(requireRecord(configuredLoadOptions, "loadWebMedia options").readIdleTimeoutMs).toBe(

1789+

120_000,

1790+

);

17851791

expect(mockCallArg(generateImage, 1, "generateImage").ssrfPolicy).toEqual({

17861792

allowRfc2544BenchmarkRange: true,

17871793

});

Original file line numberDiff line numberDiff line change

@@ -81,6 +81,7 @@ import {

8181

hasGenerationToolAvailability,

8282

normalizeMediaReferenceInputs,

8383

readGenerationTimeoutMs,

84+

REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS,

8485

resolveRemoteMediaSsrfPolicy,

8586

resolveCapabilityModelConfigForTool,

8687

resolveGenerateAction,

@@ -618,6 +619,7 @@ async function loadReferenceImages(params: {

618619

maxBytes: params.maxBytes,

619620

localRoots,

620621

ssrfPolicy: params.ssrfPolicy,

622+

...(isHttpUrl ? { readIdleTimeoutMs: REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS } : {}),

621623

});

622624

if (media.kind !== "image") {

623625

throw new ToolInputError(`Unsupported media type: ${media.kind}`);

Original file line numberDiff line numberDiff line change

@@ -1981,6 +1981,46 @@ describe("image tool implicit imageModel config", () => {

19811981

});

19821982

});

19831983
1984+

it("passes the shared remote read idle timeout when loading remote image references", async () => {

1985+

const fetch = vi.fn(

1986+

async () =>

1987+

new Response(

1988+

JSON.stringify({ content: "ok", base_resp: { status_code: 0, status_msg: "" } }),

1989+

),

1990+

);

1991+

global.fetch = withFetchPreconnect(fetch);

1992+

vi.stubEnv("MINIMAX_API_KEY", "minimax-test");

1993+

const loadWebMedia = vi.fn(async () => ({

1994+

buffer: Buffer.from(ONE_PIXEL_PNG_B64, "base64"),

1995+

contentType: "image/png",

1996+

kind: "image" as const,

1997+

}));

1998+

installImageUnderstandingProviderDeps([minimaxProvider, moonshotProvider], {

1999+

loadImageWebMediaRuntime: async () => ({

2000+

loadWebMedia,

2001+

optimizeImageBufferForWebMedia: async ({ buffer, contentType, fileName }) => ({

2002+

buffer,

2003+

contentType: contentType ?? "image/png",

2004+

kind: "image",

2005+

fileName,

2006+

}),

2007+

}),

2008+

});

2009+
2010+

await withTempAgentDir(async (agentDir) => {

2011+

const tool = createRequiredImageTool({

2012+

config: createMinimaxImageConfig(),

2013+

agentDir,

2014+

});

2015+
2016+

await expectImageToolExecOk(tool, "https://example.test/reference.png");

2017+
2018+

expect(loadWebMedia).toHaveBeenCalledTimes(1);

2019+

const [, options] = fetchCallAt(loadWebMedia, 0);

2020+

expect((options as { readIdleTimeoutMs?: number }).readIdleTimeoutMs).toBe(120_000);

2021+

});

2022+

});

2023+
19842024

it("sandboxes image paths like the read tool", async () => {

19852025

await withTempSandboxState(async ({ agentDir, sandboxRoot }) => {

19862026

await fs.writeFile(path.join(sandboxRoot, "img.png"), "fake", "utf8");

Original file line numberDiff line numberDiff line change

@@ -59,6 +59,7 @@ import {

5959

import {

6060

applyImageModelConfigDefaults,

6161

buildTextToolResult,

62+

REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS,

6263

resolveMediaToolInboundRoots,

6364

resolveMediaToolLocalRoots,

6465

resolveRemoteMediaSsrfPolicy,

@@ -90,6 +91,7 @@ type ImageToolLoadWebMediaOptions = {

9091

localRoots?: readonly string[] | "any";

9192

inboundRoots?: readonly string[];

9293

ssrfPolicy?: ReturnType<typeof resolveRemoteMediaSsrfPolicy>;

94+

readIdleTimeoutMs?: number;

9395

};

9496
9597

type ImageWebMediaRuntime = {

@@ -974,6 +976,7 @@ export function createImageTool(options?: {

974976

localRoots: mediaLocalRoots,

975977

inboundRoots: mediaInboundRoots,

976978

ssrfPolicy: remoteMediaSsrfPolicy,

979+

...(isHttpUrl ? { readIdleTimeoutMs: REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS } : {}),

977980

imageCompression,

978981

});

979982

if (media.kind !== "image") {

Original file line numberDiff line numberDiff line change

@@ -70,6 +70,8 @@ type TaskRunDetailHandle = {

7070

runId: string;

7171

};

7272
73+

export const REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS = 120_000;

74+
7375

export function applyImageModelConfigDefaults(

7476

cfg: OpenClawConfig | undefined,

7577

imageModelConfig: ImageModelConfig,

Original file line numberDiff line numberDiff line change

@@ -20,6 +20,7 @@ import { coerceImageModelConfig, type ImageModelConfig } from "./image-tool.help

2020

import {

2121

applyImageModelConfigDefaults,

2222

buildTextToolResult,

23+

REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS,

2324

resolveModelFromRegistry,

2425

resolveMediaToolLocalRoots,

2526

resolveModelRuntimeApiKey,

@@ -54,7 +55,6 @@ const DEFAULT_PROMPT = "Analyze this PDF document.";

5455

const DEFAULT_MAX_PDFS = 10;

5556

const DEFAULT_MAX_BYTES_MB = 10;

5657

const DEFAULT_MAX_PAGES = 20;

57-

const PDF_REMOTE_READ_IDLE_TIMEOUT_MS = 120_000;

5858
5959

const PDF_MIN_TEXT_CHARS = 200;

6060

const PDF_MAX_PIXELS = 4_000_000;

@@ -457,7 +457,7 @@ export function createPdfTool(options?: {

457457

: await loadWebMediaRaw(resolvedPathInfo.resolved, {

458458

maxBytes,

459459

localRoots,

460-

...(isHttpUrl ? { readIdleTimeoutMs: PDF_REMOTE_READ_IDLE_TIMEOUT_MS } : {}),

460+

...(isHttpUrl ? { readIdleTimeoutMs: REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS } : {}),

461461

ssrfPolicy: remoteMediaSsrfPolicy,

462462

});

463463
Original file line numberDiff line numberDiff line change

@@ -1515,6 +1515,30 @@ describe("createVideoGenerateTool", () => {

15151515

expect(call.inputImages?.[1]?.role).toBe("last_frame");

15161516

});

15171517
1518+

it("passes direct remote reference URLs to the provider without local media loading", async () => {

1519+

mockVideoPluginProvider({

1520+

imageToVideo: { enabled: true, maxInputImages: 1 },

1521+

});

1522+

const loadWebMedia = vi.spyOn(webMedia, "loadWebMedia").mockResolvedValue({

1523+

kind: "image",

1524+

buffer: Buffer.from("image"),

1525+

contentType: "image/png",

1526+

});

1527+

const generateSpy = mockSavedVideoResult();

1528+

const tool = createVideoPluginTool();

1529+
1530+

await tool.execute("call-1", {

1531+

prompt: "lobster",

1532+

image: "https://example.test/reference.png",

1533+

});

1534+
1535+

expect(loadWebMedia).not.toHaveBeenCalled();

1536+

const call = firstMockCallArg(generateSpy) as {

1537+

inputImages?: Array<{ url?: string }>;

1538+

};

1539+

expect(call.inputImages).toEqual([{ url: "https://example.test/reference.png" }]);

1540+

});

1541+
15181542

it("passes web_fetch SSRF policy when loading reference assets", async () => {

15191543

mockVideoPluginProvider({

15201544

imageToVideo: { enabled: true, maxInputImages: 1 },