Skip to content

Commit c4dc41a

Browse files
committed
Align mock xAI cancellation handling
1 parent 5cb9673 commit c4dc41a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

apps/server/scripts/acp-mock-agent.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,16 +576,19 @@ const program = Effect.gen(function* () {
576576
mode: "default",
577577
},
578578
});
579+
if (typeof result !== "object" || result === null || !("outcome" in result)) {
580+
throw new Error("Expected _x.ai/ask_user_question response outcome.");
581+
}
582+
if (result.outcome === "cancelled") {
583+
return { stopReason: "end_turn" };
584+
}
579585
if (
580-
typeof result !== "object" ||
581-
result === null ||
582-
!("outcome" in result) ||
583586
result.outcome !== "accepted" ||
584587
!("answers" in result) ||
585588
typeof result.answers !== "object" ||
586589
result.answers === null
587590
) {
588-
throw new Error("Expected _x.ai/ask_user_question response outcome.");
591+
throw new Error("Expected accepted _x.ai/ask_user_question response answers.");
589592
}
590593

591594
return { stopReason: "end_turn" };

0 commit comments

Comments
 (0)