hermes - 💡(How to fix) Fix Cron jobs create a new session on every run - add session_reuse option

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

  • Noise: A single */20 job creates 36+ sessions per workday. The session list becomes unusable.
  • No state continuity: Even with context_from self-referencing, the agent starts from a blank conversation each time. context_from only injects the previous run's final output as a header - it's not the same as continuing a thread.
  • Defeats the purpose: For monitoring/watchdog jobs (email checks, server pings), you want the agent to accumulate awareness over time, not re-process the same state from scratch.

Fix Action

Fix / Workaround

Workaround (current)

Patching scheduler.py to remove the timestamp suffix works but gets wiped on hermes update. The only other option is a cleanup cron that prunes old cron sessions, which is wasteful.

Code Example

_cron_session_id = f"cron_{job_id}_{_hermes_now().strftime('%Y%m%d_%H%M%S')}"

---

# In the cronjob tool schema / jobs.json:
session_reuse: true   # or: session_mode: "continue" vs "fresh" (default: "fresh" for backward compat)
RAW_BUFFERClick to expand / collapse

Problem

Cron jobs currently create a fresh isolated session on every tick. For a job running every 20 minutes, this generates dozens of sessions per day that clutter the session list and provide no state continuity.

From cron/scheduler.py line 1491:

_cron_session_id = f"cron_{job_id}_{_hermes_now().strftime('%Y%m%d_%H%M%S')}"

The timestamp suffix guarantees a new session every run.

Why this matters

  • Noise: A single */20 job creates 36+ sessions per workday. The session list becomes unusable.
  • No state continuity: Even with context_from self-referencing, the agent starts from a blank conversation each time. context_from only injects the previous run's final output as a header - it's not the same as continuing a thread.
  • Defeats the purpose: For monitoring/watchdog jobs (email checks, server pings), you want the agent to accumulate awareness over time, not re-process the same state from scratch.

Proposed solution

Add a session_reuse (or session_mode: "continue") option to cron jobs. When enabled, the job appends to a fixed session ID (cron_{job_id}) instead of generating a new one each tick.

This would let long-running monitoring jobs build up conversational context naturally, the same way a Telegram gateway session accumulates messages over time.

# In the cronjob tool schema / jobs.json:
session_reuse: true   # or: session_mode: "continue" vs "fresh" (default: "fresh" for backward compat)

Edge cases to handle:

  • Session size: auto-compress or rotate when the session exceeds a message/token threshold
  • First run after job creation: start fresh, then reuse from the second tick onward

Workaround (current)

Patching scheduler.py to remove the timestamp suffix works but gets wiped on hermes update. The only other option is a cleanup cron that prunes old cron sessions, which is wasteful.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING