
























@@ -1147,6 +1147,9 @@ export async function runCodexAppServerAttempt(
11471147// inside projector.handleNotification still releases the session lane.
11481148// See openclaw/openclaw#67996.
11491149const isTurnCompletion = notification.method === "turn/completed" && isCurrentTurnNotification;
1150+const isTurnAbortMarker =
1151+isCurrentTurnNotification && isCodexTurnAbortMarkerNotification(notification);
1152+const isTurnTerminal = isTurnCompletion || isTurnAbortMarker;
11501153try {
11511154await projector.handleNotification(notification);
11521155} catch (error) {
@@ -1155,7 +1158,10 @@ export async function runCodexAppServerAttempt(
11551158 error,
11561159});
11571160} finally {
1158-if (isTurnCompletion) {
1161+if (isTurnTerminal) {
1162+if (isTurnAbortMarker) {
1163+projector.markAborted();
1164+}
11591165if (!timedOut && !runAbortController.signal.aborted) {
11601166await steeringQueue?.flushPending();
11611167}
@@ -2344,6 +2350,37 @@ function readNestedTurnId(record: JsonObject): string | undefined {
23442350return isJsonObject(turn) ? readString(turn, "id") : undefined;
23452351}
234623522353+function isCodexTurnAbortMarkerNotification(notification: CodexServerNotification): boolean {
2354+if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) {
2355+return false;
2356+}
2357+const item = notification.params.item;
2358+if (!isJsonObject(item) || readString(item, "role") !== "user") {
2359+return false;
2360+}
2361+return extractRawResponseItemText(item).includes("<turn_aborted>");
2362+}
2363+2364+function extractRawResponseItemText(item: JsonObject): string {
2365+const content = item.content;
2366+if (!Array.isArray(content)) {
2367+return "";
2368+}
2369+return content
2370+.flatMap((entry) => {
2371+if (!isJsonObject(entry)) {
2372+return [];
2373+}
2374+const type = readString(entry, "type");
2375+if (type !== "input_text" && type !== "text") {
2376+return [];
2377+}
2378+const text = readString(entry, "text");
2379+return text ? [text] : [];
2380+})
2381+.join("");
2382+}
2383+23472384function readString(record: JsonObject, key: string): string | undefined {
23482385const value = record[key];
23492386return typeof value === "string" ? value : undefined;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。