Agent / Task 是父 runtime 调度子 agent 的入口。此前 ZCode 在工具层给
Agent 设置固定 600000ms 超时;当前目标是移除这层固定墙钟限制,避免长时间
但仍健康运行的子 agent 被父工具执行器提前判定为 tool_timeout。
Agent / Task 不设置固定工具执行超时。Agent / Task 调用。onSessionReady 等待都属于前台调用的
可取消、可检测 inactivity 生命周期;Ready 只是 SubagentSpawned 的发布屏障,不是
abort/watchdog 的安装边界。后台 subagent 的生命周期继续由 SubagentPort / runtime task registry 管理,
不通过工具执行器的固定 timeout 清理。
register task -> child setup/persist/resume -> onSessionReady -> foreground/background race -> settle
^ ^ ^ ^
| | | |
+------------- parent abort + inactivity watchdog -----------------+
pre-ready 阶段收到父 abort 或 inactivity timeout 时,外层 Agent / Task 必须及时失败,
清理未发布的 runtime task,不能继续等待 child 主动调用 onSessionReady。
foreground task 转为 background 后,child tool mirror 的 background provenance 必须在
每条事件发出时读取 runtime task registry 当前状态;不能复用 child 启动时的布尔快照。
因此前台阶段的事件不带 background: true,切后台后的迟到事件必须带
background: true,允许父 turn 结束后继续投影真实 terminal lifecycle。
120000ms 前台自动转后台逻辑。subagents.backgroundEnabled 默认关闭的临时策略。timeout: { kind: "none" },不能让无 timeout 工具回退到
executor 默认 timeout。Agent / Task 的 provider contract 不再暴露 timeoutMs,避免模型或 UI 误以为
subagent 有固定 10 分钟上限。AbortSignal 仍必须能取消等待中的 handler。ToolTimeout 原因。