Files
hermes-agent/cron
Teknium 0f2fe9ff5a fix(cron): canonical completion ids retire once nothing can replay them
Mechanism: mark_job_run appended every canonical execution id to the job's
canonical_completions (the idempotency tombstone that makes a recovered
receipt replay a no-op) and never removed one. A recurring one-minute job
grew this list by ~525k ids a year, and every membership check and
jobs.json rewrite grew with it.

Fix: the only path that can replay a completion into mark_job_run is
journal recovery (scheduler_authority.reconcile_pending iterates
cron/admissions/<hash>.json; finish_completed_run unlinks the journal as
its last step). When recording a new completion, keep only the earlier
ids whose admission journal still exists, then append the new id (it stays
last, which delivery_outcome._settle_job_record relies on). An id is
retired exactly when its recovery window has closed - no blind cap.

Test: tests/cron/test_canonical_completion_retention.py fires 65 runs
through mark_job_run with real journals: one whose tail crashed (journal
kept) plus 64 normal ones. The list is ['pending', 'run-63'], and replaying
the still-journaled completion is still a no-op (repeat.completed
unchanged). Fails on r14-base (66 ids retained).

Review: andrexibiza 4243963763
2026-10-11 23:38:03 -07:00
..
2026-10-08 19:54:07 +02:00
2026-10-09 17:34:36 +02:00
2026-10-09 17:34:38 +02:00