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
increase request size limit and handle big files better during project mapping
Dane Schneider5a9e98504d7f
diff --git a/app/cli/lib/context_load.go b/app/cli/lib/context_load.goindex 19de6b3a..96e73201 100644--- a/app/cli/lib/context_load.go+++ b/app/cli/lib/context_load.go@@ -457,6 +457,10 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {defer contextMu.Unlock()if params.DefsOnly {+ if !shared.HasFileMapSupport(path) {+ size = 0+ }+if size > shared.MaxContextBodySize {mapFilesSkippedTooLarge = append(mapFilesSkippedTooLarge, struct {Path string@@ -473,8 +477,9 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {}content := string(fileContent)- if mapSizeExceeded {+ if mapSizeExceeded || !shared.HasFileMapSupport(path) {content = ""+ size = 0}mapInputsByPath[mapInputPath][path] = contentdiff --git a/app/server/setup/setup.go b/app/server/setup/setup.goindex 3b8d7370..8da8438e 100644--- a/app/server/setup/setup.go+++ b/app/server/setup/setup.go@@ -86,8 +86,8 @@ func StartServer(handler http.Handler, configureFn func(handler http.Handler) ht// Add logging middleware before the maxBytes middlewarehandler = loggingMiddleware(handler)- // Apply the maxBytesMiddleware to limit request size to 100 MB- handler = maxBytesMiddleware(handler, 100<<20) // 100 MB limit+ // Apply the maxBytesMiddleware to limit request size to 1 GB+ handler = maxBytesMiddleware(handler, 1000<<20) // 1 GB limitif configureFn != nil {handler = configureFn(handler)@@ -191,6 +191,9 @@ func waitForActivePlans() chan struct{} {func maxBytesMiddleware(next http.Handler, maxBytes int64) http.Handler {return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ // log the size of the request body+ log.Printf("Request body size: %d", r.ContentLength)+r.Body = http.MaxBytesReader(w, r.Body, maxBytes)next.ServeHTTP(w, r)})