carlos / platform Public

Ledger · ci-timing-flakes-526

Human

<task-notification> <task-id>baqtx4fr1</task-id> <tool-use-id>toolu_01KK3JJUnn5tV3EGNp3Zw99r</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9fdb19f6-7964-4108-a723-1323c2914a76/tasks/baqtx4fr1.output</output-file> <status>completed</status> <summary>Background command "Wait for CI then merge if green and main unmoved" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>ad0d7849cb4a8efd7</task-id> <tool-use-id>toolu_01AvqnFwUEbmbQRYiytgf2UK</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9fdb19f6-7964-4108-a723-1323c2914a76/tasks/ad0d7849cb4a8efd7.output</output-file> <status>completed</status> <summary>Agent "Review CI flake fixes" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>I found one P1: the held-stream simulation lost the check that stream tasks end once the client goes, and I confirmed that with a mutation. Everything else is sound. **Scope.** I reviewed `git diff 74757d13..HEAD`, which touches five files, all `_test.go`, with no production change. `localHold.dialer` and `pinnedSettled` were already on main. All three commit subjects are under 80 characters. **What I ran** (Go cache was read-only in the sandbox, so these ran with the sandbox off): - The four activator tests plus `TestReleaseBuildPublishedBeforeExec`, `-count=5`: passed. - `TestReleaseLeaseLossUnprovenLeavesTheHold` under `-race`, `-count=20`: passed. - The two edge tests, `-count=3`, and under `-race`, `-count=2`: passed. The simulation now takes 0.25 s; the old version took 194 s. - Mutations on scratch copies, since deleted: - **Reopen delay of 170 ms, just past the 160 ms bound:** the new simulation catches it at seed 1. The old 185 ms bound would have let it through, so tightening the bound made the test stronger. - **A held task that stays alive until `MaxHold` after its client goes:** the new simulation **passes**. The old one failed with "stream tasks did not end". That is the P1 below. ## P1 **`internal/edge/heldstream_sim_test.go:350`.** The old code waited at most 5 s for the stream tasks after `cancel()` and failed "stream tasks did not end". The new `stop()` calls a bare `wg.Wait()`. Inside the bubble, virtual time runs freely while tasks sit on timers. So a `serveHeld` that ignores client cancellation and lingers until `MaxHold` (1 minute) just runs out that minute instantly, and the test passes. The fix is to keep the bounded wait inside the bubble, where the timeout is virtual: ```go cancel() waited := make(chan struct{}) go func() { wg.Wait(); close(waited) }() select { case &lt;-waited: case &lt;-time.After(5 * time.Second): t.Errorf("seed %d: stream tasks did not end within 5s of cancel", seed) &lt;-waited } ``` I tried exactly this on a scratch copy. It catches the mutation at seed 1, and an unmutated run passes with `-count=2` in about 1 s. `t.Errorf` rather than `t.Fatalf` because `stop()` also runs from a `defer`. ## P2 None. ## P3 1. **`internal/activator/rootfsrelease_test.go:710`.** `pinned` now retries for up to 5 s whenever the generations file is half-written. That is right for almost every caller, because production deletes the record before it rewrites the file (`releaseProven`, `rootfsrelease.go:713-722`). A file that never completes still fails after 5 s, so a genuinely broken write is not hidden. The one caller where the retry costs something is `TestReleaseBuildPublishedBeforeExec` (`:789`). If production ever started the release while the file write was still in flight, the retry would wait for the write to finish and report "pinned", hiding the ordering bug. Fix: give the `onStart` hook a strict read (call `release.ReadGenerations` once and fail on error) instead of `pinned`. 2. **`internal/activator/rootfsworkers_test.go:927`.** The loop now advances the clock and sweeps on every 20 ms poll until the proof holds, so it would also pass if proof needed many sweeps. The reason given is believable: `finishPendingStops` skips an entry while `genReaping` is set (`activator.go:4930`). Fix: count the passes and require at most 2. 3. **Other uses of the risky pattern.** `deadAddr` + `listenLater` is the closed-then-rebound port that caused this flake. It is still used in `localhold_test.go:227,297` and `localhold_probed_test.go:136,153`. Move them onto the owned-listener and injected-dialer pattern in a follow-up. 4. **Race-mode pin only in the edge test.** The `GOMAXPROCS(1)` workaround for Go issue 76691 is in the edge simulation only. `TestReleaseLeaseLossUnprovenLeavesTheHold` also runs in a bubble with timers and has no pin. It passed 20 runs under `-race`, but it has far fewer concurrent timers. Add the same guard, or a comment saying why it isn't needed. 5. **Minor (needs no change):** - The simulation's `testing.Short()` skip was removed. Fine at 0.25 s, but worth saying in the commit body. - Totals still vary slightly between runs (3763, 3768, 3770 legs admitted), so the run is not fully deterministic. That is harmless. - The base run also had 0 streams closed by short legs, so no coverage was lost there. ## The four checks you asked for - **Production changes:** none. - **Tests that still prove their property:** the activator assertions are unchanged, apart from the waits P3 items 1 and 2 cover. In `TestReleaseLeaseLossUnprovenLeavesTheHold` they were only re-indented into the bubble. Moving the generations check in `TestReleaseObligationRetriedUntilProven` to a wait is correct, because production rewrites the file after the record goes. The wait still comes before the next wake, so a pin that never leaves still fails. The simulation keeps all 300 seeds and has a tighter bound. Its only weakening is the P1. - **synctest correctness:** go.mod says `go 1.26.0` and the toolchain is go1.26.10. `synctest.Test` has existed since Go 1.25. Nothing inside either bubble uses real network: the simulation uses an in-memory writer and in-process handlers, and the activator rig uses SQLite plus temp files. No goroutines leak. - **WebSocket root cause:** the fix is plausible. The old test freed a port and rebound it 300 ms later, and on a loaded runner another process can take the port in that gap. The new test owns the backend for its whole life and asserts exactly 4 dial attempts (3 refused, then the backend). Probes go through the same dialer, so a stray probe would show up in that count. This is stronger than before. READY AFTER FIXES</result> <usage><subagent_tokens>98165</subagent_tokens><tool_uses>35</tool_uses><duration_ms>771353</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bz4kww2ve</task-id> <tool-use-id>toolu_01XVW2ZpnWwUyJXPEGCBe8hM</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9fdb19f6-7964-4108-a723-1323c2914a76/tasks/bz4kww2ve.output</output-file> <status>completed</status> <summary>Background command "Wait for CI then merge the test-only fix" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bqk2swy2o</task-id> <tool-use-id>toolu_011KQLKEUvBBT1GSVDcbWKFt</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9fdb19f6-7964-4108-a723-1323c2914a76/tasks/bqk2swy2o.output</output-file> <status>completed</status> <summary>Background command "Wait for CI then merge flake fix" completed (exit code 0)</summary> </task-notification>