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 work after the suggested claim release [N2,B13]
Corey Olson25f0c541ceb5
diff --git a/src/board.js b/src/board.jsindex 822b69e9..8c85ddae 100644--- a/src/board.js+++ b/src/board.js@@ -1901,7 +1901,7 @@ function milestoneRanks(board, priority) {}/** Share focus/release, remaining path and soft overlap ordering across build offers and queue display. */-export function buildOrder(board, { warm = [], agentId, readiness = barReadyForOrder } = {}) {+export function buildOrder(board, { warm = [], agentId, readiness = barReadyForOrder, releasedClaims = [] } = {}) {const milestonePriority = milestonePriorities(board);const items = listItems(board, { all: true });const rank = milestoneRanks(board, milestonePriority);@@ -1915,7 +1915,7 @@ export function buildOrder(board, { warm = [], agentId, readiness = barReadyForOconst focus = milestoneFocus(board);const group = item => focus?.ids.has(item.item_id) ? -1 : milestonePriority(item);if (!criticalPathEnabled(board)) return focusOrder(board, previous);- const paths = criticalPathOrder({ items, group, fallback: previous });+ const paths = criticalPathOrder({ items, group, fallback: previous, releasedClaims });const returnHome = lineOrderEnabled(board);const returning = item => returnHome && !focus?.ids.has(item.item_id)&& item.item_verdict === 'REJECT' && item.item_built_by === agentId;diff --git a/src/critical-path-order.js b/src/critical-path-order.jsindex 97bf5fc0..cb631bf1 100644--- a/src/critical-path-order.js+++ b/src/critical-path-order.js@@ -39,9 +39,10 @@ export function remainingPaths(items, group) {}/** Index live declared/changed paths once; an overlap lowers preference but never eligibility. */-function overlapCounts(items) {+function overlapCounts(items, releasedClaims) {const holders = new Map();for (const item of items) {+ if (releasedClaims.has(item.item_id)) continue;if (!['claimed', 'submitted'].includes(item.item_status)&& !(item.item_status === 'verified' && !item.item_merged_commit)) continue;for (const path of itemFiles(item)) {@@ -56,10 +57,10 @@ function overlapCounts(items) {}));}-/** Release/focus membership precedes longest path, then soft overlap and the established deterministic ties. */-export function criticalPathOrder({ items, group, fallback }) {+/** Order by release/path/overlap; health may omit only the claims its suggested release would remove. */+export function criticalPathOrder({ items, group, fallback, releasedClaims = [] }) {const paths = remainingPaths(items, group);- const overlaps = overlapCounts(items);+ const overlaps = overlapCounts(items, new Set(releasedClaims));return (first, second) => group(first) - group(second)|| (paths.get(second.item_id) ?? 0) - (paths.get(first.item_id) ?? 0)|| (overlaps.get(first.item_id) ?? 0) - (overlaps.get(second.item_id) ?? 0)diff --git a/src/health.js b/src/health.jsindex c7ad44a1..60df092a 100644--- a/src/health.js+++ b/src/health.js@@ -338,7 +338,6 @@ 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)) {@@ -346,6 +345,8 @@ function queueFaults(board, { items, at, retired = [], gone = new Set() }) {if (!holder) continue;// 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);+ // The suggested release removes this holder's overlap occupancy before next chooses again.+ const compare = buildOrder(board, { releasedClaims: own });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))