wiki-query
PApaperclipai/paperclip112k2,549 new stars in the last 7 days
Use when a campaign is running and work must be dispatched, retried or throttled — when a shard sits in running with no heartbeat, when a lease expired and the result was duplicated, when retries storm the source APIs, when budget or concurrency must be cut mid-campaign, or when someone wants to fix a stuck task by editing state directly.
调度器是唯一能改状态的人。 模型、脚本、人都不直接写 task 状态;
所有状态变化只由 science_campaign_run 的动作(claim / heartbeat / complete / fail /
release)产生。手工改 state 会让事件流与状态表对不上,之后每一次重跑都不可信。
leaseMs 默认 120000(2 分钟)。owner、leaseUntil、attempt。三项缺一,这次领取无效。heartbeat,间隔取 leaseMs/3(约 40 秒)。不要等到快到期才续。心跳要带三样:taskId、attempt、progress(已完成/总数)。
只发空心跳会被判为僵尸——有租约没进展,与没心跳等价。
| 现象 | 判断 | 动作 |
|---|---|---|
| 有心跳、progress 在涨 | 正常 | 继续 |
| 有心跳、progress 不动超过 2 个周期 | 卡住 | 记录事件,下一轮换策略 |
| 无心跳、租约未到期 | 可能正在长调用 | 等到期,不要抢 |
| 无心跳、租约已到期 | 僵尸 | 允许重新领取,attempt+1 |
idempotencyKey 必须只由输入决定:taskId + 输入指纹。失败后按 attempt 指数退避,并在抖动区间内随机:
delay = min(base * 2^(attempt-1), cap) * (0.5 + random()*0.5)
base = 2s, cap = 120s
429 / 限流 / 超时 → 退避,属于可重试。401 / 403 / 参数非法 / 数据不存在 → 不退避,直接 fail 并写原因。defaultMaxAttempts 3。第三次失败后转 blocked,附最后一次错误摘要与事件 id。llmConcurrency(默认 6)约束;单片内并发不要再叠。排查顺序固定,不要跳步:
science_campaign_status 看统计:pending / running / done / failed / blocked 各多少。claimed → heartbeat* → failed(reason)。attempt 与 leaseUntil:是没领到、领了没续、还是续了没产出。不要用"再跑一次看看"代替排查——重跑会污染 attempt 计数与事件流。
| 禁止 | 原因 |
|---|---|
| 手工 UPDATE 任务状态 | 状态与事件流脱钩,无法复盘 |
| 重试时更换 idempotencyKey | 产生重复产物 |
| 把 leaseMs 调到几十分钟 | 掩盖"任务太大"的真实问题 |
| 失败后立刻全量重跑 | 打爆源配额,且丢掉已成功分片 |
| 用加并发解决积压 | 加重下游与限流 |
| 在报告里把 blocked 写成 done | 后续 gate 全部失真 |
PApaperclipai/paperclip112k2,549 new stars in the last 7 days
NEnexu-io/open-design107k1,289 new stars in the last 7 days
BYbytedance/deer-flow85k340 new stars in the last 7 days
BYbytedance/deer-flow85k340 new stars in the last 7 days
COcode-yeongyu/oh-my-openagent71k212 new stars in the last 7 days
COcoreyhaines31/marketingskills59k1,381 new stars in the last 7 days