Repository navigation
scripts: test-zb-wait - #841
Conversation
Poll for the second build's waiting line and the load line with a 20s limit that fails showing the output, so a slow CI runner cannot fail the test. Agent-Team: linux Worker: claude Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… on failure Agent-Team: linux Worker: claude Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
zb took a slot with mkdir and wrote the pid afterwards, leaving a pid-less window in which another zb could judge the slot reclaimable. The merge queue (run 40194938550) showed the result: two builds ran, one slot held a pid. A slot is now built privately with its pid inside and renamed into place, and the taker runs zig only if the slot's pid is its own. Agent-Team: linux Worker: claude Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PM note: how this PR will be handledWhat it is for: scripts: test-zb-wait Rules that apply: none special. Things to watch (checked by rule):
What happens next:
A living status comment below is kept current. Nothing here is a merge decision. |
Where this PR standsStage: Author's turn What the PM needs before approving (ticks as it is met; the full CI runs only at the end, after the reviews are clean):
Reviews at the current commit (
2 earlier reviews are for older commits and will be redone. Latest fixes comment: https://github.com/fizzyedit/work/issues/329#issuecomment-6399703786 (1 finding answered) Updated 2026-10-25 16:29 UTC by the PM. This comment is edited in place. |
Agent-Team: linux Worker: claude Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Picks up #841, the zb waiting-line flake fix. Agent-Team: linux Worker: claude
Agent-Team: linux Worker: claude
Agent-Team: linux Worker: claude
Part of fizzyedit/work#332
Goal
Make the zb waiting-line test stop flaking (fizzyedit/work#287) and make zb's slot take and reclaim safe: two builds never share a slot.
What changed and why
The diff is two scripts, scripts/zb and scripts/test-zb.sh. test-zb waits for zb's lines by polling, not sleeping. zb publishes a slot with its pid already inside (a private directory renamed into place), so a taker is never reclaimed. Round 2: a reclaim could rename away a live holder's slot using a stale dead-pid reading. Now a reclaimer moves only the pid file away (the slot stays, young and pid-less, so others hold off), checks that it moved the dead pid it saw, then removes the slot, or puts a live pid back. A pid-less slot a minute old is claimed by an exclusive create of its pid, which fails if a taker got there first.
How it was verified
scripts/test-zb.sh passes 200 times in a row, and 50 times with four busy loops running; check-fmt.sh passes. The stale-reclaimer interleaving needs a pause between two shell commands, so no deterministic test is cheap; it is closed by the pid-file move failing or returning a live pid.
Not done / follow-ups
A put-back delayed by over a minute could let a waiter claim the pid-less slot; not seen, and not closed.
Changes (37 files, +482/-1366)
Gates: 6 of 6 passed
scripts/check-fmt.sh(exit 0)scripts/zb build --summary all(exit 0)scripts/zb build test --summary all(exit 0)scripts/zb build test-integration --summary all(exit 0)scripts/zb build check-web --summary all(exit 0)scripts/zb build test-sdk-version --summary all(exit 0)