Skip to content

fix(automation): keep syncing after profile renames and reload the crontab without a restart - #386

Merged
spalen0 merged 2 commits into
mainfrom
fix/automation-self-heal-crontab
Sep 26, 2026
Merged

spalen0 merged 2 commits into
mainfrom
fix/automation-self-heal-crontab

Conversation

@spalen0

@spalen0 spalen0 commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

What happened

On 2026-09-24 at 11:20 UTC the box pulled #6fe7b6c, which renamed the sync-anchor profile multisig to ten_minute. The crontab is only rebuilt when the service restarts, so supercronic kept calling run multisig. That failed with unknown profile 'multisig' before its git sync ran, and the box stopped pulling code until someone pulled and restarted by hand on 2026-09-26 08:09 UTC (about 45 h). Stables and Safe monitoring did not run at all during that window.

Fix

  • Rewrite the crontab after each sync. automation/crontab.py re-renders the crontab from the pulled jobs.yaml and rewrites $CRONTAB_PATH when it differs. supercronic now runs with -inotify, so profile adds, removes, renames and cadence changes apply without a restart. If jobs.yaml is invalid, the current schedule stays.
  • Sync even on an unknown profile. run <unknown profile> still syncs before exiting 2, so a stale crontab can't stop code sync.
  • Updated the runbook and jobs.yaml notes. Dependency changes still need uv sync plus a restart.

Testing

  • Tested on the box with supercronic v0.2.34: rewriting the watched crontab in place logs reloading crontab, and the new job runs.
  • Added tests for the crontab refresh (stale, unchanged, invalid yaml, env unset), for the runner (refresh only after a successful sync), and for the CLI (an unknown profile still syncs; --dry-run doesn't).
  • pytest: 1397 passed. ruff is clean.

Deploy note (one time)

The unit file changed (CRONTAB_PATH env and -inotify). After merging, re-render /etc/systemd/system/monitoring.service with deploy/install.sh, or add the two lines by hand. Then run sudo systemctl daemon-reload && sudo systemctl restart monitoring. Without that step, the sync-on-unknown-profile part still protects the box.

🤖 Generated with Claude Code

codex and others added 2 commits September 26, 2026 08:16
…ontab without a restart

On 2026-09-24 the sync-anchor profile `multisig` was renamed to `ten_minute`.
supercronic still ran the crontab from its last start, `run multisig` failed
with "unknown profile" before its git sync, and the box stopped pulling code
for about 45 hours. Stables and Safe monitoring were down that whole time.

- After each successful sync, re-render the crontab from the pulled jobs.yaml
  and rewrite $CRONTAB_PATH when it differs; supercronic now runs with
  -inotify and reloads it.
- `run <unknown profile>` still syncs before exiting 2, so a stale crontab
  cannot stop the box from pulling code.
- Move crontab rendering into automation/crontab.py; update runbook and
  jobs.yaml notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The unknown-profile recovery hard-resets the checkout to origin/main, so a
typo in a local `python -m automation run` could discard tracked edits. Gate
it on CRONTAB_PATH, which only the monitoring systemd unit sets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spalen0
spalen0 merged commit 80453c8 into main Sep 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant