Skip to content

Conversation

@florian-trehaut
Copy link

@florian-trehaut florian-trehaut commented Dec 6, 2025

Closes #44211

Summary

Workaround for API error 400 (tool_use ids must be unique) when sending a message while a tool awaits confirmation (e.g., ExitPlanMode in plan mode).

The root cause is not yet identified and requires further investigation. This fix prevents the problematic scenario at the UI level.

Changes

  • thread_view.rs:
    • Add has_tool_awaiting_confirmation() helper method
    • Block send() when a tool awaits confirmation
    • Disable send button visually with informative tooltip ("Respond to Tool Confirmation First")

Behavior

Users must click Accept/Reject on tool confirmations before sending new messages. This prevents users from losing their Claude session and conversation context.

Testing

Added test test_message_doesnt_send_if_tool_awaiting_confirmation.

Release Notes:

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 6, 2025
@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Dec 6, 2025
@florian-trehaut florian-trehaut marked this pull request as draft December 6, 2025 14:37
@florian-trehaut florian-trehaut force-pushed the fix/duplicate-tool-use-ids-44211 branch from adef40e to 2fac8c9 Compare December 6, 2025 17:53
@florian-trehaut florian-trehaut changed the title Fix duplicate tool_use IDs causing API error 400 fix(agent_ui): disable send when tool awaits confirmation Dec 6, 2025
@florian-trehaut florian-trehaut changed the title fix(agent_ui): disable send when tool awaits confirmation fix(agent_ui): Disable send when tool awaits confirmation Dec 6, 2025
@florian-trehaut florian-trehaut force-pushed the fix/duplicate-tool-use-ids-44211 branch from 2fac8c9 to 76de27c Compare December 6, 2025 18:00
…ries#44211)

Workaround for API error 400 (duplicate tool_use IDs) when sending a
message while a tool awaits confirmation.

The root cause is not yet identified and requires further investigation.
This fix prevents the problematic scenario at the UI level by blocking
message sending when a tool awaits confirmation.

Changes:
- Add has_tool_awaiting_confirmation() helper method
- Block send() when a tool awaits confirmation
- Disable send button visually with informative tooltip

Users must click Accept/Reject on tool confirmations before sending
new messages.

Fixes zed-industries#44211
@florian-trehaut florian-trehaut force-pushed the fix/duplicate-tool-use-ids-44211 branch from 76de27c to 15c2044 Compare December 6, 2025 18:02
@florian-trehaut florian-trehaut marked this pull request as ready for review December 6, 2025 18:03
@maxdeviant maxdeviant changed the title fix(agent_ui): Disable send when tool awaits confirmation agent_ui: Disable send when tool awaits confirmation Dec 6, 2025
@maxdeviant maxdeviant changed the title agent_ui: Disable send when tool awaits confirmation agent_ui: Disable send when tool is awaiting confirmation Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude Agent: API Error 400 - Duplicate tool_use IDs in messages

3 participants