Skip to content

cluster: an admission deadline ends that request, not the pair - #1762

Merged
jonathan308 merged 4 commits into
devfrom
fix/cluster-admission-deadline-per-request
Nov 4, 2026
Merged

jonathan308 merged 4 commits into
devfrom
fix/cluster-admission-deadline-per-request

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Production proof

The production GLM-5.3-Flash tensor-parallel pair (two M5 Ultras, 8 lanes, provider 0.10.7) dropped 6 times in 19
minutes
on 2026-11-03. The drops cost 14 engine_error terminals among 54 terminal lines. Each drop was a session
fence followed by a re-form about 20 s later, never a crash:

Drop (UTC) The follower's log In flight on the leader The request that failed admission
23:07:13 session fenced: leader fenced: the request was cancelled before it started 3 lanes decoding 1,696 tokens, arrived 23:07:13
23:09:59 same a request with a 20 ms budget 1,020 tokens; budgets that minute 20–217 ms
23:10:25 session fenced: command refused (the follower's own fence) 1 lane decoding 829 tokens
23:16:57 leader fenced: … 6 lanes (two ~101k prompts prefilling) 799 tokens
23:17:55 leader fenced: … a lone 101,738-token prefill; a 54,295-token reservation had taken 13.3 s admission started 3.6–6.4 s late
23:19:01 leader fenced: … a lone 101,614-token prefill; a reservation had taken 11.1 s admission started 8.5–9.1 s late

The same lines from the code on dev (0f99ddb18), with the checks this PR adds. These are two processes over the
loopback link control channel, with both ranks behind the real owner service:

One request's admission deadline ended the pair: request fb99cbf4 failed on the pair: admission: the request's deadline passed;
follower: ["opened", "fenced leader fenced: the request was cancelled before it started", "cleanup", "released true"]
The follower fenced its session for one request's delivery deadline: ["opened", "fenced command refused"]

Summary

Cause. A request can arrive with little of its first-content budget left. On a busy pair, rank 0 answers the
request's reservation at its next step boundary, after that admission deadline, and the leader treated that as a pair
failure:

  • it invalidated the pair, so every lane in flight failed;
  • it fenced rank 1, which was never asked ("the request was cancelled before it started").

The reservation also carried that nearly spent budget as its delivery deadline, so rank 0's own owner fenced rank 0:
ClusterWorkerOwnerService fences a worker whose reservation is unanswered past its delivery deadline.

Fix.

  • The admission deadline is now that request's outcome: ClusterWorkerOwnerError.deadline.
  • A late admission is given back, and the rank never asked is left alone.
  • The pair keeps serving. Real link or peer failures still end it.

Linked issue

None filed. Production incident 2026-11-03 23:07–23:19Z (and 2026-11-01 03:37Z).

Test plan

  • Red on dev with only the tests added (98418eacc), green with the fix (9a2398808):
    • ClusterWorkerPairAdmissionDeadlineTests, run by bash libs/darkbloom-cluster/Tests/RemoteChecks/run.sh (scripted
      ranks):
      • a 4-lane pair whose rank 0 answers after the request's admission deadline: deadline outcome, nothing fenced, the
        decoding lane finishes its 80 tokens, the next request is served, and the reservation is delivered within the
        admission wait;
      • a request ended before rank 1 was asked never fences rank 1.
    • bash libs/darkbloom-cluster/Tests/LinkWorkerChecks/run.sh:
      • the same deadline through both real owners and the loopback link;
      • a reservation relayed past its delivery deadline gets commandRefused (deadline), and the follower's session
        serves on.
    • bash libs/darkbloom-cluster/Tests/ProcessChecks/run.sh, with real children: PartialAdmissionTests.admissionDeadline
      and ProviderDeadlinePipeCheck, the latter on the provider's own deadline and owner sources.
  • The fix minus the delivery-deadline change (the outline in the root-cause report) still loses the pair through
    rank 0's own owner. The link check shows admission: the request's deadline passed and a rank did not give it back.
  • Regressions, green before and after:
    • a link that closes during admission still ends the pair;
    • a rank that misses the pair's own admission wait still ends the pair (RetirementPolicyTests);
    • a caller's cancel before rank 1 is asked fences nothing.
  • Full suites:
    • RemoteChecks: 84 XCTest + 3 Swift Testing;
    • LinkWorkerChecks: 16/16;
    • ProcessChecks: all;
    • SSHChecks: all;
    • ObservabilityChecks: 210/0;
    • libs/darkbloom-cluster-worker/Tests/QualificationChecks/run.sh: 80/0.
  • provider-swift focused: 147 tests in 29 suites, covering the pair engine, pair slots, member serving, the link
    policy, installed lanes and cancellation, the HTTP lifecycle and deadlines.
  • make docs-check, make docs-impact-check BASE=origin/dev, make changelog-check, git diff --check.
  • The real pair under load, in progress. The 0.10.8 candidate (this fix merged with the other cluster fixes) is
    being installed on the owner's M5 Ultra × M5 Ultra pair to run GLM-5.3-Flash under concurrent load. Pass means no
    session fenced on the follower, no bursts of distributed peer readiness lost, and only late requests ending with
    the deadline error. Results will be added here.

Components touched

  • provider-swift (Swift CLI): the change is in libs/darkbloom-cluster (DarkbloomClusterProcess,
    DarkbloomClusterRemote), which the provider links
  • native runtime / MLX
  • landing (Next.js)
  • enclave (Swift)
  • CI / provider release
  • docs

Protocol / interface changes

  • No protocol/interface changes. No wire format changes:
    • the coordinator, link, owner and worker wires are unchanged;
    • only the value of a reservation's delivery deadline changes (the pair's admission wait instead of the request's
      first-content budget);
    • commandRefused already carried any request-scoped refusal reason, and deadline is one.

