Skip to content

Commit 8d94a49

Browse files
committed
fix(codex): honor side-thread tool timeoutSeconds
1 parent e6d9ffe commit 8d94a49

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

‎extensions/codex/src/app-server/side-question.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,33 @@ describe("runCodexAppServerSideQuestion", () => {
18861886
expect(timeoutMs).toBe(90_000);
18871887
});
18881888

1889+
it("uses per-call timeoutSeconds for generic side-thread dynamic tool calls", () => {
1890+
expect(
1891+
testing.resolveSideDynamicToolCallTimeoutMs({
1892+
call: {
1893+
threadId: "side-thread",
1894+
turnId: "turn-1",
1895+
callId: "tool-1",
1896+
tool: "session_status",
1897+
arguments: { sessionKey: "current", timeoutSeconds: 2 },
1898+
},
1899+
config: {} as never,
1900+
}),
1901+
).toBe(12_000);
1902+
expect(
1903+
testing.resolveSideDynamicToolCallTimeoutMs({
1904+
call: {
1905+
threadId: "side-thread",
1906+
turnId: "turn-1",
1907+
callId: "tool-1",
1908+
tool: "session_status",
1909+
arguments: { sessionKey: "current", timeoutMs: 1_500, timeoutSeconds: 2 },
1910+
},
1911+
config: {} as never,
1912+
}),
1913+
).toBe(1_500);
1914+
});
1915+
18891916
it("cleans up notification handlers when side tool setup fails", async () => {
18901917
const client = createFakeClient();
18911918
createOpenClawCodingToolsMock.mockImplementation(() => {

‎extensions/codex/src/app-server/side-question.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ import {
102102

103103
const CODEX_SIDE_DYNAMIC_TOOL_TIMEOUT_MS = 90_000;
104104
const CODEX_SIDE_DYNAMIC_TOOL_MAX_TIMEOUT_MS = 600_000;
105+
const CODEX_SIDE_DYNAMIC_TOOL_TIMEOUT_SECONDS_GRACE_MS = 10_000;
105106
const CODEX_SIDE_DYNAMIC_IMAGE_GENERATION_TOOL_TIMEOUT_MS = 120_000;
106107
const CODEX_SIDE_DYNAMIC_IMAGE_TOOL_TIMEOUT_MS = 60_000;
107108
const SIDE_QUESTION_COMPLETION_TIMEOUT_MS = 600_000;
@@ -898,7 +899,14 @@ function readSideDynamicToolCallTimeoutMs(value: JsonValue | undefined): number
898899
if (!isJsonObject(value)) {
899900
return undefined;
900901
}
901-
return readSidePositiveFiniteTimeoutMs(value.timeoutMs);
902+
const timeoutMs = readSidePositiveFiniteTimeoutMs(value.timeoutMs);
903+
if (timeoutMs !== undefined) {
904+
return timeoutMs;
905+
}
906+
const timeoutSecondsMs = readSideTimeoutSecondsAsMs(value.timeoutSeconds);
907+
return timeoutSecondsMs === undefined
908+
? undefined
909+
: timeoutSecondsMs + CODEX_SIDE_DYNAMIC_TOOL_TIMEOUT_SECONDS_GRACE_MS;
902910
}
903911

904912
function readSideImageGenerationModelTimeoutMs(

0 commit comments

Comments
 (0)