open-code-review/internal/llmloop
Qiaochu Hu 9f0f63d5ab
fix(llmloop): drain per-file comment work without racing pool submissions (#449)
executeSubtask called the pool-wide CommentWorkerPool.Await() from each
per-file goroutine before running the review filter, while other files'
tool-use loops were still calling Submit(). The pool's own contract
forbids Await concurrent with Submit: both use the same sync.WaitGroup,
so an Add landing while Wait is blocked panics with "Add called
concurrently with Wait" or "WaitGroup is reused before previous Wait
has returned". The panic is recovered by the subtask wrapper, so the
symptom is a spurious per-file failure (or, depending on the
interleaving, a corrupted counter that hangs the final Await).

Add SubmitFor/AwaitKey so a caller can drain only the units submitted
under one key. The review path keys submissions by the reviewed file's
path: a file's loop submits all its async comment work before its
AwaitKey runs, so the per-key WaitGroup Add/Wait pairing is race-free,
and draining no longer waits for (or crashes into) other files'
in-flight submissions. The pool-wide Await remains for the end-of-run
call sites, where all submissions have finished.
2026-07-22 20:39:45 +08:00
..
compression.go refactor(agent,scan): share one 80% token threshold (#421) 2026-07-21 16:57:28 +08:00
compression_test.go refactor(agent,scan): share one 80% token threshold (#421) 2026-07-21 16:57:28 +08:00
init_test.go fix(session): isolate test sessions to test-sessions subdirectory 2026-06-30 13:23:21 +08:00
loop.go fix(llmloop): drain per-file comment work without racing pool submissions (#449) 2026-07-22 20:39:45 +08:00
loop_test.go fix(llmloop): guard nil tool-call arguments map to prevent panic (#393) 2026-07-21 13:24:50 +08:00
pool.go fix(llmloop): drain per-file comment work without racing pool submissions (#449) 2026-07-22 20:39:45 +08:00
pool_test.go fix(llmloop): drain per-file comment work without racing pool submissions (#449) 2026-07-22 20:39:45 +08:00
runner_test.go fix(llmloop): scope async memory compression to each RunPerFile conversation (#395) 2026-07-21 15:42:35 +08:00