Skip to content

fix(disk-cleanup): protect cron/jobs.json from deletion#32436

Closed
KeyArgo wants to merge 1 commit into
NousResearch:mainfrom
KeyArgo:fix/disk-cleanup-protect-cron-jobs
Closed

fix(disk-cleanup): protect cron/jobs.json from deletion#32436
KeyArgo wants to merge 1 commit into
NousResearch:mainfrom
KeyArgo:fix/disk-cleanup-protect-cron-jobs

Conversation

@KeyArgo

@KeyArgo KeyArgo commented May 26, 2026

Copy link
Copy Markdown

Summary

guess_category() in disk_cleanup.py classifies every file under $HERMES_HOME/cron/ and cronjobs/ as cron-output, which gets pruned after 14 days:

if top == "cron" or top == "cronjobs":
    return "cron-output"   # ← catches jobs.json too

cron/jobs.json is the live cron registry — losing it silently deletes all scheduled jobs. It is a persistent config file, not ephemeral output.

Fix: Exempt jobs.json when it sits at depth 2 (direct child of cron/). All other files under cron/ remain classified as ephemeral output.

if top == "cron" or top == "cronjobs":
    if path.name == "jobs.json" and len(rel.parts) == 2:
        return None   # protected registry
    return "cron-output"

Test plan

  • Create $HERMES_HOME/cron/jobs.json and a dummy $HERMES_HOME/cron/run_12345.log
  • Run cleanup with age > 14 days simulated
  • jobs.json is not deleted; run_12345.log is deleted

Closes #32164

🤖 Contributed via Claude Code

guess_category() classified every file under cron/ and cronjobs/ as
cron-output, which is pruned after 14 days. This included jobs.json —
the live cron registry — causing scheduled jobs to silently vanish.

Exempt jobs.json when it sits directly under the cron top-level dir
(depth == 2). All other cron output remains classified as ephemeral.

Closes NousResearch#32164
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/plugins Plugin system and bundled plugins comp/cron Cron scheduler and job management labels May 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing with #32222 and #32177 — all three fix #32164 (disk-cleanup deleting cron/jobs.json). #32222 and #32177 narrow classification to cron/output/** subtree; this PR exempts only jobs.json by name+depth check.

@teknium1

Copy link
Copy Markdown
Contributor

Closing in favor of #34840 (merged), which fixes #32164 via the cron/output/ subtree restriction (#33834). Your fix protected jobs.json by exact name; the merged approach also covers .tick.lock and any other top-level control-plane state. Thanks for the report and fix!
#34840

@teknium1 teknium1 closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management comp/plugins Plugin system and bundled plugins P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

disk-cleanup misclassifies cron/jobs.json as cron-output and can delete the live cron registry

3 participants