From d7ece5b4a9d327ff5d933bfb60b64f82acb98cc8 Mon Sep 17 00:00:00 2001 From: michaelxer <52305679+michaelxer@users.noreply.github.com> Date: Sun, 7 Jun 2026 23:16:58 +0700 Subject: [PATCH] fix: show backend error detail in context-popup compact button (#2721) When the context-popup compact button receives a non-OK response (e.g. 409 for active-run), the error detail from the backend was being discarded in favor of a generic 'Compaction failed' message. Now parses the JSON response body for non-OK responses and prefers the detail field when present, matching the behavior of the /compact slash command. Uses textContent for safe rendering. Co-authored-by: michaelxer --- static/js/chatRenderer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/js/chatRenderer.js b/static/js/chatRenderer.js index 8b648d634..088142302 100644 --- a/static/js/chatRenderer.js +++ b/static/js/chatRenderer.js @@ -1877,7 +1877,13 @@ export function displayMetrics(messageElement, metrics) { } }, 200); } else { - compactBody.innerHTML = 'Compaction failed. Try again later.'; + let detail = 'Compaction failed. Try again later.'; + try { + const err = await res.json(); + if (err.detail) detail = err.detail; + } catch {} + compactBody.textContent = detail; + compactBody.style.color = 'var(--red)'; } } catch (err) { clearInterval(waveInterval);