zcbot/scripts
caoqianming 1646205364 fix(scheduler): 定时任务超时被掐断时记 error 而非误吞成 ok(bump 0.32.2)
实测 bug:isolated 定时 job 跑满 timeout_seconds 被协作式 cancel 后,
_run_agent_bg 对 ok/cancelled 都把 run_status 收回 idle(DB 不可区分),
而 _execute_scheduled_job 收尾只判 run_status=="error",于是超时中断被落成
last_status="ok" —— 掩盖"跑到一半没写 sections/没推送",且不计连续失败、
不触发兜底。复盘 job e621c8a6「每日水泥科研简报」:timeout=600s,task
创建→last_run_at 正好 600.0s,agent 停在"按期刊打印 38 篇摘要"(还在取数)。

修:超时分支置 timed_out 标志,run 收尾后若 timed_out → record_result(
status="error", 半成品不投递 notify)并直接返回。复用既有 error 语义(计入
consecutive_failures、到阈值自动停用、前端 crons 显示「上次失败」)。不动
_run_agent_bg 的 idle-on-cancel 共享语义(HTTP cancel/drain 也依赖)。

配套:PROGRESS/RUN 故障兜底各加一条;诊断脚本 scripts/diag_sched_e621.py
(dump 输出 scripts/_*.txt 入 gitignore)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 14:35:40 +08:00
..
_smoke_proposal_diagrams.py
backfill_chat_cost_cache_discount.py
backfill_tool_message_name.py
diag_dump_task.py
diag_error_retry.py
diag_run_python_empty.py
diag_run_python_trace.py
diag_sched_e621.py fix(scheduler): 定时任务超时被掐断时记 error 而非误吞成 ok(bump 0.32.2) 2026-06-29 14:35:40 +08:00
diag_search_args.py
diag_tool_repeat.py
diag_wechat_push.py fix(wechat,email): host-side 文件工具翻译容器路径,修复附件发不出 + bump 0.24.1 2026-06-24 14:02:48 +08:00
diag_wecom.py fix(wecom): diag_wecom 加 sys.path 仓库根 + 手动 .env 兜底(直跑不再 ModuleNotFoundError)+ bump 0.26.5 2026-06-25 10:16:17 +08:00
optimize_arch_ppt.py
probe_clawbot.py
probe_clawbot_chat.py
probe_clawbot_clientid.py
probe_clawbot_file.py
probe_clawbot_stream.py
probe_clawbot_token.py
probe_seedream_i2i.py
smoke_files_rename.py
smoke_look_at_image.py
smoke_paper_skill.py
smoke_scheduler.py
smoke_scientific_skills.py
smoke_seedance.py
smoke_seedream.py