another fix for human choices

This commit is contained in:
Dorian
2026-03-11 00:13:31 +00:00
parent 112bcde515
commit bbe656929c
7 changed files with 42 additions and 22 deletions
+3 -1
View File
@@ -269,7 +269,8 @@ async function getBotResponse(
// before the SSE event tells the frontend to fetch it (fixes race condition
// where frontend fetched before pending was set → no choices shown)
const start = Date.now()
const resultPromise = waitForHumanResponse(fightId, bot.id, challenge, roundNumber)
const { promise: resultPromise, choices } = waitForHumanResponse(fightId, bot.id, challenge, roundNumber)
// Include choices directly in SSE so frontend never depends on a secondary fetch
emit(fightId, 'human_challenge', {
botId: bot.id,
round: roundNumber,
@@ -278,6 +279,7 @@ async function getBotResponse(
prompt: challenge.prompt,
timeoutMs: challenge.timeout_ms,
scoring: challenge.scoring,
choices,
})
const result = await resultPromise
const elapsed = Date.now() - start