Skip to content

[bug] Intermittent garbled text rendering with multiple Claude Code tabs and Chinese content #3572

Closed as duplicate

Description

@day0n

Describe the bug

When running the latest version of Superset desktop with approximately 7–8 Claude Code tabs open simultaneously, the UI intermittently renders garbled/corrupted text. The corruption appears primarily in code blocks, diff views, and terminal output areas — especially when working with Chinese content.

The underlying data is not corrupted: refreshing the workspace or restarting Superset immediately restores correct rendering. This points to a rendering-layer issue rather than an encoding or data problem.

Steps to reproduce

  1. Open Superset desktop (latest version)
  2. Create ~7–8 Claude Code workspaces/tabs
  3. Work with Chinese-language prompts and content across multiple tabs
  4. Switch between tabs and interact with chat outputs (code blocks, diffs, terminal)
  5. After some time, parts of the UI render as garbled/corrupted characters

Expected behavior

All text — Chinese and ASCII — should render consistently and remain readable regardless of the number of open tabs.

Actual behavior

  • Characters in code blocks, diff views, and/or terminal output become garbled
  • Both CJK and Latin characters can be affected
  • The corruption is transient: refresh or restart fixes it
  • It tends to happen more frequently with many tabs open

Workarounds

  • Refresh the affected workspace/tab
  • Restart Superset

Both restore normal rendering, but the issue can recur.

Environment

  • App: Superset desktop (latest)
  • OS: macOS
  • Content language: Chinese
  • Open tabs: ~7–8 Claude Code tabs

Suspected area

This is likely related to the xterm.js WebGL renderer and/or font shaping under memory pressure from many concurrent terminal instances. Relevant code paths:

  • xterm addons (apps/desktop/src/renderer/lib/terminal/terminal-addons.ts): WebglAddon, LigaturesAddon, and Unicode11Addon are all loaded per terminal instance. WebGL context loss handling exists but may not cover all corruption scenarios under heavy multi-tab usage.
  • Code block rendering (packages/ui/src/components/ai-elements/code-block.tsx): Shiki-based syntax highlighting with dangerouslySetInnerHTML — if the async highlight promise resolves with stale/corrupt state, it could produce garbled output.
  • Diff rendering (packages/ui/src/components/ai-elements/file-diff-tool.tsx): Inline diff lines rendered via plain text — less likely but still in the affected visual area.
  • shiki-wasm worker pool (apps/desktop/src/renderer/routes/_authenticated/layout.tsx:188): A shared pool of 8 workers handles syntax highlighting; under heavy load with many tabs, worker contention or message interleaving could corrupt highlight results.

Related issues

This issue adds a specific reproduction pattern (many concurrent Claude Code tabs + Chinese content) and cross-references the chat rendering layer in addition to the terminal layer.

