Skip to content

fix(cron): drop stale env-var override of persisted provider - #15769

Closed
dpaluy wants to merge 1 commit into
NousResearch:mainfrom
dpaluy:fix/cron-stale-provider-env
Closed

fix(cron): drop stale env-var override of persisted provider#15769
dpaluy wants to merge 1 commit into
NousResearch:mainfrom
dpaluy:fix/cron-stale-provider-env

Conversation

@dpaluy

@dpaluy dpaluy commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Cron jobs were passing os.getenv("HERMES_INFERENCE_PROVIDER") as the requested arg to resolve_runtime_provider(), which short-circuited the resolver's own precedence (explicit arg → persisted config → env) and let stale shell/.env values outrank the user's saved provider.

Long-lived cron daemons inherit env from the shell that launched them, so a since-changed provider (e.g. DeepSeek) could keep firing for jobs that don't pin provider/model. Same bug class as commit f0b763c74 fixed for the TUI /model switch.

The fix passes only job.get("provider") and lets resolve_requested_provider fall through to persisted config and env in the documented order — restoring the precedence the resolver was designed around.

Related Issue

N/A — surfaced while debugging cron jobs running on a stale provider after a /model switch.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • cron/scheduler.py (run_job): drop or os.getenv("HERMES_INFERENCE_PROVIDER") from the requested arg passed to resolve_runtime_provider(). Add a comment explaining the precedence inversion to prevent the line from being re-added.

How to Test

  1. Set a stale env override in the shell that launches the cron daemon: export HERMES_INFERENCE_PROVIDER=deepseek.
  2. Switch the persisted provider via the TUI /model (or by editing cli-config.yaml) to a different one, e.g. anthropic.
  3. Schedule a cron job without pinning provider: or model: on the job.
  4. Before this fix: the job runs against deepseek (stale env wins).
    After this fix: the job runs against anthropic (persisted config wins, env is consulted only as a final fallback).

Checklist

Code

Documentation & Housekeeping

  • N/A — no public API or config keys changed
  • N/A — cli-config.yaml.example unchanged
  • N/A — no architecture/workflow change
  • N/A — single-line behavior fix, no platform-specific code
  • N/A — no tool descriptions/schemas touched

Cron jobs were passing os.getenv("HERMES_INFERENCE_PROVIDER") as the
"requested" arg to resolve_runtime_provider(), which short-circuited
the resolver's own precedence (explicit arg → persisted config → env)
and let stale shell/.env values outrank the user's saved provider.

Long-lived cron daemons inherit env from the shell that launched them,
so a since-changed provider (e.g. DeepSeek) could keep firing for jobs
that don't pin provider/model. Same bug class as f0b763c fixed for
the TUI /model switch.

Pass only job.get("provider") and let resolve_requested_provider fall
through to persisted config and env in the documented order.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cron Cron scheduler and job management labels Apr 25, 2026
@teknium1

teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvaged via #19627 onto current main - your commit authorship was preserved. Thanks!

@teknium1 teknium1 closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants