Skip to content

fix: pre-dispatch save and response task guard - #81

Merged
IceRhymers merged 1 commit into
masterfrom
fix/pre-dispatch-save-and-task-guard
Mar 31, 2026
Merged

fix: pre-dispatch save and response task guard#81
IceRhymers merged 1 commit into
masterfrom
fix/pre-dispatch-save-and-task-guard

Conversation

@IceRhymers

Copy link
Copy Markdown
Owner

Summary

Pre-dispatch save (#79) — Moves save_message for user messages from _run_response_loop to _handle_message, before send_message. This closes the dedup window: is_message_handled() returns True immediately, preventing re-triggers during the agent response.

Response task guard (#80) — Adds an early-return check at the top of _handle_message: if _response_tasks[thread_ts] already exists, the message is silently skipped. Prevents concurrent task overwrites and conflicting DB writes.

Closes #79
Closes #80

Test plan

• 6 new tests in TestPreDispatchSave and TestResponseTaskGuard
• Full suite: 302 passed, 0 failures (baseline was 296)
• Verified RED phase: all 4 fix-specific tests failed before implementation
• Verified GREEN phase: all pass after implementation

🤖 Generated with Claude Code

…tasks

Move save_message for user messages from _run_response_loop to
_handle_message (before send_message) so is_message_handled returns True
immediately, closing the dedup window gap. Add _response_tasks guard at
top of _handle_message to prevent concurrent task overwrites.

Closes #79, closes #80

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@IceRhymers
IceRhymers merged commit cc8f01b into master Mar 31, 2026
1 check passed
@IceRhymers
IceRhymers deleted the fix/pre-dispatch-save-and-task-guard branch April 3, 2026 14:37
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.

Bug: _response_tasks silently overwritten for concurrent thread messages Bug: save_message called after dispatch causes dedup window gap

1 participant