Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

CLI: Fix for rare auto-load context timeout error when no files are loaded. Server: Fix for auto-load context error: 'Error decoding response → EOF'

Dane Schneidere255bc0206e4
diff --git a/app/cli/lib/context_auto_load.go b/app/cli/lib/context_auto_load.go
index 303a5522..f1692d75 100644
--- a/app/cli/lib/context_auto_load.go
+++ b/app/cli/lib/context_auto_load.go
@@ -130,14 +130,7 @@ func AutoLoadContextFiles(ctx context.Context, files []string) (string, error) {
}
}
- if len(loadContextReqs) == 0 {
- // If we have no new files to load, we can just display skip info.
- if len(filesSkippedTooLarge) > 0 || len(filesSkippedAfterSizeLimit) > 0 {
- // Print skip info only
- return getSkippedFilesMsg(filesSkippedTooLarge, filesSkippedAfterSizeLimit, nil, nil), nil
- }
- }
-
+ // even if there are no files to load, we still need to hit the API endpoint because the stream is waiting on a channel for the autoload to finish
res, apiErr := api.Client.AutoLoadContext(ctx, CurrentPlanId, CurrentBranch, loadContextReqs)
if apiErr != nil {
return "", fmt.Errorf("failed to load context: %v", apiErr.Msg)
diff --git a/app/server/handlers/plans_exec.go b/app/server/handlers/plans_exec.go
index df9ce117..2a0fe3c1 100644
--- a/app/server/handlers/plans_exec.go
+++ b/app/server/handlers/plans_exec.go
@@ -459,6 +459,23 @@ func AutoLoadContextHandler(w http.ResponseWriter, r *http.Request) {
}
if res == nil {
+ // the client will treat this as a no-op
+ markdownRes := shared.LoadContextResponse{
+ TokensAdded: 0,
+ TotalTokens: 0,
+ MaxTokensExceeded: false,
+ MaxTokens: 0,
+ Msg: "",
+ }
+
+ bytes, err := json.Marshal(markdownRes)
+ if err != nil {
+ log.Printf("Error marshalling response: %v\n", err)
+ http.Error(w, "Error marshalling response", http.StatusInternalServerError)
+ return
+ }
+
+ w.Write(bytes)
return
}
diff --git a/releases/cli/versions/2.1.2.md b/releases/cli/versions/2.1.2.md
new file mode 100644
index 00000000..176180ee
--- /dev/null
+++ b/releases/cli/versions/2.1.2.md
@@ -0,0 +1 @@
+- Fix for rare auto-load context timeout error when no files are loaded.
\ No newline at end of file
diff --git a/releases/server/versions/2.1.2.md b/releases/server/versions/2.1.2.md
new file mode 100644
index 00000000..26ec287b
--- /dev/null
+++ b/releases/server/versions/2.1.2.md
@@ -0,0 +1 @@
+- Fix for auto-load context error: 'Error decoding response → EOF'
\ No newline at end of file