fix(cron): tolerate UTF-8 BOM in jobs.json readers and context files (salvage #66609, #41604) - #66825
Merged
Conversation
Collaborator
Windows Notepad and PowerShell 5.1 Set-Content -Encoding UTF8 write a
leading UTF-8 BOM. json.load under encoding=utf-8 raises
JSONDecodeError("Unexpected UTF-8 BOM"), and load_jobs wraps that as
RuntimeError("Cron database corrupted and unrepairable"), taking down
cron CRUD/scheduler for a hand-edited jobs.json.
Read with utf-8-sig on all four independent jobs.json readers
(load_jobs primary + strict=False repair, dump _cron_summary, status
Scheduled Jobs). Write path stays plain utf-8 so the next save_jobs
heals a BOM'd file. Matches the env-class dialect (#65123).
Tests: BOM load (crash repro), bomless regression, empty store,
BOM+bare-list auto-repair, BOM+control-char strict=False arm, dump and
status CLI readers.
teknium1
force-pushed
the
hermes/hermes-c03a68df
branch
from
July 18, 2026 09:13
6de628c to
73332b7
Compare
Follow-up to the salvaged #66609 (4 primary readers) and #41604 (context files): two more jobs.json readers rejected a BOM'd file — - hermes_cli/backup.py _count_cron_jobs: a BOM made the count None, silently disabling the post-update cron-loss auto-restore safety net - agent/curator_backup.py _backup_cron_jobs_into: BOM broke the job count (spurious parse_warning) and propagated the BOM into snapshots Both now read utf-8-sig; curator snapshots are written BOM-free so rollback restores a file load_jobs can read. AUTHOR_MAP entry added for deacon-botdoctor. Tests: BOM'd-live-file auto-restore + BOM'd snapshot count/BOM-free copy.
teknium1
force-pushed
the
hermes/hermes-c03a68df
branch
from
July 18, 2026 09:21
73332b7 to
fbc6135
Compare
This was referenced Jul 18, 2026
This was referenced Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.hermes/cron/jobs.jsonreaders now tolerate a UTF-8 BOM (Windows Notepad / PowerShell 5.1 artifact). Previously a BOM'd jobs.json hard-crashedload_jobs()withRuntimeError: Cron database corrupted and unrepairable— the scheduler stopped running jobs, andhermes cron list/hermes status/hermes dumpall failed. Fixes #66607.Salvage of #66609 (@pnascimento9596) + the cron/context halves of #41604 (@deacon-botdoctor), widened to two additional sibling readers.
Changes
cron/jobs.py: bothload_jobs()opens →utf-8-sig(from fix(cron): accept UTF-8 BOM when reading jobs.json #66609)hermes_cli/dump.py,hermes_cli/status.py: jobs.json readers →utf-8-sig(from fix(cron): accept UTF-8 BOM when reading jobs.json #66609)agent/prompt_builder.py:_scan_context_content()strips a leading U+FEFF so a BOM'd SOUL.md/AGENTS.md isn't wholesale-blocked asinvisible_unicode; BOMs elsewhere in content still trip the threat scan (from fix: tolerate UTF-8 BOM in cron jobs.json and context files #41604)hermes_cli/backup.py_count_cron_jobs()→utf-8-sig(follow-up): a BOM made the countNone, silently disabling the post-update cron-loss auto-restore safety netagent/curator_backup.py_backup_cron_jobs_into()→utf-8-sig(follow-up): BOM brokejobs_countwith a spurious parse warning; snapshot copy is now written BOM-free so rollback restores a loadable filescripts/release.py: AUTHOR_MAP entry for deacon-botdoctorutf-8— saves stay BOM-freeValidation
load_jobs()on BOM'd filehermes status/dump_count_cron_jobs(auto-restore net)Targeted suites green:
tests/cron/test_jobs.py,tests/hermes_cli/test_jobs_json_utf8_bom.py,tests/agent/test_prompt_builder.py,tests/agent/test_curator_backup.py,tests/hermes_cli/test_backup.py— 494 passed. E2E verified against a temp HERMES_HOME with real BOM'd files across all six read sites.Credit
Infographic