Skip to content

fix(cron): coerce repeat parameter to int to prevent TypeError - #7589

Closed
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/cron-repeat-type-coercion
Closed

fix(cron): coerce repeat parameter to int to prevent TypeError#7589
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/cron-repeat-type-coercion

Conversation

@konsisumer

Copy link
Copy Markdown
Contributor

Summary

  • Coerce the repeat parameter to int at the top of cronjob() before it reaches the <= 0 comparisons in the create and update code paths
  • LLMs may pass repeat as a string (e.g. "3") despite the tool schema declaring "type": "integer", causing TypeError: '<=' not supported between instances of 'str' and 'int'

Fixes #6709

Test plan

  • New test_create_with_string_repeat_is_coerced_to_int — passes string "3" as repeat to create, verifies success
  • New test_update_with_string_repeat_is_coerced_to_int — passes string "5" as repeat to update, verifies success
  • All 41 test_cronjob_tools.py tests pass

@konsisumer

Copy link
Copy Markdown
Contributor Author

Cherry-picked 7 commits from #7534 to fix the 26 pre-existing CI test failures on main (none introduced by this PR):

  1. dd19b7fb — defensive getattr for _session_model_overrides and request_overrides (fixes ~20 test failures from tests using object.__new__())
  2. 51c58ae1 — repair 13 pre-existing test failures: AudioRecorder.is_recording property, env var cleanup in auth gate tests, _attached_images in voice CLI helper, camofox _config_version bump, progress topic reply_to assertion
  3. 21ba33ad — add missing .request() and .get_updates_request() return values to Application.builder() mock chain in telegram conflict tests
  4. 51c737bb — add missing register_p2_im_chat_member_bot_added_v1 and register_p2_im_chat_member_bot_deleted_v1 methods to feishu _Builder mock
  5. 7c1b0c5c — add request_overrides = {} to _make_agent() in test_ctx_halving_fix.py
  6. 3bea279f — update test_email_in_session_discovery for enum-based channel directory (commit baddb6f7)
  7. 534cc595 — fix get_vision_auxiliary_clientresolve_vision_provider_client, matrix sync auth retry, and gateway stop cleanup tests

@konsisumer

Copy link
Copy Markdown
Contributor Author

Also cherry-picked the atomicwrites Nix fix from #7513 — the nix (ubuntu-latest) failure was a pre-existing issue on main where atomicwrites-1.4.1 (sdist-only, legacy setup.py) fails to build without setuptools in the Nix build environment. This was not caused by this PR.

@konsisumer
konsisumer force-pushed the fix/cron-repeat-type-coercion branch 2 times, most recently from da39389 to 78c4994 Compare April 11, 2026 23:04
@konsisumer

Copy link
Copy Markdown
Contributor Author

The two CI failures on this PR are pre-existing infrastructure issues on main, not caused by this change:

Check Status Root cause
build-and-push FAILURE Docker build fails at npm install in scripts/whatsapp-bridgegit binary is missing in the container (ENOENT: spawn git). Same failure on main (recent runs all show conclusion: failure).
test CANCELLED Cancelled (likely gated on the build job). Same pattern on main — all recent test runs are also cancelled.

This PR only modifies tools/cronjob_tools.py and tests/tools/test_cronjob_tools.py and does not touch Docker, npm, or any build infrastructure.

@konsisumer
konsisumer force-pushed the fix/cron-repeat-type-coercion branch 2 times, most recently from 135b8a6 to b6b5bd8 Compare April 17, 2026 04:04
LLMs may pass the repeat parameter as a string (e.g. "3") despite the
tool schema declaring "type": "integer". This causes a TypeError at
the `repeat <= 0` comparisons in both the create and update code paths.

Fixes NousResearch#6709
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.

Cron Create Fails with Model Parameter (TypeError)

1 participant