[Stability][BUG-008] HTML artifact preview flickers and temporarily shows mojibake
#3119 opened on May 21, 2026
Description
Parent stability dashboard: #3107
This issue tracks BUG-008 from #3107.
Problem
While an HTML artifact is still being generated, the right-side preview can flicker frequently and temporarily render garbled text. After the artifact is fully written and reopened, the final file can render normally.
This issue includes the mojibake shown in the screenshot. It is grouped under artifact preview because the final artifact was not necessarily corrupted; the visible problem was the in-progress preview rendering partial/incomplete HTML.
Code evidence
The frontend auto-opens the artifact panel for the latest in-progress write_file step:
frontend/src/components/workspace/messages/message-group.tsx
isLoading && isLast && autoOpen && autoSelect && path && !result
The selected item can be a write-file: pseudo-artifact rather than a completed output file.
The HTML preview renders current content through a blob URL:
frontend/src/components/workspace/artifacts/artifact-file-detail.tsx
new Blob([content ?? ""], { type: "text/html" })
URL.createObjectURL(blob)
<iframe src={htmlPreviewUrl} />
Likely mechanism
- The preview points at partial or intermediate
write_filecontent. - Each streamed content update recreates the blob URL and reloads the iframe.
- If the current partial HTML lacks a complete
<meta charset="UTF-8">, the iframe may guess encoding incorrectly and render mojibake. - Once the final complete HTML is loaded, the artifact can render normally.
Impact
- Users see a broken-looking artifact while generation is still in progress.
- Long-running report generation feels unstable even when the final output is eventually valid.
- The preview can mislead users into thinking the model generated corrupted text.
Expected behavior
- Do not auto-render incomplete HTML as a live iframe preview, or debounce/stabilize it.
- For in-progress HTML writes, prefer code/loading view until the write completes.
- Switch to rendered preview only after a completed file result or
present_files.