From 548e32aacf5b4781bdd07a5ceea0ca5af80a7002 Mon Sep 17 00:00:00 2001 From: vianhanif Date: Thu, 27 Aug 2026 15:51:23 +0700 Subject: [PATCH] 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. --- open-sse/rtk/headroom.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/open-sse/rtk/headroom.js b/open-sse/rtk/headroom.js index 2b15eed2..bd6e3394 100644 --- a/open-sse/rtk/headroom.js +++ b/open-sse/rtk/headroom.js @@ -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