Back to blog

Terminal Graphics Residue Investigation and Issue Submission

While using Claude Code for long conversations, discovered abnormal terminal display after context compression—old content remained as static bitmaps, overlaying current output.

#Claude Code#VS Code#Terminal#Bug

Origin

While using Claude Code for long conversations, I discovered abnormal terminal display after context compression (compact): old content remained as static bitmaps, overlaying current output.

This issue is easier to reproduce when multiple terminal instances are open simultaneously and GPU memory pressure is high.

Discovery Process

Initial Observations

  • Residual content is fragments from previous conversations, like screenshots
  • Same problematic character always has the same wrong pattern
  • Splitting terminal pane then closing can clear the residue

Cause Analysis

  1. Terminal level: GPU texture cache not properly cleared under memory pressure
  2. Application level: No active refresh sequence sent after compression

Hook Validation

Documentation has PreCompact hook, tried configuring PostCompact hook:

  • ✅ Hook exists and can trigger
  • ❌ Runs in subprocess, cannot affect main process terminal display

Reference Issue #35816 also confirms this.

Contribution Actions

1. VS Code Issue

Submitted terminal GPU texture cache issue.

Issue Number: #315782(opens in a new tab)

Status: ✅ Submitted

Environment: VS Code 1.119.0, RTX 3060 Laptop GPU (6GB), Windows 10

Reproduction: 6-7 Claude Code windows running simultaneously, residue appears after compression

Characteristic: Same wrong character always has same wrong pattern (cache texture issue)

2. Claude Code Issue

Submitted post-compression terminal residue issue.

Issue Number: #58094(opens in a new tab)

Status: ✅ Submitted | ⚠️ Bot detected as possibly duplicate (replied explaining differences)

Bot Detected Duplicates: #53406, #32480, #50658

Difference Explanation:

  • #53406: Floating UI element residue
  • #32480: Dialog close residue
  • #50658: Input buffer ghost reappearance

These are different trigger sources and symptoms.

3. Issue #54536 Comment

Clarified that PostCompact hook exists but has limited functionality.

Comment Link: #54536#issuecomment-4423410692(opens in a new tab)

Technical Analysis

Why Does Residue Occur?

Normal case:
Terminal → Render → GPU Texture Cache → Display

During compression:
Compression triggered → GPU pressure increases → Texture cache evicted → New content rendered
         ↓
Old texture not properly cleared → New content overlays on old → Residue

Why Can't Hook Solve This?

PostCompact hook runs in subprocess, can only do data-level processing (like state updates), cannot affect main process terminal rendering.

Next Steps

  • Wait for VS Code team response
  • Wait for Claude Code team response
  • Consider documentation PR for PostCompact hook

Takeaways

  • PostCompact hook exists but not documented publicly
  • Subprocess hooks cannot affect main process UI
  • Terminal GPU texture cache is an independent layer issue

Related Links


Last updated: 2026-05-12