claude-code - 💡(How to fix) Fix [BUG] UI: Conversation transcript duplicates on each auto-compaction in long sessions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Workaround

None that preserves history. /clear avoids it but destroys the session — not viable when compaction is the intended mechanism for long sessions.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When a conversation runs long and auto-compaction fires multiple times, the UI renders the full transcript on top of itself once per compaction cycle. Result: N compactions → each message appears N times in the window.

What Should Happen?

Expected

Each message appears exactly once regardless of compaction count.

Actual

Every message duplicated N times (N = number of compaction cycles).

Confirmed: Data is NOT corrupted

Checked underlying JSONL files — no duplicate entries. Duplication is purely in the UI rendering layer. Token consumption is unaffected.

Environment

  • Claude Code version: 2.1.107
  • Platform: macOS Darwin 24.6.0 (Apple Silicon)
  • Shell: zsh

Workaround

None that preserves history. /clear avoids it but destroys the session — not viable when compaction is the intended mechanism for long sessions.

Error Messages/Logs

Steps to Reproduce

  1. Open a long-running session (4+ MB JSONL, multiple tool calls over hours)
  2. Let auto-compaction fire multiple times in the same session
  3. Scroll through the conversation — all messages appear duplicated N times

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.114

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

The issue can be addressed by modifying the UI rendering logic to handle compaction cycles correctly, ensuring each message appears only once.

Guidance

  • Review the UI rendering code to identify where the duplication occurs and adjust the logic to remove duplicate messages after compaction.
  • Verify that the underlying data structure used for storing conversation history is correctly updated during compaction, ensuring no duplicate entries are added.
  • Investigate the auto-compaction mechanism to understand how it interacts with the UI rendering layer, potentially leading to the duplication issue.
  • Test the fix with various session lengths and compaction cycles to ensure the solution is robust.

Example

No specific code snippet can be provided without access to the Claude Code repository, but the fix likely involves modifying the rendering function to check for and remove duplicate messages before displaying the conversation transcript.

Notes

The provided information suggests the issue is specific to the UI rendering layer and does not affect the underlying data or token consumption. However, without direct access to the codebase, the exact solution may require further investigation into the Claude Code's rendering and compaction mechanisms.

Recommendation

Apply a workaround by modifying the UI rendering logic, as the root cause seems to be related to how the UI handles compaction cycles, and there's no clear indication of a fixed version that addresses this specific issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] UI: Conversation transcript duplicates on each auto-compaction in long sessions