fix: catch ValidationError, add stream_add backoff, remove duplicate check - #90
Merged
Conversation
SchemaError is raised when the schema itself is malformed, not when data fails validation against it. The correct exception for failed validation is ValidationError. With SchemaError, actual validation failures propagated as unhandled exceptions. Affected two locations: message_validate() (line 552) and the user messages validation in run() (line 1838). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On ConnectionError or TimeoutError, ret_val stayed at its initial value of 0. The backoff check (ret_val is None) didn't match, so the success log fired incorrectly and the while loop retried immediately with no delay — a tight busy-loop on persistent connection failures. Set ret_val = None in both exception handlers so the existing backoff logic kicks in. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Line 574 checked `not "recipient" in message["payload"]` identically to line 568. The check was already true by that point in the elif chain, so this branch was unreachable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tc-wilson
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three fixes, one per commit:
SchemaError → ValidationError:
message_validate()and user message validation caughtSchemaError(malformed schema) instead ofValidationError(data fails validation). Actual validation failures propagated as unhandled exceptions.stream_add backoff on connection errors: On
ConnectionError/TimeoutError,ret_valstayed at0so theis Nonebackoff check didn't fire. The while loop retried immediately with no delay. Fix: setret_val = Nonein exception handlers so existing backoff logic applies.Duplicate recipient check:
message_for_me()checkednot "recipient" in message["payload"]twice in the elif chain (lines 568 and 574). The second was unreachable.Note: The
message_build_customcall on line 1965 withsender_id="personal-stream-created"is intentional — it prevents the self-sender filter inmessage_for_me()from dropping the personal stream creation message.Closes #89
Test plan
test/run-test.sh— exercises barrier sync, timeout, abort, and wait-for scenarios🤖 Generated with Claude Code