Skip to content

Commit fbaa763

Browse files
committed
fix(server): force stop without an attempt interrupts the run
1 parent a8541b1 commit fbaa763

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

‎apps/server/src/orchestration-v2/ThreadManagementService.ts‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,14 +1250,24 @@ const make = Effect.gen(function* () {
12501250
yield* providerTurn === undefined && !active
12511251
? Effect.void
12521252
: providerTurn === undefined
1253-
? orchestrator.dispatch({
1254-
type: "run.force-stop.settle",
1255-
commandId,
1256-
threadId: input.threadId,
1257-
runId: run.id,
1258-
attemptId: run.activeAttemptId!,
1259-
reason: FORCE_STOP_REASON,
1260-
})
1253+
? orchestrator.dispatch(
1254+
run.activeAttemptId === null
1255+
? {
1256+
type: "run.interrupt",
1257+
commandId,
1258+
threadId: input.threadId,
1259+
runId: run.id,
1260+
reason: FORCE_STOP_REASON,
1261+
}
1262+
: {
1263+
type: "run.force-stop.settle",
1264+
commandId,
1265+
threadId: input.threadId,
1266+
runId: run.id,
1267+
attemptId: run.activeAttemptId,
1268+
reason: FORCE_STOP_REASON,
1269+
},
1270+
)
12611271
: orchestrator.dispatch({
12621272
type: "thread.background-work.settle",
12631273
commandId,

0 commit comments

Comments
 (0)