fix(cron): guard AIAgent init kwargs so dream cycles cannot crash on scheduler drift #341

Closed
opened 2026-04-13 06:46:50 +00:00 by Timmy · 2 comments
Owner

Problem

Three dream cycle cron jobs are stuck red without an audit trail in hermes-agent:

  • Dream Cycle — 2:30AM (Deep) 074fb31b588f
  • Dream Cycle — 4:00AM (Abyss) a0abdafe21a7
  • Dream Cycle — 5:30AM (Awakening) 39af1269e7a9

The stored cron failure is:
TypeError: AIAgent.__init__() got an unexpected keyword argument 'tool_choice'

Diagnosis

  • Working and failing dream jobs use the same model/provider path (xiaomi/mimo-v2-pro via nous)
  • They all run the same dream script path: python3 ~/.hermes/scripts/the-dream.py
  • ~/.hermes/scripts/the-dream.py runs successfully outside cron
  • ~/.hermes/scripts/the-reflection.py also exists and runs successfully outside cron
  • The failure is therefore in cron/agent orchestration, not in the dream/reflection scripts themselves

Root cause

Cron scheduling can drift from AIAgent.__init__() and pass unsupported keyword arguments. When that happens, jobs crash before the prompt runs. In this case the unsupported kwarg was tool_choice.

Acceptance criteria

  • cron.scheduler filters or otherwise guards unsupported AIAgent init kwargs instead of crashing jobs
  • Add regression coverage proving an unexpected scheduler kwarg does not crash run_job()
  • Add regression coverage proving the supported kwargs still reach AIAgent
  • After the fix lands, the three failing dream cycles can be rerun successfully
  • Audit trail exists as hermes-agent issue + PR for the repair
## Problem Three dream cycle cron jobs are stuck red without an audit trail in hermes-agent: - Dream Cycle — 2:30AM (Deep) `074fb31b588f` - Dream Cycle — 4:00AM (Abyss) `a0abdafe21a7` - Dream Cycle — 5:30AM (Awakening) `39af1269e7a9` The stored cron failure is: `TypeError: AIAgent.__init__() got an unexpected keyword argument 'tool_choice'` ## Diagnosis - Working and failing dream jobs use the same model/provider path (`xiaomi/mimo-v2-pro` via `nous`) - They all run the same dream script path: `python3 ~/.hermes/scripts/the-dream.py` - `~/.hermes/scripts/the-dream.py` runs successfully outside cron - `~/.hermes/scripts/the-reflection.py` also exists and runs successfully outside cron - The failure is therefore in cron/agent orchestration, not in the dream/reflection scripts themselves ## Root cause Cron scheduling can drift from `AIAgent.__init__()` and pass unsupported keyword arguments. When that happens, jobs crash before the prompt runs. In this case the unsupported kwarg was `tool_choice`. ## Acceptance criteria - [ ] `cron.scheduler` filters or otherwise guards unsupported `AIAgent` init kwargs instead of crashing jobs - [ ] Add regression coverage proving an unexpected scheduler kwarg does not crash `run_job()` - [ ] Add regression coverage proving the supported kwargs still reach `AIAgent` - [ ] After the fix lands, the three failing dream cycles can be rerun successfully - [ ] Audit trail exists as hermes-agent issue + PR for the repair
claude self-assigned this 2026-04-13 06:48:28 +00:00
Author
Owner

Fixed in PR #358 (merged).

Added _safe_agent_kwargs() that filters unsupported kwargs before passing to AIAgent(). Combined with the deploy sync guard (#356), there are now two layers:

  1. Fail-fast (#356): warns on first job if params are missing
  2. Resilient filter (#358): drops unsupported kwargs so jobs keep running

Deployed to live system.

Fixed in PR #358 (merged). Added `_safe_agent_kwargs()` that filters unsupported kwargs before passing to `AIAgent()`. Combined with the deploy sync guard (#356), there are now two layers: 1. **Fail-fast** (#356): warns on first job if params are missing 2. **Resilient filter** (#358): drops unsupported kwargs so jobs keep running Deployed to live system.
Timmy closed this issue 2026-04-13 19:13:32 +00:00
Author
Owner

Fixed in PR #364 (merged). Deploy sync guard + kwarg filter + [SCRIPT_FAILED] marker all live.

Fixed in PR #364 (merged). Deploy sync guard + kwarg filter + [SCRIPT_FAILED] marker all live.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/hermes-agent#341