P2 no_agent Cron Jobs Ignore Profile — Multi-Gateway HERMES_HOME Mismatch (#53077)

Executive Summary

For cron jobs with no_agent: true, the per-job profile field is never applied before the script runs. The no_agent short-circuit in cron/scheduler.py::run_job (~line 1633) executes the script and returns before reaching the profile→HERMES_HOME scoping block (~line 1735). In a multi-gateway setup, this means _run_job_script() resolves the script under whichever gateway process won the tick, not under the job's configured profile — making execution silently non-deterministic. This is the 7th distinct P0/P1/P2 cron subsystem bug we've tracked.

Root Cause Analysis

The no_agent Short-Circuit Gap

In cron/scheduler.py::run_job(), the execution flow is:

  1. ~line 1633: if no_agent: _run_job_script(); return — script runs and function returns immediately
  2. ~line 1735: Profile→HERMES_HOME override block — never reached for no_agent jobs

The profile scoping sits below the no_agent early-return. The comment above line 1730 explicitly warns the override must happen "BEFORE any prompt/skill loading or pre-run script execution" — and the no_agent short-circuit hits exactly the failure the comment warns about.

Multi-Gateway Failure Mode

Two gateways (profile A and B) share a root cron store. A no_agent job scoped to profile B's scripts/ dir fails non-deterministically:

Agent-backed jobs (no_agent: false) are unaffected — their path reaches the HERMES_HOME override block correctly.

Evidence

Failure Log
Script not found: /home/user/.hermes/profiles/A/scripts/my_script.py Expected: /home/user/.hermes/profiles/B/scripts/my_script.py Job config: profile: B, no_agent: true Gateway that won tick: profile A

Impact Assessment

DimensionSeverityDetail
Multi-Gateway ReliabilityHIGHSilently non-deterministic — job succeeds or fails based on which gateway wins the tick
Profile IsolationHIGHProfile field is completely ignored for no_agent jobs — fundamental isolation gap
Fix ComplexityLOWHoist profile scoping above no_agent short-circuit; add finally to restore on early return
Cron Subsystem HealthCRITICAL7th distinct cron subsystem bug — scheduling, caching, security, plugin management, state isolation, and now profile scoping

Proposed Fix

  1. Hoist profile scoping above the no_agent short-circuit in run_job()
  2. Add finally block to restore original HERMES_HOME on the early-return path

PR: #53104 already open | Reporter willing to submit PR.

Cron Subsystem Bug History (7 Distinct Issues)

IssueSeverityDescription
#41037P1Cron never fires — scheduling failure
#42197P2PluginManager crash during cron execution
#20586P2State leak between cron jobs
#44585P2Provider-state inheritance corruption
#51395P0Prompt-cache-cold on cron execution
#51976P2Gateway restart loop bypass via cron
#53077P2no_agent cron jobs ignore profile — multi-gateway HERMES_HOME mismatch

⚠️ Pattern: The cron subsystem now has bugs in scheduling, caching, security, plugin management, state isolation, gateway restarts, and profile scoping. Seven distinct vectors across seven issues — suggesting the cron scheduler needs a fundamental architectural review rather than point fixes.

Source Evidence

📋 https://hermes-agent.reviews/hermes-no-agent-cron-profile-ignored-53077.html
Tracked by hermes-agent.reviews — June 26, 2026