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.

feat(merge): next pulls in line order [M1,P4,N2,H16,B13,C7,O5,O6,R1,R2]

Corey Olson23ae69a139fa
diff --cc docs/formats.md
index 075e875f,9e58828e..5d3d4970
--- a/docs/formats.md
+++ b/docs/formats.md
@@@ -113,7 -113,7 +113,7 @@@ The board file is in the repository's G
| `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. |
| `board schema` | `3` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | On a write open of a board whose version is behind: create missing tables and indexes (version 3 adds the hot-path indexes), add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. Read opens never migrate; a board at the current version whose shape differs is reported once on stderr and left as it is. |
| `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |
- | `move engine` | `99` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
-| `move engine` | `94` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
++| `move engine` | `100` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
<!-- format-versions:end -->
A builder never picks an engine number (#1101). An item that adds a board move adds its own `src/<name>-engine.js` leaf as `export const NAME_ENGINE = unassignedEngine();` (importing `unassignedEngine` from `./engine-next.js`); on its branch the leaf reads as one above the highest landed engine. The landing merge writes the next number into the leaf, in landing order, inside that item's merge commit, and sets the `move engine` row above to the highest landed number. A landed number never changes, so recorded moves replay as they were written. Moves are recorded under landed numbers only: code with an unnumbered engine is for its branch's own tests, and a move it records on a real board before landing may later read under another item's number, so the item lands before its moves are used.
@@@ -551,75 -544,6 +552,75 @@@ The engine-68 `recordSpecApprovalBaseli
| `landingBatchSize` | whole numbers 1 through 8 | `false` |
| `landingCadenceMinutes` | whole minutes 5 through 30 | `false` |
- These are recorded inputs only (#1096); this step does not enforce queue, takeover or landing behavior. 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.
+ `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.
+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.
+
+
Engine 93 adds item-addressed shouts. A shout move's optional `item` names an existing item; its event belongs to that item and includes the message text. Its canonical `shout_to` is `item:<id>`, read by the item's current builder and reviewer and the coordinator. Inbox, resume and seat watch use the same audience; an explicit seat or lane destination with `--item` still uses the item's audience. An item decision is answerable by its current participants or coordinator; replies stay in its thread and audience. The coordinator can still pass it to the person through the existing decision flow. A registered seat's shout to `all` is accepted and stored at reserved address `coordinator+person`, read only by coordination audiences. The plus sign cannot occur in valid lane names or their derived seat ids. Coordinator and person broadcasts retain `all` and reach everyone; recorded older-engine `all` rows retain their original global meaning without a retrospective sender filter. Main-checkout watch remains the person's board-wide observer. A joined seat's default watch filters shouts to its own address, lane, items and `all`, while ordinary lifecycle events remain visible.
+
+### Outside intake and sandbox receipts
+
+`pullboard intake <GitHub PR URL> --criterion "behavior" --check "command"`
+reads GitHub metadata and fetches the exact server-owned pull ref. It records an
+outside author (`outside:github:<login>`), commit, tree, source state and maintainer
+reply, and enters `submitted` without claiming that a native builder gated the PR.
+No contributor program is checked out or executed on the host. An issue URL records
+an open local source item; the GitHub issue closing does not accept the local item.
+Repeating intake refreshes source state and replies. A PR head can change only after
+normal return to open; re-intake invalidates its earlier sandbox proof and owner
+approval. Native agents cannot claim or submit an outside PR as their own build.
+
+Public source facts are in `board_meta` under `outside:<item-id>` and appear as
+`outside` on `show` JSON. Ordered `intakeOutside` and `approveOutside` moves retain
+`outside-intake`, `outside-refresh` and `outside-owner-approval` events. Approval is
+person authority bound to the exact commit, not an agent or parent-session claim.
+These facts survive board export and ordered replay. The local container logs are
+beside the board in `outside-check-output/<item-id>/<receipt-id>`; an ordered accept
+must match the executor's exact local receipt and output digests before transport.
+
+Sandbox verification reads operational provider settings from committed trusted
+main, not from the PR's configuration. `sandbox.provider` is `docker`,
+`sandbox.executable` is an absolute Docker-compatible CLI path, `sandbox.endpoint`
+is an explicit Unix daemon socket, and `sandbox.images.minimum` and
+`sandbox.images.current` are immutable `<image>@sha256:<digest>` references selected by trusted main.
+Prebuilt Node+Chrome images are supported for browser gates; outside heads cannot
+choose runtime images, and actual container Node versions must still match both roles. Images
+must already be present; verification uses `--pull never`. The actual container
+must report Linux Node 22.13.x and Node 24.x respectively, the two roles in the
+committed CI matrix; this is not a claim about the latest global Node release.
+Each role executes the trusted full gate and frozen criterion, with the criterion
+also required to fail at the recorded base. Protocol stand-ins in unit tests are
+not evidence of real containment or actual image execution.
+
+Every container has no network, an empty temporary HOME, a read-only root and
+private source export, no added capabilities, and no host credential environment.
+The Docker client has a fresh empty configuration and explicitly constructed
+environment. The source export contains independent exact-commit Git objects and
+files, never an operational checkout, its board database, worktree pointer,
+alternates or credential state. It is copied into a temporary writable container
+work directory. Exports default beside the native board under `sandbox-exports`;
+`sandbox.exportRoot` may name a private absolute directory shared with a VM-backed
+Docker daemon. Only a newly created child is exported and cleaned up. Missing
+runtime, inaccessible export or cleanup failure refuses; no host-process fallback
+is available. Normal physical gate/browser admission still applies.
+
+Owner-sensitive reasons are retained as `outside.sensitivity`, each with `path`,
+`rule` and `detail`; `outside.sensitive` is true when any reason matches. Defaults
+cover relay, sealing/signing/keys, person-move and hook code, hook configuration,
+`bin/`, CI workflows and command-bearing package fields. Trusted main may extend
+this with `intake.sensitivePaths`, relative exact files or trailing-slash prefixes;
+contributions cannot remove the defaults. Newly added process imports/calls or
+shell-runner calls and unreadable changed files also require approval. Renames
+retain both old and new touched paths. Ordinary source is not sensitive merely
+because it is source. The owner runs `pullboard intake approve <id>` through the
+person channel before sensitive work can land. Intake has no autonomous posting
+operation; each future result post still needs the person's separate OK.
+
+`FILE_GROWTH_NOTICE_ENGINE` adds atomic notices to an ordered brief edit: newly named
+files on a claimed or submitted item are checked against lease-normalized claimed,
+submitted and accepted-not-landed work. Each distinct holder receives one system
+notice per overlapping item, linked to its item thread; the edit remains allowed.
+Unchanged paths, prose, reordered lists and removals do not resend notices. Older
+recorded edits retain their silent behavior. The unassigned feature leaf receives
+its number at landing; no event-log or envelope format changes.
diff --cc docs/lifecycle.md
index 60985085,0adbccee..7be0c9ea
--- a/docs/lifecycle.md
+++ b/docs/lifecycle.md
@@@ -55,13 -54,12 +55,13 @@@ Each move checks its guards in this ord
| Move | From | To | Who | Guards, in order; result refusals |
| --- | --- | --- | --- | --- |
-| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |
+| intake | open | submitted | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), outsideSubmission (OUTSIDE_SOURCE) |
+| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE or OUTSIDE_NATIVE_BUILD), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED or BAR_NOT_READY) |
| release | open, claimed | open | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), releaseOwnsWork (NOT_YOURS), reviewReleaseExplained (NOTE_REQUIRED) |
| lapse | claimed | open | clock, when its lease runs out | none |
-| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |
+| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS or OUTSIDE_NATIVE_BUILD), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |
- | reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or SESSION_LEDGER), roadmapReadable (MILESTONES_CORRUPT), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) |
+ | reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or SESSION_LEDGER), roadmapReadable (MILESTONES_CORRUPT or LINE_SETTING_RANGE), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) |
-| accept | submitted, verified | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonIsMet (BAD_REASON), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), noUnverifiedStack (STACKED_ON_UNVERIFIED), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), itemCheckGreen (CHECK_RED or SLOT_DB_LOCKED or CHECK_UNVERIFIED or GUARD_CANNOT_FAIL or GUARD_NOT_FOUND), proofNoted (PROOF_REQUIRED), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION) |
+| accept | submitted, verified | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonIsMet (BAD_REASON), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), noUnverifiedStack (STACKED_ON_UNVERIFIED), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), itemCheckGreen (CHECK_RED or SANDBOX_PROVIDER_REQUIRED or SANDBOX_IMAGE_REQUIRED or SANDBOX_RUNTIME or SANDBOX_EXPORT or SANDBOX_EXECUTION or SANDBOX_CLEANUP_REQUIRED or SANDBOX_CHECK_REQUIRED or CHECK_NO_PROOF or OUTSIDE_SANDBOX_REQUIRED or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or CHECK_UNVERIFIED or GUARD_CANNOT_FAIL or GUARD_NOT_FOUND), proofNoted (PROOF_REQUIRED), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION) |
| reject | submitted, verified | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION), result (NOT_YOURS), result (CLOSED) |
| reopen | submitted, verified | open | coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), coordinatorOnly (COORDINATOR_ONLY), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), notMerged (ALREADY_MERGED), landingFailureRecorded (LANDING_FAILURE_REQUIRED), trunkConflicts (NOT_CONFLICTING or CONFLICT_FILES or NO_TRUNK or MERGE_CHECK_FAILED), conflictAccepted (NOT_ACCEPTED or BAD_CONFLICT or ENGINE_VERSION), result (BAD_CONFIG) |
| escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED) |
diff --cc src/board.js
index 132c0bac,867f1d67..b1272a9f
--- a/src/board.js
+++ b/src/board.js
@@@ -1,65 -1,10 +1,71 @@@
+ import {
+ lineOrderEnabled,
+ lineBuildOrder,
+ reviewerScarcity,
+ barReadyForOrder,
+ } from './line-order.js';
export { lineSettings, setLineSetting } from './line-settings.js';
+
+import {
+ applyOutsideIntake,
+ approveOutside as applyOutsideApproval,
+} from './outside-store.js';
+import {
+ outsideSandboxProblem,
+ outsideBuildProblem,
+ outsideSource,
+ requireOutsideOwner,
+ saveOutsideSource,
+} from './outside-source.js';
+import { FILE_GROWTH_NOTICE_ENGINE } from './file-growth-notice-engine.js';
+import {
+ recordBarRevision,
+ barReadyProblem,
+} from './bar-readiness.js';
+export { setBarReady, signBar } from './bar-readiness.js';
+import {
+ coordinatorCheck,
+ normalizeCheckBaseline,
+ saveCheckBaseline,
+} from './item-check-baseline.js';
+export { coordinatorCheck, completeCheckBaseline, itemCheckAuthor } from './item-check-baseline.js';
+import {
+ closeBoard,
+ openBoardForRead,
+ openBoardReadOnly,
+ readEventLogVersion,
+ systemClock,
+} from './board-read-open.js';
+import {
+ BOARD_BUSY_TIMEOUT_MS,
+ EVENT_LOG_VERSION,
+ SCHEMA,
+ SCHEMA_DIGEST,
+ SCHEMA_VERSION,
+} from './board-schema-source.js';
+import {
+ PERSON,
+ now,
+ isHeld,
+ current,
+ reviewReleasesSinceSubmit,
+ boardId,
+ itemById,
+ getItem,
+ listItems,
+ itemsInStatus,
+ reviewHolder,
+ reviewQueueBreakdown,
+ reviewQueue,
+ openDecisions,
+ unreadCount,
+ events,
+ itemThread,
+ laneHolds,
+ rowDecisions,
+ UNREAD_SQL,
+} from './board-query.js';
+
import { ITEM_SHOUT_ENGINE } from './item-shout-engine.js';
import {
COORDINATION_SHOUT,
diff --cc src/engine.js
index 588d1dc6,2186878f..c332cfcd
--- a/src/engine.js
+++ b/src/engine.js
@@@ -75,11 -70,10 +75,12 @@@ import { requireCoordinatorHold } from
import { LANDING_ENVIRONMENT_ENGINE } from './landing-environment-engine.js';
import { carriesLandingEnvironment } from './execution-environment.js';
import { LANDING_LEASE_ENGINE } from './landing-lease-engine.js';
+ import { LINE_ORDER_ENGINE } from './line-order-engine.js';
import { LINE_SETTINGS_ENGINE } from './line-settings-engine.js';
+import { PR_BRIDGE_ENGINE } from './pr-bridge-engine.js';
+import { LANDING_LOCAL_LEASE_ENGINE } from './landing-local-lease-engine.js';
-const ITEM_ID_FIRST_ARGUMENT = new Set(['acceptCheck', 'editItem', 'escalate', 'recordAttempt', 'claim', 'release', 'submit', 'reserveReview', 'verify', 'merged', 'withdraw', 'refreeze', 'reopen', 'appendFact']);
+const ITEM_ID_FIRST_ARGUMENT = new Set(['signBar', 'acceptCheck', 'editItem', 'escalate', 'recordAttempt', 'claim', 'release', 'submit', 'reserveReview', 'verify', 'merged', 'withdraw', 'refreeze', 'reopen', 'appendFact']);
/** Only these public board operations may be requested by an encrypted move. */
export const ENGINE_OPERATIONS = Object.freeze([
@@@ -100,15 -93,7 +101,16 @@@ const OPERATION_ENGINE = Object.freeze(
/** Dependency edits, causes, sealed reviews, submission proofs, trunk conflicts, health observations and milestone targets retain distinct recorded engine meanings. */
function minimumOperationEngine(operation, args, board, at) {
+ const outside = ['intakeOutside', 'approveOutside'].includes(operation) || operation === 'verify' && args[1]?.sandbox !== undefined
+ || board && ['claim', 'submit', 'verify', 'merged'].includes(operation) && Boolean(outsideSource(board, args[0]));
+ return Math.max(outside ? OUTSIDE_INTAKE_ENGINE : 1, minimumExistingOperationEngine(operation, args, board, at));
+}
+
+/** Preserve each pre-existing move's required feature level when composing outside metadata. */
+function minimumExistingOperationEngine(operation, args, board, at) {
+ if (['setBarReady', 'signBar'].includes(operation) || board && ['claim', 'submit', 'editItem', 'addItem', 'refreeze'].includes(operation) && barReadySetting(board).enabled) return BAR_READY_ENGINE;
+ if (operation === 'recordPublishFinding') return PR_BRIDGE_ENGINE;
+ if (operation === 'setLineSetting' && args[0]?.key === 'order') return LINE_ORDER_ENGINE;
if (operation === 'recordLandingTestDefect' || operation === 'verify' && args[1]?.environment !== undefined
|| operation === 'recordGateRun' && Object.hasOwn(args[0]?.receipt ?? {}, 'environment')
|| operation === 'recordLandingBatch' && carriesLandingEnvironment(args[0]?.batch)) return LANDING_ENVIRONMENT_ENGINE;
diff --cc src/line-order-engine.js
index 00000000,8df49923..fe1402d1
mode 000000,100644..100644
--- a/src/line-order-engine.js
+++ b/src/line-order-engine.js
@@@ -1,0 -1,3 +1,2 @@@
+ /** Opt-in queue ordering gets its permanent replay engine number at landing [N2,H16]. */
-import { unassignedEngine } from './engine-next.js';
-export const LINE_ORDER_ENGINE = unassignedEngine();
++export const LINE_ORDER_ENGINE = 100;
diff --cc test/next-order.test.js
index a6b0d586,00eab50f..55350e6d
--- a/test/next-order.test.js
+++ b/test/next-order.test.js
@@@ -636,70 -636,84 +636,152 @@@ test('the queue names the same noncolli
&& reason.includes('src/shared.js')), 'queue retains the same actionable blocking item and file');
});
+/** Real Git/SQLite and native edit/inbox commands; later lifecycle records are private fixture state, not gate executions. */
+test("a claimed item whose files grow into another claimed item's files names the overlap to both holders [N2,B7,B13,N20]", t => {
+ const box = crossLaneFixture(t);
+ const left = box.seat('growth-left', 'web', 'growth-left-session');
+ const right = box.seat('growth-right', 'web', 'growth-right-session');
+ /** Create ordinary coordinator briefs in the private project's permitted lane. */
+ const add = (title, file) => box.json(box.run(box.repo, 'add', 'web', title, '--specs', 'G1',
+ '--brief', `Files: ${file}\nTest: growing work names its newly shared file`, '--json')).item.item_id;
+ const a = add('A already holds x', 'web/x.js');
+ const b = add('B initially holds only y', 'web/y.js');
+ box.json(box.runAs('growth-left-session', left.root, 'claim', String(a), '--json'));
+ box.json(box.runAs('growth-right-session', right.root, 'claim', String(b), '--json'));
+ /** Read only this fixture's public board state and close before the next native command. */
+ function onBoard(work) {
+ const board = store.openBoard(join(box.repo, '.git', 'pullboard', 'board.sqlite'));
+ try { return work(board); } finally { store.closeBoard(board); }
+ }
+ /** The coordinator's normal edit is allowed even when it creates a collision. */
+ function edit(files, note = 'growing work names its newly shared file') {
+ return box.json(box.run(box.repo, 'edit', String(b), '--brief', `Files: ${files}\nTest: ${note}`, '--json'));
+ }
+ /** One delivered notice per holder names both items and the actual new collision. */
+ function noticesForBoth() {
+ const messages = [
+ box.json(box.runAs('growth-left-session', left.root, 'inbox', '--json')).shouts,
+ box.json(box.runAs('growth-right-session', right.root, 'inbox', '--json')).shouts,
+ ];
+ for (const [index, messagesForHolder] of messages.entries()) {
+ const notices = messagesForHolder.filter(message => message.shout_text.includes(`#${a}`)
+ && message.shout_text.includes(`#${b}`) && message.shout_text.includes('web/x.js'));
+ assert.equal(notices.length, 1, `${index === 0 ? 'A' : 'B'} receives exactly one new overlap notice`);
+ const item = index === 0 ? a : b;
+ assert.ok(onBoard(board => store.itemThread(board, item).some(event => event.kind === 'shout'
+ && event.detail.shout === notices[0].shout_id)), 'the holder notice is retained on its item thread');
+ }
+ }
+ edit('web/y.js, web/x.js');
+ const grown = onBoard(board => store.getItem(board, b));
+ assert.equal(grown.item_status, 'claimed', 'a warning does not revoke or reject the held edit');
+ assert.match(grown.item_brief, /web\/x\.js/u, 'the real native edit stored the enlarged file list');
+ noticesForBoth();
+ const noticeCount = onBoard(board => store.allShouts(board).length);
+ edit('web/x.js, web/y.js', 'only the prose and order changed');
+ edit('web/y.js');
+ assert.equal(onBoard(board => store.allShouts(board).length), noticeCount,
+ 'reordering existing paths, prose edits and shrinking a brief do not send duplicate notices');
+
+ // Seed later lifecycle states with real Git object IDs. These records do not claim an executed gate or landing.
+ const commit = box.git(box.repo, 'rev-parse', 'HEAD');
+ const tree = box.git(box.repo, 'rev-parse', 'HEAD^{tree}');
+ onBoard(board => {
+ submitFixture(board, a, { agentId: left.agent, commit, tree });
+ const reviewer = store.register(board, { lane: 'review', path: join(box.dir, 'growth-reviewer'), route: 'strong' });
+ store.verify(board, a, { agentId: reviewer, decision: 'ACCEPT', policy: 'any', head: commit,
+ digest: store.getItem(board, a).item_frozen_digest, note: 'Private lifecycle state only; no gate execution claimed.' });
+ submitFixture(board, b, { agentId: right.agent, commit, tree });
+ });
+ edit('web/y.js, web/x.js');
+ assert.equal(onBoard(board => store.getItem(board, b).item_status), 'submitted');
+ noticesForBoth();
+ const acceptedCount = onBoard(board => store.allShouts(board).length);
+ onBoard(board => store.merged(board, a, { agentId: 'coordinator', commit }));
+ edit('web/y.js');
+ edit('web/y.js, web/x.js');
+ assert.equal(onBoard(board => store.allShouts(board).length), acceptedCount,
+ 'an already landed item is no longer an in-flight collision');
+});
++
+
+ /** A private real Git repository and SQLite queue; lifecycle records below are not gate executions. */
+ function lineOrderFixture(t) {
+ const helpers = createE2eHelpers();
+ const box = helpers.sandbox();
+ const root = join(box.dir, 'line-order');
+ mkdirSync(root);
+ box.git(root, 'init', '-q', '-b', 'main');
+ box.git(root, 'commit', '--allow-empty', '-qm', 'test: seed the private line-order repository');
+ const board = store.openBoard(join(root, 'board.sqlite'));
+ store.register(board, { lane: 'coordinator', path: root });
+ const builder = store.register(board, { lane: 'core', path: join(root, 'builder'), route: 'strong', parent: 'builder-P', session: 'builder-child' });
+ const reviewer = store.register(board, { lane: 'review', path: join(root, 'reviewer'), route: 'strong', parent: 'reviewer-R', session: 'reviewer-child' });
+ t.after(() => { store.closeBoard(board); helpers.cleanup(); });
+ /** Switch only the recorded ordering control; other line controls remain off. */
+ function order(value) {
+ store.setLineSetting(board, { agentId: 'coordinator', key: 'order', value, reason: 'private queue policy control', window: { windowMinutes: 60, activeReviewers: 3 } });
+ }
+ return { board, root, builder, reviewer, order };
+ }
+
+ test('line order sends a send-back home first and gives the scarcest review first [N2,B13,H16]', t => {
+ const home = lineOrderFixture(t);
+ const older = store.addItem(home.board, { by: 'coordinator', lane: 'core', title: 'older fresh work' });
+ const returned = submitted(home.board, home.builder, 'a later send-back belongs home', 'strong', 1);
+ const returnedItem = store.getItem(home.board, returned);
+ store.verify(home.board, returned, { agentId: home.reviewer, decision: 'REJECT', reason: 'TEST_FAILURE',
+ note: 'Synthetic rejected lifecycle record; no gate execution claimed.', head: returnedItem.item_commit,
+ digest: returnedItem.item_frozen_digest, policy: 'any', reopenFirstRefusalMinutes: 15 });
+ store.addMilestone(home.board, { agentId: 'coordinator', name: 'first', items: [older] });
+ assert.equal(store.nextFor(home.board, { agentId: home.builder, lane: 'core' }).item.item_id, older, 'off retains release order before rework');
+ assert.equal(store.lineSettings(home.board).reviewsFirst, false, 'review-versus-build selection is a separate control');
+ home.order(true);
+ assert.equal(store.nextFor(home.board, { agentId: home.builder, lane: 'core' }).item.item_id, returned, 'on returns the builder to its own send-back before new release work');
+ home.order(false);
+ assert.equal(store.nextFor(home.board, { agentId: home.builder, lane: 'core' }).item.item_id, older, 'recorded off restores the prior order');
+
+ const scarce = lineOrderFixture(t);
+ const otherAuthor = store.register(scarce.board, { lane: 'core', path: join(scarce.root, 'author-Q'), parent: 'author-Q', session: 'author-Q-child' });
+ for (let index = 0; index < 2; index++) store.register(scarce.board, { lane: 'review', path: join(scarce.root, `sibling-${index}`),
+ parent: 'builder-P', session: `builder-sibling-${index}` });
+ const abundant = submitted(scarce.board, otherAuthor, 'older review has several independent seats', 'strong', 2);
+ const limited = submitted(scarce.board, scarce.builder, 'newer review shares its author parent with two seats', 'strong', 3);
+ const prior = store.getItem(scarce.board, limited);
+ store.verify(scarce.board, limited, { agentId: scarce.reviewer, decision: 'REJECT', reason: 'TEST_FAILURE',
+ note: 'Synthetic historical-author lifecycle record; no gate execution claimed.', head: prior.item_commit, digest: prior.item_frozen_digest, policy: 'any' });
+ store.claim(scarce.board, limited, { agentId: otherAuthor, lane: 'core', leaseMs: HOUR, freeze: FREEZE });
+ submitFixture(scarce.board, limited, { agentId: otherAuthor, commit: '4'.repeat(40), tree: '4'.repeat(40) });
+ assert.equal(store.nextFor(scarce.board, { agentId: scarce.reviewer, lane: 'review', verify: true }).item.item_id, abundant, 'off retains oldest review');
+ scarce.order(true);
+ assert.equal(store.nextFor(scarce.board, { agentId: scarce.reviewer, lane: 'review', verify: true }).item.item_id, limited,
+ 'scarcity excludes every seat from the same parent as an author, just as the review guard does');
+ const sibling = store.listAgents(scarce.board).find(agent => agent.agent_path === join(scarce.root, 'sibling-0')).agent_id;
+ assert.throws(() => store.reserveReview(scarce.board, limited, { agentId: sibling, leaseMs: HOUR, policy: 'any' }),
+ error => error.code === 'SELF_SESSION_VERIFY', 'the count cannot borrow eligibility from a seat refused by the real review guard');
+ const snapshot = exportBoard(scarce.board);
+ const replay = store.openBoard(join(scarce.root, 'replica.sqlite'));
+ t.after(() => store.closeBoard(replay));
+ importBoard(replay, snapshot);
+ assert.equal(store.nextFor(replay, { agentId: scarce.reviewer, lane: 'review', verify: true }).item.item_id, limited, 'export/import retains the recorded policy and author lineage');
+ const oldMove = prepareEngineMove(replay, 'reserveNextReview', [{ agentId: scarce.reviewer, lane: 'review', leaseMs: HOUR, policy: 'any' }]);
+ const oldOutcome = applyEngineMove(replay, { ...oldMove, engine: ENGINE_VERSION - 1 }, { sequence: 1, at: '2026-10-24T00:00:00Z' });
+ assert.equal(oldOutcome.result.item.item_id, abundant, 'an older recorded reserve-next retains its old ordering even with current policy records in the snapshot');
+
+ const ranked = lineOrderFixture(t);
+ const ordinary = store.addItem(ranked.board, { by: 'coordinator', lane: 'core', title: 'ranked ordinary work' });
+ const dependency = store.addItem(ranked.board, { by: 'coordinator', lane: 'core', title: 'another item waits for this' });
+ store.addItem(ranked.board, { by: 'coordinator', lane: 'core', title: 'blocked follower', after: [dependency] });
+ const ready = store.addItem(ranked.board, { by: 'coordinator', lane: 'core', title: 'ready bar', criterion: 'a real condition is observable', check: 'true', brief: 'Files: src/ready.js\nTest: the condition is checked' });
+ store.addMilestone(ranked.board, { agentId: 'coordinator', name: 'early', items: [ordinary, dependency, ready] });
+ store.orderMilestoneItems(ranked.board, 'early', { agentId: 'coordinator', items: [ordinary, ready, dependency] });
+ assert.equal(store.nextFor(ranked.board, { agentId: ranked.builder, lane: 'core' }).item.item_id, ordinary, 'off preserves coordinator rank');
+ ranked.order(true);
+ assert.equal(store.nextFor(ranked.board, { agentId: ranked.builder, lane: 'core' }).item.item_id, dependency, 'being waited on precedes ready-bar and coordinator rank');
+ store.withdraw(ranked.board, dependency, { agentId: 'coordinator', reason: 'private selection control: remove the prerequisite' });
+ assert.equal(store.nextFor(ranked.board, { agentId: ranked.builder, lane: 'core' }).item.item_id, ordinary, 'the signed-readiness tier is inert until its authoritative predicate lands');
+ const readiness = (_board, item) => item.item_id === ready;
+ const withSignedReadiness = [ordinary, ready].map(id => store.getItem(ranked.board, id))
+ .sort(store.buildOrder(ranked.board, { agentId: ranked.builder, readiness }));
+ assert.equal(withSignedReadiness[0].item_id, ready, 'the injected readiness predicate precedes coordinator rank without manufacturing signed records');
+ });