You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Add Input Validation for Task IDs in TaskManager (#310)
Previously, the `TaskManager` class in
`a2a/server/tasks/task_manager.py` did not perform any validation on the
`task_id` during initialization. This could lead to silent failures or
inconsistencies in task storage if an invalid ID (such as an empty
string) was provided.
### Impact
Adding this validation improves the robustness of the `TaskManager` and
prevents downstream errors in task management, especially for database
or in-memory stores.
### Fix
In `a2a/server/tasks/task_manager.py`, a check has been added to the
`__init__` method of the `TaskManager` to validate the `task_id`. It now
ensures that if a `task_id` is provided, it is a non-empty string. If
the validation fails, a `ValueError` is raised.
A corresponding unit test has been added to
`tests/server/tasks/test_task_manager.py` to verify that the validation
works as expected.
0 commit comments