fix(compose): use HINDSIGHT_API_LLM_API_KEY env var - #3398
Conversation
handnewb
left a comment
There was a problem hiding this comment.
LGTM! Clean fix — 9 compose files all reference the wrong env var (OPENAI_API_KEY → HINDSIGHT_API_LLM_API_KEY). Each file changes exactly 1 line, well-documented rationale. Variant B preserves the fail-fast behavior with corrected variable name. Thanks for catching this!
nicoloboschi
left a comment
There was a problem hiding this comment.
did you verify each readme to not contain outdated run example?
The compose files no longer read OPENAI_API_KEY, so every doc telling users to export it was left describing a variable nothing reads. - custom-models/README.md + compose header: export the correct var - timescale/README.md quick start, prereq and env-var table - timescale/.env.example: compose's project directory is the compose file's own directory, so this file IS auto-loaded - naming the wrong var here silently dropped the key on the documented happy path
nicoloboschi
left a comment
There was a problem hiding this comment.
Verified — the compose fix is correct, but it left the surrounding docs describing a variable nothing reads anymore. I've pushed a follow-up commit updating them:
custom-models/README.mdquick start + the compose file's own header commenttimescale/README.mdprerequisite, quick start and env-var tabletimescale/.env.example— the important one: compose's project directory defaults to the compose file's own directory, so this file is auto-loaded. Naming the wrong var there silently dropped the key on the documented happy path. Also collapsed theANTHROPIC_API_KEY/GEMINI_API_KEY/GROQ_API_KEYalternatives, which were never read either — the provider switch isHINDSIGHT_API_LLM_PROVIDERplus the oneHINDSIGHT_API_LLM_API_KEY.
The other 7 stacks have no README or .env.example, so there was nothing to update there.
I also ran the test plan from the description, which was still unchecked — all four now verified via docker compose config:
- key set in the environment → resolves to the real value (Variant A and B)
.env.examplecopied to.envintimescale/→ picked up correctly- key unset → Variant B fails fast with the corrected message
- key empty → Variant B also fails fast, because
?became:?
Two notes on the description rather than the code:
- The checklist says "No other compose files reference
HINDSIGHT_API_LLM_API_KEYorOPENAI_API_KEY" —nginx/docker-compose.yml:35does (${OPENAI_API_KEY:-not-needed-for-mock}, plus commented variants at :40/:44). Leaving it alone is right since it's the mock-provider stack, same rationale aslocal-llm— it just shouldn't be described as absent. - "Behavior unchanged" is slightly generous in both variants: Variant A's default moves from
your-api-keyto empty, and?→:?now also rejects an empty value. Both are improvements — worth stating as such rather than as no-ops.
Good catch on the underlying bug.
Summary
The
HINDSIGHT_API_LLM_API_KEYenvironment variable in everydocker/docker-compose/*/docker-compose.yamlreferences the wrong source variable on the right-hand side of the${...}substitution. SettingHINDSIGHT_API_LLM_API_KEY=...in.envis silently ignored — the variable resolves toOPENAI_API_KEYinstead.Two variants of the bug exist:
Variant A — 7 files, dict form (wrong var +
your-api-keydefault that fails auth at firstretain):alloydb/docker-compose.yaml:68pg_search/docker-compose.yaml:75custom-models/docker-compose.yaml:28pg_textsearch/docker-compose.yaml:71timescale/docker-compose.yaml:83pgroonga/docker-compose.yaml:71vchord/docker-compose.yaml:73Variant B — 2 files, list form (wrong var +
${VAR?msg}fail-fast, but pointed at the wrong var):external-pg/docker-compose.yaml:42s3-file-storage/docker-compose.yaml:62local-llm/docker-compose.yamlusesHINDSIGHT_API_LLM_API_KEY: not-needed(literal) and is intentionally untouched.Memory is a funny thing. I found this docker container running and didn't know what is was. Tried to use it. Wasn't working. Envs where there but no dice. LLM_BASE_URL wasn't in my docker inspect. So i did a little dance and we're good now but just in case.
Noticed but out of scope
While debugging this, I noticed
HINDSIGHT_API_LLM_BASE_URLisn't exposed as an env var in any compose file — it's only set as a literal inlocal-llm/docker-compose.yaml. Users pointing at a non-OpenAI provider (Ollama, LM Studio, etc.) currently have to edit the compose file by hand. Worth a separate PR.The bug
Two issues on one line:
OPENAI_API_KEY, notHINDSIGHT_API_LLM_API_KEY. Anyone following the README and settingHINDSIGHT_API_LLM_API_KEY=...gets nothing — the value is ignored.your-api-keyis a string the API will reject, but the container starts cleanly. Failure happens later on firstretain, far from the misconfiguration. There is no log line flaggingyour-api-keyas a placeholder.Variant B uses
${OPENAI_API_KEY?Please set the OPENAI_API_KEY env variable}, which is better — it errors at startup with a message — but still points at the wrong variable, so the message misleads users about what to set.The fix
Variant A:
Variant B (preserves the fail-fast behavior, just points it at the right var):
Why this works
${VAR:-}expands to the empty string whenVARis unset — same default behavior as before, but now reads from the correct variable. Users who setHINDSIGHT_API_LLM_API_KEYwill see it take effect; users who don't will get an auth failure on firstretain(unchanged) or a clear startup error in the Variant B files (unchanged, just with the right variable name).Testing
docker compose configon each affected file and confirmed the resolved value matches expectationsChecklist
local-llm/docker-compose.yamlleft untouched (uses literal value)HINDSIGHT_API_LLM_API_KEYorOPENAI_API_KEY(verified via grep)`