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.

fix: keep deferred landing priority after reaccept [B3,R3,R1,H16]

Corey Olsone9786b1b095f
diff --git a/docs/formats.md b/docs/formats.md
index 550f587a..f1dfabca 100644
--- a/docs/formats.md
+++ b/docs/formats.md
@@ -555,7 +555,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.
-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 retain verdict order for the next batch. 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.
+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.
Landing queue grants, first queue entries and releases are shared ordered transitions. New landing-local-heartbeat engine moves leave renewal and repeated-poll events out of history; old engine receipts keep their recorded meaning. `local:landing-lease:<token>` board metadata binds a physical board id, token/generation, process, branch and coordinator lineage to its local deadline. It is excluded from exports, imports and semantic digests and is retained only on the receiving physical board during a same-board relay snapshot restore. A linked foreign holder has no clock-based expiry: release or coordinator takeover fences it; local heartbeat deadlines never authorize another machine to merge.
diff --git a/src/land-collisions.js b/src/land-collisions.js
index 8c87cc71..b2b2bcaa 100644
--- a/src/land-collisions.js
+++ b/src/land-collisions.js
@@ -20,3 +20,20 @@ export function landingChangedFiles(root, base, commit) {
}
return fields.filter((_, index) => index % 2 === 1);
}
+
+/** Retain deferred queue places only for the identical accepted source and frozen bar. */
+export function deferredLandingPriorities(batches, items) {
+ const pending = new Map(items.map(item => [item.item_id, item]));
+ const priorities = new Map();
+ for (const batch of batches) {
+ if (batch.state !== 'landed') continue;
+ for (const entry of batch.blocked ?? []) {
+ const item = pending.get(entry.id);
+ if (entry.code !== 'LAND_FILE_OVERLAP' || !item || item.item_status !== 'verified' || item.item_merged_commit
+ || typeof entry.commit !== 'string' || entry.commit !== item.item_commit
+ || typeof entry.frozenDigest !== 'string' || entry.frozenDigest !== item.item_frozen_digest) continue;
+ if (!priorities.has(entry.id)) priorities.set(entry.id, priorities.size);
+ }
+ }
+ return priorities;
+}
diff --git a/src/land.js b/src/land.js
index f45279eb..6a0c5943 100644
--- a/src/land.js
+++ b/src/land.js
@@ -1,5 +1,8 @@
import { requireOutsideOwner } from './outside-source.js';
-import { landingChangedFiles } from './land-collisions.js';
+import {
+ landingChangedFiles,
+ deferredLandingPriorities,
+} from './land-collisions.js';
/** Coordinator landing batches retain exact Git and gate receipts across interruptions [B3,R3]. */
import { assignEngineNumbers } from './engine-numbers.js';
import {
@@ -182,12 +185,23 @@ function candidates(board, root, base, maximum, { firstReady = false } = {}) {
const pending = all.filter((item) => item.item_status === 'verified' && !item.item_merged_commit);
const order = new Map();
for (const event of store.events(board)) if (event.event_kind === 'accept') order.set(event.item_id, event.event_id);
- pending.sort((left, right) => (order.get(left.item_id) ?? Infinity) - (order.get(right.item_id) ?? Infinity) || left.item_id - right.item_id);
+ const collisionFree = store.lineSettings(board).collisionFreeBatch === true;
+ const batches = store.landingBatches(board);
+ const priorities = collisionFree ? deferredLandingPriorities(batches, pending) : new Map();
+ pending.sort((left, right) => {
+ const leftPriority = priorities.get(left.item_id);
+ const rightPriority = priorities.get(right.item_id);
+ if (leftPriority !== undefined || rightPriority !== undefined) {
+ if (leftPriority === undefined) return 1;
+ if (rightPriority === undefined) return -1;
+ if (leftPriority !== rightPriority) return leftPriority - rightPriority;
+ }
+ return (order.get(left.item_id) ?? Infinity) - (order.get(right.item_id) ?? Infinity) || left.item_id - right.item_id;
+ });
const ready = [];
const blocked = [];
- const collisionFree = store.lineSettings(board).collisionFreeBatch === true;
const touched = new Map();
- const knownReds = store.landingBatches(board).flatMap((batch) => batch.culprits ?? []);
+ const knownReds = batches.flatMap((batch) => batch.culprits ?? []);
for (const original of pending) {
const item = { ...original, item_landing_commit: store.checkedLandingCommit(board, original) };
const stale = projector.state(item);
@@ -212,6 +226,7 @@ function candidates(board, root, base, maximum, { firstReady = false } = {}) {
const shared = files.filter(file => touched.has(file));
if (shared.length) {
blocked.push({ id: item.item_id, code: 'LAND_FILE_OVERLAP', files: shared,
+ commit: item.item_commit, frozenDigest: item.item_frozen_digest,
with: [...new Set(shared.map(file => touched.get(file)))] });
continue; // Verdict order is unchanged; this item leads the next eligible batch.
}