[BUG] Long-session regression: auto-compaction obscures user input and triggers unprompted code generation (v2.1.126, opus-4.7)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
- Claude Code: v2.1.126
- Model: opus-4.7
- Plan: Max ($100/mo)
- OS: Windows 11
- Shell: PowerShell / bash
Summary
In long sessions, Claude Code exhibits four compounding failures that
together break the user's ability to trust or audit the tool:
- CLI UX visually buries user input under system banners
- Model auto-continues work after compaction without user confirmation
- Model fails to comprehend the immediately preceding user message
- No warning is given before session quality degrades
The result is unrequested file generation (hundreds of lines of code the
user never asked for) that the user cannot trace back to any specific
command.
What Should Happen?
Concrete fix requests
- Compaction UX: silent background processing + small status
indicator only. Do not interrupt conversation flow with multi-line
banners.
- Append-only user input preservation: user messages must remain
visually in place under any system event. System events get a
distinct visual channel.
- Compaction checkpoint: after compaction, model must request user
confirmation before any file-modifying action. No autonomous
continuation based on compacted summary alone.
- Block unprompted file generation: code/file creation requires an
explicit user request in the most recent turn. The system prompt
already states this principle ("Don't add features… beyond what the
task requires") but enforcement is clearly inadequate.
- Pre-degradation warning: surface session-health signals
(context fill %, compaction imminent, repetition detected) before
the user has to discover the failure manually.
- Acknowledge or refute the 4.6 → 4.7 regression in release notes.
Error Messages/Logs
Steps to Reproduce
Issue 1 — CLI UX: system events obscure user input
When auto-compaction or session resume occurs mid-conversation, the CLI
inserts an 8+ line "Welcome back!" banner plus a "Conversation compacted
(ctrl+o for history)" message directly into the conversation flow. From
the user's perspective, their most recent input message appears to have
been replaced by these system banners.
Violated principle: terminal output should be append-only. System
events (compaction, resume, model switch) belong in a separate visual
channel — distinct color, indentation, sidebar, or status footer — not
inline with conversation flow.
Expected: user input is preserved in-place under any system event;
compaction is silent background work with at most a small status
indicator.
Actual: user input becomes hard or impossible to locate visually
after compaction; the system banner reads as if it has overwritten the
user's message.
Issue 2 — Model auto-continues after compaction without confirmation
Immediately after * Conversation compacted fires, the model proceeds
to take action (generate files, write code, modify state) based on the
compacted summary, without waiting for user confirmation.
In my session, this produced two unrequested file-generation events:
LineageDatabaseComponent.h(126 lines) +.cpp(626 lines) — 750+ lines totalLineagePacketStructures.h(477 lines)
None of these were explicitly requested. The triggering user message
was "데이터를 클로드코드로 보내" ("move this data/conversation to Claude
Code"), which the model interpreted as "write database component code."
Expected: after compaction, the model pauses and asks the user to
confirm intent before taking any file-modifying action. Compaction is a
context-altering event and should be treated as a checkpoint.
Actual: model treats the compacted summary as authoritative and
proceeds autonomously.
Issue 3 — Failure to comprehend the immediately preceding message
This is the most concerning failure: it is not a long-context
"lost in the middle" issue. The model misread a single, short Korean
sentence directly preceding its response. A 1M-token context window is
irrelevant if the model cannot parse one sentence from the most recent
turn.
This suggests the model became locked into a "produce structured
tutorial / generate code" mode from earlier in the session and
interpreted ambiguous tokens through that lens, overriding the actual
user message.
Issue 4 — No warning before session quality degrades
The CLI advertises "1M context window" but does not surface any signal
when:
- Attention quality begins to degrade
- Context is approaching the compaction threshold
- The model has entered a repetitive/stuck response pattern
By the time the user notices the model is malfunctioning, the session
is already unsalvageable. There is no proactive indicator, no quality
metric, no "you may want to start a fresh session" suggestion.
Issue 5 — Suspected regression from Opus 4.6
Anecdotal but consistent across users I've spoken with: Opus 4.6 could
sustain multi-day single sessions without exhibiting the basic
comprehension failures described above. v2.1.126 + opus-4.7 reaches
this failure mode within a single working session.
If this is a known regression, it should be disclosed. If it is not
known, it warrants investigation.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.126 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
<img width="1110" height="1149" alt="Image" src="https://github.com/user-attachments/assets/64d756ee-b0f8-434f-baa1-413c000c1294" />
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