Skip to content

fix(task-loop): cancel scheduler task on round timeout - #553

Open
openjiuwen-sync-bot[bot] wants to merge 1 commit into
openJiuwen-ai:developfrom
openjiuwenai:sync/pr-2344
Open

fix(task-loop): cancel scheduler task on round timeout#553
openjiuwen-sync-bot[bot] wants to merge 1 commit into
openJiuwen-ai:developfrom
openjiuwenai:sync/pr-2344

Conversation

@openjiuwen-sync-bot

@openjiuwen-sync-bot openjiuwen-sync-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Paired: GitHub #553GitCode !2344

What type of PR is this?

/kind fix

Self-checklist:(请自检,在[ ]内打上x,我们将检视你的完成情况,否则会导致pr无法合入

    • 设计:PR对应的方案是否已经经过Maintainer评审,方案检视意见是否均已答复并完成方案修改
    • 测试:PR中的代码是否已有UT/ST测试用例进行充分的覆盖,新增测试用例是否随本PR一并上库或已经上库
    • 验证:PR描述信息中是否已包含对该PR对应的Feature、Refactor、Bugfix的预期目标达成情况的详细验证结果描述
    • 接口:是否涉及对外接口变更,相应变更已得到接口评审组织的通过,API对应的注释信息已经刷新正确
    • 文档:是否涉及官网文档修改,如果涉及请及时提交资料到Doc仓

Linked Closing Issues:

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@openjiuwen-collaboration-bot

openjiuwen-collaboration-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

head_sha: 532c3bf55b6a855974b312cf1da76cbb6754799c

变更摘要

本 PR 修复了任务循环轮次超时后未真正取消调度任务的问题:此前 wait_completion 超时仅返回错误字典,实际执行任务的调度器任务仍可能继续运行。此次改动将 completion_timeout 扩展为可空的 Optional[float]None 表示不限制),在超时时通过 TaskLoopEventHandler 主动取消该轮次的调度任务,并将输入提交改为同步注册以确保超时计时从任务注册后开始;同时把各类失败结果统一为包含 outputresult_typeerror 的结构,NativeHarness 的慢轮次日志任务也改为在超时阈值为 None 时不再创建。

主要改动

  • 支持无限制的完成超时:将 DeepAgentConfig.completion_timeoutDeepAgentSpec.completion_timeoutfloat 改为 Optional[float] / float | None,并补充 None means no limit 的语义说明。
  • 超时后取消调度任务TaskLoopEventHandler.wait_completion 捕获 TimeoutError 后调用新增的 _cancel_timed_out_round,通过 task_scheduler.cancel_task(task_id) 取消该轮调度任务(带 _CANCEL_WAIT_TIMEOUT = 1.5 秒上限),并返回标准化错误结果。
  • 同步注册轮次任务TaskLoopController.submit_round 改为直接调用 self._event_queue.publish_event 完成同步注册,新增 _round_task_ids 记录 round_id → task_id,确保完成超时计时在调度任务存在后才开始。
  • 统一错误结果结构:新增 _error_result 辅助函数,将 no LoopCoordinatortask_manager is None、输入处理失败等结果统一为包含 output/result_type/error 的字典,避免下游 answer-stream 适配器丢弃错误信息。
  • 条件化慢轮次日志NativeHarness_slow_round_log_after_seconds 改为 float | None,仅当其非 None 时创建 slow_log_task,并在 _log_slow_round_until_done 中对 None 直接返回。

@openjiuwen-collaboration-bot

openjiuwen-collaboration-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

head_sha: 532c3bf55b6a855974b312cf1da76cbb6754799c

代码审查

✅ 未发现问题

@openjiuwen-collaboration-bot

Copy link
Copy Markdown

head_sha: 532c3bf55b6a855974b312cf1da76cbb6754799c

任务名称 结果 日志操作
静态检查 ❌FAILED 点此跳转
禁用词扫描 N/A N/A
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A

A timed-out task-loop round only returned {"error": "completion_timeout"}
and left the scheduler task running in the background. The answer-stream
adapter drops bare error dicts, so callers saw an empty success while the
LLM work kept going.

- TaskLoopEventHandler tracks the registered scheduler task id per round
  and, on timeout, requests a coordinator abort plus
  task_scheduler.cancel_task; cleanup is bounded to 1.5s and spills to a
  background done-callback so the timeout error still returns promptly.
- Timeout and submit-failure paths now return a standard
  output/result_type/error dict so the output layer surfaces the error.
- TaskLoopController.submit_round uses the synchronous EventQueue publish
  API so the completion timeout cannot start before the task id is
  registered, while preserving event ordering and error wrapping.
- DeepAgentConfig/DeepAgentSpec accept completion_timeout=None to disable
  the limit; NativeHarness keeps its non-terminating slow-round warning
  contract (None disables the warning task).

Update API docs, S_12/S_18 specs, and add F_80 feature notes.
@openjiuwen-collaboration-bot

Copy link
Copy Markdown

head_sha: 202b87fa0785ee417e48ff905343b97140d671e5

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 N/A N/A
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: claw-bench全量测试,执行一部分后不再有内容回复,中途停止执行了

2 participants