Repository navigation
fix(cli): serve dev UI behind prefix-stripping proxies - #7440
Open
reddynitish wants to merge 1 commit into
Open
reddynitish wants to merge 1 commit into
reddynitish wants to merge 1 commit into
Conversation
Restore a missing application root only for static-file lookup while preserving FastAPI root_path and Swagger URLs. Fixes google#7439
|
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. |
reddynitish
marked this pull request as ready for review
October 7, 2026 15:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue
Closes #7439.
Problem and Solution
With
url_prefix=/adk, a proxy that forwards/adk/dev-ui/as/dev-ui/causes ADK 2.11 to return 404. Starlette's static mount includes/adkin its childroot_path, but the incomingpathlacks it, so the static lookup retainsdev-ui/inside the asset directory.Use a private
StaticFilessubclass that restores a missing application root in a copied scope for file-path lookup. Keep FastAPI'sroot_path, Swagger URLs, runtime configuration, and other routes unchanged. Already-prefixed paths are recognized at a path boundary.Testing Plan
Regression observed before the fix: three stripped-prefix cases failed with 404; retained-prefix and outer-mount cases passed.
Final API-server module: 229 passed, 5 skipped, 1 xfailed.
Seven regression configurations cover no prefix, stripped/retained prefixes, an outer mount, a nested prefix,
/devversus/dev-ui, and an absolute backend URL. Checks include HTML, a static asset, missing-file 404, runtime config,/list-apps, Swagger, and OpenAPI.All applicable pre-commit checks passed.
File-level mypy diagnostics match the base revision exactly: 49 existing errors, no new errors.
Full unit suites executed through tox on Python 3.11–3.14:
Baseline failures: The five failures in every version are GKE code-executor tests rejecting a mocked
uidas a string. Python 3.13 and 3.14 also fail theagentandrunnerentry-point package allowlist tests. Each failing test was rerun against the unmodified base source in the same corresponding tox environment and reproduced. The full suites are therefore not green; this draft does not claim otherwise. The changed API-server module and new regression cases passed in every version.Ran the initial full tox invocation through completion of py311, then stopped its redundant py312 rerun; py312/py313/py314 completed in a separate
tox -e py312,py313,py314 -p autoinvocation.Manual E2E: Started
adk web --host 127.0.0.1 --port 8765 --url_prefix /adkwith a minimal agent. Put an HTTP proxy on port 8766 that forwards/adk/*to the server after stripping/adk. Opened/adk/dev-ui/in a browser and verified the UI renders with the agent selected. No model credentials or inference calls are required to reproduce this routing bug.Swagger still references
/adk/openapi.json, and runtime config still reports/adkas the backend URL.Checklist
Codex-assisted contribution. CLA status remains subject to the repository's check; no agreement was signed by the coding assistant.