Repository navigation
fix(ui): decode artifact previews as UTF-8 - #117657
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 9:48 PM ET / August 2, 2026, 01:48 UTC. ClawSweeper reviewWhat this changesThe PR decodes Base64 Merge readinessCurrent main still corrupts Base64 UTF-8 artifact text by using the binary string returned from Priority: P2 Review scores
Verification
How this fits togetherThe Control UI requests workspace artifacts from the Gateway, selects a preview based on MIME type, and forwards rendered and raw text to the sidebar. This patch changes the Base64 text conversion boundary before that content is displayed or copied. flowchart LR
A[Gateway artifact response] --> B[Workspace artifact request]
B --> C[MIME preview selection]
C --> D[Base64 bytes decoded as UTF-8]
D --> E[Rendered sidebar preview]
D --> F[Copyable raw text]
Decision needed
Why: The implementation is source-proven and the supplied exact-head browser evidence is strong, but the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +89. Total +87 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the focused UTF-8 byte-decoding repair after a maintainer confirms the refreshed merge result, retaining the existing image data-URL and visible malformed-Base64 error paths. Do we have a high-confidence way to reproduce the issue? Yes. Current main routes Base64 Is this the best way to solve the issue? Yes. Converting the Base64 binary string into bytes and applying the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6a527b6e5531. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
…elf-release * commit '10a390ed7fa88d09da0d4523c3ed1e3550ece5c6': (4646 commits) fix(release): allow larger npm plugin artifacts (openclaw#117745) refactor(macos): consolidate gateway process fixtures (openclaw#117740) fix(ui): preserve complete persisted log messages (openclaw#117666) fix(ui): decode artifact previews as UTF-8 (openclaw#117657) fix(control-ui): restore sandbox media previews (openclaw#117689) fix(plugins): link host declared as direct dependency (openclaw#117738) fix(macos): avoid self-named defaults suite (openclaw#117690) fix(inference): preserve run ownership and completion delivery (openclaw#117731) test(talk): align browser E2E tool completion test: consolidate OpenClaw E2E fixtures (openclaw#117701) fix(release): ignore bundle fields in npm locks (openclaw#117730) fix(meeting-bot): keep configured host options internal refactor(line): remove dead card helpers (openclaw#117729) perf(cli): attribute command startup stages (openclaw#117720) refactor(whatsapp): deduplicate reply delivery test fixtures (openclaw#117710) docs(changelog): note bounded WebRTC tool calls docs(changelog): note meeting audio bounds fix(meeting-bot): preserve node host SDK surface test(talk): split WebRTC tool lifecycle coverage fix(meeting-bot): break node host import cycle ... # Conflicts: # package.json # src/agents/model-auth.ts
What Problem This Solves
Control UI workspace previews corrupt UTF-8 text and JSON artifacts. Accented characters, CJK text, and emoji appear as mojibake, and the sidebar's copied raw text is corrupted too.
Why This Change Was Made
The Gateway delivers inline artifacts as Base64-encoded bytes, but the workspace preview treated the binary string returned by
atob()as decoded text. One canonical text-artifact path now converts those bytes throughTextDecoder, matching the existing attachment decoder inui/src/pages/chat/components/chat-attachments.tsand removing duplicated JSON/plain-text branches.User Impact
Downloaded
text/plainandapplication/jsonartifacts display and copy their original Unicode content correctly. Existing Markdown/JSON code fences, image data URLs, and visible malformed-Base64 errors are preserved. Production code decreases by two lines.Evidence
node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-session-workspace.test.ts.findings: [],patch is correct, and confidence0.98; TruffleHog secret scanning also passed.a2893fba094c2aa541613b0013ceacd308d50495.a2893fba094c2aa541613b0013ceacd308d50495: 2/2 passed using actual Google Chrome150.0.7871.187, the real Vite-served Control UI, and a mocked Gateway WebSocket;artifacts.listandartifacts.downloadwere exercised through the actual workspace artifact rows.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/qa400-artifact-utf8-proof.e2e.test.ts(the isolated temporary proof spec was removed after the run; the reviewed Git tree stayed unchanged).Résumé 東京 🦀for bothtext/plainandapplication/json, expanded the JSON preview, clicked each real code-copy button, and confirmed the browser clipboard received the exact original Unicode string; no Gateway or unknown-agent error appeared.text-plain-rendered.png,text-plain-raw.png,application-json-rendered.png, andapplication-json-raw.pngunder/private/tmp/openclaw-qa400-ui-artifact-utf8-a289-browser-proof/. Structured request/clipboard evidence is intext-plain.jsonandapplication-json.jsonin the same directory./private/tmp/openclaw-qa400-ui-artifact-utf8-a289-browser-proof-final.log(Test Files 1 passed;Tests 2 passed; duration10.45s).