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
chore(merge): carry main into the runner wait deadline [C7]
Corey Olsoncd46f98d0806
diff --cc docs/lifecycle.mdindex 87dc73b3,af8f8833..010830ba--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@@ -59,9 -59,9 +59,9 @@@ Each move checks its guards in this ord| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED 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), lineCapacity (LINE_WIP_LIMIT or LINE_SETTING_RANGE), 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 AGENT_REPLACED 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 AGENT_REPLACED 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 RUNNER_WAIT_DEADLINE or RUNNER_GUI_SESSION_REQUIRED 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), result (LINE_SETTING_RANGE) |-| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED 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 RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), result (LINE_SETTING_RANGE) |++| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED 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 RUNNER_WAIT_DEADLINE or RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), result (LINE_SETTING_RANGE) || reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED 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 AGENT_REPLACED 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 RUNNER_WAIT_DEADLINE or RUNNER_BROWSER_SLOT_REQUIRED or RUNNER_GUI_SESSION_REQUIRED 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) |-| accept | submitted, verified | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED 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 RUNNER_BROWSER_SLOT_REQUIRED or RUNNER_GUI_SESSION_REQUIRED 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), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), 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 AGENT_REPLACED 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 RUNNER_WAIT_DEADLINE or RUNNER_BROWSER_SLOT_REQUIRED or RUNNER_GUI_SESSION_REQUIRED 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), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), 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 AGENT_REPLACED 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 | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reopenAuthority (COORDINATOR_ONLY or VERDICT_WITHDRAW_FORBIDDEN or VERDICT_WITHDRAW_STATE), 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_VERDICT_WITHDRAW), result (ENGINE_VERSION), result (BAD_CONFIG) || escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED) |diff --cc src/gate.jsindex 0ac4ae15,9360ed71..1a4c4468--- a/src/gate.js+++ b/src/gate.js@@@ -237,9 -249,9 +250,9 @@@ export function runProfiledShell(root,};// The registered worker returns the same complete stage/component accounting as a local run.gateLease?.tracker?.mark('runAt');- const run = gateLease?.runner ? { ...runOnRunner(root, command, { runner: gateLease.runner, source: gateLease.source,+ const run = gateLease?.runner ? { ...runOnRunner(root, command, { runner: gateLease.runner, source: gateLease.source, runnerWaitDeadline: gateLease.runnerWaitDeadline,browser: gateLease.browser, pipefail, stages, waivers: landing ? waivers : [], metadata: { ...(gateLease.runMetadata ?? {}), landing, ...(timeoutMs ? { timeoutMs } : {}) } }) }- : runShell(root, command, { pipefail, env: inherited, stages, timeoutMs });+ : runShell(root, command, { pipefail, env: inherited, stages, timeoutMs, captureRuntimes: Boolean(gateLease) });gateLease?.tracker?.mark('ranAt');if (gateLease) {gateLease.environment = run.environment ?? null;@@@ -440,9 -514,9 +515,10 @@@ async function withOneGateSlot(root, actiming,allowIdleCapacityUpdate: true,remote: remote && Boolean(source),+ runnerOnly,runnerProvider: () => loadMachineSettings().runners ?? [],runnersFirstProvider: gateRunnersFirstEnabled,+ runnerWaitMs: gateRunnerWaitMs(),releaseContext,memory: floorMB === null ? undefined : memoryAdmission({ floorBytes: () => (memoryFloorMB() ?? floorMB) * 1024 ** 2, read: readMemory }),onWait,diff --cc src/machine.jsindex 40efdf17,fac28ac6..b5245b71--- a/src/machine.js+++ b/src/machine.js@@@ -132,8 -132,9 +132,9 @@@ export const GUARDS ={ id: 'barReady', refuse: 'BAR_NOT_READY', rule: 'an opted-in new bar has a named red baseline, measurement notes, reviewer edges and a revision-bound signature from another parent session', next: 'the author completes the brief, then another parent runs pullboard bar sign <id>', source: 'board', when: 'bar ready is on and this bar was frozen or edited after activation' },{ id: 'checkProvesSomething', refuse: 'CRITERION_PROVES_NOTHING', rule: "the item's check does not already pass on main, or the person accepted that exact check", next: 'set a check that fails before the work, or the person runs pullboard check accept <id>', source: 'cli', when: 'only when accepted main sets checks.provesNothing to "hold"' },- { id: 'gateGreen', refuse: 'GATE_RED', alsoRefuses: [{ code: 'RUNNER_GUI_SESSION_REQUIRED', next: 'nothing to do: the run reruns locally; log in to a GUI session on the runner before sending GUI-marked files there' }, { code: 'LAND_TIMEOUT_CUSTODY', next: 'inspect the saved timed gate cleanup state and stop only its proven owned processes before starting another landing' }, { code: 'LAND_GATE_OUTPUT', next: 'inspect the retained timed gate output directory and free disk space, then start another landing' }, { code: 'SLOT_DB_LOCKED', next: 'the run never started, so it is not a red; rerun the same command once the named process releases the slot database' }, { code: 'TIMING_SLOT_REQUIRED', next: 'start the timing check outside its inherited ordinary lease and acquire the machine gate with timing true' }, { code: 'RUNNER_BROWSER_SLOT_REQUIRED', next: 'nothing to do: the run reruns on a local gate slot; if it repeats, set gate.browserByLaunch the same on this machine and that runner' }, { code: 'PIPEFAIL_UNAVAILABLE', next: 'rewrite the gate without a pipe' }], rule: 'the gate, which submit runs itself every time, is green at HEAD', next: 'fix what the digest names, commit, submit again', source: 'cli' },+ { id: 'gateGreen', refuse: 'GATE_RED', alsoRefuses: [{ code: 'RUNNER_WAIT_DEADLINE', next: 'check the runners the message names, or restore local gate capacity with pullboard settings, then retry' }, { code: 'RUNNER_GUI_SESSION_REQUIRED', next: 'nothing to do: the run reruns locally; log in to a GUI session on the runner before sending GUI-marked files there' }, { code: 'LAND_TIMEOUT_CUSTODY', next: 'inspect the saved timed gate cleanup state and stop only its proven owned processes before starting another landing' }, { code: 'LAND_GATE_OUTPUT', next: 'inspect the retained timed gate output directory and free disk space, then start another landing' }, { code: 'SLOT_DB_LOCKED', next: 'the run never started, so it is not a red; rerun the same command once the named process releases the slot database' }, { code: 'TIMING_SLOT_REQUIRED', next: 'start the timing check outside its inherited ordinary lease and acquire the machine gate with timing true' }, { code: 'RUNNER_BROWSER_SLOT_REQUIRED', next: 'nothing to do: the run reruns on a local gate slot; if it repeats, set gate.browserByLaunch the same on this machine and that runner' }, { code: 'PIPEFAIL_UNAVAILABLE', next: 'rewrite the gate without a pipe' }], rule: 'the gate, which submit runs itself every time, is green at HEAD', next: 'fix what the digest names, commit, submit again', source: 'cli' },{ id: 'queuedItemLease', refuse: 'ITEM_LEASE_LOST', alsoRefuses: [{ code: 'A5_GRAMMAR_VERSION', next: 'upgrade Pullboard or restore a spec written for grammar 1, then retry' }, { code: 'SPEC_BEHIND_MAIN', next: 'merge main into this worktree, then renew the claim and retry' }, { code: 'NOT_A_REPO', next: 'restore the worktree Git metadata, then retry the command' }, { code: 'NO_CONFIG', next: 'restore pullboard.json in this worktree, then retry the command' }], rule: 'the caller still owns the same live item claim or review and can renew it against the frozen criterion', next: 'claim or reserve the item again before retrying the command', source: 'cli', when: 'while submit or an accept waits for a machine slot, and once immediately before admission' },+ { id: 'proofRecorded', refuse: 'PROOF_RUN_UNAVAILABLE', alsoRefuses: [{ code: 'PROOF_RUN_UNBOUND', next: 'restore the native gate receipt; do not supply provenance by hand' }, { code: 'PROOF_RUN_ACTOR', next: 'use the receipt from your own seat' }, { code: 'PROOF_RUN_STALE', next: 'read the changed criterion before running a new proof' }, { code: 'PROOF_RUN_CHANGED', next: 'keep the original receipt and run a new proof' }], rule: 'every executed proof is recorded from its native gate receipt before the item outcome', next: 'restore receipt storage and read pullboard show <id>', source: 'cli' },{ id: 'treeStillDuringGate', refuse: 'MOVED_DURING_GATE', rule: 'when the gate ends, HEAD and every tracked file are as they were when it started', next: 'leave the worktree alone until the gate finishes, then submit again', source: 'cli' },{ id: 'childrenDone', refuse: 'CHILDREN_OPEN', rule: 'every child item is verified or withdrawn', next: 'finish the child items, or the coordinator withdraws them', source: 'board' },{ id: 'headIsNew', refuse: 'HEAD_NOT_NEW', rule: 'a verifier has not rejected this commit at this bar; after a no-verdict reopen, the bar was refrozen', next: 'commit the rework, or refreeze the bar after a no-verdict reopen before resubmitting the same commit', source: 'board' },diff --cc src/resources.jsindex 137e7043,6629cd3b..88f021d6--- a/src/resources.js+++ b/src/resources.js@@@ -354,20 -348,19 +356,20 @@@ function queueOrder(scope)/** Read the complete resource line with the metadata every admission view orders identically. */function queuedWaiters(db, name) {- return db.prepare('SELECT ticket, pid, agent, repo, since, landing, item_check AS itemCheck, diagnostic, browser, gui, remote, item, kind, lease_until AS leaseUntil, classed, release_aware, board_key, release_rank, queue_ticket, short_eligible AS shortEligible, timing, memory_held AS memoryHeld, runner_deadline AS runnerDeadlineAt, runner_wait_branch AS runnerWaitBranch, runner_wait_reasons AS runnerWaitReasons FROM waiter WHERE name = ?').all(name);- return db.prepare('SELECT ticket, pid, agent, repo, since, landing, item_check AS itemCheck, diagnostic, browser, gui, remote, runner_only AS runnerOnly, item, kind, lease_until AS leaseUntil, classed, release_aware, board_key, release_rank, queue_ticket, short_eligible AS shortEligible, timing, memory_held AS memoryHeld FROM waiter WHERE name = ?').all(name);++ return db.prepare('SELECT ticket, pid, agent, repo, since, landing, item_check AS itemCheck, diagnostic, browser, gui, remote, runner_only AS runnerOnly, item, kind, lease_until AS leaseUntil, classed, release_aware, board_key, release_rank, queue_ticket, short_eligible AS shortEligible, timing, memory_held AS memoryHeld, runner_deadline AS runnerDeadlineAt, runner_wait_branch AS runnerWaitBranch, runner_wait_reasons AS runnerWaitReasons FROM waiter WHERE name = ?').all(name);}/** Current holders and the waiting line in admission order, each waiter naming its class (aged only while class order is on). */function snapshot(db, name, order = ARRIVAL_ORDER, now = Date.now()) {/** Preserve older public entries while naming diagnostics as a distinct queue class. */- const project = ({ diagnostic, browser, gui, remote, runner, item, kind, leaseUntil, shortSlot, shortEligible, timing, memoryHeld, runnerDeadlineAt, runnerWaitBranch, runnerWaitReasons, ...entry }) => ({ ...entry, landing: entry.landing === 1,- const project = ({ diagnostic, browser, gui, remote, runnerOnly, runner, item, kind, leaseUntil, shortSlot, shortEligible, timing, memoryHeld, ...entry }) => ({ ...entry, landing: entry.landing === 1,++ const project = ({ diagnostic, browser, gui, remote, runnerOnly, runner, item, kind, leaseUntil, shortSlot, shortEligible, timing, memoryHeld, runnerDeadlineAt, runnerWaitBranch, runnerWaitReasons, ...entry }) => ({ ...entry, landing: entry.landing === 1,itemCheck: entry.itemCheck === 1 && diagnostic !== 1, ...(diagnostic === 1 ? { diagnostic: true } : {}),...(['gate', 'browser'].includes(name) && shortSlot === 1 ? { slot: 'short' } : {}),...(['gate', 'browser'].includes(name) && shortSlot === 0 ? { slot: 'gate' } : {}),...(['gate', 'browser'].includes(name) && shortEligible === 1 ? { requestedSlot: 'short-eligible' } : {}),+ ...(runnerDeadlineAt > 0 && now >= runnerDeadlineAt ? { runnerDeadline: { at: runnerDeadlineAt, branch: runnerWaitBranch, runners: JSON.parse(runnerWaitReasons) } } : {}),...(memoryHeld === 1 ? { memoryHeld: true } : {}), ...(timing === 1 ? { timing: true } : {}), ...(browser === 1 ? { browser: true } : {}), ...(gui === 1 ? { gui: true } : {}), ...(remote === 1 ? { remote: true } : {}),- ...(runner ? { runner } : {}), ...(item ? { item } : {}), ...(kind ? { kind } : {}), ...(leaseUntil ? { leaseUntil } : {}) });+ ...(runnerOnly === 1 ? { runnerOnly: true } : {}), ...(runner ? { runner } : {}), ...(item ? { item } : {}), ...(kind ? { kind } : {}), ...(leaseUntil ? { leaseUntil } : {}) });// Browser is an additional capability on a gate lease, not a second partially held row.const where = name === 'browser' ? 'name = ? AND browser = 1' : 'name = ?';const sourceName = name === 'browser' ? 'gate' : name;@@@ -948,32 -939,14 +952,32 @@@ export async function takeResource(optireturn { acquired: false, state: { ...snapshot(db, name, order), position: waiterPosition(db, name, initialTicket, { order, shortCapacity: options.shortCapacityProvider?.() ?? 0 }), rejoined: true } };}// The marker follows this poll's setting, so a change mid-wait reaches every process's ranking.- db.prepare('UPDATE waiter SET heartbeat = ?, classed = ?, remote = ?, runner_deadline = ? WHERE token = ?')- .run(Date.now(), classedMarker(order), Number(remote && !runnerDeadlinePassed), runnerDeadlineAt, token);- db.prepare('UPDATE waiter SET heartbeat = ?, classed = ?, runner_only = ? WHERE token = ?').run(Date.now(), classedMarker(order), Number(runnerOnly), token);++ db.prepare('UPDATE waiter SET heartbeat = ?, classed = ?, runner_only = ?, remote = ?, runner_deadline = ? WHERE token = ?')++ .run(Date.now(), classedMarker(order), Number(runnerOnly), Number(remote && !runnerDeadlinePassed), runnerDeadlineAt, token);+ waiter.remote = Number(remote && !runnerDeadlinePassed);const unavailable = unavailableRunnerHosts(db, now);const memoryHeld = Boolean(memory?.held && (name !== 'gate' || waiter.remote !== 1|| !runners.some(runner => runnerCompatible(db, runner, waiter, unavailable))));db.prepare('UPDATE waiter SET memory_held = ? WHERE token = ?').run(Number(memoryHeld), token);+ const limit = db.prepare('SELECT capacity FROM resource WHERE name = ?').get(name).capacity;+ let runnerDeadline;+ if (runnerDeadlineAt && (runnerDeadlinePassed || !waiter.runnerWaitBranch)) {+ const state = snapshot(db, name, order, now);+ runnerDeadline = { at: runnerDeadlineAt, runners: runnerWaitReasons(db, runners, { ...waiter, timing: Number(timing) }, unavailable),+ branch: localWaitBranch({ capacity: limit, browserCapacity: options.browserCapacityProvider?.() ?? 1,- runnerOnly: false, browser, timing, memoryHeld: memory?.held === true, holders: state.holders }) };++ runnerOnly, browser, timing, memoryHeld: memory?.held === true, holders: state.holders }) };+ db.prepare('UPDATE waiter SET runner_wait_branch = ?, runner_wait_reasons = ? WHERE token = ?')+ .run(runnerDeadline.branch, JSON.stringify(runnerDeadline.runners), token);+ // Without local capacity the run cannot fall back, so it refuses by name rather than wait forever.- if (runnerDeadlinePassed && runnerDeadline.branch === 'no local capacity') {++ if (runnerDeadlinePassed && (runnerOnly || runnerDeadline.branch === 'no local capacity')) {+ throw new Refused('RUNNER_WAIT_DEADLINE', `${runnerDeadlineLine(runnerDeadline)}; restore safe local capacity or check the named runners, then retry`);+ }+ // A read-only status may cross the clock boundary between polls. Seed its facts+ // immediately, while progress and fallback still wait for the actual deadline.+ if (!runnerDeadlinePassed) runnerDeadline = undefined;+ }const spot = snapshot(db, name, order, now);const reportPosition = waiterPosition(db, name, waiter.ticket, { order, now, shortCapacity: options.shortCapacityProvider?.() ?? 0 });- const limit = db.prepare('SELECT capacity FROM resource WHERE name = ?').get(name).capacity;// Local pressure blocks local executors, including short slots, but never a remote executor.if (name !== 'gate' && memoryHeld) return { acquired: false, state: { ...spot, position: reportPosition, memory } };const executor = name === 'gate'@@@ -985,12 -958,12 +989,13 @@@const acquiredAt = new Date().toISOString();const holderName = executor.host ? runnerResourceName(executor.host) : name;db.prepare('INSERT INTO holder(token, name, pid, started, agent, repo, since, heartbeat, landing, item_check, diagnostic, browser, item, kind, runner, short_slot, timing, timing_aware) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)').run(token, holderName, pid, started, agent, repo, acquiredAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind, executor.host, Number(executor.shortSlot === true), Number(timing), 1);+ db.prepare('UPDATE holder SET runner_execution = ? WHERE token = ?').run(Number(options.runnerExecution === true), token);- return { acquired: true, state: { ...spot, position: 0 }, ticket: waiter.ticket, queueTicket, runner: executor.host ? executor : undefined, shortSlot: executor.shortSlot === true, capacity: limit, admittedAt: acquiredAt };+ return { acquired: true, state: { ...spot, position: 0, ...(runnerDeadline ? { runnerDeadline } : {}) }, ticket: waiter.ticket, queueTicket, runner: executor.host ? executor : undefined, shortSlot: executor.shortSlot === true, capacity: limit, admittedAt: acquiredAt };}- return { acquired: false, state: { ...spot, position: reportPosition, ...(memoryHeld ? { memory } : {}) } };+ return { acquired: false, state: { ...spot, position: reportPosition, ...(memoryHeld ? { memory } : {}), ...(runnerDeadline ? { runnerDeadline } : {}) } };}));if (acquired.acquired) {+ if (acquired.state.runnerDeadline) process.stderr.write(runnerDeadlineLine(acquired.state.runnerDeadline) + '; running locally\n');// Only item-lease callbacks opt into admission. Await them so no renewal remains in// flight during the run, and restart the ordinary item expiry from this boundary.if (leaseUntil) {@@@ -1078,14 -1051,13 +1083,14 @@@throw error;}db.close();- return takeResource({ ...options, ...(local ? { remote: false } : {}), _resume: { token, ticket: requeueTicket ?? acquired.ticket, queueTicket: requeueOpportunity,+ return takeResource({ ...options, ...(local && !runnerOnly ? { remote: false } : {}), _resume: { token, ticket: requeueTicket ?? acquired.ticket, queueTicket: requeueOpportunity,- queuedAt, requestedAt, priorWaitMs: acquiredWaitMs, waitStartedAt: Date.now() } });+ queuedAt, requestedAt, runnerDeadlineAt, priorWaitMs: acquiredWaitMs, waitStartedAt: Date.now() } });};- return { name, scope, token, pool, browser, timing, admittedAt: acquired.admittedAt, capacity: acquired.capacity, slotClass: acquired.shortSlot ? 'short' : 'gate', ...(acquired.runner ? { runner: acquired.runner } : {}),+ return { name, scope, token, pool, browser, timing, runnerExecution: options.runnerExecution === true, admittedAt: acquired.admittedAt, capacity: acquired.capacity, slotClass: acquired.shortSlot ? 'short' : 'gate', ...(acquired.runner ? { runner: acquired.runner } : {}),- waitMs: acquiredWaitMs, release, renew, timingEvidence,+ waitMs: acquiredWaitMs, ...(runnerDeadlineAt ? { runnerWaitDeadline: runnerDeadlineAt } : {}), release, renew, timingEvidence,...(acquired.runner ? { requeueRunner } : {}) };}+ if (acquired.state.runnerDeadline) process.stderr.write(runnerDeadlineLine(acquired.state.runnerDeadline) + '\n');await keepItemLease(acquired.state, 'waiter');await pause(POLL_MS);}diff --cc test/move-registry-baseline.jsonindex b011e53d,18d9f5b6..449f4784--- a/test/move-registry-baseline.json+++ b/test/move-registry-baseline.json@@@ -661,6 -663,7 +663,14 @@@null,null],- "recordProofRun": [null, "first", null, null, null, null],++ "recordProofRun": [++ null,++ "first",++ null,++ null,++ null,++ null++ ],"recordRowVerification": [null,"first",@@@ -7054,7 -7076,11 +7081,12 @@@"RELAY_SSH_KEY": "make an SSH key with ssh-keygen -t ed25519, add it to GitHub with gh ssh-key add, then run pullboard relay on again","RELAY_SSH_KEYGEN": "install OpenSSH, then run pullboard relay on again","RELAY_SSH_SIGN": "load the key with ssh-add, or set PULLBOARD_SSH_KEY to a key on your GitHub account, then run pullboard relay on again",+ "COMPANION_PARENT": "name the parent item: pullboard companion <parent> <lane> \"<title>\" --key <key>",+ "COMPANION_KEY": "supply a stable --key and reuse it for this same parent and target lane",+ "COMPANION_LANE": "choose a different target lane; ordinary same-lane children use pullboard add --parent",+ "COMPANION_CONTENT": "supply title, criterion and brief text and existing spec ids for the companion",- "COMPANION_RECORD": "restore a consistent board export so the companion request index matches its child"++ "COMPANION_RECORD": "restore a consistent board export so the companion request index matches its child",+ "RUNNER_WAIT_DEADLINE": "check the runners the message names, or restore local gate capacity with pullboard settings, then retry"},"replay": {"initial": {diff --cc test/runner-wait-deadline.test.jsindex 4d38336a,00000000..53faed10mode 100644,000000..100644--- a/test/runner-wait-deadline.test.js+++ b/test/runner-wait-deadline.test.js@@@ -1,240 -1,0 +1,239 @@@+/** Runner deadlines retain ordinary local admission and never create disabled capacity [C7,Q1,Q2]. */+import assert from 'node:assert/strict';+import { after, test } from 'node:test';+import { mkdirSync, readFileSync, existsSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import { pathToFileURL } from 'node:url';+import { createE2eHelpers } from './e2e-helpers.js';+import { cleanupFixtureChildren, runFixtureChild } from './fixture-child.js';+import { cleanupToolingSnapshots, cli, fixtureResultContext, gateResult, runThroughGate } from './runner-tooling-fixture.js';+import { HOST, installSshStandIn, shellQuote } from './runner-ssh-fixture.js';+import { listResources, takeResource } from '../src/resources.js';++const e2e = createE2eHelpers();+after(e2e.cleanup);+after(cleanupFixtureChildren);+after(cleanupToolingSnapshots);++/** Build the real loopback SSH transport in an isolated machine, with a short private deadline. */+function fixture({ hold = '', runnerWaitMs = 60, dropFirst = !hold } = {}) {+ const box = e2e.project('true');+ const paths = Object.fromEntries(['bin', 'worker', 'remoteHome', 'remoteMachine'].map(name => [name, join(box.dir, name)]));+ for (const path of Object.values(paths)) mkdirSync(path, { recursive: true });+ const requests = join(box.dir, 'requests.jsonl');+ const starts = join(box.dir, 'starts.jsonl');+ const stderrLog = join(box.dir, 'worker-stderr.log');+ installSshStandIn({ bin: paths.bin, worker: paths.worker, home: paths.remoteHome,+ machineHome: paths.remoteMachine, requests, starts, hold, dropFirst, stderrLog });+ box.env.PATH = paths.bin + ':' + box.env.PATH;+ const added = cli(box.repo, box.env, 'runner', 'add', HOST + '-drop', '--slots', '1', '--browser', '1');+ assert.equal(added.status, 0, fixtureResultContext(added));+ const settingsFile = join(box.env.PULLBOARD_MACHINE_HOME, 'settings.json');+ const settings = JSON.parse(readFileSync(settingsFile, 'utf8'));+ writeFileSync(settingsFile, JSON.stringify({ ...settings, gateSlots: 1, browserSlots: 1,+ gate: { ...settings.gate, runnerWaitMs, runnersFirst: false } }));+ return { ...box, requests, starts, stderrLog, settingsFile };+}++/** Observe a real fixture phase, with cleanup owned by the caller rather than a production timeout override. */+async function observe(predicate, description) {+ const until = Date.now() + 10_000; // budget: private Git and SSH startup; no production deadline extension.+ while (!predicate()) {+ if (Date.now() >= until) throw new Error('fixture did not reach ' + description);+ await new Promise(resolve => setTimeout(resolve, 20));+ }+}++test('a gate run waiting for an unreachable runner falls back to a local slot after the deadline and names the runner [C7,Q1,Q2]', async () => {+ const box = fixture({ runnerWaitMs: 1_000 });+ const previous = [process.env.PULLBOARD_HOME, process.env.PULLBOARD_MACHINE_HOME];+ process.env.PULLBOARD_HOME = box.env.PULLBOARD_HOME;+ process.env.PULLBOARD_MACHINE_HOME = box.env.PULLBOARD_MACHINE_HOME;+ let held;+ let pending;+ try {+ const settings = JSON.parse(readFileSync(box.settingsFile, 'utf8'));+ const idle = await takeResource({ name: 'gate', scope: 'machine', root: box.repo, capacity: 1,+ browserCapacityProvider: () => 1, browser: true, gui: true, remote: true,+ runnerProvider: () => settings.runners, runnersFirstProvider: () => false, agent: 'idle-local-control' });+ assert.equal(idle.runner, undefined, 'an idle compatible local slot is not hidden by registered non-GUI runners');+ idle.release();+ held = await takeResource({ name: 'gate', scope: 'machine', root: box.repo, capacity: 1, agent: 'real-local-holder' });+ const marker = join(box.dir, 'ran-locally');+ const command = 'node -e ' + shellQuote(`require('node:fs').writeFileSync(${JSON.stringify(marker)},'actual local command'); console.log('DEADLINE_LOCAL_EXECUTION')`);+ pending = runThroughGate(box.repo, box.env, command, { item: 'deadline-case', requests: box.requests });+ await observe(() => existsSync(box.requests) && readFileSync(box.requests, 'utf8').includes('"dropped":true'), 'the actual SSH transport drop');+ const queue = () => listResources({ scope: 'machine' }).find(resource => resource.name === 'gate');+ await observe(() => queue()?.line.some(row => row.item === 'deadline-case'), 'the original run requeued after transport loss');+ const first = queue().line.find(row => row.item === 'deadline-case');+ await new Promise(resolve => setTimeout(resolve, 1_100)); // budget: pass the private one-second deadline while the real local holder stays held.+ const resources = cli(box.repo, box.env, 'resources');+ assert.equal(resources.status, 0, fixtureResultContext(resources));+ assert.match(resources.stdout, /runner wait deadline/iu, 'public resources names the overdue run');+ assert.match(resources.stdout, new RegExp(HOST + '-drop.*unreachable', 'iu'), 'the actual dropped runner and reason are named');+ const status = cli(box.repo, box.env, 'status');+ assert.equal(status.status, 0, fixtureResultContext(status));+ assert.match(status.stdout, /runner wait deadline/iu, 'ordinary status also names a run past its runner deadline');+ const current = queue().line.find(row => row.item === 'deadline-case');+ assert.equal(current.since, first.since, 'fallback preserves the original queue age');+ assert.equal(existsSync(marker), false, 'the deadline never bypasses a live local holder');+ held.release(); held = null;+ const result = await pending; pending = null;+ assert.equal(result.status, 0, fixtureResultContext(result));+ assert.match(result.stdout, /DEADLINE_LOCAL_EXECUTION/u);+ assert.equal(gateResult(result.stdout).runner, undefined, 'the command actually executes locally');+ assert.match(result.stderr, new RegExp(HOST + '-drop.*unreachable', 'iu'), 'fallback emits the named runner reason');+ assert.equal(readFileSync(box.requests, 'utf8').trim().split('\n').length, 1, 'a quarantined runner is not retried after the deadline');+ assert.equal(queue().holders.length + queue().line.length, 0, 'all private leases drain');+ } finally {+ held?.release();+ if (pending) await pending; // Release the held slot even on a missing-deadline assertion, then drain the owned controller.+ for (const [index, key] of ['PULLBOARD_HOME', 'PULLBOARD_MACHINE_HOME'].entries()) {+ if (previous[index] === undefined) delete process.env[key]; else process.env[key] = previous[index];+ }+ }+});+- test('disabled local capacity refuses by name at the runner deadline [C7,Q1]', () => {- // Runner-only work (#1240) composes its own case when it lands; on this trunk every run may fall back locally.- for (const runnerOnly of [false]) {++test('disabled local capacity and runner-only work refuse by name at the runner deadline [C7,Q1]', () => {++ for (const runnerOnly of [false, true]) {+ const box = fixture();+ const settings = JSON.parse(readFileSync(box.settingsFile, 'utf8'));+ writeFileSync(box.settingsFile, JSON.stringify({ ...settings, gateSlots: runnerOnly ? 1 : 0, browserSlots: runnerOnly ? 1 : 0 }));+ const module = pathToFileURL(join(import.meta.dirname, '../src/gate.js')).href;+ const source = `import {withGateSlot} from ${JSON.stringify(module)};+try { await withGateSlot(${JSON.stringify(box.repo)},()=>{throw Error('disabled execution ran')},{browser:true,gui:true,runnerOnly:${runnerOnly},agent:'deadline-refusal'}); process.exitCode=9; }+catch(error) { console.log(JSON.stringify({code:error.code,message:error.message})); process.exitCode=error.code==='RUNNER_WAIT_DEADLINE'?0:8; }`;+ const result = runFixtureChild(process.execPath, ['--input-type=module', '-e', source], {+ cwd: box.repo, env: box.env, encoding: 'utf8', timeout: 5_000 }); // budget: a missing 60ms private deadline is a bounded failure, not an immortal test.+ assert.equal(result.status, 0, result.context);+ assert.match(result.stdout, runnerOnly ? /runner.only/iu : /no local capacity/iu);+ assert.match(result.stdout, new RegExp(HOST + '-drop', 'u'));+ }+});++test('a registered runner that never answers is canceled at the deadline and the original run executes locally [C7,Q1,Q2]', async () => {+ const box = fixture({ hold: 'dispatch', runnerWaitMs: 1_000 });+ const previous = [process.env.PULLBOARD_HOME, process.env.PULLBOARD_MACHINE_HOME];+ process.env.PULLBOARD_HOME = box.env.PULLBOARD_HOME;+ process.env.PULLBOARD_MACHINE_HOME = box.env.PULLBOARD_MACHINE_HOME;+ let held;+ let pending;+ try {+ held = await takeResource({ name: 'gate', scope: 'machine', root: box.repo, capacity: 1, agent: 'stalled-local-holder' });+ pending = runThroughGate(box.repo, box.env, 'node -e "console.log(\'STALLED_RUN_LOCAL\')"', { item: 'stalled-case', requests: box.requests });+ await observe(() => existsSync(box.starts), 'the non-answering SSH stand-in actually starting');+ const queue = () => listResources({ scope: 'machine' }).find(resource => resource.name === 'gate');+ await observe(() => queue()?.line.some(row => row.item === 'stalled-case' && row.runnerDeadline), 'deadline cancellation and the original local queue ticket');+ const waiting = queue().line.find(row => row.item === 'stalled-case');+ assert.match(waiting.runnerDeadline.branch, /local gate slots busy/u);+ assert.match(waiting.runnerDeadline.runners[0].reason, /unreachable/u);+ assert.equal(readFileSync(box.starts, 'utf8').trim().split('\n').length, 1, 'the non-answering host is not retried');+ held.release(); held = null;+ const result = await pending; pending = null;+ assert.equal(result.status, 0, fixtureResultContext(result));+ assert.match(result.stdout, /STALLED_RUN_LOCAL/u);+ assert.equal(gateResult(result.stdout).runner, undefined);+ assert.match(result.stderr, /runner wait deadline/iu);+ assert.equal(queue().holders.length + queue().line.length, 0);+ } finally {+ held?.release();+ // A deliberately non-answering stand-in is owned by the fixture's existing phase watchdog.+ if (pending) await pending.catch(() => {});+ for (const [index, key] of ['PULLBOARD_HOME', 'PULLBOARD_MACHINE_HOME'].entries()) {+ if (previous[index] === undefined) delete process.env[key]; else process.env[key] = previous[index];+ }+ }+});++test('the public runner deadline setting has a five-minute default and rejects unsafe timer values [C7]', () => {+ const box = e2e.project('true');+ const initial = cli(box.repo, box.env, 'settings', '--json');+ assert.equal(initial.status, 0, fixtureResultContext(initial));+ const approvedDefault = 300_000; // budget: the approved five-minute default in milliseconds.+ assert.equal(JSON.parse(initial.stdout).settings.gate.runnerWaitMs, approvedDefault);+ const configuredDuration = 1500; // budget: a private configurable duration whose exact value must persist.+ const changed = cli(box.repo, box.env, 'settings', 'gate.runnerWaitMs', String(configuredDuration), '--json');+ assert.equal(changed.status, 0, fixtureResultContext(changed));+ assert.equal(JSON.parse(changed.stdout).settings.gate.runnerWaitMs, configuredDuration);+ const file = join(box.env.PULLBOARD_MACHINE_HOME, 'settings.json');+ const before = readFileSync(file, 'utf8');+ for (const value of ['0', '-1', '1.5', '2147483648', 'Infinity']) {+ const invalid = cli(box.repo, box.env, 'settings', 'gate.runnerWaitMs', value);+ assert.notEqual(invalid.status, 0, fixtureResultContext(invalid));+ assert.equal(readFileSync(file, 'utf8'), before, 'invalid settings never replace the last valid deadline');+ }+});++test('an executing runner command keeps its test budget after the admission deadline [C7]', async () => {+ const box = fixture({ runnerWaitMs: 5_000, dropFirst: false });+ const previous = [process.env.PULLBOARD_HOME, process.env.PULLBOARD_MACHINE_HOME];+ process.env.PULLBOARD_HOME = box.env.PULLBOARD_HOME;+ process.env.PULLBOARD_MACHINE_HOME = box.env.PULLBOARD_MACHINE_HOME;+ let held;+ let pending;+ try {+ held = await takeResource({ name: 'gate', scope: 'machine', root: box.repo, capacity: 1, agent: 'admitted-run-local-holder' });+ const started = Date.now();+ pending = runThroughGate(box.repo, box.env,+ 'node -e "setTimeout(()=>console.log(\'ADMITTED_LONG_COMMAND\'),6000)"', { requests: box.requests });+ await observe(() => existsSync(box.stderrLog) && readFileSync(box.stderrLog, 'utf8').includes('PULLBOARD_RUNNER_READY '), 'the real worker READY frame');+ console.error('private worker became ready after', Date.now() - started, 'ms; admission deadline is 5000ms');+ const result = await pending; pending = null;+ assert.equal(result.status, 0, fixtureResultContext(result));+ assert.match(result.stdout, /ADMITTED_LONG_COMMAND/u);+ assert.equal(gateResult(result.stdout).runner, HOST + '-drop', 'a ready runner is not canceled or duplicated locally');+ assert.equal(readFileSync(box.requests, 'utf8').trim().split('\n').length, 1);+ } catch (error) {+ const lines = existsSync(box.stderrLog) ? readFileSync(box.stderrLog, 'utf8').split('\n') : [];+ console.error('private worker diagnostics:', lines.filter(line => !line.startsWith('PULLBOARD_RUNNER_RESULT ')).slice(-8).map(line => line.slice(0, 500)).join('\n'));+ if (existsSync(box.requests)) console.error('private worker outcomes:', readFileSync(box.requests, 'utf8').split('\n').filter(Boolean).map(line => {+ const { call, workerStarted, code, signal } = JSON.parse(line);+ return { call, workerStarted, code, signal };+ }));+ throw error;+ } finally {+ held?.release();+ if (pending) await pending.catch(() => {});+ for (const [index, key] of ['PULLBOARD_HOME', 'PULLBOARD_MACHINE_HOME'].entries()) {+ if (previous[index] === undefined) delete process.env[key]; else process.env[key] = previous[index];+ }+ }+});++test('a busy runner is named at the deadline and fallback waits for a real local slot [C7,Q1,Q2]', async () => {+ const box = fixture({ dropFirst: false });+ const previous = [process.env.PULLBOARD_HOME, process.env.PULLBOARD_MACHINE_HOME];+ process.env.PULLBOARD_HOME = box.env.PULLBOARD_HOME;+ process.env.PULLBOARD_MACHINE_HOME = box.env.PULLBOARD_MACHINE_HOME;+ let held;+ let remote;+ let pending;+ try {+ held = await takeResource({ name: 'gate', scope: 'machine', root: box.repo, capacity: 1, agent: 'busy-local-holder' });+ const settings = JSON.parse(readFileSync(box.settingsFile, 'utf8'));+ remote = await takeResource({ name: 'gate', scope: 'machine', root: box.repo, capacity: 1,+ browser: true, browserCapacityProvider: () => 1, remote: true,+ runnerProvider: () => settings.runners, agent: 'real-remote-reservation' });+ assert.equal(remote.runner.host, HOST + '-drop');+ pending = runThroughGate(box.repo, box.env, 'node -e "console.log(\'BUSY_FALLBACK_LOCAL\')"', { item: 'busy-case', requests: box.requests });+ const queue = () => listResources({ scope: 'machine' }).find(resource => resource.name === 'gate');+ await observe(() => queue()?.line.some(row => row.item === 'busy-case' && row.runnerDeadline?.branch), 'busy-runner deadline facts with both real capacities held');+ const row = queue().line.find(waiter => waiter.item === 'busy-case');+ assert.match(row.runnerDeadline.branch, /local gate slots busy/u);+ assert.equal(row.runnerDeadline.runners[0].reason, 'busy');+ assert.equal(existsSync(box.starts), false, 'a busy reservation is never oversubscribed');+ held.release(); held = null;+ const result = await pending; pending = null;+ assert.equal(result.status, 0, fixtureResultContext(result));+ assert.match(result.stdout, /BUSY_FALLBACK_LOCAL/u);+ assert.equal(gateResult(result.stdout).runner, undefined);+ assert.match(result.stderr, new RegExp(HOST + '-drop: busy', 'u'));+ assert.equal(existsSync(box.starts), false, 'fallback does not retry the still-held remote reservation');+ } finally {+ held?.release(); remote?.release();+ if (pending) await pending.catch(() => {});+ for (const [index, key] of ['PULLBOARD_HOME', 'PULLBOARD_MACHINE_HOME'].entries()) {+ if (previous[index] === undefined) delete process.env[key]; else process.env[key] = previous[index];+ }+ }+});