fix(codex): let async media coexist with terminal batches · openclaw/openclaw@1e82263
steipete
·
2026-05-31
·
via Recent Commits to openclaw:main
File tree
extensions/codex/src/app-server
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8,6 +8,7 @@ import {
|
8 | 8 | handleDynamicToolCallWithTimeout, |
9 | 9 | resolveDynamicToolCallTimeoutMs, |
10 | 10 | resolveTerminalDynamicToolBatchAction, |
| 11 | +shouldBlockTerminalReleaseForNonTerminalDynamicToolResult, |
11 | 12 | shouldReleaseTurnAfterTerminalDynamicTool, |
12 | 13 | toCodexDynamicToolProgressResponse, |
13 | 14 | toCodexDynamicToolProtocolResponse, |
@@ -363,4 +364,26 @@ describe("dynamic tool execution helpers", () => {
|
363 | 364 | }), |
364 | 365 | ).toBe("release-pending-terminal"); |
365 | 366 | }); |
| 367 | + |
| 368 | +it("does not let async-start tool results block terminal side-effect batches", () => { |
| 369 | +const asyncStartedResponse = { |
| 370 | +contentItems: [{ type: "inputText" as const, text: "Background task started." }], |
| 371 | +success: true, |
| 372 | +}; |
| 373 | +Object.defineProperty(asyncStartedResponse, "asyncStarted", { |
| 374 | +configurable: true, |
| 375 | +enumerable: false, |
| 376 | +value: true, |
| 377 | +}); |
| 378 | + |
| 379 | +expect(shouldBlockTerminalReleaseForNonTerminalDynamicToolResult(asyncStartedResponse)).toBe( |
| 380 | +false, |
| 381 | +); |
| 382 | +expect( |
| 383 | +shouldBlockTerminalReleaseForNonTerminalDynamicToolResult({ |
| 384 | +contentItems: [{ type: "inputText", text: "regular output" }], |
| 385 | +success: true, |
| 386 | +}), |
| 387 | +).toBe(true); |
| 388 | +}); |
366 | 389 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -250,6 +250,12 @@ export function shouldReleaseTurnAfterTerminalDynamicTool(
|
250 | 250 | ); |
251 | 251 | } |
252 | 252 | |
| 253 | +export function shouldBlockTerminalReleaseForNonTerminalDynamicToolResult( |
| 254 | +response: CodexDynamicToolCallResponse, |
| 255 | +): boolean { |
| 256 | +return response.asyncStarted !== true; |
| 257 | +} |
| 258 | + |
253 | 259 | export type TerminalDynamicToolBatchAction = |
254 | 260 | | "idle" |
255 | 261 | | "wait" |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -158,6 +158,7 @@ import {
|
158 | 158 | isMatchingDynamicToolTerminalDiagnostic, |
159 | 159 | resolveDynamicToolCallTimeoutMs, |
160 | 160 | resolveTerminalDynamicToolBatchAction, |
| 161 | +shouldBlockTerminalReleaseForNonTerminalDynamicToolResult, |
161 | 162 | shouldReleaseTurnAfterTerminalDynamicTool, |
162 | 163 | toCodexDynamicToolProgressResponse, |
163 | 164 | toCodexDynamicToolProtocolResponse, |
@@ -1595,6 +1596,8 @@ export async function runCodexAppServerAttempt(
|
1595 | 1596 | response, |
1596 | 1597 | durationMs: toolDurationMs, |
1597 | 1598 | }); |
| 1599 | +} else if (!shouldBlockTerminalReleaseForNonTerminalDynamicToolResult(response)) { |
| 1600 | +scheduleTerminalDynamicToolReleaseCheck(); |
1598 | 1601 | } else { |
1599 | 1602 | currentTurnHadNonTerminalDynamicToolResult = true; |
1600 | 1603 | pendingTerminalDynamicToolRelease = undefined; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。