hermes - 💡(How to fix) Fix [Feature]: Named/resumable sessions for cron jobs [1 participants]

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…
GitHub stats
NousResearch/hermes-agent#14821Fetched 2026-04-24 06:14:35
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3
RAW_BUFFERClick to expand / collapse

Problem or Use Case

Every cron job invocation creates a brand-new session (auto-named with timestamp + hash, e.g. 20260421_135634_d8fa8a14). For recurring jobs that run every N minutes, this generates massive session bloat:

- A job running every 20 minutes creates 72 new sessions per day
- A job running every hour creates 24 new sessions per day
- Over a month, a single cron job accumulates ~2,160 sessions

These sessions are meaningless monitoring/health-check sessions that carry no conversation history worth preserving. They pollute the session directory, consume disk space, and slow down session enumeration.

Expected Behavior

Cron jobs should support a session parameter that allows specifying a named session to reuse across invocations. For example:

yaml
job:
  name: "Gateway Health Monitor"
  session: "gateway_health_monitor"  # Reuse this session each run
  schedule: "every 20m"


With this, each run of the job appends to the same conversation thread instead of creating a new session. The session would still exist but remain lean — just a short log of each cron run rather than a full isolated conversation.

Benefits

1. Massive session reduction — 72 sessions/day → 1 session forever
2. Cleaner session directory — monitoring jobs no longer pollute session lists
3. Persistent short-term context — if the health check needs to remember the last state (e.g., "gateway was down 3 minutes ago"), it can without creating new sessions
4. Easier debugging — all health check runs are in one place, easy to review timeline of issues

Implementation Notes

- The session name should be a simple string identifier (no special characters)
- If the session doesn't exist on first run, create it
- The session could have a special marker/type to indicate it's a cron-reused session (for session cleanup/rotation logic)
- Optional: support a max_session_history to keep the reused session from growing unbounded

Proposed Solution

cron job yaml file has session parameter that will append log data upon cron execution.

Alternatives Considered

deleting prior sessions that match a string.

Feature Type

Gateway / messaging improvement

Scope

Small (single file, < 50 lines)

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

extent analysis

TL;DR

Implement a session reuse mechanism in cron jobs by adding a session parameter to the job configuration, allowing invocations to append to the same conversation thread instead of creating new sessions.

Guidance

  • Introduce a session parameter in the cron job YAML configuration to specify a named session for reuse across invocations.
  • Modify the cron job execution logic to check if the specified session exists, and if not, create it on the first run.
  • Consider adding a special marker or type to indicate that a session is being reused by a cron job, to facilitate session cleanup and rotation logic.
  • Optionally, implement a max_session_history parameter to limit the growth of reused sessions.

Example

job:
  name: "Gateway Health Monitor"
  session: "gateway_health_monitor"
  schedule: "every 20m"

Notes

The proposed solution requires careful consideration of session management and cleanup to prevent unbounded growth of reused sessions.

Recommendation

Apply workaround by implementing the proposed session parameter and modifying the cron job execution logic to reuse sessions, as this addresses the root cause of session bloat and provides a clean solution.

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