TestPersistence_DiscoverLatestClaudeJSONL_Unit fails intermittently in the 'TestPersistence_ suite (-race)' job with:
testing.go:1369: TempDir RemoveAll cleanup: unlinkat /tmp/TestPersistence_DiscoverLatestClaudeJSONL_Unit<sub>NNNN/001: directory not empty
testing.go:1369: TempDir RemoveAll cleanup: unlinkat .../001/.local: directory not empty
Evidence it is a cleanup race, not a logic defect: on two consecutive runs of the SAME commit the failing subtests differed (run 1: newest_wins_on_mtime; run 2: agent_prefix_skipped and non_uuid_skipped). Something creates paths (note the .local directory) inside t.TempDir() AFTER the subtest returns, so Go's TempDir cleanup fails. Likely a background goroutine or lazily-started helper that keeps writing under the sandboxed HOME after the test body finishes.
Ask: make the discovery code under test stop writing after its context ends, or have the test wait for that worker to quiesce before returning (and if a helper must create HOME subdirs, create them inside the test body so cleanup owns them). This job is a required check on every PR, so the flake costs a re-run each time it hits — it surfaced today blocking #1765, which touches nothing in internal/session.
Adding to the conductor's known-flaky list meanwhile.
TestPersistence_DiscoverLatestClaudeJSONL_Unit fails intermittently in the 'TestPersistence_ suite (-race)' job with:
Evidence it is a cleanup race, not a logic defect: on two consecutive runs of the SAME commit the failing subtests differed (run 1: newest_wins_on_mtime; run 2: agent_prefix_skipped and non_uuid_skipped). Something creates paths (note the .local directory) inside t.TempDir() AFTER the subtest returns, so Go's TempDir cleanup fails. Likely a background goroutine or lazily-started helper that keeps writing under the sandboxed HOME after the test body finishes.
Ask: make the discovery code under test stop writing after its context ends, or have the test wait for that worker to quiesce before returning (and if a helper must create HOME subdirs, create them inside the test body so cleanup owns them). This job is a required check on every PR, so the flake costs a re-run each time it hits — it surfaced today blocking #1765, which touches nothing in internal/session.
Adding to the conductor's known-flaky list meanwhile.