fix(tasks): 沉默跳过判为 SKIPPED + 超时拆出 TIMEOUT(补全 #41) - #46
Open
o00nmq wants to merge 1 commit into
Open
Conversation
…RROR 之前派发任务终态实质只由 endReason 决定:本分支已把 interrupted→SKIPPED,但主流的 "想过之后决定不回复"是 end_turn + 零产出,仍被误记为 COMPLETED。live 实测最近 500 条 派发任务 100% COMPLETED,其中 ~20% 整轮没发任何消息(都是有意的沉默跳过)。 - 新增 classifyDispatchedTaskStatus:在 endReasonToTaskStatus 之上叠加运行时信息—— 正常收尾但整轮无任何对外动作(没发消息、没贴表态)→ SKIPPED;error 且为超时 → TIMEOUT。 - 表态计入"对外动作":telegram/discord sendReaction 发 system.agent_reaction_sent, SentMessageCollector 累计 reactionCount(贴纸/媒体已走 allSent,故 sticker-only 仍 COMPLETED); telegram emoji=null 为撤销表态,不计。 - catch 路径:超时异常 → TIMEOUT(区别于泛 ERROR、以及用户取消的 SKIPPED)。 - isTimeoutError:宽口径超时判定(代码块执行超时 + LLM 调用超时)。 global-state 的启动对账 / 终态立即落盘沿用本分支已有实现,未改动。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit 567f548df82911a037f01fe986da72d7d81f0e47)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#41 给派发任务终态加了
endReasonToTaskStatus(interrupted→SKIPPED、error→ERROR、其余→COMPLETED)以及 global-state 的启动对账 / 终态立即落盘。但线上复查发现问题没真正解决:最近 500 条派发任务 100% 都是
COMPLETED,其中约 20%(98 条)整轮没发任何消息——这些是「想过之后决定不回复」的有意沉默(思考记录里明确写着「够了不用再接」「话题自然收尾」之类)。根因:真正的「沉默跳过」是
end_turn+ 零产出,不是interrupted(interrupted只在被新消息打断时才出现)。#41 只挂在interrupted上,所以主流的沉默跳过仍然落COMPLETED。改动
classifyDispatchedTaskStatus(endReason, { producedOutput, error }),在endReasonToTaskStatus之上叠加运行时信息:end_turn/max_turns)但整轮没有任何对外动作(没发消息、没贴表态)→SKIPPEDerror且错误是超时 →TIMEOUT(把执行 / LLM 超时从泛ERROR拆出来)endReasonToTaskStatustelegram/discord的sendReaction发system.agent_reaction_sent,SentMessageCollector累计reactionCount(贴纸 / 媒体已走allSent,故 sticker-only 仍COMPLETED;telegramemoji=null撤销表态不计)。TIMEOUT(区别于用户取消的SKIPPED和泛ERROR)。isTimeoutError:宽口径超时判定(代码块执行超时 + LLM 调用超时)。测试
end-reason-status.test.ts:新增classifyDispatchedTaskStatus用例(无产出→SKIPPED、有产出→COMPLETED、超时→TIMEOUT、interrupted 让路语义)。session-runner.test.ts:isTimeoutError+SentMessageCollector表态计数。platform-dedup.test.ts:telegram / discord 表态事件(含 telegramemoji=null不发事件)。验证
已在测试机(萩原)上线并验证:Telegram 连接正常、Restarts=0、无报错;新派发任务现在会正确出现
SKIPPED/TIMEOUT。🤖 Generated with Claude Code