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
Fix for occasional "Stream buffer tokens too high" error really fixes #34.
Dane Schneiderf0751382f8b0
diff --git a/app/server/model/plan/build_fix_stream.go b/app/server/model/plan/build_fix_stream.goindex a29efe97..742bc92d 100644--- a/app/server/model/plan/build_fix_stream.go+++ b/app/server/model/plan/build_fix_stream.go@@ -102,7 +102,7 @@ func (fileState *activeBuildStreamFileState) listenStreamFixChanges(stream *openfileState.activeBuild.FixBufferTokens++// After a reasonable threshhold, if buffer has significantly more tokens than original file + proposed changes, something is wrong- cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 2)+ cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 20)if fileState.activeBuild.FixBufferTokens > 500 && fileState.activeBuild.FixBufferTokens > cutoff {log.Printf("File %s: Stream buffer tokens too high\n", filePath)log.Printf("Current file tokens: %d\n", fileState.activeBuild.CurrentFileTokens)diff --git a/app/server/model/plan/build_stream_line_nums.go b/app/server/model/plan/build_stream_line_nums.goindex 2efb9b11..1b7cfa7a 100644--- a/app/server/model/plan/build_stream_line_nums.go+++ b/app/server/model/plan/build_stream_line_nums.go@@ -107,7 +107,7 @@ func (fileState *activeBuildStreamFileState) listenStreamChangesWithLineNums(strfileState.activeBuild.WithLineNumsBufferTokens++// After a reasonable threshhold, if buffer has significantly more tokens than original file + proposed changes, something is wrong- cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 2)+ cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 20)if fileState.activeBuild.WithLineNumsBufferTokens > 500 && fileState.activeBuild.WithLineNumsBufferTokens > cutoff {log.Printf("File %s: Stream buffer tokens too high\n", filePath)log.Printf("Current file tokens: %d\n", fileState.activeBuild.CurrentFileTokens)