[BUG] [UX] Auto-compaction during Q&A leaves question unanswered, summary consumes remaining context budget

Resolved 💬 3 comments Opened Mar 10, 2026 by Shaivpidadi Closed Apr 7, 2026

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?

When a user asks a question with code changes (e.g., "update X and explain why"), auto-compaction can trigger mid-response. The compaction summary itself then consumes the remaining context budget, leaving the original question unanswered and the code output truncated or vice versa (code generated but explanation dropped).

Suggested Fix

  1. Detect pending Q&A turns before compaction if the current user message contains a question, flag it as unresolved
  2. Post-compaction re-injection: After compaction completes, re-ask any unanswered questions from the triggering turn
  3. Minimum: Surface a message like:

"Context was compacted mid-response. Your question about X wasn't answered resuming now..." so the user isn't left guessing

Impact

  • Users lose answers silently with no indication
  • Common in "explain + fix" workflows (very common pattern)
  • Creates distrust in longer sessions

What Should Happen?

When compaction triggers during a response that has both a code ask and a pending question, the question should be queued and answered after compaction completes or at minimum, Claude should surface that the answer was truncated and offer to re-answer it.

Error Messages/Logs

Steps to Reproduce

  1. Start a long session with mixed Q&A + code edits
  2. Approach context limit (~75-85% capacity)
  3. Ask a question that requires both a code change and an explanation
  4. Auto-compaction triggers during response generation

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.72

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