Skip to content

fix: serialize task IDs and gate queue admission - #400

Merged
TheWeiHu merged 2 commits into
mainfrom
todo-alloc-and-queue-gate
Sep 17, 2026
Merged

TheWeiHu merged 2 commits into
mainfrom
todo-alloc-and-queue-gate

Conversation

@TheWeiHu

@TheWeiHu TheWeiHu commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

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.

impetuous-agent and others added 2 commits September 18, 2026 03:08
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
@TheWeiHu TheWeiHu changed the title todo alloc and queue gate fix: serialize task IDs and gate queue admission Sep 17, 2026
@TheWeiHu
TheWeiHu merged commit 9ec0e60 into main Sep 17, 2026
3 checks passed
@TheWeiHu
TheWeiHu deleted the todo-alloc-and-queue-gate branch September 17, 2026 19:12
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