fix(answer): stash the answer input event before addToolOutput

The onSubmitAnswer path was the one Wave B send site missing its stash:
addToolOutput triggers the SDK's automatic continuation send, the
transport found nothing stashed, and threw — the answer never POSTed, so
the question stayed open. One line (plus the contract comment). Caught
live by the owner; the suite drives answer events directly at the
handler, so this client seam stays untested until Wave D's client work.
This commit is contained in:
amosblomqvist
2026-09-26 00:51:16 +03:00
parent 7ab47d4fcb
commit 2e8bf92408
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -1310,6 +1310,12 @@ export function Chat({
}
onSubmitAnswer={(output) => {
if (!pending) return;
// THE INPUT-EVENTS CONTRACT (Wave B): the answer ride order is
// stash-then-send — addToolOutput triggers the SDK's automatic
// continuation send (sendAutomaticallyWhen), and the transport
// consumes THIS stash to build {chatId, input}. Dismissals ride
// the same callback (QuestionAnswerData.dismissed).
stashInput({ type: "answer", toolCallId: pending.toolCallId, answer: output });
void addToolOutput({
tool: pending.tool as "quiz" | "ask_user_question",
toolCallId: pending.toolCallId,