db-connection-pool #1
Loading…
Reference in a new issue
No description provided.
Delete branch "db-connection-pool"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
`GEMINI_MODEL` and `GOOGLE_CLOUD_LOCATION` have been pointing at the previous model in every place that supplies a fallback, so the intended `gemini-3.1-flash-lite` was reached only when those vars happened to be exported in the surrounding shell. Root `.env` is what compose reads, and it set `GOOGLE_CLOUD_LOCATION=us-central1` with no `GEMINI_MODEL` at all, so `${GEMINI_MODEL:-gemini-2.5-flash}` won: a `make up` stack has been grounding on 2.5-flash from a regional endpoint, not 3.1-flash-lite on the global one. `api/.env` had the right values all along, but compose never reads it. Confirmed by resolving `GroundingConfig.from_env()` inside the running container, which reported `gemini-2.5-flash` / `us-central1`. That cost more than the model choice suggests: on 2.5-flash the default thinking budget spends ~2.7k thought tokens and ~9.5s per grounding call, against ~0.7s for 3.1-flash-lite (see the preceding commit for the measurements). README already recorded the same ratio end to end — ~11-16s on 2.5-flash. `deploy/deploy.sh` carried the same two fallbacks, which is the riskier one: it is the Cloud Run path, so a deploy run from a shell without those vars exported would have shipped 2.5-flash to production. `deploy/cloudrun.env` sets both explicitly, so a deploy that sourced it was unaffected. Both vars have to move together — 3.1-flash-lite is served only on Vertex's global endpoint and a regional one 404s — so compose now carries a comment saying so. Root `.env` deliberately gets no comment: `deploy/sync-env.sh` rewrites that file by parsing `KEY=value` lines and discarding everything else, so a comment there would disappear on the next `make up`. The keys survive. `GOOGLE_CLOUD_REGION=us-central1` in `deploy/cloudrun.env{,.example}` is left alone — that is the Cloud Run deploy region, a different axis from the Vertex endpoint, and changing it would move where the service runs. Verified by recreating the container: it now resolves `gemini-3.1-flash-lite` / `global`. The code change in the preceding commit needs an image rebuild to go live; `make up` does both. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>