fix: preserve prompt on network error, swallow 524 to avoid duplicate sends

This commit is contained in:
Chris Scott committed 2026-06-17 14:02:45 -04:00
1 parent 909effee28
commit da28f58706
4 files changed
+51 -2

No files matched your search

+5 -1
View File
@@ -9,7 +9,7 @@ import type {
MessageWithParts,
} from "../api/types";
import type { paths, components } from "../api/opencode-types";
import { parseNetworkError } from "../lib/opencode-errors";
import { parseNetworkError, isGatewayTimeout } from "../lib/opencode-errors";
import { showToast } from "../lib/toast";
import { useSendErrorStore } from "../stores/sendErrorStore";
import { useSessionStatus } from "../stores/sessionStatusStore";
@@ -510,6 +510,10 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?:
(old) => old?.filter((msgWithParts) => !msgWithParts.info.id.startsWith("optimistic_")),
);
if (isGatewayTimeout(error)) {
return;
}
useSessionStatus.getState().clearStatus(sessionID);
const parsed = parseNetworkError(error);