fix(agent): stream loop abort, mid-stream retry parity, collector cleanup (#376)

* fix(agent): align stream retry abort and event collection

* fix(agent): cancel stream on loop detect, harden retry and tool events

* fix(agent): drain previous stream before retry

* fix(lint): ctx ci lint

---------

Co-authored-by: 晨苒 <16112591+chen-ran@users.noreply.github.com>
This commit is contained in:
Fodesu
2026-04-18 03:19:58 +08:00
committed by GitHub
parent b534248e19
commit db777b98ac
5 changed files with 587 additions and 47 deletions
+18 -10
View File
@@ -488,17 +488,25 @@ func (m *Manager) RunningTasksSummary(botID, sessionID string) string {
defer m.mu.Unlock()
var lines []string
for _, t := range m.tasks {
if t.BotID == botID && t.SessionID == sessionID && t.Status == TaskRunning {
desc := t.Description
if desc == "" {
desc = truncate(t.Command, 80)
}
lines = append(lines, fmt.Sprintf("- [%s] %s (started %s ago, output: %s)",
t.ID, desc,
time.Since(t.StartedAt).Round(time.Second),
t.OutputFile,
))
t.mu.Lock()
matches := t.BotID == botID && t.SessionID == sessionID && t.Status == TaskRunning
id := t.ID
desc := t.Description
command := t.Command
startedAt := t.StartedAt
outputFile := t.OutputFile
t.mu.Unlock()
if !matches {
continue
}
if desc == "" {
desc = truncate(command, 80)
}
lines = append(lines, fmt.Sprintf("- [%s] %s (started %s ago, output: %s)",
id, desc,
time.Since(startedAt).Round(time.Second),
outputFile,
))
}
if len(lines) == 0 {
return ""