Repository navigation
chore: item redispatch: explicit assignee_agent should release the old agent's live claim (parity with item update) - #780
Conversation
…agent's live claim, the same way `item action=update` does. It passes its tests. I haven't committed anything. - **Fix:** in `item_redispatch` (`src/mcp_server/item.rs`), when the caller passes `assignee_agent` explicitly, it now calls `reassignment_releases_claim` with the resulting assignee. This runs before the `dispatchable` check, so the item reports `dispatchable=true` right away instead of waiting out the 4h TTL. I renamed the outer `assignee_agent` variable to `req_assignee` because the match arm shadows it. - **What stays the same:** a redispatch with no explicit assignee still leaves the claim alone, because the assignee doesn't change. Handing off to the same agent (ignoring the `:instance` suffix) also keeps the claim, matching `update`. `agentflare_backend::item::redispatch` is untouched; it deliberately doesn't touch the claim ledger. - **Tests:** I added two in `src/mcp_server/tests/action_tests.rs`. One redispatches to `claude-code` while `opencode:dead-job` holds a claim, and checks the claim is gone and `dispatchable=true`. The other redispatches to `opencode` while `opencode:live-job` holds a claim, and checks the claim survives. - **Results:** `cargo fmt --check` is clean. `cargo test --bin agentflare redispatch` gives 6 passed. `cargo test --bin agentflare item_` gave 307 passed and 1 failed: `pm_tests::pm_health_matches_item_health_for_the_same_params`. That test passes when run alone (1 passed), and I didn't investigate why it failed in the larger run. My change doesn't touch the health code. **Concern:** `redispatch` and the release are two separate steps, not one transaction, the same as in `item_update`. A failure between them would leave the item re-armed with the old claim still in place, which is the current behaviour anyway. **Existing quirk:** a same-agent redispatch still reports `dispatchable=false`, since the `dispatchable` check compares the full owner string (`opencode:live-job`) against the bare agent name (`opencode`). The existing test `item_redispatch_reports_dispatch_blocked_when_a_live_claim_remains` relies on this. I left it alone, and it may deserve its own item.
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Repository: getappz/agentflare/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: getappz/agentflare/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. 📝 WalkthroughWalkthroughChangesRedispatch claim handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Claiming self-repair for |
supervisor — CI self-repair dispatchedFailing checks: hakari, CI Green. Please investigate and push a fix. job: 8ifYZXgsEBJPZDNLwO4qr |
supervisor — CI greenChecks are passing again. |
item action=redispatch assignee_agent=<other>now releases the old agent's live claim, the same wayitem action=updatedoes. It passes its tests. I haven't committed anything.item_redispatch(src/mcp_server/item.rs), when the caller passesassignee_agentexplicitly, it now callsreassignment_releases_claimwith the resulting assignee. This runs before thedispatchablecheck, so the item reportsdispatchable=trueright away instead of waiting out the 4h TTL. I renamed the outerassignee_agentvariable toreq_assigneebecause the match arm shadows it.:instancesuffix) also keeps the claim, matchingupdate.agentflare_backend::item::redispatchis untouched; it deliberately doesn't touch the claim ledger.src/mcp_server/tests/action_tests.rs. One redispatches toclaude-codewhileopencode:dead-jobholds a claim, and checks the claim is gone anddispatchable=true. The other redispatches toopencodewhileopencode:live-jobholds a claim, and checks the claim survives.cargo fmt --checkis clean.cargo test --bin agentflare redispatchgives 6 passed.cargo test --bin agentflare item_gave 307 passed and 1 failed:pm_tests::pm_health_matches_item_health_for_the_same_params. That test passes when run alone (1 passed), and I didn't investigate why it failed in the larger run. My change doesn't touch the health code.Concern:
redispatchand the release are two separate steps, not one transaction, the same as initem_update. A failure between them would leave the item re-armed with the old claim still in place, which is the current behaviour anyway.Existing quirk: a same-agent redispatch still reports
dispatchable=false, since thedispatchablecheck compares the full owner string (opencode:live-job) against the bare agent name (opencode). The existing testitem_redispatch_reports_dispatch_blocked_when_a_live_claim_remainsrelies on this. I left it alone, and it may deserve its own item.Opened by
claude-codeon flared:c997d745ae66 for item #598 via agentflare.Summary by CodeRabbit