Repository navigation
fix(dispatcher): clear dispatch labels on cancel, make discovery state-aware - #661
Conversation
…e-aware item_cancel never cleared ready-for-work/dispatched/needs-manual-dispatch, and run_discovery_tick's list_by_label query joined purely on label with no state filter. A cancelled item that still carried ready-for-work (the normal case for a cancel shortly after handoff, before any orphan/failure cycle would've swapped the label) kept getting redispatched indefinitely. - item_cancel now best-effort clears the dispatch-lifecycle labels, mirroring what redispatch already does in reverse. - list_by_label is now state-aware like its sibling list_by_assignee_agent, excluding completed/cancelled items at the SQL level. Adds regression tests for both; the new list_by_label test lives in a new tests_labels.rs to respect the frozen LOC limit on item/tests.rs, same split pattern as the existing tests_relations.rs. Agentflare-Agent: claude-code Agentflare-Branch: task/225-item-cancel-doesn-t-clear-ready-for-work Agentflare-Item: 225 Agentflare-Session: b80abe7f-226d-4884-95a6-2aca737f1aa8
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (5)
Included review availability: 3 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe change prevents cancelled and completed items from remaining dispatch candidates. Label-based listing filters inactive states, and cancellation best-effort removes dispatch lifecycle labels. Regression tests cover both behaviors. ChangesDispatch lifecycle handling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Cancelled and completed items are filtered from dispatch candidates, and cancellation clears the relevant lifecycle labels. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Tracking this PR for automated review ( |
Summary
Fixes item #225. A deeper related bug (`claim()` not checking item state, so a stale queued retry job can still reopen a cancelled item) is filed separately as item #226 — bigger design question, not bundled here.
Test plan
Summary by CodeRabbit
Bug Fixes
Tests