fix(mindspace): fail closed on invalid page data delivery

This commit is contained in:
john
2026-07-14 19:40:47 +08:00
parent 192548b0b9
commit 72fd88219c
6 changed files with 114 additions and 11 deletions
+12
View File
@@ -31,6 +31,18 @@ export function shouldPromoteSessionIdToStreaming(chatState) {
return chatState !== 'idle';
}
/**
* Only transport uncertainty may continue a run after submit fails. A
* deterministic gateway error already has a terminal outcome and must return
* the chat UI to an error/idle state instead of leaving a Stop button active.
*
* @param {number | undefined | null} status
* @returns {boolean}
*/
export function shouldKeepStreamingAfterRunError(status) {
return status === 0 || status === 409 || Number(status) >= 500;
}
/**
* Agent-run POST tracks portal request_id; Goose SSE may emit a different chat_request_id.
* Adopt the upstream id so Message/Finish events are not dropped in the UI.