claude-code - 💡(How to fix) Fix [BUG] Background terminals block user query from agent client protocol [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#54267Fetched 2026-04-29 06:31:51
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×2

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Sometimes this requires the user to repeat several times until the model receives it. This isn't even a workaround. Let's say there are 3 queued background terminal notifications, you need to repeat 3 times to send your prompt to the model. After that, you need another 3 repeat for your next prompt, meanwhile the model gets your first prompt 3 times.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When operating claude code over ACP,

  • Give the agent a long task, and it spawns a background terminal
  • Wait until the agent finishes its task
  • Then send a prompt.

At this point, a user message containing ONLY the information of a background terminal has done is sent to the model. The actual user query is NOT sent to the model. It seems background terminal notification would block in the user message queue.

Sometimes this requires the user to repeat several times until the model receives it. This isn't even a workaround. Let's say there are 3 queued background terminal notifications, you need to repeat 3 times to send your prompt to the model. After that, you need another 3 repeat for your next prompt, meanwhile the model gets your first prompt 3 times.

What Should Happen?

The agent should immediately process the user query when sent, regardless of any pending or finished background terminals.

Error Messages/Logs

Steps to Reproduce

I often hit this when using Telegram-ACP, but should be triggerable on any ACP client.

  1. Give the agent a long task, and it spawns a background terminal
  2. Wait until the agent finishes its task
  3. Then send a prompt.

At this point, a user message containing ONLY the information of a background terminal has done is sent to the model. The actual user query is NOT sent to the model. It seems background terminal notification would block in the user message queue.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.120

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Non-interactive/CI environment

Additional Information

No response

extent analysis

TL;DR

The issue can be mitigated by clearing the user message queue after a background terminal task is completed, ensuring that pending notifications do not block new user queries.

Guidance

  • Investigate the message queue handling in the ACP client to identify why background terminal notifications are blocking new user queries.
  • Consider implementing a mechanism to clear or prioritize the message queue after a background task is finished, allowing new user queries to be sent to the model immediately.
  • Review the Telegram-ACP client code to see if there's a specific issue with how it handles background terminal notifications and user queries.
  • Test the issue with different ACP clients to confirm if it's a client-specific problem or a general issue with the Claude Code API.

Example

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

Notes

The root cause of the issue is unclear, and more investigation is needed to determine why background terminal notifications are blocking new user queries. The suggested mitigation steps are based on the assumption that the issue is related to message queue handling.

Recommendation

Apply a workaround to clear or prioritize the message queue after a background task is finished, as upgrading to a fixed version is not an option since the issue's cause is unknown.

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