Skip to content

fix: prevent duplicate run IDs on false-success mkdir - #81

Merged
TSLsun merged 2 commits into
mainfrom
fix/run-allocation-lock
Nov 2, 2026
Merged

TSLsun merged 2 commits into
mainfrom
fix/run-allocation-lock

Conversation

@TSLsun

@TSLsun TSLsun commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Concurrent agent launches can allocate the same run ID when mkdir reports success after losing the race to create run.lock. Require both a successful exit and a nonempty creation receipt before entering the allocator, matching the existing metadata lock protection. The retry limit and cleanup protocol remain unchanged.

The regression holds another writer's lock and models false-success mkdir. It verifies that allocation never enters the critical section, removes the held lock, or changes existing events. It fails on the original implementation and passes with the guard.

This is the production allocator fix targeting current main. Its diff contains only lib/cmd/agents.sh and test/run_lock.bats. No benchmark workflow, readiness changes, worker-default changes or benchmark documentation are included. Benchmark PR #73 remains a separate, unmerged reference.

Validation:

  • Local regression and full lint pass after updating from current origin/main.
  • Fresh Linux/macOS CI is green on current-main-updated head 0af5348.
  • Controlled experiment tested the identical allocator/test patch: all 120 real concurrent-ID checks passed. Its separate Codex/Gemini readiness failures remain recorded; neither was a duplicate-ID failure.
  • The native Linux probe observed 17 status-0/no-creation-receipt mkdir exits in 50 rounds of 32 contenders; kernel controls had one winner per round. Upstream mechanism.

User authorization promotes this PR from an experimental candidate to a production fix for review. Merging remains a separate human decision; no automatic merge is enabled.

@TSLsun TSLsun changed the title [DO NOT MERGE] fix: guard run allocation against false-success mkdir fix: prevent duplicate run IDs on false-success mkdir Nov 2, 2026
@TSLsun
TSLsun marked this pull request as ready for review November 2, 2026 13:31
@TSLsun
TSLsun merged commit 6f812a0 into main Nov 2, 2026
2 checks passed
@TSLsun
TSLsun deleted the fix/run-allocation-lock branch November 2, 2026 14:04
TSLsun added a commit that referenced this pull request Nov 2, 2026
**Maintainer review:** Earlier stress runs exposed intermittent failures
listed below. The PR checks run the full suites; three stress
repetitions run after pushes to main and can still fail. Please assess
this risk before merging.

## Summary
- Restore the test readiness, bounded deadlines, failure diagnostics,
fzf dependency, and CI stress changes from #70, which were reverted by
#80.
- Apply the revert of #80 on current main, retaining the independently
merged allocator fix #81. No benchmark tooling from #73 is included.

## Review notes
- The original final PR run passed Linux and macOS:
https://github.com/TSLsun/tmux-collie/actions/runs/41333821228.
- The subsequent merge-commit Linux run failed a dashboard
key-navigation assertion:
https://github.com/TSLsun/tmux-collie/actions/runs/41334612140. Cause
was not established; do not treat the earlier green run as proof of
sustained reliability.
- Later controlled benchmarking also recorded two macOS readiness
failures:
https://github.com/TSLsun/tmux-collie/actions/runs/41376826676.
Benchmark PR #73 is closed as reference.
- Fresh PR checks run against current main. Please review and merge only
after assessing the checks and these known failures.


## CI event behavior
Pull requests and reusable workflow calls run the normal Linux/macOS
suite. Direct pushes to main additionally run three readiness stress
repetitions with failure diagnostics. The base measurement step is
removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant