fix(agent-runtime): bound trusted extension lifecycle waits - #788
Conversation
Retire pending hook dispatches on cancellation and disposal so stale results cannot continue a stopped turn. Bound startup and shutdown waits and make concurrent shutdown idempotent. Report deferred event registrations without disabling supported hooks, and preserve existing result folding and fail-open behavior. fixes vastsa#787
|
pr 最近有点多,慢慢合,感谢时间! |
|
核查过了:问题真实,修法也是点对点的,但当前 head 不满足落地门禁。 根因确认(main): 落地阻塞:与最新 main 冲突(GitHub 另请确认/跟进两点
rebase 之后我做集成验证(typecheck + desktop 测试 + |
Preserve the trusted-extension lifecycle fix and both sides of the E2E and decision-log additions when integrating current main. This removes the documentation conflicts blocking review without changing runtime behavior.
Preserve the existing lifecycle fix while integrating current main. Own cancellation of SDK subprocesses, prompts, tool payloads, and late continuations without imposing an event deadline on legitimate long tasks. Refs vastsa#816
Refresh the existing PR candidate with current main while preserving both delivery-document additions. Refs vastsa#816
问题与改动
可信扩展原先可能在 Stop 或销毁后继续运行:旧命令仍可弹窗、发送消息、发布工具进度,
pi.exec子进程也可能遗留到下一次操作。本 PR 完成 #787 的有界生命周期等待,并补齐 #816 的副作用归属和取消清理。
改动
pi.exec管理其创建的进程组/进程树并在操作退役时清理;销毁等待已登记进程结束并保留清理错误诊断。waitForIdle、newSession、fork、sendUserMessage、模型及会话名操作传播取消;等待请求前 hook 时停止,不再请求模型,并保留用户消息供后续回合使用。兼容性与边界
通知、启动和关闭 handler 从无界等待改为每个 handler 30 秒预算。 模块加载与工厂初始化各有独立的 30 秒预算,handler 内等待 UI 回答也计入事件预算。
命令和工具不增加固定 30 秒期限,合法长任务可运行至完成、显式取消、Stop 或销毁。同步 JavaScript、直接 Node API、主动逃逸进程组不能被强制终止;已经进入 Host 的事务不能回滚,但取消后不会继续本地状态提交或队列优先级续接。
无数据库迁移、不新增权限,Native Pi 生命周期不在本 PR 范围。
验证
build:js、Desktop typecheck、lint、docs:check、agent-policy、架构检查及 host-core build 通过;最后的小范围 Runtime 补充后只重跑受影响的定向测试与 typecheck。Closes #787
Closes #816