Pre-flight validation for `agents-cli deploy` (e.g. detect lockfiles pinned to package indexes unreachable from the remote build)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by tracing the agents-cli deploy command and its existing check for an ignored Dockerfile; the issue does not name that command's file or tests. Compare dev/cmd_install.py and scaffold/utils/generate_locks.py to understand how install and scaffold handle lockfiles and index configuration. Define the pre-flight checks and their error-versus-warning behavior before implementing; done means deploy reports actionable findings before upload, with skip and dry-run behavior as described.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is your feature suggestion?
Add a fast, offline pre-flight validation step to agents-cli deploy that runs before source is uploaded for a remote build (Agent Runtime, Cloud Run source builds, GKE via Cloud Build). It catches configuration problems that are certain to make the remote build fail, and reports each one with an actionable fix.
Headline check: lockfile references a package index the remote builder can't reach.
Many enterprises configure Python package managers machine-wide (for example a system-level uv.toml or pip.conf) to resolve packages through an internal mirror or security proxy. uv records the index URL of every package in uv.lock. The scaffolded Dockerfile runs uv sync --frozen, which downloads from exactly those URLs. The managed build environment has no route to the internal mirror, so the build fails.
The CLI currently surfaces only:
❌ Error: Deployment failed: {'code': 3, 'message': 'Build failed. The issue might be caused by
incorrect code, requirements.txt file or other dependencies. ...'}
The real cause (Failed to download <package> ... Connection refused) is only visible by querying Cloud Logging for the reasoning_engine_build log, which most users won't know exists. Because the failure doesn't depend on the code, it reproduces with an unmodified scaffolded template, in every region.
Proposed behavior:
❌ Pre-flight: uv.lock pins 175 packages to a package index that remote builds may not be able to reach:
http://<internal-mirror-host>/simple/
This usually comes from a machine-wide package manager config (e.g. a system uv.toml).
Fix (any one):
• Re-lock against the public index: uv lock --no-config --default-index https://pypi.org/simple
• Pin the public index in pyproject.toml so future locks stay deployable:
[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple"
default = true
Skip with --skip-preflight if this index is reachable from your build environment.
Other checks that fit the same step (all offline, all cases where the remote build is certain to fail or the deployed agent to break):
- Lockfile missing or out of sync with
pyproject.toml.uv sync --frozenfails without a lockfile, and with a stale one it silently installs an outdated set of dependencies. - Build inputs excluded from the upload. Files the
DockerfileCOPYs (e.g.uv.lock,README.md, the agent directory) are matched by.gcloudignore/.gitignore, or local path dependencies (path = "../shared-lib") live outside the upload. This generalises the existing check that theDockerfileisn't ignored. - Python version mismatch. The
Dockerfilebase image's Python version (e.g.FROM python:3.12-slim) doesn't satisfyrequires-pythoninpyproject.toml.
Suggested controls: errors block the deploy; warnings don't (e.g. a private index that may be legitimately reachable); --skip-preflight bypasses the checks; --dry-run runs them, reports the results, and exits non-zero if any error is found, so it can gate CI or a coding agent's deploy step.
Related inconsistency: agents-cli install undoes the scaffold's public lockfile. The scaffold deliberately generates uv.lock against the public index (scaffold/utils/generate_locks.py runs uv lock --no-config --default-index https://pypi.org/simple, "to ensure consistent lock files"). agents-cli install (dev/cmd_install.py) then runs plain uv sync, which honours the machine-wide config. On a workstation with a mirror configured, that re-resolves the lock against the mirror and turns a deployable template into one that can't be deployed. Suggestion: agents-cli install (and anything else agents-cli runs to lock or sync) should follow the same index policy as the scaffold without overriding an index the project pins itself. Where forcing the public index isn't appropriate (some networks only allow the mirror), it should at least warn when the resulting lock references a non-public index.
What will this enable you to do?
- Fail in about a second, locally, instead of waiting for a remote build to fail (about a minute per attempt in our case, longer for larger dependency sets), with a message naming the cause and the fix, instead of a generic "Build failed" that sends people searching through Cloud Logging.
- Deploy reliably from enterprise-managed workstations. Machine-wide package mirrors are common in regulated and security-conscious organisations. Today these users hit an opaque failure even with an unmodified template, and the usual workarounds (dropping the lockfile, removing
--frozen) give up reproducible builds. - Help coding agents too. Agents driving
agents-cli deployget a clear, machine-readable failure they can fix themselves, instead of guessing at dependencies, regions or permissions. - Keep the CLI consistent. It already catches one problem of this kind before uploading (a
Dockerfileexcluded by ignore rules "instead of failing opaquely in Agent Engine"). A small pre-flight framework would let more of these checks be added the same way.
Additional context
Related issues:
- #17, #36, #42: three different root causes (missing lockfile, Python version mismatch, dependency that wouldn't resolve), all showing up as the same opaque
code: 3 Build failed. Pre-flight checks and showing the build log would have saved time in each. - #48: deployment-readiness contract. This proposal could be one concrete piece of it.
Reproduction (no internal infrastructure needed):
agents-cli scaffold create demo --agent adk --deployment-target agent_runtime --prototype, thenagents-cli install.- Simulate a lock produced behind a machine-wide mirror by pointing its URLs at a host the remote builder can't reach:
In real life a machine-widesed -i.bak -e 's#https://pypi.org/simple#http://10.0.0.1:3141/simple#' \ -e 's#https://files.pythonhosted.org#http://10.0.0.1:3141#g' uv.lockuv.tomlpointing at an internal mirror produces the same kind of lock with plainuv lock. agents-cli deploy→Build failed(code 3) after the remote build starts.- The real error is only in Cloud Logging, under
logName=".../logs/aiplatform.googleapis.com%2Freasoning_engine_build":RUN uv sync --frozen × Failed to download `attrs==26.1.0` ├─▶ Failed to fetch: `http://<internal-mirror-host>/.../attrs-26.1.0-py3-none-any.whl` ╰─▶ Connection refused - Re-locking against the public index (
uv lock --no-config --default-index https://pypi.org/simple) gives an identical set of package versions (only the URLs change) and the deploy succeeds.
Observations:
gcloud builds listin the user's project shows nothing, because the build runs in a Google-managed project. The forwarded log underaiplatform.googleapis.com/reasoning_engine_buildis the only place the cause appears. A related improvement would be foragents-cli deployto print the tail of that log when the operation fails withBuild failed.- Verified with uv 0.12: adding
[[tool.uv.index]] … default = truetopyproject.tomloverrides a machine-wide index foruv lock/uv add. A project-leveluv.tomlwithdefault-index = …is rejected as an unknown field.
Environment: agents-cli 1.8.0, google-adk 2.10.0, uv 0.12.x, macOS (managed workstation), deployment target agent_runtime (reproduced in us-west1 and us-central1).
I'm happy to contribute an implementation if the approach is acceptable.
- Ngôn ngữ chính
- Python
- Star
- 6k
- Fork
- 686
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/agents-cli
-
documentation needs review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
google/agents-cli#86 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
google/agents-cli#94 · 1 người được giao ·
-
needs review
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
google/agents-cli#92 · 2 bình luận ·
-
When an extension is applied, there is a warning emitted for EVERY commandCó thể đã có người làm @asrujana-44 đã nhận 13 ngày trước. Đang mở
google/agents-cli#91 · 1 bình luận · 1 người được giao ·
-
scaffold: dependency reconciliation is silent — no diff shown, unlike enhance/upgradeCó thể đã có người làm @asrujana-44 đã nhận 7 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
google/agents-cli#85 · 1 bình luận · 1 người được giao ·
Tất cả issue của google/agents-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
fabriziosalmi/certmate#1207 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[work-item] adam-adae-onset-emergence: document the minute-precision datetime coercion (ASTTMF not derivable)Có thể đã có người làm @muse-yamaa-bot đã nhận hôm nay. Đang mởwork-item
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
CommunityToolkit/Aspire#2231 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
volcengine/OpenViking#5711 ·
Maintainer thường phản hồi trong vòng 1 ngày