Skip to content

ci: admit heavy local test commands through a host-wide ledger with priority and preemption #2943

Closed

Description

@schlessera

Part of #2934 (Phase A, task 5).

Its scope depends on the Phase A task 3 ruling (if heavy suites move to hosted draft runs, this shrinks to whatever stays local), Its priority and preemption policy were ruled on #2938 (2026-10-25): preemption within the caller's own subtree, only to admit a red-main fix.

Context

Several agents on one host each run long system-wide suites. The host chokes, suites hit their timeouts, and agents skip the checks to proceed (see #2934). The only coordination today is per workspace: ensureWorkspaceLease (scripts/workspace-lease.mjs:183) serializes overlapping commands in the same checkout and announces "Acquiring exclusive workspace output access". Separate worktrees on the same host do not coordinate at all, so five worktrees can start five native suites at once.

Product and test deadlines must not be raised to absorb contention (docs/decisions/ci-utility.md, "Local feedback and authoritative proof").

Agents run under an orchestrator agent, one per person, and the orchestrator must be able to make room for a red-main fix (see the #2934 orchestration rules). Its decisions have to go through a deterministic command with durable state, so an orchestrator that crashes or loses context leaves nothing inconsistent, and a worker running without an orchestrator still gets an admission limit.

Scope

  • A host-wide admission limit for heavy local test commands (native, runtime-host, browser and integrated categories, and any test file over a declared duration), shared across worktrees on one machine.
  • A command that would exceed the limit waits, printing the holders and its queue position, instead of starting and timing out.
  • The wait is recorded as a wait-started/wait-finished pair with reason other (or a new reason, if the throughput doc is amended) through scripts/ci-timings.ts record (docs/process/ci-throughput.md:78-109).
  • The ledger records each slot's holder process, worker ID, orchestrator ID and priority class; ownership is checked by process liveness as processIdentity/liveAncestor do (scripts/workspace-lease.mjs:46-69), and a dead holder's slot is reclaimed.
  • A preempt <slot> --reason <reason> command signals the holder's process group to cancel, lets its cleanup run (mounts, tmpfs, sandboxes, timers) within a bounded grace period, then kills it. The preempted run is recorded as preempted. The command refuses a slot outside the caller's orchestrator subtree.
  • Admission has priority classes: a command run for a PR declared as a red-main fix (per the Phase A task 2 ruling) is admitted ahead of every queued ordinary command; it does not preempt running ones.
  • The limit defaults from the host's CPU count and can be overridden by an environment variable documented in the environment documentation.

Out of scope

Acceptance criteria

  • With the limit set to 1, two heavy commands started from two worktrees run one after the other, and neither times out; proven by a test that starts both and fails before the change.
  • A crashed holder's slot is reclaimed, proven by a test that kills a holder.
  • With the limit set to 1 and one ordinary command queued, a red-main-fix command started later is admitted first when the running holder finishes; proven by a test that fails before the change.
  • A preempted holder's cleanup runs before the slot is reassigned, and the run is recorded as preempted; proven by a test whose holder registers a cleanup marker.
  • preempt refuses a slot held under a different orchestrator ID; proven by a test.
  • With no orchestrator running, two heavy commands are still limited by the host slots.
  • The wait appears as a recorded event pair.

Verification

Focused tests for the admission module, plus a restored mutation receipt that removes the limit and shows the concurrency test fail.

Contract impact

None.

2026-10-25: #2938 ruled on preemption; this issue now waits only on #2939.

2026-10-25: #2939 ruled; no remaining blocker.

Activity

  1. added
    type: chore
    area: ci
    agent-ready
    blocked
    on Oct 25, 2026
  2. removed
    blocked
    on Oct 25, 2026
  3. added this to the 0.45.0 milestone on Oct 25, 2026
  4. added
    priority: p2
    on Oct 25, 2026
  5. self-assigned this
    on Nov 2, 2026
  6. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Claimed as part of working epic #2934 end to end (claim token wi-20261102-fd2d2f21). Order chosen for earliest queue-velocity benefit: #2938+#2939 rulings first (they unlock hosted draft feedback), then the red-main/merge-path chain (#2942, #2940, #2944); #2943, #2941 and #2937 run in parallel since they touch disjoint code. Intended branch: feat/2943-host-admission.

  7. 41 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: cipriority: p2type: chore

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions