Skip to content

Conversation

@AhrendsW
Copy link

@AhrendsW AhrendsW commented Feb 7, 2026

Summary

  • Fixes Error adk_web_server.py:1431 - Error in event_generator: Failed to parse the parameter file_patterns: List[str] | None = None of function cleanup_unused_files #3591 — The function parameter parser did not recognize types.UnionType (created by Python 3.10+ pipe syntax like list[str] | None), only typing.Union. This caused a ValueError and fallback to Pydantic, which didn't always work (e.g., in the web builder).
  • Adds types.UnionType checks in three conditions within _parse_schema_from_parameter() in _function_parameter_parse_util.py:
    1. Simple union handler (get_origin check)
    2. Outer isinstance guard for the GenericAlias block
    3. Inner union check inside the GenericAlias block
  • Adds 8 new tests covering pipe union variants (optional list/dict, defaults, simple primitives, complex multi-type, GEMINI_API fallback, and typing.Union regression)

Test plan

  • All 43 tests in test_build_function_declaration.py pass
  • Full unittest suite passes (4017 passed, 0 failures)
  • pyink and isort formatting verified via autoformat.sh
  • Lint checks pass (pyink --check reports no changes needed)
  • No merge conflicts with main

… parser

The parser only recognized `typing.Union` but not `types.UnionType`
(created by Python 3.10+ pipe syntax like `list[str] | None`), causing
a ValueError fallback. This adds `types.UnionType` checks in three
conditions within `_parse_schema_from_parameter()`.

Fixes google#3591
@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Feb 7, 2026
@wuliang229 wuliang229 self-assigned this Feb 10, 2026
@ryanaiagent ryanaiagent added core [Component] This issue is related to the core interface and implementation needs review [Status] The PR/issue is awaiting review from the maintainer and removed tools [Component] This issue is related to tools labels Feb 10, 2026
@ryanaiagent
Copy link
Collaborator

Hi @AhrendsW , Thank you for your contribution! We appreciate you taking the time to submit this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation needs review [Status] The PR/issue is awaiting review from the maintainer

Projects

None yet

4 participants