Skip to content

[bug] Claude code rendering issue in superset terminal #3668

Closed as duplicate

Description

@distroinfinity

Describe the bug

Image

Hey
been repeatedly facing issue with rendering of claude code output inside superset terminal.

  • one pattern is what is in the image above things going gibberish
  • second pattern is duplicate repetitive output of claude code, same thing rendered twice or thrice in a row

Activity

  1. github-actions commented on Apr 23, 2026

    @github-actions
    Contributor

    Triaged this but could not produce a failing bun:test reproduction. Writing up what I looked at in case it helps narrow things down.

    Pipeline investigated (desktop renderer → daemon):

    • apps/desktop/src/renderer/.../Terminal/v1-terminal-cache.ts — cache-level event gating (streamReady, eventHandler, pendingStreamEvents, pendingLifecycleEvents)
    • apps/desktop/src/renderer/.../Terminal/hooks/useTerminalStream.ts — component-level gating (isStreamReadyRef, pendingEventsRef)
    • apps/desktop/src/renderer/.../Terminal/hooks/useTerminalRestore.ts — flushPendingEvents / maybeApplyInitialState
    • apps/desktop/src/renderer/.../Terminal/hooks/useTerminalLifecycle.ts — startStream + setStreamReady call site (lines 604–605) and the reattach path (line 546)
    • apps/desktop/src/main/lib/terminal/daemon/daemon-manager.ts — PTY → batcher → IPC emission
    • apps/desktop/src/main/lib/data-batcher.ts — 16ms UTF-8-aware batching, uses StringDecoder to keep split multi-byte chars across flushes
    • apps/desktop/src/main/lib/terminal-host/headless-emulator.ts — server-side emulator with chunk-safe tracked-sequence buffer

    I modeled the event-routing state machine (cache + component queues + mount/unmount/remount) in a unit test and could not manufacture a double-write or out-of-order delivery. Every data event in every scenario I traced ended up written to the xterm sink exactly once. That matches the code paths:

    • Cache pendingStreamEvents is flushed via routeEvent, which for data events forwards to the component handler (when mounted) or writes directly to xterm (when unmounted) — never both.
    • Component pendingEventsRef is flushed only once by flushPendingEvents after maybeApplyInitialState sets isStreamReadyRef=true.
    • routeEvent never queues a data event while unmounted — it writes directly — so nothing can be replayed on remount.

    Where I suspect the real cause lives

    1. xterm.js parsing of Claude Code's TUI output under the alternate screen buffer — the isAltScreenReattach branch in useTerminalRestore.ts writes \x1b[?1049h then rehydrateSequences but intentionally NOT snapshotAnsi; a subtle interaction with Claude Code's redraw-on-resize flow could leave the screen with half-rendered escape sequences.
    2. Clear-scrollback detection at chunk boundaries — apps/desktop/src/main/lib/terminal-escape-filter.ts matches \x1b[3J in a single chunk. If the 4-byte sequence splits across IPC batches, containsClearScrollbackSequence returns false on both halves, the headless emulator is not reset, and subsequent cold-restore snapshots include stale content that xterm then re-renders on top of live output — plausible match for the "duplicate repetitive output" symptom.
    3. OSC-7 / mode-scan carry buffers in useTerminalCwd.ts / useTerminalModes.ts don't buffer across chunks for OSC-7 specifically; a split sequence would be silently dropped, but this would only cause a CWD miss, not gibberish.

    What would actually pin this down

    • A terminal session recording (raw byte stream from the PTY) captured while the bug is reproducing, plus a note of the last ~50 frames.
    • Whether the duplication is on first render, on tab-switch-back, or after a daemon reconnect — the three paths hit different code.
    • Platform / Claude Code version and whether the Superset window was resized or backgrounded at the time.

    Happy to take another pass with any of that.

  2. 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):

  3. wsullivan-dev commented on May 15, 2026

    @wsullivan-dev

    Terminal output covered in red symbols
    Mac OS Tahoe 26.3
    M4 Macbook

    Image
  4. rikva commented on May 19, 2026

    @rikva

    Same here, started happening more often in the last few days.

  5. distroinfinity commented on May 19, 2026

    @distroinfinity
    ContributorAuthor

    hey @Kitenite
    first part of my reported issue might me claude code native, check these once:

    However, the second related issue of claude output being renders twice inside superset might be an unhandled or a leak in superset terminal orchestrator.

    Issue persists as of today May 19, as well.
    Thanks for looking into it!

  6. 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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions