Skip to content
Closed
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
10 changes: 9 additions & 1 deletion cron/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2270,7 +2270,15 @@ def run_job(job: dict) -> tuple[bool, str, str, Optional[str]]:
_cron_title = f"{_title_base} · {_hermes_now().strftime('%b %d %H:%M')}"
_session_db.set_session_title(_cron_session_id, _cron_title)
except (Exception, KeyboardInterrupt) as e:
logger.debug("Job '%s': failed to set cron session title: %s", job_id, e)
# Title conflict or DB error — retry with a unique fallback so
# the session is never left blank. Append the session suffix
# (includes seconds) to guarantee uniqueness.
logger.warning("Job '%s': failed to set cron session title: %s", job_id, e)
try:
_fallback_title = f"{_title_base} · {_cron_session_id.split('_')[-1]}"
_session_db.set_session_title(_cron_session_id, _fallback_title)
except Exception:
logger.debug("Job '%s': fallback title also failed", job_id, exc_info=True)
try:
_session_db.end_session(_cron_session_id, "cron_complete")
except (Exception, KeyboardInterrupt) as e:
Expand Down