claude-code - 💡(How to fix) Fix [Bug] Input field auto-prefills assistant text and submits it on Enter keystroke [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#56199Fetched 2026-05-06 06:34:33
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

The Claude Code TUI prefills the prompt input with text drawn from previous assistant messages. The prefilled text is rendered in the same input field as user typing, and pressing Enter submits it as if the user had typed it. This is not a UX preference — it is a correctness bug. The input field is mutating its value with content the user did not author, and a single Enter keystroke turns that content into a binding instruction to the agent.

Root Cause

Impact

  • Unintended commits, pushes, file deletions, branch operations, command executions.
  • Erosion of trust in the tool: users stop typing freely because the input field is no longer theirs.
  • Disproportionate impact on long sessions where many suggestions accumulate.
RAW_BUFFERClick to expand / collapse

Bug Description

Summary

The Claude Code TUI prefills the prompt input with text drawn from previous assistant messages. The prefilled text is rendered in the same input field as user typing, and pressing Enter submits it as if the user had typed it. This is not a UX preference — it is a correctness bug. The input field is mutating its value with content the user did not author, and a single Enter keystroke turns that content into a binding instruction to the agent.

Reproduction

  1. Have a conversation in which the assistant emits an imperative-style sentence (e.g. "commit this", "run the tests", "delete the branch").
  2. After the assistant's turn, type any character whose first letter matches the prefill (or in some cases, type nothing at all).
  3. Observe the previous assistant suggestion appear as ghosted text in the input.
  4. Press Enter.
  5. The ghosted text is submitted as the next user message and the agent acts on it.

Expected behavior

The input field reflects only what the user has typed. If a suggestion mechanism is desired, it must:

  • be off by default, or at minimum
  • require an explicit, distinct accept key (Tab) and never be committed by Enter, and
  • be disable-able via settings.json and an env var.

Actual behavior

  • Suggestions are on by default.
  • Enter — the universal "submit" key — accepts and submits the suggestion.
  • There is no documented setting, env var, or CLI flag to disable it.
  • Closing the suggestion is not obvious; users discover it only after it has fired.

Why this is a bug, not a feature request

  1. The input field is the primary trust boundary between the user and the agent. Mutating its value with non-user content violates that boundary.
  2. The accept key is overloaded with submit. Any "I'm just hitting Enter to clear / send my own message / dismiss" muscle-memory fires an unintended instruction.
  3. The instructions issued this way are not idle text — they cause the agent to take real, sometimes destructive, actions (commits, file edits, command execution).
  4. There is no opt-out. A correctness defect with no off switch is a bug by definition.

Impact

  • Unintended commits, pushes, file deletions, branch operations, command executions.
  • Erosion of trust in the tool: users stop typing freely because the input field is no longer theirs.
  • Disproportionate impact on long sessions where many suggestions accumulate.

Severity

High. Loss of input integrity in an agent that executes shell commands and edits files is a safety issue, not a polish issue.

Existing related issues

#16032, #14003, #15427 — all currently filed as feature requests. This report asks for re-triage as a bug.

Suggested fix (in priority order)

  1. Default the suggestion behavior to off.
  2. Add settings.json key (e.g. "input.autosuggest": false) and matching env var.
  3. Decouple the accept key from Enter; require Tab (or similar) to accept, Esc to dismiss.
  4. Visually distinguish ghosted suggestion text from typed text far more strongly than current rendering.

Environment

  • Claude Code version: 2.1.128
  • OS: MacOS
  • Terminal: terminal
  • Shell: bash

extent analysis

TL;DR

Disable the autosuggest feature by default and decouple the accept key from Enter to prevent unintended submissions.

Guidance

  • Review the suggested fix priorities and consider implementing them in order to address the correctness bug.
  • Add a settings.json key (e.g., "input.autosuggest": false) and a matching environment variable to provide an opt-out mechanism.
  • Visually distinguish ghosted suggestion text from typed text to reduce confusion.
  • Test the changes with various scenarios, including imperative-style sentences and different user inputs, to ensure the fix works as expected.

Example

No code snippet is provided as the issue does not imply a specific code change, but rather a change in behavior and configuration.

Notes

The provided information suggests that this is a critical issue that requires a prompt fix to prevent unintended actions and maintain user trust.

Recommendation

Apply the workaround by defaulting the suggestion behavior to off and adding a configuration option to enable or disable it, as this addresses the primary concern of input integrity and provides a clear path forward.

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…

FAQ

Expected behavior

The input field reflects only what the user has typed. If a suggestion mechanism is desired, it must:

  • be off by default, or at minimum
  • require an explicit, distinct accept key (Tab) and never be committed by Enter, and
  • be disable-able via settings.json and an env var.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING