fix: Validate the wait_for_action_attempt option - #637
Open
razor-x wants to merge 2 commits into
Open
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y1RzepycXEYA3LStfjt8cY
razor-x
changed the base branch from
main
to
claude/python-sdk-audit-o2iid9-03-poll-query
August 28, 2026 00:15
…de/python-sdk-audit-o2iid9-04-wait-option
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.
What
wait_for_action_attemptwas dispatched with anis Trueidentity check, so any truthy non-Truevalue —1,"true"(an env string), a numpy bool — silently fell through to no waiting and no failure raising: the caller got back a pending attempt and believed the door unlocked (SDK audit finding M2). Dict options were equally silent: unknown keys were ignored, so the docstring's ownpoll_intervaltypo polled at the default rate without complaint.This PR makes the option strict, in both sync and async variants:
validate_wait_for_action_attemptraisesSeamInvalidOptionsErrorfor anything that is not aboolor an options dict, for unknown dict keys (naming the key — this makes thepoll_intervaltypo fail loudly), and for non-numeric dict values.Nonenow means "use the default" (wait), matching what per-requestNonealready meant. PreviouslySeam(wait_for_action_attempt=None)silently behaved asFalsewhile per-requestNonemeant "use the client default" — the same annotation with opposite meanings.Noneexplicitly to disable waiting; passFalsefor that.seam.wait_for_action_attemptinstance attribute is now a real property backed bydefaults, on all four clients (Seam,AsyncSeam,SeamWithoutWorkspace,AsyncSeamWithoutWorkspace). It previously did nothing after construction — routes readdefaults, which the attribute never touched. Reading it reflects the live default; assigning it validates and takes effect.SeamWithoutWorkspacealso gains the same publicdefaultsdict the other clients had.'poll_interval'→'polling_interval'typo in ten constructor/factory docstrings (the code always readpolling_interval; the README was already correct).Depends on #636 (stacked; diff shrinks once it merges).
Testing
New
test/wait_for_action_attempt_option_test.py(sync + async): junk values raise at construction, at route call, and at property assignment with pinned messages; unknown dict key and non-numeric value raise naming the problem; constructorNonewaits; the property reflects and updates route behavior.Revert check: with the source reverted, the junk-value test fails with
DID NOT RAISE(the silent-pending audit symptom) and the ctor-Nonetest showsdefaultsholdingNone(behaving asFalse).Full suite: 203 passed; mypy, pylint (10.00), black clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y1RzepycXEYA3LStfjt8cY
Generated by Claude Code