GitHub Issue: Cron job fails to expand ${ENV_VAR} from .env file
Bug Description
When running a cron job without specifying a model, environment variables (e.g., ${HERMES_MODEL}, ${OPENROUTER_FALLBACK_MODEL}) from .env are not expanded. The literal string ${VAR} is passed to the API, causing a 400 error.
Steps to Reproduce
-
Set variables in ~/.hermes/.env:
HERMES_MODEL=some-model
OPENROUTER_FALLBACK_MODEL=some-fallback-model
-
Create a cron job WITHOUT specifying model:
hermes cron create --name "test" --schedule "0 3 * * *" --prompt "test"
-
Run: hermes cron run <job_id>
-
Check logs: ~/.hermes/logs/agent.log
Expected Behavior
${HERMES_MODEL} should expand to some-model, and ${OPENROUTER_FALLBACK_MODEL} to some-fallback-model.
Actual Behavior
Logs show:
Fallback activated: ${HERMES_MODEL} → ${OPENROUTER_FALLBACK_MODEL}
...
Error: '${OPENROUTER_FALLBACK_MODEL}' is not a valid model ID
Root Cause (Speculation)
The .env file uses ${VAR} syntax, but the cron execution path may not apply expansion. The cli.py has "Expand ${ENV_VAR}" logic, but it may not be applied in cron context.
Workaround
Specify model explicitly (but loses flexibility):
hermes cron create ... --model "some-model" --provider "openrouter"
Environment
- Hermes Version: v0.11.0
- OS: Linux
- Python Version: 3.x
Additional Context
Labels
bug, cron, environment-variables
GitHub Issue: Cron job fails to expand ${ENV_VAR} from .env file
Bug Description
When running a cron job without specifying a model, environment variables (e.g.,
${HERMES_MODEL},${OPENROUTER_FALLBACK_MODEL}) from.envare not expanded. The literal string${VAR}is passed to the API, causing a 400 error.Steps to Reproduce
Set variables in
~/.hermes/.env:Create a cron job WITHOUT specifying model:
Run:
hermes cron run <job_id>Check logs:
~/.hermes/logs/agent.logExpected Behavior
${HERMES_MODEL}should expand tosome-model, and${OPENROUTER_FALLBACK_MODEL}tosome-fallback-model.Actual Behavior
Logs show:
Root Cause (Speculation)
The
.envfile uses${VAR}syntax, but the cron execution path may not apply expansion. Thecli.pyhas "Expand ${ENV_VAR}" logic, but it may not be applied in cron context.Workaround
Specify model explicitly (but loses flexibility):
Environment
Additional Context
cronjob,messaging, andclarifytoolsets disabled.envrequired_environment_variablesare not passed through correctly for remote-backed sessions (daytona,docker, etc.) #3433 (environment variable handling in remote sessions)Labels
bug, cron, environment-variables