Skip to content

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

Fix potential race condition/goroutine explosion in context update

Dane Schneiderf90c1f69ec0d
diff --git a/app/cli/lib/context_update.go b/app/cli/lib/context_update.go
index 7d59c106..fffa7e91 100644
--- a/app/cli/lib/context_update.go
+++ b/app/cli/lib/context_update.go
@@ -684,9 +684,9 @@ func checkOutdatedAndMaybeUpdateContext(doUpdate bool, maybeContexts []*shared.C
mapFileInfoByPath[path] = fileInfo
}
mu.Unlock()
-
- innerExistenceErrCh <- nil
}
+
+ innerExistenceErrCh <- nil
}(path)
}
@@ -753,7 +753,6 @@ func checkOutdatedAndMaybeUpdateContext(doUpdate bool, maybeContexts []*shared.C
}
mu.Lock()
- defer mu.Unlock()
totalMapPaths++
@@ -767,6 +766,8 @@ func checkOutdatedAndMaybeUpdateContext(doUpdate bool, maybeContexts []*shared.C
return
}
+ defer mu.Unlock()
+
if state.currentMapInputBatch.NumFiles()+1 > shared.ContextMapMaxBatchSize || state.totalMapSize+res.size > shared.ContextMapMaxBatchBytes {
state.currentMapInputBatch = shared.FileMapInputs{}
state.mapInputBatches = append(state.mapInputBatches, state.currentMapInputBatch)
diff --git a/releases/cli/versions/2.0.3.md b/releases/cli/versions/2.0.3.md
new file mode 100644
index 00000000..d49196f4
--- /dev/null
+++ b/releases/cli/versions/2.0.3.md
@@ -0,0 +1,2 @@
+- Fix potential race condition/goroutine explosion/crash in context update.
+- Prevent crash with negative viewport height in stream tui.