Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion hermes_cli/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ def cron_list(show_all: bool = False):

delivery_err = job.get("last_delivery_error")
if delivery_err:
print(f" {color('⚠ Delivery failed:', Colors.YELLOW)} {delivery_err}")
# Delivery is tracked separately from execution: a cron run can
# complete successfully while the platform send fails. Say "Last
# delivery" so an old platform error is not mistaken for a current
# execution failure.
print(f" {color('⚠ Last delivery failed:', Colors.YELLOW)} {delivery_err}")

print()

Expand Down
15 changes: 14 additions & 1 deletion tests/hermes_cli/test_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from cron.jobs import create_job, get_job, list_jobs
from cron.jobs import create_job, get_job, list_jobs, mark_job_run
from hermes_cli.cron import cron_command


Expand Down Expand Up @@ -111,3 +111,16 @@ def test_create_with_multiple_skills(self, tmp_cron_dir, capsys):
assert jobs[0]["skills"] == ["blogwatcher", "maps"]
assert jobs[0]["name"] == "Skill combo"
assert jobs[0]["profile"] == "default"

def test_list_labels_delivery_failure_as_delivery_not_execution(self, tmp_cron_dir, capsys):
job = create_job(prompt="Report", schedule="every 1h", name="Report job")
mark_job_run(job["id"], success=True, delivery_error="telegram TLS failure")

cron_command(Namespace(cron_command="list", all=False))

out = capsys.readouterr().out
assert "Last run:" in out
assert "ok" in out
assert "Last delivery failed:" in out
assert "Delivery failed:" not in out
assert "telegram TLS failure" in out