[nu-demo] hero_agent reads OPENROUTER_API_KEYS (plural) — no fallback to singular #136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Symptom
hero_agent chat fails with:
even though
OPENROUTER_API_KEYis set in the env (the Hero-wide convention).Root cause
hero_agent/crates/hero_agent/src/config.rs:85:reads only
OPENROUTER_API_KEYS(plural, comma-separated). It does NOT tryOPENROUTER_API_KEY(singular) as a fallback. The aibroker secret store and every other place in the hero stack uses the singular form, so operators naturally set only the singular and hero_agent gets no keys at all.Demo workaround (applied 2026-04-23)
Patched the hero_agent action env to set BOTH
OPENROUTER_API_KEYandOPENROUTER_API_KEYSto the same value.Proper fix
In
config.rs, the key lookup should accept a fallback chain like["OPENROUTER_API_KEYS", "OPENROUTER_API_KEY"], split the result on comma, and use whichever is present. Extendenv_csv(or addenv_csv_with_fallback) to support this. Apply the same pattern for any other provider env var hero_agent reads.Filed 2026-04-23 nu-shell demo bring-up. Signed-off-by: mik-tf
make demotarget — provision + install + seed + verify a fresh Hero OS demo VM in one command #163Fixed in hero_agent commit
cec24b4ondevelopment.Change at
crates/hero_agent/src/config.rs:84:Root cause was simple: both args to
env_csv(primary, fallback)were the same string"OPENROUTER_API_KEYS", so the fallback was a no-op duplicate. Operators who only exported the canonical OpenRouter SDK env var nameOPENROUTER_API_KEYended up withopenrouter_keys = []and chat failing 401 even though the key was present.Resolution table:
OPENROUTER_API_KEYSOPENROUTER_API_KEYAligns with
service_agent.nu:76which already forwards the singular env var under the plural action-env name — so after this fix hero_agent works with either name on the operator side.Verification:
cargo fmt --check -p hero_agentclean;cargo check -p hero_agentpasses.Meta-tracker: home#193.
Signed-off-by: mik-tf
make demotarget — provision + install + seed + verify a fresh Hero OS demo VM in one command #31