Fix Codex image generation tool timeout (#84369) · openclaw/openclaw@eb814b0
clawsweeper
·
2026-05-20
·
via Recent Commits to openclaw:main
File tree
extensions/codex/src/app-server
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,7 @@ Docs: https://docs.openclaw.ai
|
12 | 12 | ### Fixes |
13 | 13 | |
14 | 14 | - Agents/code mode: spell out the `exec` tool's JavaScript/TypeScript, no Node module, and catalog-bridge constraints in model-visible schema text so agents can use enabled tools without trial-and-error. (#84269) Thanks @Kaspre. |
| 15 | +- Codex: give `image_generate` dynamic-tool calls a 120s default watchdog when no per-call or configured image timeout is set, so image generation no longer falls back to the generic 30s bridge timeout. (#84254) Thanks @moritzmmayerhofer. |
15 | 16 | - CLI/message: include a stable top-level `messageId` in `openclaw message --json` output when channel sends return one. (#84191) Thanks @100menotu001. |
16 | 17 | - Gateway/agents: use an agent's `identity.name` in Gateway agent summaries when `agents.list[].name` is unset, so configured agent labels remain visible in clients. (#84355; refs #57835) Thanks @luoyanglang. |
17 | 18 | - Plugins/hooks: apply a default 30-second timeout to `before_compaction` and `after_compaction` hooks so a hung plugin handler no longer blocks compaction completion. (#84153) |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -256,6 +256,8 @@ available timeout in this order:
|
256 | 256 | |
257 | 257 | - A positive per-call `timeoutMs` argument. |
258 | 258 | - For `image_generate`, `agents.defaults.imageGenerationModel.timeoutMs`. |
| 259 | +- For `image_generate` without a configured timeout, the 120 second |
| 260 | + image-generation default. |
259 | 261 | - For the media-understanding `image` tool, `tools.media.image.timeoutSeconds` |
260 | 262 | converted to milliseconds, or the 60 second media default. |
261 | 263 | - The 30 second dynamic-tool default. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -532,9 +532,10 @@ Supported `appServer` fields:
|
532 | 532 | OpenClaw-owned dynamic tool calls are bounded independently from |
533 | 533 | `appServer.requestTimeoutMs`: Codex `item/tool/call` requests use a 30 second |
534 | 534 | OpenClaw watchdog by default. A positive per-call `timeoutMs` argument extends |
535 | | -or shortens that specific tool budget. The `image_generate` tool also uses |
| 535 | +or shortens that specific tool budget. The `image_generate` tool uses |
536 | 536 | `agents.defaults.imageGenerationModel.timeoutMs` when the tool call does not |
537 | | -provide its own timeout, and the media-understanding `image` tool uses |
| 537 | +provide its own timeout, or a 120 second image-generation default otherwise. |
| 538 | +The media-understanding `image` tool uses |
538 | 539 | `tools.media.image.timeoutSeconds` or its 60 second media default. Dynamic tool |
539 | 540 | budgets are capped at 600000 ms. On timeout, OpenClaw aborts the tool signal |
540 | 541 | where supported and returns a failed dynamic-tool response to Codex so the turn |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -237,8 +237,9 @@ from each attempt.
|
237 | 237 | backends. A per-call `timeoutMs` tool parameter overrides the configured |
238 | 238 | default. Google, OpenRouter, and xAI hosted image providers use 180 second |
239 | 239 | defaults; Azure OpenAI image generation uses 600 seconds. Codex dynamic-tool |
240 | | -calls honor the same timeout budget, bounded by OpenClaw's 600000 ms |
241 | | -dynamic-tool bridge maximum. |
| 240 | +calls use a 120 second `image_generate` bridge default and honor the same |
| 241 | +timeout budget when configured, bounded by OpenClaw's 600000 ms dynamic-tool |
| 242 | +bridge maximum. |
242 | 243 | </Accordion> |
243 | 244 | <Accordion title="Inspect at runtime"> |
244 | 245 | Use `action: "list"` to inspect the currently registered providers, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1903,6 +1903,22 @@ describe("runCodexAppServerAttempt", () => {
|
1903 | 1903 | ).toBe(180_000); |
1904 | 1904 | }); |
1905 | 1905 | |
| 1906 | +it("uses a 120 second default for Codex image generation dynamic tool calls", () => { |
| 1907 | +expect( |
| 1908 | +testing.resolveDynamicToolCallTimeoutMs({ |
| 1909 | +call: { |
| 1910 | +threadId: "thread-1", |
| 1911 | +turnId: "turn-1", |
| 1912 | +callId: "call-image-generate-default", |
| 1913 | +namespace: null, |
| 1914 | +tool: "image_generate", |
| 1915 | +arguments: { prompt: "cat" }, |
| 1916 | +}, |
| 1917 | +config: undefined, |
| 1918 | +}), |
| 1919 | +).toBe(120_000); |
| 1920 | +}); |
| 1921 | + |
1906 | 1922 | it("uses the media image timeout for Codex image dynamic tool calls", () => { |
1907 | 1923 | expect( |
1908 | 1924 | testing.resolveDynamicToolCallTimeoutMs({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -181,6 +181,7 @@ import { filterToolsForVisionInputs } from "./vision-tools.js";
|
181 | 181 | |
182 | 182 | const CODEX_DYNAMIC_TOOL_TIMEOUT_MS = 30_000; |
183 | 183 | const CODEX_DYNAMIC_TOOL_MAX_TIMEOUT_MS = 600_000; |
| 184 | +const CODEX_DYNAMIC_IMAGE_GENERATION_TOOL_TIMEOUT_MS = 120_000; |
184 | 185 | const CODEX_DYNAMIC_IMAGE_TOOL_TIMEOUT_MS = 60_000; |
185 | 186 | const CODEX_APP_SERVER_STARTUP_CONNECTION_CLOSE_MAX_ATTEMPTS = 3; |
186 | 187 | const CODEX_APP_SERVER_STARTUP_TIMEOUT_FLOOR_MS = 100; |
@@ -3020,9 +3021,12 @@ function readConfiguredDynamicToolTimeoutMs(
|
3020 | 3021 | if (toolName === "image_generate") { |
3021 | 3022 | const imageGenerationModel = config?.agents?.defaults?.imageGenerationModel; |
3022 | 3023 | if (!imageGenerationModel || typeof imageGenerationModel !== "object") { |
3023 | | -return undefined; |
| 3024 | +return CODEX_DYNAMIC_IMAGE_GENERATION_TOOL_TIMEOUT_MS; |
3024 | 3025 | } |
3025 | | -return readPositiveFiniteTimeoutMs(imageGenerationModel.timeoutMs); |
| 3026 | +return ( |
| 3027 | +readPositiveFiniteTimeoutMs(imageGenerationModel.timeoutMs) ?? |
| 3028 | +CODEX_DYNAMIC_IMAGE_GENERATION_TOOL_TIMEOUT_MS |
| 3029 | +); |
3026 | 3030 | } |
3027 | 3031 | |
3028 | 3032 | if (toolName === "image") { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1072,6 +1072,20 @@ describe("runCodexAppServerSideQuestion", () => {
|
1072 | 1072 | expect(timeoutMs).toBe(123_456); |
1073 | 1073 | }); |
1074 | 1074 | |
| 1075 | +it("uses a 120 second default for side-thread image_generate calls", () => { |
| 1076 | +const timeoutMs = testing.resolveSideDynamicToolCallTimeoutMs({ |
| 1077 | +call: { |
| 1078 | +threadId: "side-thread", |
| 1079 | +turnId: "turn-1", |
| 1080 | +callId: "tool-1", |
| 1081 | +tool: "image_generate", |
| 1082 | +}, |
| 1083 | +config: {} as never, |
| 1084 | +}); |
| 1085 | + |
| 1086 | +expect(timeoutMs).toBe(120_000); |
| 1087 | +}); |
| 1088 | + |
1075 | 1089 | it("cleans up notification handlers when side tool setup fails", async () => { |
1076 | 1090 | const client = createFakeClient(); |
1077 | 1091 | createOpenClawCodingToolsMock.mockImplementation(() => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -66,6 +66,7 @@ import { filterToolsForVisionInputs } from "./vision-tools.js";
|
66 | 66 | |
67 | 67 | const CODEX_SIDE_DYNAMIC_TOOL_TIMEOUT_MS = 30_000; |
68 | 68 | const CODEX_SIDE_DYNAMIC_TOOL_MAX_TIMEOUT_MS = 600_000; |
| 69 | +const CODEX_SIDE_DYNAMIC_IMAGE_GENERATION_TOOL_TIMEOUT_MS = 120_000; |
69 | 70 | const CODEX_SIDE_DYNAMIC_IMAGE_TOOL_TIMEOUT_MS = 60_000; |
70 | 71 | const SIDE_QUESTION_COMPLETION_TIMEOUT_MS = 600_000; |
71 | 72 | const CODEX_SIDE_NATIVE_HOOK_RELAY_MIN_TTL_MS = 30 * 60_000; |
@@ -671,7 +672,8 @@ function resolveSideDynamicToolCallTimeoutMs(params: {
|
671 | 672 | const configured = |
672 | 673 | readSideDynamicToolCallTimeoutMs(params.call.arguments) ?? |
673 | 674 | (params.call.tool === "image_generate" |
674 | | - ? readSideImageGenerationModelTimeoutMs(params.config) |
| 675 | + ? (readSideImageGenerationModelTimeoutMs(params.config) ?? |
| 676 | +CODEX_SIDE_DYNAMIC_IMAGE_GENERATION_TOOL_TIMEOUT_MS) |
675 | 677 | : undefined) ?? |
676 | 678 | (params.call.tool === "image" |
677 | 679 | ? (readSideTimeoutSecondsAsMs(params.config?.tools?.media?.image?.timeoutSeconds) ?? |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。