Skip to content

fix(sse): add lock to prevent race in tool confirmation flow - #809

Closed
CodeLine9 wants to merge 1 commit into
amd:mainfrom
CodeLine9:clawoss/fix/sse-confirm-race
Closed

CodeLine9 wants to merge 1 commit into
amd:mainfrom
CodeLine9:clawoss/fix/sse-confirm-race

Conversation

@CodeLine9

Copy link
Copy Markdown
Contributor

Bug

confirm_tool_execution resets _confirm_event and _confirm_result on entry. If resolve_tool_confirmation runs concurrently between those two resets, the early approval is clobbered and the confirmation is lost.

Fix

Add a threading.Lock (_confirm_lock) to serialize the critical sections in both confirm_tool_execution (the reset) and resolve_tool_confirmation (the set). This prevents the race window where an approval could be discarded.

Closes #792

@CodeLine9

Copy link
Copy Markdown
Contributor Author

Closing — won't have bandwidth to address feedback on this. Apologies for the noise.

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.

SSE handler: race in confirm_tool_execution can drop an early approval

1 participant