Repository navigation
fix(upgrade): don't exit silently when .env lacks AGENT_SERVER_IMAGE - #549
Merged
Merged
Conversation
….env and improve get_env_var function
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
get_env_varno longer fails on a missing variable — bothscripts/upgrade.shandscripts/install.shnow wrap thegrepin{ … || true; }before thehead | cutpipeline, so an absentVARyields an empty string instead of killingset -euo pipefailscripts at anyX="$(get_env_var …)"assignment. The grouping also swallows the SIGPIPEgrepgets whenhead -1closes the pipe on duplicate keys.- Regression smoke test —
.github/workflows/scripts-pr-ci.yml'supgrade-smokejob seeds a.envwithoutAGENT_SERVER_IMAGE, runs the realupgrade.shforPACA_AGENT_RUNNER=yesandno, and asserts the upgrade succeeds,compose … upruns, the runner flag is preserved, and no baredocker pulloccurs. - Verified meaningful — both variants hit the missing-var read at
scripts/upgrade.sh:383before any Agent Runner branching, so the step fails against the pre-fix script.
I re-ran shellcheck --shell=bash scripts/install.sh scripts/upgrade.sh (a required lint job) and bash -n; both clean, and the workflow YAML parses. I also reproduced the original silent exit and confirmed the fix returns empty and proceeds. Not backfilling AGENT_SERVER_IMAGE is safe: deploy/docker-compose.prod.yml supplies ${AGENT_SERVER_IMAGE:-ghcr.io/paca-ai/paca-agent-server-goose:latest}, so the container still gets a default; only the best-effort pre-pull is skipped and the sandbox pulls lazily on first conversation.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Closed
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.

Summary
upgrade.shcould exit with status 1 and no error message right after the "Proceed with upgrade?" prompt (reported in #546).get_env_varwasgrep … | head -1 | cut …; underset -euo pipefail, agrepmiss makes the whole pipeline fail, so any bareX="$(get_env_var .env SOME_VAR)"assignment silently kills the script whenSOME_VARisn't in.env.The first such read to hit a missing variable is
AGENT_SERVER_IMAGE_AT_START(added with the image-pruning change in 2a89138), which runs immediately after the prompt. Other bare reads (STORAGE_PROVIDER,PACA_AI_AGENT_IMAGE,AGENT_SERVER_IMAGE) had the same exposure.Changes
scripts/upgrade.sh,scripts/install.sh:get_env_varnow prints nothing and succeeds when the variable is absent.install.shhad the same bug: a kept.envwithoutAGENT_SERVER_IMAGEwould die at the pre-pull step, before its existing fallback default could apply..github/workflows/scripts-pr-ci.yml: newupgrade-smokestep that upgrades a v0.18.0-style.envwith noAGENT_SERVER_IMAGE, with Agent Runner both enabled and disabled (install.shlets users opt out). It asserts the upgrade succeeds, the stack is brought up, and no image is invented or pulled.Verification
bash -npasses on both scripts; the workflow YAML parses.shellcheck(not installed) and the rest of theupgrade-smokejob; CI covers these.Note on the root cause
The mechanism is reproduced on a synthetic
.env, but I haven't seen the reporter's actual.env. A fresh v0.18.0install.shdoes writeAGENT_SERVER_IMAGE, so the reporter's file presumably lacks it for another reason (hand-edited, manually created, kept from an older setup). Asking them forgrep -c '^AGENT_SERVER_IMAGE=' .envandbash -x upgrade.shoutput would confirm. The change is safe regardless, since it only affects variables that are allowed to be absent.Refs #546