Skip to content

[Bug] FutureTask 创建成功但到点不触发(Linux + systemd + uv tool + Telegram) #6357

@heraclitus-1112

Description

@heraclitus-1112

What happened / 发生了什么

我在 Telegram 中让 AstrBot 创建未来提醒任务,create_future_task 调用成功,WebUI 的“未来任务管理”页面中也能看到任务被成功注册,但到了触发时间后任务并不会执行。

这不是单纯的“消息发送失败”问题,因为在触发时间窗口内,日志里完全没有出现任务被触发或执行的记录,例如:

  • 没有 CronJob triggered
  • 没有任务执行日志
  • 没有异常/traceback
  • 没有发送消息尝试

看起来像是:任务被成功写入了,但调度器没有在到点时真正执行它。

已确认事项

  1. 当前只有一个 AstrBot 进程在运行,不存在多实例混跑。
  2. systemctl status astrbot 显示服务为 active (running)
  3. which astrbotreadlink -f /root/.local/bin/astrbot 以及 systemd 的 ExecStart 都指向同一个 uv 环境。
  4. 主动能力已经开启。
  5. Telegram adapter 已正常运行。

Reproduce / 如何复现?

见上文

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

  • 操作系统:Ubuntu 22.04.5 LTS
  • 部署方式:uv tool + systemd
  • AstrBot 版本:4.20.0
  • Python 版本:3.12.13
  • 平台适配器:Telegram
  • systemd 启动命令:/root/.local/bin/astrbot run

OS

Linux

Logs / 报错日志

[2026-03-15 11:52:18.126] [Core] [INFO] [runners.tool_loop_agent_runner:657]: Agent 使用工具: ['create_future_task']
[2026-03-15 11:52:18.805] [Core] [INFO] [runners.tool_loop_agent_runner:703]: 使用工具: create_future_task, 参数: {'note': '提醒heraclituszh(狗修金)两分钟时间到了。请用丛雨的语气提醒他,比如“狗修金,两分钟到了哦~”', 'run_once': True, 'run_at': '2026-03-15T19:54:00+08:00', 'name': '两分钟提醒'}
[2026-03-15 11:52:18.811] [Core] [INFO] [runners.tool_loop_agent_runner:881]: Tool create_future_task Result: Scheduled future task 8d62c0b8-83c4-4dac-afbd-fdb40c52004d (两分钟提醒) one-time at 2026-03-15 19:54:00+08:00.

但是在实际触发时间窗口内查看原始日志:
journalctl -u astrbot --since "2026-03-15 11:53:30 UTC" --until "2026-03-15 11:55:30 UTC" --no-pager
输出为:
-- No entries --

我曾有一个触发时间处在astrbot关闭状态的未来提醒,后续检查日志时存在:

Run time of job 'CronJobManager._run_job (trigger: date[2026-03-15 19:33:00 UTC+08:00], next run at: 2026-03-15 19:33:00 UTC+08:00)' was missed by 0:18:22.038636

且部分日志被当成文本输出到tg回答上:

[CronJob] 20分钟提醒: 提醒heraclituszh(狗修金)20分钟时间到了。请用丛雨的语气提醒他,比如“狗修金,20分钟到了哦~” triggered at 2026-03-15T11:33:00.000000+00:00, I finished this job, here is the result: (准时出现)狗修金,20分钟到了哦~
(眨眨眼)时间过得真快呢,吾辈可是准时来提醒了。

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions