📝 Bug Description
TestConcurrentFinalizeElectsExactlyOneWriter (internal/cli/review_lock_contention_test.go) fails intermittently in the hosted Unit Tests lane. We have observed two occurrences on unrelated PRs within ~13 hours, in both cases while every other lane (Windows Runtime, Darwin, all E2E lanes, organic runtimes) passed and recent main runs were green:
Both PRs touch entirely different subsystems (doctor symlink handling and Git object-format lookup respectively), so the failure does not track either change. The assertion message in both logs is the same shape:
review_lock_contention_test.go:266: approved compact authority survived at
/tmp/TestConcurrentFinalizeElectsExactlyOneWriter<suffix>/.git/gentle-ai/review-transactions/v2/review-986db52f8b6e253d: <nil>
This points at a race window in the concurrent finalize election: under contention, one writer observes the approved compact authority as absent (<nil>) where the test requires it to have survived.
The subsystem overlaps open #3572 (late finalize recreating burned lineage), but that issue reports a user-facing behavioral defect while this is an intermittent assertion failure of the contention test itself, so they may share a root without being the same report. The closed history of this area (#2181, #1982, #1861) shows prior races were each classified and fixed individually; this tracker exists so the intermittent stops consuming required merge-check lanes one PR at a time.
🔄 Steps to Reproduce
Not reproduced locally; both occurrences are hosted-CI runs of the full unit suite. Reproduction attempt guidance: run go test ./internal/cli/ -run TestConcurrentFinalizeElectsExactlyOneWriter -count=100 on a loaded multi-core runner and inspect for the <nil> survival assertion at line 266.
✅ Expected Behavior
Either the election has no such race (test passes deterministically), or the test tolerates only legitimate interleavings explicitly, with any tolerated outcome documented in the test rather than masked by a retry.
❌ Actual Behavior
The required merge-check unit lane fails intermittently on unrelated changes, forcing re-runs and occasionally blocking unrelated contributions.
🌍 Environment
Hosted GitHub Actions Ubuntu runners; internal/cli/review_lock_contention_test.go; observed against current main ancestry of both PRs above.
💡 Logs / Error Output
--- FAIL: TestConcurrentFinalizeElectsExactlyOneWriter (0.54s)
review_lock_contention_test.go:266: approved compact authority survived at
/tmp/TestConcurrentFinalizeElectsExactlyOneWriter2238138274/004/.git/gentle-ai/review-transactions/v2/review-986db52f8b6e253d: <nil>
(Second occurrence shows the same shape with a different temp suffix and 0.58s.)
📝 Bug Description
TestConcurrentFinalizeElectsExactlyOneWriter(internal/cli/review_lock_contention_test.go) fails intermittently in the hosted Unit Tests lane. We have observed two occurrences on unrelated PRs within ~13 hours, in both cases while every other lane (Windows Runtime, Darwin, all E2E lanes, organic runtimes) passed and recentmainruns were green:Both PRs touch entirely different subsystems (doctor symlink handling and Git object-format lookup respectively), so the failure does not track either change. The assertion message in both logs is the same shape:
This points at a race window in the concurrent finalize election: under contention, one writer observes the approved compact authority as absent (
<nil>) where the test requires it to have survived.The subsystem overlaps open #3572 (late finalize recreating burned lineage), but that issue reports a user-facing behavioral defect while this is an intermittent assertion failure of the contention test itself, so they may share a root without being the same report. The closed history of this area (#2181, #1982, #1861) shows prior races were each classified and fixed individually; this tracker exists so the intermittent stops consuming required merge-check lanes one PR at a time.
🔄 Steps to Reproduce
Not reproduced locally; both occurrences are hosted-CI runs of the full unit suite. Reproduction attempt guidance: run
go test ./internal/cli/ -run TestConcurrentFinalizeElectsExactlyOneWriter -count=100on a loaded multi-core runner and inspect for the<nil>survival assertion at line 266.✅ Expected Behavior
Either the election has no such race (test passes deterministically), or the test tolerates only legitimate interleavings explicitly, with any tolerated outcome documented in the test rather than masked by a retry.
❌ Actual Behavior
The required merge-check unit lane fails intermittently on unrelated changes, forcing re-runs and occasionally blocking unrelated contributions.
🌍 Environment
Hosted GitHub Actions Ubuntu runners;
internal/cli/review_lock_contention_test.go; observed against currentmainancestry of both PRs above.💡 Logs / Error Output
(Second occurrence shows the same shape with a different temp suffix and 0.58s.)