Skip to content

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.

chore(merge): integrate accepted queue rank [N2,B13]

Corey Olsona87197eb6978
diff --cc docs/api.md
index cc61ac94,047e6c82..59e721f5
--- a/docs/api.md
+++ b/docs/api.md
@@@ -441,6 -446,14 +447,16 @@@ Each checkout with a committed npm lock
Post-run cleanup reports `RUNNER_CLEANUP_TIMEOUT` after 30 seconds instead of leaving the controller waiting indefinitely. That failure does not retry the command. The physical runner slot is released after its known children have drained and no unresolved live process remains; an unresolved live process keeps the slot occupied until cleanup can be verified.
+ New acceptances seal the exact checked commit in `review.head`. A stale re-review lands that checked composition while retaining the original submitted commit as the item identity; landing snapshots record `reviewedCommit` when it differs. Adoption and publishing refuse if that proof changes. Historical released-engine receipts retain their original replay meaning. Coordinator resume derives `item_checked_commit` on its pending-merge cards. Merge groups, active integration claims and the printed merge command use that accepted composition; `item_commit` remains the immutable submitted identity, and stale cards still stay out of `toMerge`. The checked commit is pinned at `refs/pullboard/items/<id>/<first-12-sha>`; another replica must fetch that ref's Git objects before the sealed re-review can clear its stale state. Missing objects fail closed. The checked-head meaning starts at engine 33 on this composition, as assigned by the coordinator. Merge the actual trunk before landing. Earlier records retain their original meaning.
+
+ A re-review seals the union of the original item paths and paths changed by the checked repair against its reviewed trunk. Files added by a repair therefore participate in later stale-verdict detection.
+
+ Device-sealed presentations carry the same derived `verdictState`, including Git-only trunk movement and re-review, without changing native tables. Browser snapshot decoding preserves it. Repeated unchanged sealed snapshots reuse derived values and start no Git process after warm-up; staged supplied boards bypass that cache.
+
+ Cold freshness reads query first-parent history limited to the item’s literal paths, then inspect matching commits. Unrelated main revisions do not each start a file-diff process; merge and revert changes still count.
+
+ Unavailable Git-object verdict projections are retried on the next read, so fetching the sealed reviewed commit clears that uncertainty without a board event or trunk move. Known freshness projections remain cached.
+
When 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. `next` compares milestone, explicit rank, then its existing route/recent-file/age tie-breaks. A never-ranked board keeps its existing order. Removing an item drops its rank; adding it again leaves it unranked. This does not change newcomer help or person flows.
diff --cc docs/formats.md
index 98aa761c,e6137d4b..a60f2a6b
--- a/docs/formats.md
+++ b/docs/formats.md
@@@ -406,8 -409,6 +409,8 @@@ The schema, trigger and parser tables a
### Landing records
- Engine 8 adds `recordLandingBatch`, `recordLandingWaiver`, `recordLandingFlake` and `finishLandingBatch`. Older engines stop before applying these operations. Their append-only events need no schema migration. A batch snapshot has version 1, identity, base and tip commits, trunk branch, landing worktree, items with their first-containing merge commits, state, owner, log path and revision. Additional owner-lease and environment fields can be added without changing version 1. A revision refuses stale updates. Successful push precedes the atomic merged receipts and single `main-moved` event.
+ Engine 8 adds `recordLandingBatch`, `recordLandingWaiver`, `recordLandingFlake` and `finishLandingBatch`. Older engines stop before applying these operations. Their append-only events need no schema migration. A batch snapshot has version 1, identity, base and tip commits, trunk branch, landing worktree, items with their first-containing merge commits, state, owner, log path and revision. Additional owner-lease and environment fields can be added without changing version 1. A revision refuses stale updates. Successful push precedes the atomic merged receipts and single `main-moved` event. An engine-12 landing finish ordered after an engine-33 checked re-review still records the tree the older client actually pushed. If that legacy batch did not check the newer reviewed head, it also appends `landing-review-moved` with `code: "LAND_ITEM_MOVED"` and the exact verdict, checked head and landed merge. The newer review reads stale until its checked composition reaches the known trunk; the earlier landing receipt and verdicts remain immutable. Recovery creates a separate correction item rather than reopening or re-reviewing the already-landed original. Historical finishes ordered before the newer review retain their original receipts.
A person waiver records its identity, named test, expiry, reason and person channel. A distinct landing proof records the exact batch tree and each failing test with its covering waiver identity. Pre-push checks every waiver against the current time; this proof never writes an ordinary green-gate stamp. Flake records retain a test path, source digest, failing names and one defect item, so a repeated observation does not create another defect.
+
+Engine 32 adds the agent/coordinator `orderMilestoneItems` move, carrying a milestone name and its ordered subset of item ids. Earlier engines refuse it before changing the board or replay cursor. Ranked item ids stay with their milestone in its `order` metadata; old entries without it keep their prior queue order. Recorded next/reserve moves below engine 32 retain their original ordering even when later metadata contains ranks. Engine slots 25 through 31 belong to their separately allocated train items.
diff --cc src/engine.js
index 9347a0d6,a88943bd..9b8590f0
--- a/src/engine.js
+++ b/src/engine.js
@@@ -23,14 -23,20 +23,20 @@@ export const ENGINE_OPERATIONS = Object
]);
/** Engine version at which each ordered operation first has stable replay semantics. */
-const OPERATION_ENGINE = Object.freeze({ reopen: 8, recordLandingBatch: 8, recordLandingWaiver: 8, recordLandingFlake: 8, finishLandingBatch: 8, acceptCheck: CHECK_ACCEPT_ENGINE });
+const OPERATION_ENGINE = Object.freeze({ orderMilestoneItems: 32, reopen: 8, recordLandingBatch: 8, recordLandingWaiver: 8, recordLandingFlake: 8, finishLandingBatch: 8, acceptCheck: CHECK_ACCEPT_ENGINE });
- /** Dependency edits add engine-10 meaning, edit reasons engine-19, implied items engine-20, and a
- * cause key on a reject, reopen or person fact engine-30 (#713), without changing ordinary historical envelopes.
- */
- function minimumOperationEngine(operation, args) {
+ /** Dependency edits, bar reasons and sealed review metadata retain their distinct recorded engine meanings. */
+ function minimumOperationEngine(operation, args, board) {
const options = args[1];
const given = (name) => Boolean(options && typeof options === 'object' && Object.hasOwn(options, name) && options[name] !== undefined && options[name] !== null && options[name] !== false);
+ if (board && ['recordLandingBatch', 'finishLandingBatch'].includes(operation)) {
+ const id = operation === 'recordLandingBatch' ? args[0]?.batch?.id : args[0]?.id;
+ const prior = id && store.landingBatches(board).find(batch => batch.id === id);
+ if (prior && ['items', 'candidates'].some(key => Array.isArray(prior[key]) && prior[key].some(entry => entry && Object.hasOwn(entry, 'reviewedCommit')))) return VERDICT_REVIEW_ENGINE;
+ }
+ if (operation === 'verify' && options && Object.hasOwn(options, 'review')) return VERDICT_REVIEW_ENGINE;
+ if (operation === 'recordLandingBatch' && args[0]?.batch
+ && ['items', 'candidates'].some(key => Array.isArray(args[0].batch[key]) && args[0].batch[key].some(entry => entry && typeof entry === 'object' && Object.hasOwn(entry, 'reviewedCommit')))) return VERDICT_REVIEW_ENGINE;
if (['verify', 'reopen', 'appendFact'].includes(operation) && (given('cause') || given('neverAgain') || given('asPerson'))) return CAUSE_ENGINE;
if (carriesImplies(operation, args)) return IMPLIES_ENGINE;
if (carriesBarReason(operation, args)) return BAR_ENGINE;