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 <michaelxer@users.noreply.github.com>
This commit is contained in:
michaelxer
2026-06-07 23:16:58 +07:00
committed by GitHub
parent 5dff35ba03
commit d7ece5b4a9
+7 -1
View File
@@ -1877,7 +1877,13 @@ export function displayMetrics(messageElement, metrics) {
}
}, 200);
} else {
compactBody.innerHTML = '<span style="color:var(--red);">Compaction failed. Try again later.</span>';
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);