Repository navigation
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/core/cron/manager.py" line_range="189" />
<code_context>
persistent: bool = True,
run_once: bool = False,
run_at: datetime | None = None,
+ interval_seconds: int | None = None,
) -> CronJob:
# If run_once with run_at, store run_at in payload for later reference.
</code_context>
<issue_to_address>
**issue (bug_risk):** The new interval capability is not propagated to the built-in future-task tool: its create and edit paths still require a Cron expression and never pass `interval_seconds`. An interval task created through the WebUI therefore cannot be edited through the agent tool, even for metadata-only changes, because the tool rejects it with `cron_expression is required when run_once=false`.
**Triggers:** When an interval task is edited through the built-in future-task tool.
**Suggested fix:** Teach the tool's create/edit validation and update payloads about `interval_seconds`, or explicitly reject interval tasks with a clear unsupported-schedule error.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and this changes persisted scheduling state and the production scheduler, so an incorrect interval or anchor could cause active-agent jobs to run at the wrong times and send task results or other notifications before the change is reverted. Reverting restores the old scheduling code, but it cannot undo jobs that already ran or messages that were already sent.
Blocking findings: astrbot/core/cron/manager.py:189
|
Addressed the Sourcery finding in 0226878:
@Soulter Is there anything else needed for this PR? |
…nterval # Conflicts: # docs/en/use/proactive-agent.md # docs/zh/use/proactive-agent.md
|
@LIghtJUNction This implements the approach from your analysis in #10363 and is now conflict-free with master. Most of the diff is tests (~510 of ~830 lines); production changes are ~270 lines. Could a maintainer approve the CI run and take a look when convenient? Thanks! |
|
@RC-CHN @anka-afk This fixes #10363 by scheduling fixed intervals with |
…nterval # Conflicts: # astrbot/core/cron/manager.py
|
Friendly ping: the CI workflows for this PR are still waiting for maintainer approval ("action_required"), so they have not run yet. The branch is up to date with the latest master and has no conflicts. Could a maintainer please approve the workflow run? Thanks! |
|
@Soulter Could you approve the CI workflow run for this PR when you have a moment? Thanks! |
…nterval # Conflicts: # astrbot/core/cron/manager.py
Fixes #10363.
The WebUI converted fixed intervals into Cron field steps, so “every 40 minutes” ran at alternating 40/20-minute gaps, 60 minutes became 59/1, and 24 hours became 23/1. Interval tasks now use APScheduler's
IntervalTriggerwith a persisted UTC anchor.Modifications
Add nullable
interval_secondsandinterval_anchor_atcolumns with an idempotent SQLite migration. Existing jobs retain their Cron expressions and schedules.Run new interval jobs after one full interval. Restart and enable/disable preserve their phase and skip missed periods. Editing metadata keeps the anchor; changing the duration resets it. A day means 24 elapsed hours, including across DST.
Validate whole-minute intervals and reject invalid, oversized, or conflicting schedules before persistence, including disabled jobs. Both API families support explicitly clearing an interval when changing schedule types.
Submit structured intervals from the WebUI. Legacy
*/Njobs display and reopen as Custom Cron rather than promising a fixed interval.Regenerate the API client and update the Chinese/English instructions, including the current Extensions → Future Tasks navigation and migration guidance. Replace the outdated task screenshot with complete text instructions.
This is not a breaking change for existing schedules.
Verification steps and test results
bash scripts/run_pytests_ci.sh tests -qwith an isolated temporary test directory.node --test dashboard/tests/*.test.mjs.uv run ruff format .,uv run ruff check ., and all configured pre-commit hooks passed.pnpm --dir dashboard buildandpnpm --dir docs docs:buildpassed.*/40 * * * *schedule is labeled Custom Cron. No live model or messaging credentials were configured.Checklist
Summary by Sourcery
Preserve fixed scheduling intervals by storing UTC anchors and running them with elapsed-time interval triggers instead of Cron field steps.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: