



























@@ -1035,6 +1035,7 @@ export async function runCodexAppServerAttempt(
10351035let userInputBridge: ReturnType<typeof createCodexUserInputBridge> | undefined;
10361036let steeringQueue: ReturnType<typeof createCodexSteeringQueue> | undefined;
10371037let completed = false;
1038+let terminalTurnNotificationQueued = false;
10381039let timedOut = false;
10391040let turnCompletionIdleTimedOut = false;
10401041let turnCompletionIdleTimeoutMessage: string | undefined;
@@ -1562,6 +1563,9 @@ export async function runCodexAppServerAttempt(
15621563isCurrentTurnNotification &&
15631564isCodexTurnAbortMarkerNotification(notification, { currentPromptText: promptBuild.prompt });
15641565const isTurnTerminal = isTurnCompletion || isTurnAbortMarker;
1566+if (isTurnTerminal) {
1567+terminalTurnNotificationQueued = true;
1568+}
15651569try {
15661570await waitForCodexNotificationDispatchTurn();
15671571await projector.handleNotification(notification);
@@ -1592,6 +1596,18 @@ export async function runCodexAppServerAttempt(
15921596pendingNotifications.push(notification);
15931597return Promise.resolve();
15941598}
1599+const isCurrentTurnNotification = isTurnNotification(
1600+notification.params,
1601+thread.threadId,
1602+turnId,
1603+);
1604+if (
1605+isCurrentTurnNotification &&
1606+(notification.method === "turn/completed" ||
1607+isCodexTurnAbortMarkerNotification(notification, { currentPromptText: promptBuild.prompt }))
1608+) {
1609+terminalTurnNotificationQueued = true;
1610+}
15951611notificationQueue = notificationQueue.then(
15961612() => handleNotification(notification),
15971613() => handleNotification(notification),
@@ -2023,7 +2039,7 @@ export async function runCodexAppServerAttempt(
20232039addCloseHandler?: (handler: (client: CodexAppServerClient) => void) => () => void;
20242040}
20252041).addCloseHandler?.(() => {
2026-if (completed || runAbortController.signal.aborted) {
2042+if (completed || terminalTurnNotificationQueued || runAbortController.signal.aborted) {
20272043return;
20282044}
20292045clientClosedPromptError = "codex app-server client closed before turn completed";
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。