fix(sdk): validate task retry counts and timeout in decorator guardrails#4117
Open
UGVicV wants to merge 15 commits into
Open
fix(sdk): validate task retry counts and timeout in decorator guardrails#4117UGVicV wants to merge 15 commits into
UGVicV wants to merge 15 commits into
Conversation
added 15 commits
May 22, 2026 11:55
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.
Description
This PR resolves the issue where the
@taskdecorator silently accepted negative retry counts and invalid timeout values, storing them in__task_config__without validation. Schedulers could skip or repeat work based on invalid metadata.Fix
retries: rejects non-integer types (including bool) withTypeError.retries: rejects negative values withValueError("retries must be non-negative").timeout: rejects non-integer types (including bool) withTypeError.timeout: rejects zero and negative values withValueError("timeout must be a positive integer").logger.error()for robust error logging.Any,Dict).Verification (Proof)
Created new regression test file
tests/test_sdk_decorators.pywith 8 test cases:test_valid_retries: Valid retries=3 stored correctly.test_valid_zero_retries: Zero retries accepted.test_negative_retries: Negative retries raisesValueError.test_non_int_retries: String retries raisesTypeError.test_bool_retries: Boolean retries raisesTypeError.test_negative_timeout: Negative timeout raisesValueError.test_zero_timeout: Zero timeout raisesValueError.test_non_int_timeout: String timeout raisesTypeError.Test Execution Output
Lint & Formatting Output
flake8 src/sdk/decorators.py tests/test_sdk_decorators.py-> Passed (0 errors/warnings)git diff --check-> Passed (0 errors)No secrets, tokens, or hidden context are included in the code.
Closes #2324.