Documentation impact

  • Canonical documentation updated:
    • docs/architecture/inference.md: the admission-deadline rule, beside the cluster request engine's cancellation
      invariant;
    • docs/developer/test.md: the checks.

Changelog

  • Added changelog.d/cluster-admission-deadline-per-request.md and ran make changelog-check.

Notes for reviewers

  • Two existing checks asserted the old behaviour and now assert the new one.
    • PartialAdmissionTests said "an unanswered submitted reservation … the pair is quarantined"; its group now asserts
      that only the request ends.
    • ProviderDeadlinePipeCheck said "reserve threw before actual fences"; it now asserts that nothing is fenced and that
      the pair takes the next request.
    • missingProof keeps its contract: a fenced rank's missing proof holds reserve. It now does so with a rank that
      misses the pair's own admission wait, which is a real failure.
  • The per-request branch applies only once the request's own deadline has passed. A rank that misses the pair's
    admission wait (RetirementPolicyTests) still ends the pair.
  • reserve still waits on the engine's serial queue, bounded at 30 s, for a late answer to be given back. The
    refusal and caller-cancel paths do the same. Taking admission off that queue, and slicing a lone prompt's merged frames
    while control is pending, are follow-ups.
  • Not done: refusing a request up front below a budget floor. The floor would have to track the live step time
    (0.1–13 s).

Before And After

Before: behavior

sequenceDiagram
  autonumber
  participant C as Coordinator
  participant L as Leader pair
  participant R0 as Rank 0 (busy lanes)
  participant F as Follower (rank 1)
  C->>L: request B, almost no first-content budget left
  L->>R0: reserve B, delivery deadline = B's budget
  Note over R0: inside a step, answers at its next boundary
  Note over L: B's budget passes first, read as a pair failure
  L->>L: invalidate the pair, cancel every lane in flight
  L->>F: fence (the request was cancelled before it started)
  Note over F: session fenced, worker exits lost-input
  Note over R0: its own owner fences it, reserve unanswered past the delivery deadline
  L-->>C: B fails, every in-flight request fails (distributed peer readiness lost)
  Note over C,F: the pair re-forms about 20 s later, 6 times in 19 minutes
Loading

After: behavior

sequenceDiagram
  autonumber
  participant C as Coordinator
  participant L as Leader pair
  participant R0 as Rank 0 (busy lanes)
  participant F as Follower (rank 1)
  C->>L: request B, almost no first-content budget left
  L->>R0: reserve B, delivered within the 30 s admission wait
  Note over L: B's budget passes, B alone ends, F is not asked
  R0-->>L: admitted B at its next step boundary
  L->>R0: cancel B
  R0-->>L: retired (cancelled) B
  L-->>C: B fails with a deadline error
  Note over L,F: nothing fenced, the other lanes keep decoding and finish, the pair keeps serving
Loading

Before / After: code

