Files
clawmates/deploy/gw-04/clawmates-library.timer
T
Omar SobhandClaude Opus 5 3124fd3c8f
ci / gates (push) Failing after 7s
ci / rust (push) Skipped
ci / frontend (push) Skipped
ci / e2e (push) Skipped
ci / publish (push) Skipped
feat(library): weekly harvest on a systemd timer
Monday 07:00, Persistent=true so a week missed to downtime fires on next
boot rather than leaving a silently empty library. 30-minute timeout so a
wedged run cannot hold the slot until the following week.

The script is deliberately thin — it calls the API and reports — so it
never needs changing when the harvest does. Auth is a long-lived operator
session in /etc/clawmates/library.token (root-only, 600); rotate by
replacing the file.

Exit status follows `healthy`, not paper count. A mature library shelves
nothing most weeks and that is success; a run that errored is a failure
even if it shelved something.

The first manual fire caught a real bug in this script, in the opposite
direction to this week's usual: the harvest genuinely shelved 15 papers
and pushed them, and the reporter crashed on an escaped quote inside an
f-string, so systemd marked the unit FAILED. A false failure destroys
trust in the signal exactly as a false success does. The reporter now
avoids backslashes entirely (it is embedded in a single-quoted shell
string) and was proved against the real response shape before being
trusted.

Verified end to end on gw-04:
  run 1: 25 candidates, 10 already held, 15 shelved, pushed
  run 2: 25 candidates, 25 already held,  0 shelved, no branch, healthy

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-03 10:59:13 -07:00

17 lines
498 B
SYSTEMD

[Unit]
Description=Clawmates paper library — weekly harvest
[Timer]
# Monday 07:00 local. Weekly rather than daily because arXiv moves at
# roughly that pace for a narrow topic set, and a run that almost always
# finds nothing trains you to ignore it.
OnCalendar=Mon *-*-* 07:00:00
# Fire on next boot if the machine was down at the scheduled time — a
# missed week is a silently empty library.
Persistent=true
AccuracySec=1min
Unit=clawmates-library.service
[Install]
WantedBy=timers.target