Skip to content

Commit f454d62

Browse files
committed
fix(agents): preserve explicit active run aborts
1 parent 1556e3c commit f454d62

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎src/agents/embedded-agent-runner/run/attempt.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,6 +3100,10 @@ export async function runEmbeddedAttempt(
31003100
}
31013101
};
31023102

3103+
const abortActiveRunExternally = () => {
3104+
externalAbort = true;
3105+
abortRun();
3106+
};
31033107
const queueHandle: EmbeddedAgentQueueHandle & {
31043108
kind: "embedded";
31053109
cancel: (reason?: "user_abort" | "restart" | "superseded") => void;
@@ -3115,10 +3119,8 @@ export async function runEmbeddedAttempt(
31153119
isCompacting: () => subscription.isCompacting(),
31163120
supportsTranscriptCommitWait: true,
31173121
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
3118-
cancel: () => {
3119-
abortRun();
3120-
},
3121-
abort: abortRun,
3122+
cancel: abortActiveRunExternally,
3123+
abort: abortActiveRunExternally,
31223124
};
31233125
let lastAssistant: AssistantMessage | undefined;
31243126
let currentAttemptAssistant: EmbeddedRunAttemptResult["currentAttemptAssistant"];

0 commit comments

Comments
 (0)