





















@@ -1464,6 +1464,19 @@ export async function runCodexAppServerAttempt(
14641464});
14651465};
146614661467+const isTerminalTurnNotificationForTurn = (
1468+notification: CodexServerNotification,
1469+notificationTurnId: string,
1470+): boolean => {
1471+if (!isTurnNotification(notification.params, thread.threadId, notificationTurnId)) {
1472+return false;
1473+}
1474+return (
1475+notification.method === "turn/completed" ||
1476+isCodexTurnAbortMarkerNotification(notification, { currentPromptText: promptBuild.prompt })
1477+);
1478+};
1479+14671480const handleNotification = async (notification: CodexServerNotification) => {
14681481userInputBridge?.handleNotification(notification);
14691482if (!projector || !turnId) {
@@ -1562,7 +1575,7 @@ export async function runCodexAppServerAttempt(
15621575const isTurnAbortMarker =
15631576isCurrentTurnNotification &&
15641577isCodexTurnAbortMarkerNotification(notification, { currentPromptText: promptBuild.prompt });
1565-const isTurnTerminal = isTurnCompletion || isTurnAbortMarker;
1578+const isTurnTerminal = isTerminalTurnNotificationForTurn(notification, turnId);
15661579if (isTurnTerminal) {
15671580terminalTurnNotificationQueued = true;
15681581}
@@ -1596,16 +1609,7 @@ export async function runCodexAppServerAttempt(
15961609pendingNotifications.push(notification);
15971610return Promise.resolve();
15981611}
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-) {
1612+if (isTerminalTurnNotificationForTurn(notification, turnId)) {
16091613terminalTurnNotificationQueued = true;
16101614}
16111615notificationQueue = notificationQueue.then(
@@ -2034,6 +2038,14 @@ export async function runCodexAppServerAttempt(
20342038nativePostToolUseRelayEnabled:
20352039nativeHookRelay?.allowedEvents.includes("post_tool_use") === true,
20362040});
2041+if (
2042+isTerminalTurnStatus(turn.turn.status) ||
2043+pendingNotifications.some((notification) =>
2044+isTerminalTurnNotificationForTurn(notification, activeTurnId),
2045+)
2046+) {
2047+terminalTurnNotificationQueued = true;
2048+}
20372049closeCleanup = (
20382050client as {
20392051addCloseHandler?: (handler: (client: CodexAppServerClient) => void) => () => void;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。