fix(rtk): set diagnostic before silent null return on Responses translation failure

The openai-responses branch of compressWithHeadroom returned null without
recording a reason, leaving the diagnostics panel blank and making Codex
translation failures indistinguishable from a successful compression.
This commit is contained in:
vianhanif
2026-08-27 15:51:23 +07:00
parent abb20d9f39
commit 548e32aacf

View File

@@ -281,7 +281,10 @@ export async function compressWithHeadroom(body, { enabled, url, model, format,
return null;
}
const oai = openaiResponsesToOpenAIRequest(model, body, false);
if (!Array.isArray(oai?.messages)) return null;
if (!Array.isArray(oai?.messages)) {
setDiagnostic(diagnostics, "openai-responses request did not translate to messages[]");
return null;
}
const data = await callCompress(url, oai.messages, model, timeoutMs, compressUserMessages, diagnostics || {});
if (!data) return null;
// input: undefined so the translator rebuilds input from the compressed