fix(server): close task event streams when the client only wants a replay
Interrupted runs often have no done event, so a refresh replay would otherwise hold the SSE connection open. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -502,6 +502,10 @@ func (s *Server) handleTaskRunEvents(w http.ResponseWriter, r *http.Request) {
|
||||
if err := writeStoredEvents(replay); err != nil {
|
||||
return
|
||||
}
|
||||
// 刷新后只重放已落库事件,避免 interrupted 任务没有 done/error 时把连接挂住。
|
||||
if r.URL.Query().Get("replay_only") == "1" {
|
||||
return
|
||||
}
|
||||
for _, stored := range replay {
|
||||
if stored.Event.Type == stream.EventDone || stored.Event.Type == stream.EventError {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user