Workflow output renders with overlapping ghost frames on return to main view

Status Open
Reported on v2.1.186
Maintainer reply None cached
Activity 0 comments · opened Jul 16, 2026

Description

When a /workflow completes and the view transitions back to the main conversation, the output renders with overlapping/scrambled content. Multiple agent outputs, tables, and text layers from different workflow phases bleed together, making the result unreadable.

Steps to Reproduce

  1. Run a multi-agent workflow (e.g., a workflow with 3+ parallel agents producing markdown tables/structured output)
  2. Wait for workflow to complete
  3. Observe the /workflows view — renders correctly
  4. Return to the main conversation view

Expected: Clean, sequential rendering of the workflow result
Actual: Text layers overlap, tables render on top of each other, content from different agents bleeds together

Screenshots

The output looks like multiple terminal frames composited on top of each other — text from different agents visible simultaneously at overlapping positions.

Environment

  • Claude Code version at time of bug: 2.1.186
  • Current version: 2.1.211 (updated, retesting)
  • OS: macOS Darwin 25.5.0
  • Terminal: Default macOS Terminal
  • Shell: zsh

Analysis

Root cause appears to be in the alternate screen buffer transition from workflow view → main view:

  1. Frame buffer not fully cleared: The renderer's damage-map optimization skips redrawing "unchanged" regions, but stale workflow content remains in those regions after the view transition.
  1. prevFrameContaminated not reset: The frame compositor doesn't force a full repaint when exiting the workflow view, so partial frame data from the workflow persists.
  1. Synchronized output not flushed: The \x1B[?2026h/l synchronized output protocol may have pending batches during the \x1B[?1049l (exit alternate screen) call, causing interleaved frame data.
  1. Damage map not reset to full screen: On workflow exit, the damage map should be set to {x:0, y:0, width: cols, height: rows} to force a complete repaint, but it appears to retain the workflow view's partial damage state.

Changelog Reference

v2.1.206 partially addressed this:

"Fixed returning to the agents view from a session leaving overlapping ghost frames with CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1"

The fix may be incomplete for the workflow → main view transition (as opposed to agents view → session).

Suggested Fix

During exitAlternateScreen() → main view initialization:

  1. Force full repaint: set damage map to full screen
  2. Flush synchronized output: complete any pending \x1B[?2026l before exiting
  3. Reset frame contamination: force prevFrameContaminated = true
  4. Send explicit clear + home: \x1B[2J\x1B[H after alternate screen exit
  5. Synchronize dimensions: ensure terminalColumns/terminalRows match between both rendering contexts

Workaround

export CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1

This disables alternate screen mode entirely, avoiding the buffer-swap issue.

View original on GitHub ↗