Repository navigation
Conversation
A freshly created handoff item is real, undone work -- the supervisor's discovery loop (run_discovery_tick) only notices items already labeled ready-for-work, so until now a human had to add that label by hand for autonomous dispatch to ever pick up a handed-off item. Only the brand-new-item path is labeled, not replies to an existing item_id -- those may already be claimed, in progress, or done, and silently re-queuing them for dispatch would be wrong. Applies to every recipient, not just confirmed-autonomous agents: the discovery loop's own resolve_confirmed_agent gate already handles a non-autonomous recipient safely (relabels to needs-manual-dispatch with an explanatory comment), so that check isn't duplicated here. Best-effort: looks up the ready-for-work label by name in the project and skips silently if the project doesn't have it, rather than creating one out of nowhere for a project that hasn't opted into autonomous dispatch. READY_LABEL (src/supervisor.rs) is now pub(crate) so handoff.rs can reuse it as the single source of truth instead of duplicating the label name as a second string literal that could drift.
📝 WalkthroughWalkthroughThe handoff workflow now applies the existing project ChangesHandoff labeling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/mcp_server/handoff.rs (1)
139-160: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPropagate label lookup failures.
Line 141 converts every backend error into an empty label list. A transient or persistent query failure then creates an unlabeled handoff item and prevents supervisor discovery.
Return the backend error. Only an empty successful result should skip the label.
Proposed fix
let ready_label_id = agentflare_backend::label::list_by_project(conn, &project.id) - .ok() + .map_err(map_backend_err)? .and_then(|labels| { labels .into_iter() .find(|l| l.name == crate::supervisor::READY_LABEL) }) .map(|l| l.id);🤖 Prompt for 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. In `@src/mcp_server/handoff.rs` around lines 139 - 160, The ready-label lookup in the handoff creation flow must propagate errors from label::list_by_project instead of converting them to an empty result. Update the chain around ready_label_id so successful empty results still omit the label, while backend failures are returned from the enclosing function before creating the item.
🧹 Nitpick comments (1)
src/mcp_server/handoff.rs (1)
451-482: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTest the reusable-item branch without
item_id.This test sets
item_id, so it only tests the update branch at Lines 75-82. It does not test thereusablebranch at Lines 91-111.Create the second handoff without
item_id. Assert that it returns the first item ID and that the cleared label remains absent.🤖 Prompt for 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. In `@src/mcp_server/handoff.rs` around lines 451 - 482, Update the test a_reply_to_an_existing_item_is_not_labeled_ready_for_work to omit item_id from the second HandoffRequest, exercising the reusable-item branch. Capture the returned item ID, assert it matches the first item ID, and retain the assertion that the cleared ready-for-work label remains absent.
🤖 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.
Outside diff comments:
In `@src/mcp_server/handoff.rs`:
- Around line 139-160: The ready-label lookup in the handoff creation flow must
propagate errors from label::list_by_project instead of converting them to an
empty result. Update the chain around ready_label_id so successful empty results
still omit the label, while backend failures are returned from the enclosing
function before creating the item.
---
Nitpick comments:
In `@src/mcp_server/handoff.rs`:
- Around line 451-482: Update the test
a_reply_to_an_existing_item_is_not_labeled_ready_for_work to omit item_id from
the second HandoffRequest, exercising the reusable-item branch. Capture the
returned item ID, assert it matches the first item ID, and retain the assertion
that the cleared ready-for-work label remains absent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e7b55b81-f92e-4d2f-95e5-b4cefe07793f
📒 Files selected for processing (2)
src/mcp_server/handoff.rssrc/supervisor.rs
Summary
Depends on #401 — targeted at that branch so this diff only shows item #32's incremental work; retarget to
masteronce #401 merges (independent of #402, can merge in either order after #401).Today
mcp__flare__handoff(src/mcp_server/handoff.rs) assignsassignee_agenton the item it creates/updates but never touches labels — a human has to separately add theready-for-worklabel for the daemon's discovery loop (run_discovery_tickinsrc/supervisor.rs) to notice and auto-dispatch it. Handoff is effectively manual today.item_idnot given) gets auto-labeled — not replies to an existingitem_id, which may already be claimed, in progress, or done and shouldn't be silently re-queued for dispatch.resolve_confirmed_agent) already safely no-ops and relabels toneeds-manual-dispatchwith an explanatory comment for a human/non-autonomous recipient, so that check isn't duplicated here.ready-for-worklabel by name in the project; skips silently if the project doesn't have it, rather than creating one out of nowhere for a project that hasn't opted into autonomous dispatch.READY_LABEL(src/supervisor.rs) is nowpub(crate)sohandoff.rsreuses it as the single source of truth instead of duplicating the label name as a second string literal that could drift.Also includes (merged in from #401's branch, same fix needed here since this branch runs the same test suite): the
coaching::ruleWindows CI flake fix (tempfile::tempdir()instead of a process-local counter that collides acrosscargo nextest's per-test-process model).Test plan
cargo build -p agentflare -p agentflare-jobs— cleancargo test -p agentflare -p agentflare-jobs --lib --bins— 1139 passed (3 new: label added when the project hasready-for-work, skipped silently when it doesn't, not added on a reply to an existing item)cargo fmt --all -- --check/cargo clippy --all-targets— cleanSummary by CodeRabbit