feat: assign, queue, S3 events, dependency-aware locking (#12 #13 #15 #17)#19
Merged
Conversation
… deps #15 assign: auto-pick and claim a free symbol from a file pattern - `grit assign -a agent -i intent --file pattern` - Picks first unlocked symbol, claims it, creates worktree #12 queue: FIFO lock queue for contested symbols - `--queue` flag on claim: enqueue instead of failing when blocked - Auto-promotion: next agent in queue gets the lock on release/done - `grit queue list` / `grit queue cancel` management commands - New lock_queue table in schema #13 S3 distributed events: poll-based watch for distributed agents - `grit watch --poll <secs>` diffs lock state periodically - Auto-detects S3 backend and defaults to polling mode #17 dependency-aware locking: call graph extraction + transitive locks - Parser extracts function calls from AST (13 languages) - Populates deps table during `grit init` - `--with-deps` flag on claim: auto-locks transitive callees as read - `grit plan` shows dependencies and suggests --with-deps - Recursive CTE for transitive dependency resolution 72 tests pass (10 new tests for queue, deps, and call extraction).
scripts/ai-agents/ — launch N claude/gemini agents in parallel via grit scripts/synthetic/ — no-AI merge conflict stress test (grit vs raw git) scripts/sweep/ — multi-config sweep across agent counts & projects scripts/lib/ — shared helpers (setup, modify, reporting)
- Use git -C instead of cd to avoid cwd invalidation after rm -rf - Use set +e in subshells to prevent silent exit on grit claim failure - Fix grep -c pattern with || true instead of || echo "0" - Separate setup_git_repo (no grit) from setup_work_repo (with grit) - Remove set -e from synthetic bench (incompatible with || patterns)
- Use git -C instead of cd everywhere - set +e in grit subshells - grep || true pattern for conflict/merge counting - Remove set -e (incompatible with || fallback patterns)
Add add_file_header() that prepends a unique comment to every modified file. This forces real git merge conflicts (agents branch from same commit, all prepend to same file -> line 1 conflict). Results: 10 agents: git 80% fail, grit 0% fail 20 agents: git 82% fail, grit 0% fail 50 agents: git 70% fail, grit 0% fail, 175 conflict files vs 0
…icts New scripts/throughput/ benchmark that measures what users care about: how many features actually ship vs how many are LOST to conflicts. Git workflow: all agents branch from same commit (realistic parallel work), then merge sequentially. Conflicts = work thrown away. Results on ts-api: 10 agents: git 70% work lost, grit 0% 20 agents: git 75% work lost, grit 0% 30 agents: git 83% work lost, grit 0% 50 agents: git 90% work lost, grit 0%
- New banner matching RTK/ICM/VOX visual style - Feature throughput benchmark results (70-90% work wasted with git) - 13 language support table with extracted symbol types - New commands: assign, queue, watch --poll, claim --with-deps - RTK AI ecosystem section
Run systematic benchmarks (1,2,5,10,15,20,25,30,40,50 agents) across ts-api, pi-calc, and rust-service projects (3 rounds each). Generated charts showing: - Merge failure rate by agent count (per project + grit always 0%) - Work wasted to conflicts (area chart: git vs grit) - Successful merges bar chart Key finding: git wastes 50-80% of work at 2+ agents. Grit: always 0%.
If-None-Match conditional PUT only works on AWS S3 and Cloudflare R2. MinIO, GCS (S3-compat), and Azure (S3 gateway) return errors instead of 412. Fall back to GET-then-PUT for these providers. Tested with MinIO: claim/block/release cycle works end-to-end.
For providers without conditional PUT (MinIO, GCS), use optimistic write-then-verify pattern. Tested with MinIO (works), GCS (race condition in sequential claims due to last-writer-wins semantics). Note: GCS and Azure need native API clients for true atomic locking. S3-compatible fallback works for MinIO and low-contention scenarios. Providers with conditional PUT (AWS S3, Cloudflare R2) are unaffected.
Add azure_store.rs using Azure SDK (not S3-compat) with: - If-None-Match: * for atomic lock acquisition (no race conditions) - Native blob list/get/put/delete - Automatic Event Grid integration (free: BlobCreated/BlobDeleted events) Tested end-to-end on real Azure Storage: agent-1 claim login → Granted agent-2 claim login → BLOCKED (atomic conditional PUT) agent-2 claim logout → Granted agent-1 done → merge + release agent-2 retry login → Granted grit config set-azure --account <name> --access-key <key> --container <name>
- Azure Blob tested with 10/20/30/50 agents: 0 conflicts, 0 orphan blobs - Backend comparison table: Azure (atomic + Event Grid), S3 (atomic), MinIO (fallback) - Event system docs: Azure Event Grid fires free events on every claim/release - Reorganized Backends section with setup commands for each provider
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.
Summary
Implements the 4 remaining open issues in a single PR (#16 was already done):
grit assign: Auto-pick and claim a free symbol from a file pattern. Simplifies agent prompts from 10 lines to 1 command.--queueflag on claim enqueues agents FIFO when blocked. Auto-promotes next agent on release/done.grit queue list/cancelfor management.grit watch --poll <secs>diffs lock state for distributed agents. Auto-detects S3 backend.depstable during init.--with-depson claim auto-locks transitive callees as read. Recursive CTE for dependency resolution.Changes
src/cli/mod.rssrc/db/mod.rssrc/parser/mod.rsTest plan
grit initon a repo with function calls → verify deps count > 0grit claim --queuewhen blocked → verify queue positiongrit claim --with-deps→ verify callees locked as readgrit assign -f pattern→ verify auto-pick worksgrit watch --poll 2→ verify events printed on lock changesCloses #12, closes #13, closes #15, closes #17
🤖 Generated with Claude Code