Skip to content

fix(workflow): reject bare strings and non-sequences in RetryConfig.exceptions - #8527

Open
nizamudheenti wants to merge 1 commit into
google:mainfrom
nizamudheenti:fix/workflow-retry-config-exceptions-validation
Open

nizamudheenti wants to merge 1 commit into
google:mainfrom
nizamudheenti:fix/workflow-retry-config-exceptions-validation

Conversation

@nizamudheenti

Copy link
Copy Markdown

Fixes #8526

Summary

  • Guard RetryConfig._normalize_exceptions (src/google/adk/workflow/_retry_config.py) against bare str/bytes/bytearray and non-Sequence inputs by raising WorkflowConfigurationError (which Pydantic surfaces as a ValidationError).
  • Prevents RetryConfig(exceptions="ValueError") from silently splitting into ['V', 'a', 'l', 'u', 'e', 'E', 'r', 'r', 'o', 'r'] and prevents non-iterable inputs like RetryConfig(exceptions=ValueError) from raising a raw TypeError.

Testing Plan

  • Added parametrized unit tests in tests/unittests/workflow/utils/test_retry_utils.py covering str, bytes, single exception class, int, and dict inputs.
  • Verified all 5 new cases failed before the fix and pass after:
    • pytest tests/unittests/workflow/utils/test_retry_utils.py -q → 36 passed
    • ruff check src/google/adk/workflow/_retry_config.py tests/unittests/workflow/utils/test_retry_utils.py → All checks passed

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.

workflow: RetryConfig(exceptions='ValueError') silently splits string into characters instead of raising validation error

1 participant