Repository navigation
fix: serialize dispatch slot admission - #360
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughDispatch startup now reserves capacity atomically through the run module. Core dispatch uses the reservation result for provisioning and progress reporting. Tests validate concurrent starts when capacity is limited to one task. ChangesDispatch admission
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant TaskA
participant TaskB
participant CoreDispatch
participant RunModule
participant RunStore
TaskA->>CoreDispatch: start dispatch
TaskB->>CoreDispatch: start dispatch
CoreDispatch->>RunModule: reserveDispatch
RunModule->>RunStore: reserve dispatch under lock
RunStore-->>RunModule: reserved provisioning run
RunModule-->>CoreDispatch: reserved result
CoreDispatch->>RunModule: reserveDispatch
RunModule->>RunStore: reserve dispatch under lock
RunStore-->>RunModule: full result
RunModule-->>CoreDispatch: slots-full result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@v2/src/run/index.ts`:
- Around line 627-648: Update reserveDispatch to use a lock path that cannot
collide with create’s task-derived lock for the valid task ID
dispatch:admission, while keeping the admission critical section protected. Add
a regression test covering dispatch:admission and verifying dispatch does not
wait for the stale-lock timeout.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6a4facc3-c0d7-4547-aa58-febf68770af2
📒 Files selected for processing (3)
v2/e2e/dispatch.e2e.test.tsv2/src/core/index.tsv2/src/run/index.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
ClipboardHealth/cbh-core(manual)
Review-body findingsAgree
Already fixed
🤖 |
ghost
left a comment
There was a problem hiding this comment.
LGTM
The new commit sensibly isolates the lock into .locks/dispatch-admission.lock to prevent a slug collision with actual run records. The withFileLock helper already creates parent directories recursively (line 902), so the .locks dir is handled. The regression test correctly validates that a task whose canonical ID contains the lock's basename succeeds without triggering stale-lock reclamation. No issues found.
What this PR does
Moves the dispatch admission lock file into a .locks subdirectory to prevent path collisions with run record files (e.g., if a task slug matched the lock name). Adds a unit test that verifies a task with canonicalTaskId: "dispatch:admission" does not collide with the lock file.
Tag @mendral-app with feedback or questions. View session
Why
Two concurrent
crew startprocesses could each observe an open slot before either persisted its run. WithmaximumInProgress: 1, both could launch, exceeding the configured orchestration limit and consuming more agent capacity than operators allowed.Summary
Validation
npx vitest run e2e/dispatch.e2e.test.ts -t "reserves one shared slot"npx vitest run e2e/dispatch.e2e.test.ts(46 passed)node --run verify(79 passed, 1 skipped)Notes
fnd_sig-feat-cli-command-49a9766219-_11fd05c55dandfnd_sig-feat-cli-command-012418b101-_4055fbdd6c.Agent session:
codex resume 019fecf3-dfb5-7931-ae12-80611ee76626🤖
cb-ship:created v1 skill@1.0.2