Bruno Clermont and Bruno Clermont
cde8940501
fix(agent): fix race in TestMaybeSummarize_LogsTriggerDecisionOverThreshold ( #1347 )
...
maybeSummarize spawns a background goroutine that logs via slog.Info
before calling the LLM provider -- correct, intentional async design,
not a bug. The test read the shared log buffer (buf.String(), inside
captureSlog) immediately after maybeSummarize returned, i.e. right
after the goroutine was merely spawned, not after it finished logging
-- an unsynchronized concurrent read/write on bytes.Buffer, caught by
go test -race. This was surfaced by an unrelated PR's CI run
(nextlevelbuilder/goclaw#1346 ), confirmed unrelated to that PR's
actual changes.
Moved the existing done-channel wait inside captureSlog's closure, so
the buffer read only happens after the background goroutine has
signalled it reached provider.Chat -- which happens strictly after
the slog.Info write on this path. Proper happens-before via the
channel, no sleep/poll, no production code changed.
Verified 10/10 passes under go test -race -count=10, plus full
package regression run clean.
Co-authored-by: Bruno Clermont <bruno.clermont@gmail.com >
2026-07-04 23:57:30 +07:00
..
2026-06-12 15:17:57 +07:00
2026-04-15 11:24:57 +07:00
2026-04-10 10:13:58 +07:00
2026-04-10 10:13:58 +07:00
2026-04-11 21:22:23 +07:00
2026-03-27 09:35:57 +07:00
2026-07-04 00:25:00 +07:00
2026-04-11 21:22:23 +07:00
2026-03-19 13:59:32 +07:00
2026-02-22 14:58:07 +07:00
2026-02-22 14:58:07 +07:00
2026-04-16 20:32:37 +07:00
2026-05-24 11:13:03 +07:00
2026-04-15 11:24:57 +07:00
2026-04-05 21:32:59 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 08:31:53 +07:00
2026-06-23 01:23:43 +07:00
2026-06-23 01:23:43 +07:00
2026-07-04 00:25:00 +07:00
2026-04-18 15:34:46 +07:00
2026-06-24 10:49:31 +07:00
2026-07-04 23:57:30 +07:00
2026-06-24 10:49:31 +07:00
2026-07-03 08:25:05 +07:00
2026-05-22 20:53:01 +07:00
2026-04-15 11:24:57 +07:00
2026-07-04 00:25:00 +07:00
2026-07-04 00:25:00 +07:00
2026-05-24 12:48:51 +07:00
2026-07-03 08:25:05 +07:00
2026-07-03 08:25:05 +07:00
2026-06-21 22:27:44 +07:00
2026-03-25 12:37:49 +07:00
2026-06-22 14:23:34 +07:00
2026-06-22 14:23:34 +07:00
2026-07-04 00:25:00 +07:00
2026-06-30 18:25:28 +07:00
2026-07-04 00:25:00 +07:00
2026-05-31 12:24:00 +07:00
2026-06-12 17:58:22 +07:00
2026-07-03 06:24:21 +07:00
2026-07-03 06:24:21 +07:00
2026-07-03 06:24:21 +07:00
2026-03-30 15:20:01 +07:00
2026-07-04 00:25:00 +07:00
2026-06-22 14:23:34 +07:00
2026-07-03 06:24:21 +07:00
2026-03-31 14:33:33 +07:00
2026-07-04 00:25:00 +07:00
2026-06-21 08:06:07 +07:00
2026-05-17 15:33:55 +07:00
2026-04-13 11:04:19 +07:00
2026-04-09 21:15:19 +07:00
2026-05-31 12:24:00 +07:00
2026-04-23 08:22:39 +07:00
2026-04-14 18:28:31 +07:00
2026-04-14 18:28:31 +07:00
2026-05-31 12:33:15 +07:00
2026-03-30 22:15:34 +07:00
2026-05-24 12:48:51 +07:00
2026-04-14 18:28:31 +07:00
2026-04-23 08:22:39 +07:00
2026-04-11 21:22:23 +07:00
2026-05-23 00:16:03 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-27 12:00:20 +07:00
2026-04-23 08:22:39 +07:00
2026-07-03 08:25:05 +07:00
2026-07-03 08:25:05 +07:00
2026-07-03 08:25:05 +07:00
2026-05-31 13:35:04 +07:00
2026-04-09 21:15:19 +07:00
2026-05-31 13:35:04 +07:00
2026-04-15 11:24:57 +07:00
2026-04-19 21:00:13 +07:00
2026-04-19 21:00:13 +07:00
2026-03-31 11:44:54 +07:00
2026-06-21 22:27:44 +07:00
2026-04-09 21:15:19 +07:00
2026-04-23 19:16:08 +07:00
2026-04-16 21:26:45 +07:00
2026-04-11 21:22:23 +07:00
2026-04-11 23:22:17 +07:00
2026-04-11 21:22:23 +07:00
2026-04-11 21:22:23 +07:00
2026-04-11 23:22:17 +07:00
2026-04-14 18:28:31 +07:00
2026-06-24 14:03:00 +07:00
2026-05-31 13:22:07 +07:00
2026-03-10 23:11:02 +07:00
2026-03-24 10:24:10 +07:00
2026-06-29 11:25:13 +07:00
2026-04-04 21:17:47 +07:00
2026-06-23 09:08:07 +07:00
2026-06-29 11:25:13 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-05-24 16:39:44 +07:00
2026-05-24 16:39:44 +07:00
2026-05-24 16:39:44 +07:00
2026-05-24 16:39:44 +07:00
2026-06-12 17:58:22 +07:00
2026-04-10 10:13:58 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-07-03 08:25:05 +07:00
2026-04-09 21:15:19 +07:00
2026-05-31 13:35:04 +07:00
2026-06-09 09:12:23 +07:00
2026-06-12 15:17:57 +07:00
2026-07-03 08:25:05 +07:00
2026-04-09 21:15:19 +07:00
2026-05-22 20:53:01 +07:00
2026-07-03 08:25:05 +07:00
2026-07-03 08:25:05 +07:00
2026-05-24 11:13:03 +07:00
2026-03-31 08:35:06 +07:00
2026-03-19 13:35:57 +07:00
2026-05-19 06:53:45 +07:00
2026-05-19 06:53:45 +07:00
2026-04-16 21:26:45 +07:00
2026-05-23 00:16:03 +07:00
2026-07-03 06:24:21 +07:00
2026-07-03 06:24:21 +07:00
2026-04-08 14:47:39 +07:00
2026-04-08 14:47:39 +07:00
2026-03-12 18:26:40 +07:00