Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

test(daemon): fix flaky TestLocalPathLockerSerializes (#10148)

Jiayuan Zhangccd3bc5c6d54
diff --git a/server/internal/daemon/local_directory_test.go b/server/internal/daemon/local_directory_test.go
index 555d0ab0c0..8f319da8b4 100644
--- a/server/internal/daemon/local_directory_test.go
+++ b/server/internal/daemon/local_directory_test.go
@@ -422,8 +422,9 @@ func TestLocalPathLockerSerializes(t *testing.T) {
done := make(chan error, 1)
go func() {
rel, err := locker.Acquire(context.Background(), path, "task-2", func(holder string) {
- waitCalls.Add(1)
+ // Store before Add: the main goroutine polls waitCalls, then reads sawHolder.
sawHolder.Store(holder)
+ waitCalls.Add(1)
})
if err != nil {
done <- err