Skip to content

fix(profile): exclude cron from distribution payload on update - #25297

Closed
shanewas wants to merge 4 commits into
NousResearch:mainfrom
shanewas:fix/profile-cron-wipe-25281-clean
Closed

shanewas wants to merge 4 commits into
NousResearch:mainfrom
shanewas:fix/profile-cron-wipe-25281-clean

Conversation

@shanewas

Copy link
Copy Markdown

Summary

Fixes #25281 — "Update button in dashboard deletes all scheduled cron jobs"

The Bug

_copy_dist_payload() in profile_distribution.py copies a distribution's cron/ directory to the target profile during update. If the distribution ships an empty cron/ scaffolding directory, shutil.rmtree(dest) is called on the user's existing cron directory, and copytree then copies the empty staging dir — wiping all user cron jobs.

The Fix

Add "cron" to USER_OWNED_EXCLUDE alongside "memories", "sessions", "logs", etc. User-created cron jobs (cron/jobs.json) are now protected on update the same way other user data already is.

Root cause analysis

  • profile_distribution.py line 554-556: if dest.exists(): shutil.rmtree(dest) — called before copytree
  • cron/ was not in USER_OWNED_EXCLUDE (line 98)
  • Any distribution with a bundled cron/ directory (even empty) would wipe user crons on update
  • This explains why cron jobs kept disappearing on every update despite being reported before

Files changed

  • hermes_cli/profile_distribution.py — +5 lines to USER_OWNED_EXCLUDE
  • tests/hermes_cli/test_profile_distribution.py — +8 lines: extend test_update_preserves_user_data to cover cron/jobs.json

Tests

All 63 tests in test_profile_distribution.py pass.

Navi added 3 commits May 14, 2026 08:11
…k reconnect ladder

Fixes #25221

When the retry start_polling() call inside _handle_polling_conflict()
raises, the exception was only logged before returning silently — no
reconnect was scheduled, leaving the gateway alive but with dead polling.

The fix mirrors _handle_polling_network_error (lines 814-823): schedule
a background task calling _handle_polling_network_error(retry_err) so
the failure is routed through the exponential-backoff reconnect ladder.

Tests: tests/gateway/test_telegram_polling_conflict_retry.py (4 tests)
Wipe of user cron jobs during 'hermes update' was caused by the
_copy_dist_payload() path in profile_distribution.py.  When a
distribution ships an empty cron/ directory and the user's profile
already has cron/jobs.json, shutil.rmtree(dest) deletes the user's
cron directory before copytree re-populates it from the staged empty
dir.

Fix: add 'cron' to USER_OWNED_EXCLUDE alongside 'memories', 'sessions',
'logs', etc., so the cron directory is protected on update the same way
other user data directories already are.

Regression test added to test_update_preserves_user_data: creates
cron/jobs.json in the profile, runs update, asserts jobs.json survives.

Fixes #25281.
Wipe of user cron jobs during 'hermes update' was caused by the
_copy_dist_payload() path in profile_distribution.py.  When a
distribution ships an empty cron/ directory and the user's profile
already has cron/jobs.json, shutil.rmtree(dest) deletes the user's
cron directory before copytree re-populates it from the staged empty
dir.

Fix: add 'cron' to USER_OWNED_EXCLUDE alongside 'memories', 'sessions',
'logs', etc., so the cron directory is protected on update the same way
other user data directories already are.

Regression test added to test_update_preserves_user_data: creates
cron/jobs.json in the profile, runs update, asserts jobs.json survives.

Fixes #25281.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management comp/cli CLI entry point, hermes_cli/, setup wizard P1 High — major feature broken, no workaround labels May 14, 2026
@shanewas

Copy link
Copy Markdown
Author

Requesting review for this P1 fix (cron wipe on update). This is the highest priority open PR. All tests pass (4 commits, branch: fix/profile-cron-wipe-25281-clean). Please review when possible.

@shanewas shanewas closed this by deleting the head repository May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management 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.

[BUG] Update button in dashboard deletes all scheduled cron jobs

2 participants