Activity

  1. day0n commented on Apr 19, 2026

    @day0n
    Author
    Image
  2. github-actions commented on Apr 19, 2026

    @github-actions
    Contributor

    Investigated this bug but couldn't produce a unit-test reproduction. Notes below in case they help narrow future work.

    What I checked

    • packages/ui/src/components/ai-elements/code-block.tsx — ran exploratory tests against highlightCode with CJK input, ~20 concurrent highlights, unknown-language fallback, and line-number transformer reuse across concurrent codeToHtml calls sharing a transformer array. All produced correct output. The useEffect cleanup flag correctly gates stale promise resolutions, and the shared line-number transformer does not cross-contaminate because each codeToHtml parses a fresh AST.
    • packages/ui/src/components/ai-elements/file-diff-tool.tsx — buildSimpleDiff/getDiffLines are pure UTF-16 string operations (split("\n"), slice(1)), so CJK cannot corrupt; worst case is noisy output, not garbled glyphs.
    • apps/desktop/src/renderer/lib/terminal/terminal-runtime.ts — noted that restoreBuffer (which calls terminal.write) runs before loadAddons, so the Unicode 11 provider isn't active when the persisted buffer is parsed. For common CJK ranges Unicode 6 and 11 agree on width, but edge-case ideographs, newer emoji, and ZWJ sequences could end up with wrong widths baked into the buffer. Could be a minor contributor but doesn't explain the general garbled text.
    • apps/desktop/src/renderer/lib/terminal/terminal-addons.ts — onContextLoss disposes the WebGL addon on that terminal but does not set suggestedRendererType = \"dom\" globally, so subsequent terminals re-attempt WebGL. Under the browser's per-document WebGL context cap (~16), this can cause cascading context loss as tabs open. Still a symptom, not proven to produce the glyph corruption shown.

    Why no PR

    The most likely root causes (xterm WebGL texture-atlas corruption under context-loss cascades, shared shiki-wasm worker pool in @pierre/diffs, memory pressure across many live WebGL contexts) only manifest in a real browser + GPU + many open tabs. They can't be exercised from bun:test without standing up an Electron / Playwright harness, and the logic-level code paths I could test don't fail.

    Refs #$ISSUE_NUMBER

  3. johann-taberlet commented on Apr 19, 2026

    @johann-taberlet
    Image

    I have the same problem very often. For me, the quickest workaround is to resize the Superset window, and the rendering returns to normal. That's the only criticism I can make of this application so far.

  4. Kitenite commented on Apr 20, 2026

    @Kitenite
    Member

    Taking a look at this atm, thanks for the patience!

  5. nnnnoel commented on Apr 22, 2026

    @nnnnoel

    @Kitenite It's not fixed when i see.

    Image
  6. Kitenite commented on Apr 22, 2026

    @Kitenite
    Member

    Hey sorry about that will take another look

  7. Kitenite commented on May 6, 2026

    @Kitenite
    Member

    Related reports (cross-referenced during issue triage — same area, may or may not share a root cause):

  8. valentin-ib commented on May 10, 2026

    @valentin-ib

    Reproducible in environments without Chinese-character text too.
    Can confirm it happens when a lot of agent conversations are open, and resolves itself on app refresh / update.

    Image
  9. jnelken commented on May 19, 2026

    @jnelken
  10. vahidkowsari commented on May 19, 2026

    @vahidkowsari
    Contributor

    I see this on a daily basis. Could it be font related? I use the Menlo and also jetbrains mono fonts.

  11. justincrich commented on May 23, 2026

    @justincrich
    Contributor

    Picking this up — opened #4893 which bumps @xterm/* to 6.1.0-beta.220 (and @xterm/addon-webgl to 0.20.0-beta.219) to consume xtermjs/xterm.js#5883 "Fix webgl rendering corruption from atlas page merges" merged 2026-05-21 by Tyriar.

    The upstream PR fixes two atlas-merge bugs that produce the exact wrong-glyph rendering symptom described here. Tyriar's approval comment on PR #5883 calls out our use case:

    "This has been an issue for a long time, I think it's popped up more recently due to agentic CLIs using a much wider range of character styles."

    PR #5883 is cross-referenced as closing this issue plus the sibling cluster (#3527, #3794, #4601, #4639, #4617). Beta.220 was already published to npm and multiple downstream consumers (VSCode #317927, Alfredo, Ouroboros) are bumping to consume it.

    Defense-in-depth: also added a one-line VSCode-pattern (microsoft/vscode#120393) fallback inside both onContextLoss handlers — sets suggestedRendererType = "dom" for the rarer GPU-process-death class of failure that bypasses the atlas-merge fix.

    See PR #4893 for the binding scope, test plan, and full reasoning.

  12. Kitenite commented on Jul 11, 2026

    @Kitenite
    Member

    Closing as a duplicate of #5605, the consolidated tracker for stale terminal-rendering issues from the July 2026 stale-issue sweep (no activity since 2026-06-01). If this still applies on a current build, comment on #5605 and we'll reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions