Skip to content

fix(cron): normalize string repeat values - #7216

Open
ARegalado1 wants to merge 1 commit into
NousResearch:mainfrom
ARegalado1:fix/cron-repeat-once-7142
Open

fix(cron): normalize string repeat values#7216
ARegalado1 wants to merge 1 commit into
NousResearch:mainfrom
ARegalado1:fix/cron-repeat-once-7142

Conversation

@ARegalado1

@ARegalado1 ARegalado1 commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Normalize cron repeat values before numeric comparisons.
  • Accept integer-like strings such as "3" and coerce them to integers.
  • Treat non-numeric strings such as "once" and "forever" as unset instead of crashing.
  • Preserve one-shot schedule behavior by auto-setting unset repeat values to 1.
  • Reuse the same normalization in the cronjob update flow.
  • Add regression tests for create, update, numeric-string, and non-numeric-string paths.

Context

LLMs can still pass repeat as a string even though the tool schema declares it as an integer. Before this patch, create/update paths could compare a string to 0 and raise:

TypeError: '<=' not supported between instances of 'str' and 'int'

Refresh note: this branch was rebased onto current main and rewritten as a clean cron-only PR. An unrelated GitHub/local terminal environment commit that was previously on the branch was dropped.

Closes #7142

Test Plan

  • python -m py_compile cron/jobs.py tools/cronjob_tools.py
  • python -m pytest tests/cron/test_jobs.py tests/cron/test_cron_script.py tests/tools/test_cronjob_tools.py -q -o 'addopts=' — 135 passed
  • git diff --check upstream/main...HEAD

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cron Cron scheduler and job management labels Apr 29, 2026
- treat non-numeric repeat values like 'once' as unset
- auto-coerce one-shot jobs back to repeat=1 after normalization
- reuse repeat normalization in cronjob update
- add regression coverage for create and update flows
@ARegalado1
ARegalado1 force-pushed the fix/cron-repeat-once-7142 branch from 31aeb85 to 968cec5 Compare May 3, 2026 15:01
@ARegalado1

Copy link
Copy Markdown
Contributor Author

Refresh update:

No GitHub CI checks are currently attached to this fork PR.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused fix. The reported failure is present on current main: cron/jobs.py:1009 compares repeat <= 0 during creation, and tools/cronjob_tools.py:946 does the same during tool-driven update. A string supplied despite the schema therefore raises before the existing one-shot/default handling can run.

The PR’s shared normalizer addresses both verified sites and preserves existing semantics for non-positive values and one-shot defaults. The added create/update regressions match the two paths. This is an automated hermes-sweeper review.

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 P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TESTED FIX] TypeError when repeat='once' passed to cronjob create (string-to-int coercion missing)

3 participants