Files
AstrBot/tests/unit
Yoshy 09a56127ad fix: apply max_agent_step config to cron and background task agents (#9801)
* fix: apply max_agent_step config to cron and background task agents

The cron (scheduled task) and background task wake-up paths hardcoded
step_until_done(30) since the "extract main agent" refactor (0c5308a),
ignoring provider_settings.max_agent_step.

Read the value via coerce_int_config so invalid values fall back to the
default with a warning instead of crashing or silently degrading.

Fixes #9800

* test: cover max_agent_step propagation in cron and background wake-ups

Add parametrized tests asserting step_until_done receives the configured
max_agent_step on both the cron and background task agent paths, with
fallback coverage for missing, boolean-polluted, and numeric-string
config values.

* fix: clamp max_agent_step to a minimum of 1 in cron and background wake-ups

Non-positive provider_settings.max_agent_step values previously reached
step_until_done as-is: the local runner skipped all steps and forced a
final response, while the DeerFlow runner raised ValueError. Pass
min_value=1 to coerce_int_config so zero/negative values are clamped to
a usable minimum, and cover the zero case in both unit test suites.
2026-08-26 10:11:00 +08:00
..