Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Tool Consistency on Stop #155

Closed

Conversation

demeisen-avatar
Copy link

Fix Tool Consistency on Stop

This PR ensures tool execution remains consistent when stopping AI execution, preventing orphaned tool_use blocks.

Changes

  • Add tools_disabled flag to session state
  • Disable tools when stop button is pressed
  • Re-enable tools on new user message
  • Prevent new tool operations after stop
  • Maintain message consistency during stop

Benefits

  • Ensures tool_use blocks always have matching tool_result blocks
  • Provides clean shutdown of tool operations
  • Prevents state corruption during stops
  • Maintains conversation integrity

Testing

  • Tested stopping during tool execution
  • Verified tool state consistency after stops
  • Confirmed tools re-enable on new messages
  • Validated conversation state remains clean

Fixes #121

- Add tools_disabled flag to session state
- Disable tools when stop button is pressed
- Re-enable tools on new user message
- Prevent new tool operations after stop
- Maintain message consistency during stop

This change ensures tool_use blocks always have matching
tool_result blocks, even when execution is stopped.

Fixes anthropics#121
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.

computer-use-demo: STOP button hangs or crashes conversation
1 participant