claude-code - 💡(How to fix) Fix Context compaction auto-submits unfinished user message without Enter [2 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#56374Fetched 2026-05-06 06:29:49
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2closed ×1

During context compaction, an in-progress user message was automatically submitted and executed without the user pressing Enter. The user was mid-message when compaction triggered, and the partial/complete message was sent as if the user had confirmed it.

Root Cause

During context compaction, an in-progress user message was automatically submitted and executed without the user pressing Enter. The user was mid-message when compaction triggered, and the partial/complete message was sent as if the user had confirmed it.

RAW_BUFFERClick to expand / collapse

Description

During context compaction, an in-progress user message was automatically submitted and executed without the user pressing Enter. The user was mid-message when compaction triggered, and the partial/complete message was sent as if the user had confirmed it.

Steps to Reproduce

  1. Have a long conversation that approaches context limits
  2. Begin typing a message but do not press Enter
  3. Context compaction triggers
  4. Message is submitted automatically without user confirmation

Expected Behavior

Context compaction should never submit or execute a pending user message. Any in-progress input should remain in the input buffer, untouched, after compaction completes.

Actual Behavior

The unfinished message was submitted as a command and executed without the user pressing Enter.

Impact

This can cause unintended actions — in this case, infrastructure changes were applied to a live AWS environment based on a message the user had not yet chosen to send. The outcome happened to be acceptable, but this behavior is unsafe in general.

Environment

  • Platform: macOS (darwin 25.3.0)
  • Shell: zsh
  • Model: claude-sonnet-4-6

extent analysis

TL;DR

Prevent automatic message submission during context compaction by ensuring that in-progress user input is not executed without explicit user confirmation.

Guidance

  • Review the context compaction trigger logic to identify why it's submitting the in-progress message without waiting for user confirmation.
  • Verify that the input buffer is properly handled during compaction, ensuring that unfinished messages remain untouched.
  • Consider implementing a flag or check to detect when a user is mid-message and prevent automatic submission during compaction.
  • Investigate if there are any existing safeguards or hooks in the system that can be leveraged to prevent unintended message execution.

Example

No code snippet is provided due to lack of specific implementation details in the issue.

Notes

The exact fix may depend on the underlying implementation of the context compaction mechanism and how user input is handled. Further investigation into the system's architecture and codebase is necessary to determine the root cause and apply a targeted solution.

Recommendation

Apply a workaround to prevent automatic message submission during context compaction, such as temporarily disabling compaction while a user is typing or implementing a manual confirmation step before executing any pending messages. This approach prioritizes safety and prevents unintended actions until a more permanent fix can be developed.

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 Context compaction auto-submits unfinished user message without Enter [2 comments, 2 participants]