Repository navigation
fix: serialize task IDs and gate queue admission - #400
Merged
Merged
Conversation
Two concurrent `devbrain todo add` calls with different slugs could both read the same max NNNN and both win their O_EXCL create, because exclusivity was on the full `NNNN-<slug>.md` name rather than the prefix. Production hit it: one queue has two files each for 0240, 0252, 0281, 0282, 0302 and 0303. The dashboard's Queue.Create minted ids with its own copy of the same unlocked scan. - task.AllocID is now the one allocator: the max scan and the O_EXCL create run under an exclusive flock on <dir>/.alloc.lock; the todo CLI and the dashboard both mint through it. Only canonical NNNN-*.md names (live and archive/) take part in the scan. install adds the lock file to the data repo's .gitignore. - `todo add` warns on stderr (never fails) once a project has more than 20 open tasks. - /distill's "Queue tasks" rule is rewritten as five gates (explicit commitment, not already tracked in the queue or an external tracker, not a dated readout — one per-project calendar task instead, not owned by a runner, not a user-only decision) plus a 20-open soft cap under which the fold-in merges or drops and says so. The loose reading minted 321 tasks in one project in six weeks; triage found 17 of 72 open were real work. /continue's description and briefing and docs/architecture.md mirror the rule. Tests: goroutine and subprocess concurrency tests assert unique NNNN prefixes; a soft-cap test pins the warning. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0187uQV368edznjA9Q9QG4Y9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Concurrent CLI and dashboard task creation now share a locked ID allocator, preventing duplicate numeric task IDs across different slugs. Distill admits only committed, untracked work through five queue gates and a 20-task soft cap; continue surfaces user-only decisions separately.
Reinstall also excludes allocation locks from existing brain repositories, preserving their custom ignore rules. Includes the v1.5.29 release bump.
Validation: task and todo packages passed
go test -race -count=10; allocator goroutine/subprocess tests, soft-cap behavior, and installer upgrade regression coverage are included. Full Linux and macOS race suites run in CI.