Skip to content

fix(chat): don't send on Enter while the agent is running#100

Closed
viniciussouzax wants to merge 1 commit into
evolution-foundation:mainfrom
viniciussouzax:fix/chat-enter-guard
Closed

fix(chat): don't send on Enter while the agent is running#100
viniciussouzax wants to merge 1 commit into
evolution-foundation:mainfrom
viniciussouzax:fix/chat-enter-guard

Conversation

@viniciussouzax

Copy link
Copy Markdown

Problem

While an agent response is streaming, pressing Enter sends the typed text
anyway. Sending a new message aborts the in-flight query (chat-bridge
stopSession), so a user's follow-up — often an impatient "are you there?" —
silently kills the very answer they were waiting for. This shows up as the
recurring "Claude Code process aborted by user" message and the impression
that the chat is broken.

Root cause

The keydown handler in AgentChat.tsx calls sendMessage() unconditionally:

if (e.key === 'Enter' && !e.shiftKey) {
  e.preventDefault()
  sendMessage()
}

The Send button is already guarded — it's disabled via
canSend = ... && status !== 'running' — but the Enter shortcut bypasses that
guard entirely.

Fix

Mirror the button's guard in the Enter handler:

if (e.key === 'Enter' && !e.shiftKey) {
  e.preventDefault()
  if (status !== 'running') sendMessage()
}

Shift+Enter (newline) is unaffected.

Testing

  • Before: send a message, then press Enter again while it streams → the
    response is aborted ("Claude Code process aborted by user").
  • After: pressing Enter while running is a no-op (same as the disabled Send
    button); the streaming response completes normally. Sending works as before
    once the agent is idle.

Pressing Enter while a response was streaming called sendMessage()
unconditionally. A new message aborts the in-flight query (chat-bridge
stopSession), so a user's follow-up (often an impatient "are you there?")
silently killed the very answer they were waiting for, which surfaced as the
recurring "Claude Code process aborted by user" message.

Guard the Enter handler with `status !== 'running'`, mirroring the Send button
that is already disabled through `canSend` while the agent is running. Shift+Enter
(newline) is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @viniciussouzax, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@viniciussouzax viniciussouzax closed this by deleting the head repository Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant