Skip to content

Fix #2623: Validate task decorator timeout values#2709

Open
1150654748m-dev wants to merge 1 commit into
orchestration-agent:mainfrom
1150654748m-dev:fix-2623-task-timeout
Open

Fix #2623: Validate task decorator timeout values#2709
1150654748m-dev wants to merge 1 commit into
orchestration-agent:mainfrom
1150654748m-dev:fix-2623-task-timeout

Conversation

@1150654748m-dev
Copy link
Copy Markdown

Summary

This PR fixes issue #2623 by adding validation to the @task decorator to ensure timeout values are positive numbers.

Problem

The task() decorator accepted any value for the timeout parameter, including zero, negative numbers, and non-numeric types. This caused asyncio.wait_for() to fail immediately or behave unexpectedly when the decorated function was called.

Solution

Added validation at decorator creation time:

  • Raises TypeError if timeout is not a number (int or float)
  • Raises ValueError if timeout is zero or negative

Changes

  • Modified src/sdk/decorators.py: Added validation logic to task() decorator
  • Added tests/test_sdk_decorators.py: Comprehensive regression tests

Verification

All tests pass:

pytest tests/test_sdk_decorators.py -v
# 10 passed in 0.03s

Checklist

/bounty 000

- Add validation to ensure timeout is a positive number
- Raise TypeError for non-numeric timeout values
- Raise ValueError for zero or negative timeout values
- Add comprehensive regression tests

Fixes orchestration-agent#2623
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.

[ Bounty $6k ] [ SDK ] Validate task decorator timeout values — decorator guardrails

1 participant