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: apply path priority to reviews and retain rework [N2,H16]
Corey Olson8f8eadc323a7
diff --git a/docs/api.md b/docs/api.mdindex 1614940d..b77ce6cf 100644--- a/docs/api.md+++ b/docs/api.md@@ -618,7 +618,7 @@ Unavailable Git-object verdict projections are retried on the next read, so fetcWhen the runner's own resource pool refuses the run's setup, the run fails at once with `RUNNER_SETUP_REFUSED`, naming the runner host and the pool's refusal code. It is not retried, and it leaves no holder or waiter on either machine.-Agents and the coordinator can set explicit item ranks with `milestone order <name> <ids>` (comma-separated ids from that milestone). It replaces that milestone’s `order` list in board metadata; other items stay unranked. For current-engine build offers, `next` compares focus/release group, longest remaining unit-item dependency path, soft file overlap, then explicit rank and existing route/recent-file/age ties. File overlaps remain warnings and never hard-block ready work. Historical engines preserve their earlier order; review ordering keeps its existing policy. Removing an item drops its rank; adding it again leaves it unranked. This does not change newcomer help or person flows.+Agents and the coordinator can set explicit item ranks with `milestone order <name> <ids>` (comma-separated ids from that milestone). It replaces that milestone’s `order` list in board metadata; other items stay unranked. For current-engine build and review offers, `next` compares focus/release group, longest remaining unit-item dependency path, soft file overlap, then explicit rank and existing route/recent-file/age ties. File overlaps remain warnings and never hard-block ready work. Historical engines preserve their earlier order; review standing, held reservations and cooldowns retain their existing guards. Opt-in own-send-back priority leads outside the configured focus. Removing an item drops its rank; adding it again leaves it unranked. This does not change newcomer help or person flows.`resume` on the coordinator seat includes `rigor: {undrafted: [...]}`, naming each repeated cause that has no live or approved proved draft. Each entry retains the ordinary Rigor cause key, item evidence and commits. The text resume names the proof-bearing `pullboard rigor draft` command. Declined repeats stay quiet until a new item repeats them. `needsYou` may contain an individual `kind: "rigor-draft"` call with `cause`, `evidence`, `proof`, a qualified spec or doctrine `target`, and `what: "Approve or Decline"`. An ordinary draft remains in the existing aggregate count; a Rigor draft is not counted twice. These fields add no person permission: the existing person-only approval and decline channels still apply.diff --git a/docs/formats.md b/docs/formats.mdindex 7ff0183b..0f1288b4 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -577,7 +577,7 @@ The engine-68 `recordSpecApprovalBaseline` move carries `{agentId, baseline: {ve`order` opts into next ordering: a builder’s own send-back, scarce review eligibility, release, downstream demand, signed-bar readiness, then coordinator rank. The readiness tier stays inert until the signed-readiness predicate is available (#1110); it never guesses a sign-off from prose. The other inputs retain their separate meanings; `reviewsFirst` selects review versus build and does not turn ordering on. Takeover and landing behavior are separate changes. The move carries `{agentId,key,value,reason,window}`; its native `line_setting` event carries `{key,value,reason,window}` with the board's actor and time outside that detail. Latest values live under `board_meta` keys `line_setting:<name>`, and ordered engine replay updates them and appends the same evidence. The unassigned `LINE_SETTINGS_ENGINE` leaf receives its permanent number at landing. Older engine records cannot request this new operation. Range, unknown-key, missing-reason and invalid-window refusals have named codes. The existing settings API reports each input as `scope: "board"`, key `line.<name>`, with off as its default and the board SQLite file as its source; it does not expose reason text or evidence payloads through that inventory.-The critical-path engine, numbered at landing, orders ready build offers within each focus/release group by the longest remaining dependency path. Each unfinished item counts as one unit; verified and withdrawn work contributes none. This is the unit-duration Hu ordering, not a claim of measured completion-time estimates. Equal paths prefer fewer overlaps with live claimed, submitted or accepted-not-landed files, then retain existing rank, route, recent-file and age ties. An overlap never makes ready work unavailable. Queue display and next share this rule; dependency, hold, route and reviewer-authority guards remain in force. Earlier engine records retain their original ordering and hard file-collision policy.+The critical-path engine, numbered at landing, orders ready build and review offers within each focus/release group by the longest remaining dependency path. Each unfinished item counts as one unit; verified and withdrawn work contributes none. This is the unit-duration Hu ordering, not a claim of measured completion-time estimates. Equal paths prefer fewer overlaps with live claimed, submitted or accepted-not-landed files, then retain existing rank, route, recent-file and age ties. An overlap never makes ready work unavailable. The opt-in own-send-back priority remains ahead of release ordering outside the configured focus; within the focus, longest path leads. Queue display and next share this rule; dependency, hold, route and reviewer-authority guards remain in force. Earlier engine records retain their original ordering and hard file-collision policy.With `collisionFreeBatch` on, landing selection previews each reviewed commit against the immutable trunk and reads the resulting Git changed paths, including both rename paths. Overlapping later verdicts wait without reopening; disjoint items still join the current batch. Deferred items keep their recorded place ahead of newer acceptances, even after merge-only re-acceptance. This priority applies only while the setting is on and the item remains accepted and unlanded with the identical submitted commit and frozen digest; new source or a new bar loses that old priority. Once the first batch lands, each deferred item receives one item-addressed reviewer notice in the same atomic landed transition. Existing verdict freshness is unchanged: if main touched the deferred review, its reviewer merges the new trunk and records a merge-only re-accept without a builder cycle or reopening. The default off path keeps existing composition. The control has its own replay-engine boundary; it does not infer paths from briefs.diff --git a/src/board.js b/src/board.jsindex 76f76add..822b69e9 100644--- a/src/board.js+++ b/src/board.js@@ -1900,7 +1900,7 @@ function milestoneRanks(board, priority) {return entry => ranks.get(entry.item_id) ?? Number.MAX_SAFE_INTEGER;}-/** Make the shared build-queue comparator once: milestone, explicit rank, route, recent files, then oldest. */+/** Share focus/release, remaining path and soft overlap ordering across build offers and queue display. */export function buildOrder(board, { warm = [], agentId, readiness = barReadyForOrder } = {}) {const milestonePriority = milestonePriorities(board);const items = listItems(board, { all: true });@@ -1914,7 +1914,12 @@ export function buildOrder(board, { warm = [], agentId, readiness = barReadyForOconst previous = lineOrderEnabled(board) ? lineBuildOrder({ agentId, release: milestonePriority, rank, items, ready: item => readiness(board, item), fallback }) : fallback;const focus = milestoneFocus(board);const group = item => focus?.ids.has(item.item_id) ? -1 : milestonePriority(item);- return focusOrder(board, criticalPathEnabled(board) ? criticalPathOrder({ items, group, fallback: previous }) : previous);+ if (!criticalPathEnabled(board)) return focusOrder(board, previous);+ const paths = criticalPathOrder({ items, group, fallback: previous });+ const returnHome = lineOrderEnabled(board);+ const returning = item => returnHome && !focus?.ids.has(item.item_id)+ && item.item_verdict === 'REJECT' && item.item_built_by === agentId;+ return focusOrder(board, (first, second) => Number(returning(second)) - Number(returning(first)) || paths(first, second));}/**@@ -1964,9 +1969,13 @@ export function nextFor(board, { agentId, lane, verify = false, policy = 'any',const scarcity = lineOrderEnabled(board) ? reviewerScarcity(board, candidates.map(candidate => candidate.entry), (entry, reviewer) =>Object.values(reviewerChecks(board, { agentId: reviewer, policy, familyPolicy })).every(guard => !guard(entry))) : null;const lineCompare = scarcity ? buildOrder(board, { agentId }) : null;- candidates.sort((first, second) => (scarcity ? scarcity.get(first.entry.item_id) - scarcity.get(second.entry.item_id)- || lineCompare(first.entry, second.entry) : milestonePriority(first.entry) - milestonePriority(second.entry)- || rank(first.entry) - rank(second.entry)));+ const previousOrder = (first, second) => scarcity ? scarcity.get(first.item_id) - scarcity.get(second.item_id)+ || lineCompare(first, second) : milestonePriority(first) - milestonePriority(second)+ || rank(first) - rank(second);+ const focus = milestoneFocus(board);+ const group = item => focus?.ids.has(item.item_id) ? -1 : milestonePriority(item);+ const order = criticalPathEnabled(board) ? criticalPathOrder({ items: listItems(board, { all: true }), group, fallback: previousOrder }) : previousOrder;+ candidates.sort((first, second) => order(first.entry, second.entry));candidates.sort((a, b) => focusCompare(a.entry, b.entry));const item = candidates.find((candidate) => !candidate.holder && !candidate.cooldown)?.entry;if (item) return { item, reasons: focusReasons(board, item) };diff --git a/test/next-order.test.js b/test/next-order.test.jsindex d8afeb8d..85e69b85 100644--- a/test/next-order.test.js+++ b/test/next-order.test.js@@ -399,20 +399,20 @@ test('pullboard queue lists releases as breakpoints and items in pull order [N2,const lines = text.out.trim().split('\n');const at = (pattern) => lines.findIndex((line) => pattern.test(line));assert.ok(at(/^current: 0\/4 landed$/u) === 0, `the first release is a breakpoint with its landed count:\n${text.out}`);- const order = [ranked, oldest, claimed, waiting].map((id) => at(new RegExp(`^ \\d+\\. #${id} `, 'u')));- assert.deepEqual([...order].sort((a, b) => a - b), order, `items follow next's order: rank, then route, then age:\n${text.out}`);+ const order = [claimed, ranked, oldest, waiting].map((id) => at(new RegExp(`^ \\d+\\. #${id} `, 'u')));+ assert.deepEqual([...order].sort((a, b) => a - b), order, `items follow remaining path, then rank, route and age:\n${text.out}`);assert.ok(order[0] > 0 && at(/^later: 0\/1 landed$/u) > order[3], 'the later release is its own breakpoint after the current one');assert.ok(at(new RegExp(`^ \\d+\\. #${later} `, 'u')) > at(/^later: /u));assert.ok(at(/^in no release$/u) > at(new RegExp(`#${later} `, 'u')) && at(new RegExp(`#${loose} `, 'u')) > at(/^in no release$/u));- assert.match(lines[order[0]], new RegExp(`#${ranked} mid api open: Ranked mid API work$`, 'u'), 'each item shows its route, lane and status');- assert.match(lines[order[2]], new RegExp(`#${claimed} strong web claimed · ${holder.agent}: `, 'u'), 'a claimed item names its holder');+ assert.match(lines[order[1]], new RegExp(`#${ranked} mid api open: Ranked mid API work$`, 'u'), 'each item shows its route, lane and status');+ assert.match(lines[order[0]], new RegExp(`#${claimed} strong web claimed · ${holder.agent}: `, 'u'), 'a claimed item names its holder');assert.match(lines[order[3] + 1], new RegExp(`^ waits on #${claimed} \\(claimed\\)$`, 'u'), 'an item names what it waits on');const document = box.json(box.run(box.repo, 'queue', '--json'));assert.deepEqual(document.releases.map((release) => [release.name, release.landed, release.total, release.items.map((item) => item.id)]),- [['current', 0, 4, [ranked, oldest, claimed, waiting]], ['later', 0, 1, [later]]]);+ [['current', 0, 4, [claimed, ranked, oldest, waiting]], ['later', 0, 1, [later]]]);assert.deepEqual(document.unreleased.map((item) => item.id), [loose]);- assert.deepEqual(document.releases[0].items[2], { id: claimed, title: 'Claimed strong work', route: 'strong', lane: 'web', status: 'claimed', holder: holder.agent, waits: [] });+ assert.deepEqual(document.releases[0].items[0], { id: claimed, title: 'Claimed strong work', route: 'strong', lane: 'web', status: 'claimed', holder: holder.agent, waits: [] });});test('the queue names the first item each route would pull [N2,B13]', (t) => {