Pre-flight validation for `agents-cli deploy` (e.g. detect lockfiles pinned to package indexes unreachable from the remote build)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 6k
- Forks
- 686
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de google/agents-cli
-
documentation needs review
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
google/agents-cli#86 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
google/agents-cli#94 ·
-
needs review
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
google/agents-cli#92 · 2 comentarios ·
-
When an extension is applied, there is a warning emitted for EVERY commandPosiblemente ocupada @asrujana-44 la tomó hace 12 días. Abierto
google/agents-cli#91 · 1 comentario · 1 asignado ·
-
scaffold: dependency reconciliation is silent — no diff shown, unlike enhance/upgradePosiblemente ocupada @asrujana-44 la tomó hace 6 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
google/agents-cli#85 · 1 comentario · 1 asignado ·
Todos los issues de google/agents-cli
Issues similares
-
needs-human needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
gke-labs/kube-agents#2400 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Device Details tables: FS/SF columns contradict each other (nfet_01v8 Vt row, pfet_01v8 Idsat row)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
google/skywater-pdk#450 ·
-
Drained trajectory arrays are overwritten when the sequence buffer is reusedPosiblemente ocupada @sylvesterkaczmarek la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google-deepmind/bsuite#56 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
LearningCircuit/local-deep-research#7206 ·
Los mantenedores suelen responder en 1 día
-
[TASK] Document technology stackAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
chingu-voyages/V62-tier3-team-33#285 ·
Los mantenedores suelen responder en 1 día