flowchart TB
  subgraph Before["Before"]
    direction TB
    b1["admit: reserve sent with deadline = request budget"] --> b2{"answer before the budget?"}
    b2 -->|"no: .deadline, or send .closed"| b3["reserve catch-all: invalidate()"]
    b3 --> b4["cleanup, not alone: fence rank 0 and the never-asked rank 1"]
    b1 -.-> b5["owner service: reserve unanswered past delivery deadline, fence worker"]
    b6["follower accept: relayed reserve past delivery deadline"] --> b7["fence the follower session: command refused"]
  end
  subgraph After["After"]
    direction TB
    a1["admit: reserve delivered within the admission wait"] --> a2{"answer before the request deadline?"}
    a2 -->|"no: .deadline, next rank not asked"| a3["reserve: cancel .deadline, cleanup alone"]
    a3 --> a4["read the late answer, cancel the admission, retired cancelled"]
    a4 --> a5["pair valid, throw .deadline for this request"]
    a3 -.->|"not given back within 30 s"| a6["fence and invalidate, as before"]
    a7["cleanup: a never-asked rank is acknowledged, never fenced"]
    a8["follower accept: commandRefused deadline, session kept"]
  end
  classDef bad fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d;
  classDef good fill:#dcfce7,stroke:#15803d,color:#14532d;
  classDef step fill:#dbeafe,stroke:#1d4ed8,color:#172554;
  class b3,b4,b5,b7,a6 bad;
  class a4,a5,a7,a8 good;
  class b1,b2,b6,a1,a2,a3 step;
Loading

Legend: red is a pair-level failure, green is a per-request outcome, blue is admission.

Validator notes, round 2

One more signed commit, 113757ad86, docs only. Sources, tests, wire and changelog are byte-identical to eef2995aaf.

