fix(cron): wire max_tokens from per-job config into AIAgent constructor - #58582
fix(cron): wire max_tokens from per-job config into AIAgent constructor#58582AlexFucuson9 wants to merge 1 commit into
Conversation
run_job() reads several job-config keys (model, reasoning, toolsets, etc.) into the AIAgent constructor but never reads max_tokens. A cron job that sets max_tokens: 4096 gets it silently ignored, causing RuntimeError: Response remained truncated after 3 continuation attempts for long-running outputs. Fixes NousResearch#58423
Duplicate of #58440 — both fix #58423 by wiring |
|
Thanks for tracing the missing constructor forwarding; the diagnosis and one-line implementation are clear. This is an automated hermes-sweeper review. This change is being closed under the standing
For truncation cases, please use or improve the documented global Closed as not-planned per standing maintainer policy ( |
Summary
run_job()incron/scheduler.pyreads several job-config keys (model, reasoning_config, toolsets, etc.) into theAIAgent(...)constructor but never readsmax_tokens. A cron job that setsmax_tokens: 4096gets it silently ignored.Impact
Any cron job whose expected output exceeds the model's default max-output behavior fails with
RuntimeError: Response remained truncated after 3 continuation attempts— and settingmax_tokensin that job's config to fix it does nothing, silently.Fix
Added
max_tokens=job.get(max_tokens)to theAIAgent()constructor call inrun_job().Root Cause
AIAgent.__init__acceptsmax_tokens: int = Noneand the plumbing exists everywhere downstream (agent_init.py→build_api_kwargs()). The only missing link was the constructor call incron/scheduler.py.Fixes #58423