issue #189 grill定案——用asyncio.shield保护delegate task的in-flight工具调用 #196
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/189-delegate-task-cancellation-shield"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
grill issue #189(评估:task.cancel()可能中断已生效副作用工具调用)定案:用
asyncio.shield()保护delegate task中正在执行的工具调用,不被取消打断。核实确认
task.cancel()是真正的asyncio.Task.cancel(),可在subagent.py::run_delegated_task循环体任意 await 点(含call_host_tool工具调用执行中途)抛出CancelledError。零host接入意味着当前没有真实副作用工具,但 issue #188(已合并)新增的"真人活跃"自动抢占触发源大概率复用同一条取消路径,且不经模型识别、drive_tick周期性运行暴露窗口更大——"取消撞上工具调用执行中"这个场景的触发概率会实质性上升,现在就把保护机制设计好。用
asyncio.shield()包住call_host_tool那次 await:取消时外层循环仍会立刻识别取消并停止继续,但被shield保护的工具调用本身会在后台跑完、不被从中打断,确保副作用完整生效而非半途而废。不需要host配合(不用给工具标记"是否有副作用"),也不需要重新设计取消入口。issue #189 已从评估票转为实现票。
Changes
ADR-0020 追加一条更新节记录这次定案,append-only。
Test plan
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.