Persist subagent intermediate messages for the agent tracker view.

This commit is contained in:
weichen
2026-09-29 17:54:23 +00:00
parent 0d74ec94dd
commit 16fbd70721
+8
View File
@@ -488,6 +488,14 @@ func (m *Manager) spawnSubagent(parentCtx context.Context, parent core.Run, name
m.st.UpdateRun(&child)
m.emit(child.ConversationID, child.ID, core.EvAgentResult, payload)
// 子代理中间过程落库(AgentTracker 弹窗的权威数据源;消息树带 run_id 归属)。
m.mu.Lock()
subParts := append([]core.Part{}, h.assistant...)
m.mu.Unlock()
if len(subParts) > 0 {
_ = m.st.AppendMessage(&core.Message{ConversationID: child.ConversationID, RunID: child.ID, Role: core.RoleAssistant, Parts: subParts})
}
m.mu.Lock()
delete(m.active, child.ID)
m.mu.Unlock()