handleSubagentDone translates a completed subagent check into the appropriate return value, surfacing error-status chats as errors.
( chat database.Chat, report string, )
| 1366 | // handleSubagentDone translates a completed subagent check into the |
| 1367 | // appropriate return value, surfacing error-status chats as errors. |
| 1368 | func handleSubagentDone( |
| 1369 | chat database.Chat, |
| 1370 | report string, |
| 1371 | ) (database.Chat, string, error) { |
| 1372 | if chat.Status == database.ChatStatusError { |
| 1373 | reason := strings.TrimSpace(report) |
| 1374 | if reason == "" { |
| 1375 | reason = "agent reached error status" |
| 1376 | } |
| 1377 | return database.Chat{}, "", xerrors.New(reason) |
| 1378 | } |
| 1379 | return chat, report, nil |
| 1380 | } |
| 1381 | |
| 1382 | func (p *Server) closeSubagent( |
| 1383 | ctx context.Context, |
no test coverage detected