Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(health): rank inversion sees work held only by its holder [N2,B13]
Corey Olsone9041c3aafe2
diff --git a/src/health.js b/src/health.jsindex 2a2df568..c7ad44a1 100644--- a/src/health.js+++ b/src/health.js@@ -339,11 +339,15 @@ function queueFaults(board, { items, at, retired = [], gone = new Set() }) {}const compare = buildOrder(board);+ const open = [...queue.releases.flatMap((release) => release.items), ...queue.unreleased].filter((entry) => entry.status === 'open');// A lapsed claim is CLAIM_LAPSED's to report; only a live claim can rank behind free work.for (const claim of items.filter((item) => item.item_status === 'claimed' && Date.parse(item.item_lease_until ?? '') > at)) {const holder = agents.find((agent) => agent.id === claim.item_owner);if (!holder) continue;- const ahead = waiting.filter((entry) => entry.lane === holder.lane && canTake(holder.route, entry.route))+ // Free work that waits only on files the holder's own claims touch is free to the holder once it releases (#1114).+ const own = items.filter((item) => item.item_status === 'claimed' && item.item_owner === holder.id).map((item) => item.item_id);+ const freeToHolder = (entry) => entry.waits.every((wait) => own.some((id) => wait.startsWith(`#${entry.id} waits for #${id} (claimed) on `)));+ const ahead = open.filter((entry) => freeToHolder(entry) && entry.lane === holder.lane && canTake(holder.route, entry.route)).map((entry) => raw.get(entry.id)).filter((item) => item && compare(item, claim) < 0).sort(compare);diff --git a/test/health.test.js b/test/health.test.jsindex 17ca9e53..cb203cb1 100644--- a/test/health.test.js+++ b/test/health.test.js@@ -410,6 +410,8 @@ test('every printed next step runs as pasted through main() [N2,B13]', async (t)store.addItem(board, { by: 'coordinator', lane: 'core', title: 'Earlier mid', route: 'mid', ...brief });const later = store.addItem(board, { by: 'coordinator', lane: 'core', title: 'Later mid', route: 'mid', ...brief });const strong = store.addItem(board, { by: 'coordinator', lane: 'core', title: 'Strong work' });+ // Earlier mid shares src/mid.js with the held claim, so next gives the idle seat only this one (#1114).+ store.addItem(board, { by: 'coordinator', lane: 'core', title: 'Other mid', route: 'mid', ...brief, brief: 'Files:\n- src/other.js\nTest:\n- the other work runs' });store.claim(board, later, { agentId: holder, lane: 'core', leaseMs: 2 * HOUR, freeze });store.closeBoard(board);