fix: serve runtime-config.json dynamically instead of writing to package directory#4600
fix: serve runtime-config.json dynamically instead of writing to package directory#4600meadsteve wants to merge 1 commit intogoogle:mainfrom
Conversation
…age directory The dev UI frontend fetches runtime-config.json to discover the backendUrl (url_prefix). Previously this was written to the installed package directory at startup, which fails silently in read-only environments (e.g. containerized deployments with a read-only .venv). The frontend then falls back to the default empty backendUrl, causing 404s for all API calls when url_prefix is set. Replace the filesystem read/write with a pure builder method and serve the config via a dynamic GET endpoint that takes priority over the static mount. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @meadsteve, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Hello @meadsteve, thank you for your contribution! Before we can review this PR, please sign the Contributor License Agreement (CLA). Also, could you please create a GitHub issue for this bug fix and link it to this PR? Finally, for bug fixes, could you please provide logs or a screenshot demonstrating the fix? This information is required for us to proceed with the review. You can find more details in our contribution guidelines: https://github.com/google/adk-python/blob/main/CONTRIBUTING.md Response from ADK Triaging Agent |
There was a problem hiding this comment.
Code Review
The pull request successfully addresses the issue of serving runtime-config.json dynamically, which is a significant improvement for containerized environments where the package directory might be read-only. The implementation replaces filesystem operations with a dynamic FastAPI endpoint and includes thorough unit and integration tests. The code is clean and follows the existing patterns in the repository.
| ) | ||
| if web_assets_dir: | ||
| self._setup_runtime_config(web_assets_dir) | ||
| self._build_runtime_config() |
There was a problem hiding this comment.
The call to _build_runtime_config() here is used for validation at startup, but its return value is ignored. While this correctly triggers a ValueError if the logo configuration is invalid, it might be confusing to other developers. Consider adding a brief comment to clarify that this call is for validation purposes.
|
@adk-bot I've done what you've asked. How do I rerun the checks? |
Fixes #4601
Summary
The dev UI frontend fetches
runtime-config.jsonto discover thebackendUrl(url_prefix). Previously,_setup_runtime_configwrote this file into the installed package directory (src/google/adk/cli/browser/assets/config/runtime-config.json) at startup. In containerized environments where.venvis read-only, this write fails silently (theIOErroris caught and logged). The frontend then loads the static default{"backendUrl": ""}and makes API calls without theurl_prefix, causing 404s.This PR replaces the filesystem read/write with:
_build_runtime_config()method that builds and returns the config dictGET /dev-ui/assets/config/runtime-config.jsonendpoint registered before the static mount so it takes priorityTest plan
pytest tests/unittests/cli/test_adk_web_server_run_live.py— 14 passed)_build_runtime_config(default, with prefix, with logo, ValueError on partial logo config)GET /dev-ui/assets/config/runtime-config.jsonreturns correct JSON viaTestClientadk web --url_prefix /fooand verify/dev-ui/assets/config/runtime-config.jsonreturns{"backendUrl": "/foo"}🤖 Generated with Claude Code