Skip to content

fix: avoid ApiServer scope shadowing in web reload#5769

Open
he-yufeng wants to merge 2 commits into
google:mainfrom
he-yufeng:fix/web-reload-agents-api-server-scope
Open

fix: avoid ApiServer scope shadowing in web reload#5769
he-yufeng wants to merge 2 commits into
google:mainfrom
he-yufeng:fix/web-reload-agents-api-server-scope

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • remove redundant function-local ApiServer imports in get_fast_api_app
  • add a regression test for web=True plus reload_agents=True while DevServer is available

Fixes #5765

To verify

  • .\.venv\Scripts\python.exe -m py_compile src\google\adk\cli\fast_api.py tests\unittests\cli\test_fast_api.py
  • .\.venv\Scripts\python.exe -m pytest tests/unittests/cli/test_fast_api.py::test_web_reload_agents_uses_module_api_server_import -q -p no:cacheprovider
  • uv run --extra dev pyink --check src\google\adk\cli\fast_api.py tests\unittests\cli\test_fast_api.py
  • git diff --check

Notes

  • uv run --extra test ... currently cannot resolve the locked test environment on Windows because yarl==1.24.1 has no win_amd64 wheel or source distribution.

@adk-bot adk-bot added the web [Component] This issue will be transferred to adk-web label May 20, 2026
@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented May 20, 2026

Response from ADK Triaging Agent

Hello @he-yufeng, thank you for creating this PR!

This PR looks great and addresses issue #5765! To fully follow our contribution guidelines, could you please:

  • Provide the logs or a screenshot of the passed test/verification output (e.g., the pytest output for the regression test you added).

This will help reviewers understand and approve your changes much faster. Thank you!

@rohityan rohityan self-assigned this May 20, 2026
@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label May 20, 2026
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @he-yufeng , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

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

Labels

request clarification [Status] The maintainer need clarification or more information from the author web [Component] This issue will be transferred to adk-web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnboundLocalError on ApiServer in cli/fast_api.py when running adk web --reload_agents on 2.0.0

3 participants