1. A generation deadline shorter than a busy rank's answer can still end the pair. Not changed here (follow-up below).

  • Not reachable through the coordinator or a client.
    • Coordinator-routed requests carry only first_content_budget_ms, which sets the admission deadline.
    • The generation deadline is the provider's own: the setup's request deadline, counted from the request's arrival.
      When the planner derives it, it is three times the placement's predicted longest request plus 30 s, within
      60–3600 s.
    • Short of minutes of serial engine-queue backlog, nothing in front of reserve holds a coordinator request that
      long. The device-local queue can.
  • Not a small extension of this fix.
    • Each rank's owner holds every request to its generation deadline: ClusterOwnerLeaseState.clock quarantines the
      rank when a held request's deadline passes.
    • An ad hoc probe went through both real owners and the loopback link. Rank 0 answered in 0.3 s and the generation
      deadline was 100 ms.
    • The probe ends the pair at this head. It still ends the pair with the generation cap removed from the reservation's
      delivery deadline (admission: a rank's command stream closed).
  • Doc fix. docs/architecture/inference.md said every reservation is delivered within the pair's admission wait. It
    now says: within that wait, or by the generation deadline if that comes first. A rank still holding a request at its
    generation deadline ends the pair.

2. The follower's log for genuine admission failures (behavior unchanged, as intended).

  • A request's admission can fail for real (a lost rank, a peer failure) before rank 1 was asked. The follower then no
    longer logs session fenced: leader fenced: the request was cancelled before it started.
    • That text was the cleanup's generic default. It never named the real cause.
  • The follower now ends through the failing pair's shutdown: a clean shutdown, or leader fenced with no text if it
    doesn't answer.
  • The real cause stays in the leader's incident: request <id> failed on the pair: admission: <cause>.
  • Carrying the cause to the follower would need one of these, and none is trivial, so it isn't done here:
    • a fence of the never-asked rank (which this PR removes on purpose);
    • a new reason-only endpoint call;
    • a reason on the shutdown wire.

Follow-up (not in this PR): a lane request reserved close to its generation deadline.

  • Where:
    • ClusterOwnerLeaseState.clock;
    • ClusterWorkerOwnerService's per-request admission deadlines, which ClusterWorkerRequest.admit caps at the
      generation deadline.
  • Trigger: a lane request is reserved with less of its generation deadline left than rank 0 needs to answer and give
    it back. That is two step boundaries: about 26 s during 100k-token prefills.
    • Getting there takes a provider-side wait of nearly the whole request deadline: the device-local queue, or minutes of
      serial-engine-queue backlog.
  • Effect: rank 0's own owner fences rank 0, and the pair ends.
  • Options:
    • Refuse such a request before asking any rank when less than laneDeadlineMarginNanoseconds (20 s) is left. Today it
      is cancelled the moment it is admitted anyway. This narrows the window.
    • Let both owners give back a never-started request past its deadline instead of fencing. This closes the window, but
      it changes the owners' stuck-worker rule.

Validation at 113757ad86 (sandboxed, nice -n 19):

  • LinkWorkerChecks 16/16; RemoteChecks filtered: ClusterWorkerPairAdmissionDeadlineTests 4/4, ClusterLinkWorkerCommandRefusalTests 5/5, ClusterReservationRelayTests 1/1; ProcessChecks RetirementPolicyTests, PartialAdmissionTests and ProviderDeadlinePipeCheck: pass.
  • make docs-check, make docs-impact-check BASE=origin/dev, make changelog-check and git diff --check: clean.

Refactor Pass addendum: the round-2 commit 113757ad86 came after the refactor pass. It is a documentation
correction: it states the existing behavior. It is not a behavior fix or a refactor, and no source, test or wire changed.
It was checked against the PR's invariants, which all still hold:

  • only the late request ends;
  • a late admission is given back, or the pair ends;
  • a never-asked rank is never fenced for a request;
  • a closed link, a lost rank or a missed pair admission wait still ends the pair;
  • no wire format changes.

Refactor Pass

Done by a dedicated refactor subagent (AGENTS.md § "Required Refactor Pass") on the finished fix. Verdict:
behavior-preserving cleanup, one signed commit (eef2995aaf). It changes no source logic, wire format or test assertion.

  • ClusterWorkerRequest.admit: dropped a comment's claim that every command is delivered within the pair's admission
    wait (start and token decisions use the request's generation deadline). A send that a still-serving endpoint closed
    is now explained as a deadline, not a lost rank.
  • ClusterWorkerRequest.cleanup: the never-asked rule is stated once, at its branch, instead of in three overlapping
    comments.
  • LinkWorkerPairCheck: one local helper relays each leader command in the expired-reservation check, instead of
    three hand-built wires (same sequences, delivery times and assertions).
  • ClusterWorkerPairAdmissionDeadlineTests: dropped the task-list labels "(a)" and "(c)" from the doc comments.
  • docs/architecture/inference.md: rewrote a tautology ("a rank not yet asked is not asked") and an "only … ends the
    pair" that contradicted the next sentence. The facts are unchanged.
  • Changelog: the heading plus one plain sentence for pair owners.

Reviewed and kept:

  • the new .deadline catch beside the .cancelled one (a shared helper saves no lines and would assemble the
    grep-able incident text);
  • the request-deadline versus admission-wait arithmetic, which invariant 4 depends on;
  • the near-deadline guard before each send and the expired-send .closed mapping. Both are reachable; without them,
    the outcome would be a race;
  • the requestRefusal(deliveryExpired:) default, which an existing test relies on;
  • the test helpers (no shareable duplicate in the same compilation unit).

Validation after the pass (rebuilt from the refactor head):

  • RemoteChecks build, filtered to the admission-deadline and link-refusal classes: 9/0;
  • LinkWorkerChecks: 16/16;
  • ProcessChecks RetirementPolicyTests, PartialAdmissionTests and ProviderDeadlinePipeCheck: pass;
  • QualificationChecks: 80/0;
  • provider-swift's 29 focused suites (147 tests), rebuilt and run with HOME isolated: pass;
  • make docs-check, make docs-impact-check BASE=origin/dev, make changelog-check and git diff --check: clean.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

jonathan308 and others added 3 commits November 3, 2026 15:42
Production, 2026-11-03 23:07-23:19Z: six drops of the GLM-5.3-Flash pair
in 19 minutes, and the same trigger on 2026-11-01 03:37Z (0.10.6). A
request arrived with little of its first-content budget left, rank 0
answered its reservation at its next step boundary, after that admission
deadline, and the leader ended the whole pair.

These checks are red on origin/dev (0f99ddb) and green with the fix
that follows:

- ClusterWorkerPairAdmissionDeadlineTests (scripted ranks in process): on
  a lane pair, a reservation answered after the request's admission
  deadline ends that request with a deadline outcome while the decoding
  lane finishes and nothing is fenced; a request ended before rank 1 was
  asked never fences rank 1; a closed link still ends the pair.
- LinkWorkerChecks: the same deadline through both real owners and the
  link control channel (the follower printed the production line "fenced
  leader fenced: the request was cancelled before it started"), and a
  relayed reservation past its delivery deadline (the 23:10:25Z variant,
  "fenced command refused").
- PartialAdmissionTests and ProviderDeadlinePipeCheck asserted the old
  behaviour (pair quarantined, both ranks fenced) and now assert that
  only the request ends. missingProof keeps its contract with a rank that
  misses the pair's own admission wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A request that arrives with little of its first-content budget left can
see a busy rank answer its reservation at its next step boundary, after
that admission deadline. The leader treated that as a pair failure: it
invalidated the pair (every lane in flight failed with "distributed peer
readiness lost"), fenced rank 1, which was never asked ("leader fenced:
the request was cancelled before it started"), and its follower closed
its worker. Production, 2026-11-03 23:07-23:19Z: six drops of the
GLM-5.3-Flash pair in 19 minutes (and 2026-11-01 03:37Z on 0.10.6).

- ClusterWorkerPair.reserve: a deadline during admission, once the
  request's own deadline has passed, is that request's outcome. It is
  cancelled with `.deadline`, so its cleanup retires alone: an answer
  still on its way is read and an admission given back within the lane
  wait, and the pair stays valid. A rank that does not give it back in
  time still ends the pair; every other failure keeps the catch-all.
- ClusterWorkerRequest.admit: a reservation is delivered within the
  pair's admission wait, not with the request's admission deadline.
  Each rank's owner (ClusterWorkerOwnerService) fences a worker whose
  reservation is unanswered past its delivery deadline, so with the
  budget as that deadline rank 0's own owner still ended the pair (the
  link check shows it with the other fixes alone). The request's
  deadline still bounds how long reserve waits for the answers; a rank
  is not asked once it has passed, and a send closed only because its
  deadline passed is that deadline.
- ClusterWorkerRequest.cleanup: a rank never asked is acknowledged,
  never fenced, whatever ended the request.
- ClusterLinkWorkerServer: a relayed reservation that reaches the
  follower past its delivery deadline is that request's refusal
  (commandRefused, deadline), not a fence of the follower's session.

No wire format changes. docs/architecture/inference.md states the rule;
docs/developer/test.md names the checks; changelog fragment added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…changelog

Behavior-preserving cleanup of the admission-deadline fix (the required
refactor pass). No source logic, wire format or test assertion changes.

- ClusterWorkerRequest.admit: drop the claim that every command is delivered
  within the pair's admission wait (start and token decisions use the
  request's generation deadline, cancels the cleanup wait). Say why a send a
  still-serving endpoint closed is a deadline, not a lost rank.
- ClusterWorkerRequest.cleanup: state the never-asked rule once, at its
  branch, instead of in three overlapping comments.
- LinkWorkerPairCheck: one local helper relays each leader command in the
  expired-reservation check, instead of three hand-built wires.
- ClusterWorkerPairAdmissionDeadlineTests: drop the task-list labels (a)
  and (c) from the doc comments.
- docs/architecture/inference.md: fold "a rank not yet asked is not asked"
  and "only a rank that does not give the reservation back in time ends the
  pair" into the sentences they belong to, with the same facts; restamped.
- changelog: the heading and one plain sentence for pair owners.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 requested a review from davidtai November 4, 2026 00:12
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Error Error Nov 4, 2026 2:32am UTC
d-inference-console-ui-dev Error Error Nov 4, 2026 2:32am UTC
d-inference-landing Ready Ready Preview Nov 4, 2026 2:32am UTC
darkbloom-status Ready Ready Preview Nov 4, 2026 2:32am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 4, 2026 2:32am UTC

Request Review

…s owner

The admission-deadline paragraph said every reservation is delivered within
the pair's admission wait. A reservation's delivery deadline is also capped by
the request's generation deadline, and each rank's owner holds every request
to that deadline (ClusterOwnerLeaseState.clock), so a rank that still holds a
request when it passes still ends the pair. Say so, and say where the
generation deadline comes from: the setup's request deadline counted from the
request's arrival; the coordinator's first_content_budget_ms sets only the
admission deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch had an error being deployed

2 failed and 3 active deployments
Preview – d-inference-landing — 113757ad Deployed Nov 4, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 113757ad Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference — 113757ad Deployed Nov 4, 2026 by vercel[bot]
Preview – darkbloom-status — 113757ad Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 113757ad Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant