Skip to content

fix(cron): clean up job output dir in remove_job#21882

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-1e782d14
May 8, 2026
Merged

fix(cron): clean up job output dir in remove_job#21882
teknium1 merged 1 commit into
mainfrom
hermes/hermes-1e782d14

Conversation

@teknium1

@teknium1 teknium1 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

remove_job() now removes the per-job output directory at ~/.hermes/cron/output/{job_id}/ so deleted jobs don't leave orphaned dirs accumulating forever.

Changes

  • cron/jobs.py: after save_jobs(jobs) in remove_job, shutil.rmtree the job's output dir if it exists.

Context

Salvaged from #13510 by @hekaru-agent. The honcho RLock half of that PR was already merged as commit dad0217; this lands the remaining cron cleanup hunk on its own with authorship preserved.

Validation

E2E: seeded a job, wrote output, called remove_job — job + output dir both gone. Nonexistent id still returns False. Job that never produced output removes cleanly without crashing.

Closes #13510.

remove_job() deletes the job from cron/jobs.json but leaves the per-job
output directory at ~/.hermes/cron/output/{job_id}/ behind. Over time
this accumulates orphaned dirs that never get reclaimed.

Adopted from #13510 by @hekaru-agent; the honcho RLock half of that PR
was already salvaged in commit dad0217 so this lands the remaining
cron cleanup hunk on its own.
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-1e782d14 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7688 on HEAD, 7688 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4034 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

Comment thread cron/jobs.py
save_jobs(jobs)
# Clean up output directory to prevent orphaned dirs accumulating
job_output_dir = OUTPUT_DIR / job_id
if job_output_dir.exists():
Comment thread cron/jobs.py
# Clean up output directory to prevent orphaned dirs accumulating
job_output_dir = OUTPUT_DIR / job_id
if job_output_dir.exists():
shutil.rmtree(job_output_dir)
@teknium1 teknium1 merged commit f4e621f into main May 8, 2026
11 of 12 checks passed
@teknium1 teknium1 deleted the hermes/hermes-1e782d14 branch May 8, 2026 13:28
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.

3 participants