fix(agent): 插话 - 独立运行时路径的送达与退回 (#673)

复现:Agent 运行中发送插话,独立 Agent 运行时(Pi)下既不送达模型也不退回用户,插话一直停在待送队列里。

原因与修法:插话送达点原本只有旧 Go 执行循环(advanceCloudAgent 开步前出队);Pi 运行时接手执行后调度循环不再推进。现把 Pi 路径的送达搬到 /model 模型步:出队、规范历史追加与 delivered 事件同在入队的一次 CAS 写入里,响应携带 steeringMessages 交给运行时 session.steer。完成、失败、取消、审批拒绝与步数耗尽统一退回;最终回答之后的插话在预算富余时续跑一步。完成闸一次带走多条插话时,合并后的续跑提示词也记入指纹,避免被恢复闸当成遗留提示词清空。
This commit is contained in:
jiabx
2026-10-05 13:39:57 +08:00
committed by GitHub
parent dd563d3373
commit 5bf838ebbe
6 changed files with 730 additions and 6 deletions

View File

@@ -162,7 +162,10 @@ type cloudAgentRuntime struct {
PiResumePrompt string `json:"piResumePrompt,omitempty"`
TransientReferences map[string]cloudAgentTransientReference `json:"transientReferences,omitempty"`
InterjectionIDs []string `json:"interjectionIds,omitempty"`
Events []CloudAgentEvent `json:"events"`
// 已送达插话正文的 SHA-256 指纹(有界)。运行时投影回写 canonical 时不带
// 来源标记,模型步按指纹补回 user_interjection,见 cloud_agent_interjection_pi.go。
DeliveredInterjectionDigests []string `json:"deliveredInterjectionDigests,omitempty"`
Events []CloudAgentEvent `json:"events"`
// PiAssistantResponses counts successful assistant message_end events from
// the Pi runtime. Completion must not be inferred from a clean Node exit:
// a provider/session error can otherwise be reported as a successful run.