hermes - 💡(How to fix) Fix Bug: cron.jobs.update_job crashes when schedule updates use raw string form [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#13706Fetched 2026-04-22 08:04:35
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

cron.jobs.update_job() crashes when a caller updates schedule using the raw string form that the API layer accepts (for example "0 * * * *"). The function assumes updated["schedule"] is a parsed schedule dict and immediately calls .get() on it.

Error Message

AttributeError: 'str' object has no attribute 'get'

Root Cause

cron.jobs.update_job() crashes when a caller updates schedule using the raw string form that the API layer accepts (for example "0 * * * *"). The function assumes updated["schedule"] is a parsed schedule dict and immediately calls .get() on it.

Fix Action

Fix / Workaround

Affected code

  • cron/jobs.py:487-516
  • especially cron/jobs.py:502-509
  • API expectation nearby: tests/gateway/test_api_server_jobs.py:288-312 patches the API with json={"name": "updated-name", "schedule": "0 * * * *"}

Why this is a bug

The public API shape already allows string schedules, but update_job() only works if the caller pre-parses the schedule into a dict. A PATCH that changes only the schedule can therefore explode with AttributeError instead of updating the job.

Expected behavior

  • update_job() should accept the same string schedule shape as create_job() / the API PATCH payload and normalize it before reading derived fields.

Code Example

import os
import tempfile
from cron.jobs import create_job, update_job

with tempfile.TemporaryDirectory() as td:
    os.environ["HERMES_HOME"] = td
    job = create_job(name="demo", prompt="x", schedule="30m")
    update_job(job["id"], {"schedule": "0 * * * *"})

---

AttributeError: 'str' object has no attribute 'get'
RAW_BUFFERClick to expand / collapse

Summary

cron.jobs.update_job() crashes when a caller updates schedule using the raw string form that the API layer accepts (for example "0 * * * *"). The function assumes updated["schedule"] is a parsed schedule dict and immediately calls .get() on it.

Affected code

  • cron/jobs.py:487-516
  • especially cron/jobs.py:502-509
  • API expectation nearby: tests/gateway/test_api_server_jobs.py:288-312 patches the API with json={"name": "updated-name", "schedule": "0 * * * *"}

Why this is a bug

The public API shape already allows string schedules, but update_job() only works if the caller pre-parses the schedule into a dict. A PATCH that changes only the schedule can therefore explode with AttributeError instead of updating the job.

Minimal reproduction

import os
import tempfile
from cron.jobs import create_job, update_job

with tempfile.TemporaryDirectory() as td:
    os.environ["HERMES_HOME"] = td
    job = create_job(name="demo", prompt="x", schedule="30m")
    update_job(job["id"], {"schedule": "0 * * * *"})

Actual exception:

AttributeError: 'str' object has no attribute 'get'

Expected behavior

  • update_job() should accept the same string schedule shape as create_job() / the API PATCH payload and normalize it before reading derived fields.

Actual behavior

  • The update path crashes on updated_schedule.get(...).

Suggested investigation

Normalize or parse updates["schedule"] before deriving schedule_display / next_run_at, and add a regression test that exercises update_job(job_id, {"schedule": "0 * * * *"}) directly (not just a mocked API patch).

extent analysis

TL;DR

The update_job() function should be modified to parse the schedule string into a dictionary before attempting to access its attributes.

Guidance

  • Check the type of updated["schedule"] before calling .get() on it to handle both string and dictionary cases.
  • Add a parsing step to convert the schedule string into a dictionary if it's not already in that format.
  • Verify that the parsing logic is consistent with the schedule parsing used in create_job().
  • Consider adding a regression test to ensure that update_job() works correctly with both string and dictionary schedule formats.

Example

def update_job(job_id, updates):
    if isinstance(updates["schedule"], str):
        # Parse the schedule string into a dictionary
        updates["schedule"] = parse_schedule(updates["schedule"])
    # Now it's safe to call .get() on updates["schedule"]
    schedule_display = updates["schedule"].get("display")
    # ...

Notes

The exact implementation of the parse_schedule() function is not specified in the issue, so it's assumed to be already available or easily implementable. If not, additional investigation would be needed to determine the correct parsing logic.

Recommendation

Apply a workaround by modifying the update_job() function to parse the schedule string into a dictionary before attempting to access its attributes, as this will allow the function to handle both string and dictionary schedule formats correctly.

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…

FAQ

Expected behavior

  • update_job() should accept the same string schedule shape as create_job() / the API PATCH payload and normalize it before reading derived fields.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix Bug: cron.jobs.update_job crashes when schedule updates use raw string form [1 participants]