Skip to content

Ensure concurrent prompts are handled.#348

Merged
benbrandt merged 1 commit intozed-industries:mainfrom
SteffenDE:sd-concurrent-prompts
Feb 27, 2026
Merged

Ensure concurrent prompts are handled.#348
benbrandt merged 1 commit intozed-industries:mainfrom
SteffenDE:sd-concurrent-prompts

Conversation

@SteffenDE
Copy link
Contributor

This basically implements the pending prompt queueing RFD. When a prompt request is received while the agent is already generating, we immediately forward the message to Claude and then wait until it replays the message back to us. When it replays it, we respond to the previous prompt request with "end_turn", which also singifies to the client that the message is now being processed by the agent.

See agentclientprotocol/agent-client-protocol#484.

@cla-bot cla-bot bot added the cla-signed label Feb 25, 2026
claudeCode: {
promptQueueing: true,
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I decided to announce this behavior if a client wants to check.

@josevalim
Copy link
Contributor

josevalim commented Feb 26, 2026

To give a bit more context, this can probably be considered a bug fix: the code was already forwarding, but the code was not prepared to handle that. So what would happen is that you send the second prompt request, Claude would handle it, but ACP would never reply with the response for the second request.

@benbrandt
Copy link
Member

@SteffenDE ok i tried doing the conflicts but it got a bit messy... Since you did both this and the usage, maybe you can best resolve it

This basically implements the pending prompt queueing RFD. When
a prompt request is received while the agent is already generating,
we immediately forward the message to Claude and then wait until
it replays the message back to us. When it replays it, we respond to
the previous prompt request with "end_turn", which also singifies to
the client that the message is now being processed by the agent.

See agentclientprotocol/agent-client-protocol#484.
@SteffenDE SteffenDE force-pushed the sd-concurrent-prompts branch from e49e0f1 to 886fdf5 Compare February 27, 2026 16:23
@SteffenDE
Copy link
Contributor Author

Yeah, the conflict was ugly, but only because git doesn't seem to handle wrapping a block in try {...} finally well...

@benbrandt benbrandt merged commit 3b3ce6f into zed-industries:main Feb 27, 2026
2 checks passed
rohan-patra added a commit to rohan-patra/claude-agent-acp that referenced this pull request Feb 27, 2026
Brings in upstream changes:
- claude-agent-sdk 0.2.62
- Prompt queueing support (zed-industries#348)
- History support fix (zed-industries#356)
- Windows arm builds (zed-industries#355)
- Node --cli support (zed-industries#358)

Fork additions preserved:
- In-process MCP server (mcp-server.ts) for Zed Review Changes UI
- Tool redirect system prompt, PreToolUse hook, PostToolUse onFileRead
- acpToolNames cases in tools.ts switch statements
- @modelcontextprotocol/sdk and diff dependencies

Also improves Write tool: new files that don't exist yet skip the
read-before-write guard instead of relying on error message parsing.
SteffenDE added a commit to SteffenDE/claude-code-acp that referenced this pull request Mar 6, 2026
Closes zed-industries#381.
Relates to zed-industries#348.

In zed-industries#348 I added replay to handle queued prompts.
In Tidewave, we ignore user_message_chunks, so I did not experience
the issue when testing. But clients that show the user_message_chunk
like Zed showed the replayed content. This commit ensures that replayed
messages are skipped.
@SteffenDE SteffenDE mentioned this pull request Mar 6, 2026
SteffenDE added a commit to SteffenDE/claude-code-acp that referenced this pull request Mar 6, 2026
Closes zed-industries#381.
Relates to zed-industries#348.

In zed-industries#348 I added replay to handle queued prompts.
In Tidewave, we ignore user_message_chunks, so I did not experience
the issue when testing. But clients that show the user_message_chunk
like Zed showed the replayed content. This commit ensures that replayed
messages are skipped.
benbrandt pushed a commit that referenced this pull request Mar 6, 2026
Closes #381.
Relates to #348.

In #348 I added replay to handle queued prompts.
In Tidewave, we ignore user_message_chunks, so I did not experience the
issue when testing. But clients that show the user_message_chunk like
Zed showed the replayed content. This commit ensures that replayed
messages are skipped.
@SteffenDE SteffenDE deleted the sd-concurrent-prompts branch March 6, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants