Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
add error handling for stream error
Dane Schneider476be4615aac
diff --git a/app/cli/stream_tui/update.go b/app/cli/stream_tui/update.goindex 40fb2709..86334a55 100644--- a/app/cli/stream_tui/update.go+++ b/app/cli/stream_tui/update.go@@ -334,8 +334,8 @@ func (m *streamUIModel) streamUpdate(msg *shared.StreamMessage, deferUIUpdate boreturn m.checkMissingFile(msg)case shared.StreamMessageReply:- log.Println("Stream message reply:")- log.Println(spew.Sdump(msg))+ // log.Println("Stream message reply:")+ // log.Println(spew.Sdump(msg))// ignore empty reply messagesif msg.ReplyChunk == "" {diff --git a/app/server/model/plan/tell_context.go b/app/server/model/plan/tell_context.goindex 76a9b1ac..4ea5f23e 100644--- a/app/server/model/plan/tell_context.go+++ b/app/server/model/plan/tell_context.go@@ -154,6 +154,8 @@ func (state *activeTellStreamState) checkAutoLoadContext() []string {return nil}+ log.Printf("%d existing contexts by path\n", len(contextsByPath))+// pick out all potential file paths within backticksmatches := pathRegex.FindAllStringSubmatch(activePlan.CurrentReplyContent, -1)diff --git a/app/server/model/plan/tell_stream_main.go b/app/server/model/plan/tell_stream_main.goindex 453e7681..a659d571 100644--- a/app/server/model/plan/tell_stream_main.go+++ b/app/server/model/plan/tell_stream_main.go@@ -87,6 +87,13 @@ mainLoop:log.Printf("Tell: error receiving stream chunk: %v\n", err)state.execHookOnStop(true)++ state.onError(onErrorParams{+ streamErr: fmt.Errorf("error receiving stream chunk: %v", err),+ storeDesc: true,+ canRetry: true,+ })+ // here we want to return no matter what -- state.onError will decide whether to retry or notreturn}diff --git a/app/server/types/active_plan.go b/app/server/types/active_plan.goindex 3a63722a..b879cdd9 100644--- a/app/server/types/active_plan.go+++ b/app/server/types/active_plan.go@@ -182,7 +182,7 @@ func (ap *ActivePlan) FlushStreamBuffer() {}}-const verboseStreamLogging = true+const verboseStreamLogging = falsefunc (ap *ActivePlan) Stream(msg shared.StreamMessage) {if verboseStreamLogging {