fix(mindspace): fail closed on invalid page data delivery
This commit is contained in:
@@ -54,6 +54,7 @@ import { buildAutoChatSkillPrefix } from '../../chat-skills.mjs';
|
||||
import {
|
||||
reconcileSessionEventRequestContext,
|
||||
resolvePostAgentRunChatState,
|
||||
shouldKeepStreamingAfterRunError,
|
||||
shouldPromoteSessionIdToStreaming,
|
||||
} from '../../chat-agent-run-gate.mjs';
|
||||
import { mergeConversationSnapshot } from '../../chat-finish-sync.mjs';
|
||||
@@ -233,11 +234,6 @@ function mergeMessagePages(older: Message[], current: Message[]): Message[] {
|
||||
return merged;
|
||||
}
|
||||
|
||||
function isAmbiguousReplySubmitError(err: unknown) {
|
||||
if (!(err instanceof ApiError)) return true;
|
||||
return err.status === 0 || err.status === 409 || err.status >= 500;
|
||||
}
|
||||
|
||||
const SESSION_LIST_RETRY_ATTEMPTS = 3;
|
||||
const SESSION_LIST_RETRY_DELAY_MS = 450;
|
||||
|
||||
@@ -1619,7 +1615,11 @@ export function useTKMindChat(
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (activeSessionId && isAmbiguousReplySubmitError(err)) {
|
||||
if (
|
||||
activeSessionId &&
|
||||
err instanceof ApiError &&
|
||||
shouldKeepStreamingAfterRunError(err.status)
|
||||
) {
|
||||
subscribeToSession(activeSessionId);
|
||||
setChatState('streaming');
|
||||
setError(null);
|
||||
|
||||
Reference in New Issue
Block a user