Contracts, Charter & Verification Gates Audit — PR #742 (selene,helios: bound pool-only capture buffer to max_sequence_pages) @ f26d8a8
Verdict: No contract or verification gate blockers.
All four hard gates pass. The diff is 9 files, +105/−21 (pr_files: docs +15/−12, helios/src/runtime_core/memory.rs +43/−1, helios/src/runtime_core/model.rs +12/−3, selene/src/offload.rs +9/−1, selene/src/offload/tests.rs +18/−4, plus six single-line fixture insertions in helios/src/offload/pool/tests.rs, selene-manager/tests/{client,offload}.rs, selene/src/offload/sharded/tests.rs). Nothing in it adds or changes a signed core-format/wire/captured-graph contract, forks a vendored upstream file, triggers a formal or GPU-benchmark gate, or asserts a claim contradicted by the tree.
Gate 1 — Signed core-format / wire / captured-graph / public-contract boundaries: PASS
- No proto, core-format, graph-catalog, enum, or wire change. The diff touches no
.proto, nohelios/src/core/, noFORMAT_VERSION, no reserved identifier, no signature domain. Existing exported cores load unchanged: prepared metadata, allocation payloads, and graph catalogs are untouched, sodocs/design-review.md:116-120(principle 13, model-core compatibility) is not engaged. - No captured-graph operation contract.
docs/design-review.md:22-26requires owner approval for a new operation family; this PR adds no operation, shape/capacity variant, or graph kind. No approval is engaged and none is claimed. - The only API addition is internal and unpublished.
PrepareInputs::max_sequence_pages: Option<std::num::NonZeroU64>(selene/src/offload.rs:339-345) is a field on an internal Rust struct in a crate that is not published —selene/Cargo.toml:7publish = false,helios/Cargo.toml:7publish = false, matching the charter roadmap (#6, "the crates aren't published yet"). No CLI flag, config key, environment variable, or default changes, sodocs/design-review.md:89-92(principle 10) and the charter's "no magic defaults / no per-model flags" rule are respected. - No per-model branch or policy flag. The bound derives from prepared structural metadata (
max_sequence_tokens,contract.cache.page_tokens), not model identity —docs/design-review.md:47-61(principle 3) satisfied. Scope is narrow by construction: capture requirespool_only() && self.cluster().is_none()(helios/src/runtime_core/memory.rs:1009) andshard.is_none()(selene/src/offload.rs:163). - The one normative doc that specifies this buffer is updated in place.
docs/prefix-cache-offload.md:1593-1609now states the ceilingmin(GPU page capacity, ceil(max_sequence_tokens / page_tokens))plus one row's slots, bounded by the host budget, and the capped startup-failure condition (:1601-1602). Adjacent normative statements remain true and are not contradicted:docs/core-design.md:293-296(not opened) ("shared CPU/GPU DRAM is one budget") — the accounting rule is unchanged; only the size charged into that budget shrinks.docs/runtime-core-design.md:732-738("deduct the pinned host reservation from prefix-cache capture growth") — still exactly whatcapture_growthdoes, with a clampedpages(memory.rs:1494-1497).docs/core-format-design.md— grep forcapture|host budget|max_sequence_tokensreturns only unrelated capture-device/capture-storage prose (lines 13, 87, 110-112, 337, 418, 448, 819, 843); nothing about this host buffer.docs/scheduling-theory.mdanddocs/scheduling-runtime-design.md— searches forcapture buffer/host budget/pool-only/page capacity/offload/prefix cache/intakereturn no matches. There is no normative statement to contradict.
- No hidden validation removal. The admission error
host budget cannot hold a full pool captureis retained (selene/src/offload.rs:175-177, still the only definition —grepreturnsoffload.rs:176and the doc linedocs/prefix-cache-offload.md:1602), now applied to the capped chain.AGENTS.md:182-187("reject weakened guarantees ... do not remove validation") is not violated; the PR adds validation (max_sequence_pages(context, page_tokens)athelios/src/runtime_core/memory.rs:562-569rejects zero page size and zero context, and it is called unconditionally at:1007, i.e. every model load).
Gate 2 — Vendored upstream dependencies & cross-PR coupling: PASS
- No vendored upstream file is forked.
helios/native/,selene-manager/docs/, and all vendored C /build.rs(not opened) inputs are untouched. There is noCargo.tomlorCargo.lockchange in the diff, so dependencies remain pinned exactly as onmain(charter #215). - No unmerged external recipe or PR dependency. The change is self-contained in-repo; the eight
max_sequence_pages: Nonefixture insertions preserve every existing caller's behaviour (None⇒ uncapped,selene/src/offload.rs:165-167). - Info / Nit — merge order with open #737 (lukealonso).
related_itemsconfirms #737 shares exactly three files (helios/src/runtime_core/memory.rs,helios/src/runtime_core/model.rs,selene/src/offload.rs) and extendsPlannedHostBudgets; it can move the free-host bound this buffer is charged against. This is a sequencing hazard, not a gate violation, and no shared line is forked. Flagged at theInfo / Nitlevel only, per calibration. - Closed #718 shares all nine files, but it is closed/unlanded and this PR carries none of its HTTP/routing/announce-barrier surface — no dependency in either direction.
Gate 3 — Mandatory verification evidence & failing tests: PASS
- No failing test or failing CI is reported anywhere. The PR conversation (3 comments: author 09:19, author 09:49, autobot 09:51 — plus the case-file notice) contains no red check and no failing-test report. Both earlier autobot rounds say "Blockers: 0". Nothing in the description or the Discovery Dossier states a test or CI failure on
f26d8a8. - Layer 1 (
docs/design-review.md:180-194) is satisfied and correctly scoped. The PR reportscargo test --locked --releaseon the head foreos(12),selene --features test-support(649 = 648 unit + 1 doctest),selene-manager --features test-support(448, 1 ignored),helios --features runtime-core,server(2,041 passed, 88 ignored),flare(255),flare-cli(254, 3 ignored) underRUSTFLAGS="-D warnings"in a pinnedrust:1.94.1-slim-trixiecontainer. I verified this covers every crate the mandatory workflow executes:.github/workflows/native-serving.yml:47(not opened) (eos),:51-52(selene, selene-manager),:63(helios--features runtime-core,server),:73(flare-cli),:77(flare),:81(flare-winui/bridge, untouched).--locked --releaseis used;cargo checkis not substituted.heliopauseis not in that test list andgrepforPrepareInputs|headroom_with_inputs|prepare_with_inputsunderheliopause/returns no matches, so not running it is not a gap. - Layer 3 is not triggered (
docs/design-review.md:209-230). Its triggers are admission, fences, generations, cancellation, speculation accounting, cache compaction, snapshot aliases, response buffering/ownership, offload aggregation, readiness, rank coordination. The changed functions are startup host/KV sizing only:headroom_inner(selene/src/offload.rs:150-221),allocate_cachesplanning with itscapture_growth(memory.rs:677-691) /planned_offload_host(:1562-1568) callbacks, andprepare_offloadplumbing (helios/src/runtime_core/model.rs:1119-1179). Concretely:verification/helios-lifecycle/check.py:22-36declares nine checked protocols (Lifecycle, RankProtocol, DispatchRing, OffloadTransfer, CacheOwnership, Speculation, ResponseLifecycle, CheckpointReservation, AsyncTransfer).grepforruntime_core/memory.rs|offload.rs|runtime_core/model.rsunderverification/helios-lifecycle/returns no matches; the mutation targets listed atcheck.py:473-792touchscheduler.rs(not opened),scheduler/policy.rs(not opened),scheduler/cache_memory.rs(not opened),scheduler/checkpoints.rs(not opened),cache.rs(not opened),server/runtime.rs(not opened),offload/copy_gate.rs(not opened),offload/transfer.rs(not opened),execution/threaded{,.rs},async_transfer/scheduler.rs(not opened) — none of them this diff.- Kani:
#[cfg(kani)]modules exist only athelios/src/async_transfer/mod.rs:11(not opened),helios/src/execution/transport.rs:219(not opened),helios/src/model.rs:14(not opened),helios/src/model/contract.rs:15(not opened),helios/src/output/tagged.rs:1214(not opened).helios/src/runtime_core/has none. No completion-vector validation, prepared completion contract, state-view extent arithmetic, or sequential validator is touched. - No new protocol state or geometry bound is added, so
design-review.md:241-246("keep formal bounds aligned") does not apply. - Note
.github/workflows/helios-lifecycle.yml:3-11(not opened) does trigger onhelios/**,selene/**,selene-manager/**, so the lifecycle and Kani jobs are queued by CI regardless; the author's "not re-run because this PR does not modify … Kani-proven validators" is about relevance, not execution.
- The memory claim is a live trace, not an unattributable stacked speedup.
docs/verification.md:15requires "the target benchmark or live trace" for memory cost. The author suppliesdocker statscontainer RSS on identical Qwen4-35B-A3B hardware under a 24 GiB cgroup (18.74–19.06 GiB at--prefix-cache-memory 0vs 7.83–8.04 GiB at1G, delta 10.91–11.02 GiB matching the 11.8 vs 0.9 GiB slab delta) plus the startup log linepool only: capture buffer 11.8 GiB (16475 slots, …). It is not a performance speedup claim, so principle 12'smain-vs-branch served-workload A/B requirement (design-review.md:106-115) is not the applicable test; and the provenance is disclosed verbatim ("observed on av0.6.0(f705086) build running the samemax_sequence_pagessizing rule rather than re-measured via an A/B restart onf46a99220a"), together with an explicit "Unrun checks" list (hardware CUDA,tests/server/test_prefix_cache_offload.py(not opened),qualify/host_cache.py(not opened), integrated memory, sharded/RoCE, Windows, Kani, TLA+). That is the disclosureAGENTS.md:103-112and principle 12 require. Tightening it to an A/B on head is a maintainer judgement call, not a hard gate failure under the hierarchy as written. - Charter "bring real evidence" / four-part description. All four parts are present in order (why → what changed → claimed benefit → evidence), the bounded and unbounded formulas are distinguished with a metric table, and the required
Discord: fakoliline is present (AGENTS.md:142-153, principle 17). - Charter authorisation is satisfied on the
AGENTS.md:165-166test. The change addresses "a measured performance or memory problem" with a live trace and a reproducible startup failure (host budget cannot hold a full pool capture), which lands inside the accepted list. That yatesdr's #455 review asked only for documentation is a provenance nuance for the merging maintainer, not a gate breach.
Gate 4 — Material scope / claim contradictions: PASS
Every concrete artifact the description names exists on the head:
pool_only_sizes_registered_capture_and_headroom_for_local_rankswith the folded bounded/unbounded cases —selene/src/offload/tests.rs:525-576(loop cases(10, None),(512, None),(512, Some(64))at:531-535, strictly-smaller assertion at:558-560).pool_capture_growth_caps_at_max_sequence_pages_without_throttling_gpu_pages—helios/src/runtime_core/memory.rs:2453-2476, including the zero-input rejections (:2454-2455), the ceiling rounding1025/64 == 17(:2456),1_048_576/64 == 16_384(:2457), and the parity assertionspages == uncapped_pagesandpages > max_pages.- The clamps:
capture_growth(layout, pages.min(max_sequence_pages.get()), …)(memory.rs:1497), theplanned_offload_hostchain clamp (:1564), and the single enforcement point (selene/src/offload.rs:165-170). - The plumbing:
PlannedHostBudgets::max_sequence_pages(memory.rs:34, filled:1602), passedmodel.rs:1052, acceptedmodel.rs:1125, forwarded intoPrepareInputs(model.rs:1172); the duplicatedserver_config["max_sequence_tokens"]lookup inmodel.rsis genuinely gone (grep max_sequence_pagesshows nodiv_ceilinmodel.rs). - The guarded helper
fn max_sequence_pages(context: u64, page_tokens: usize) -> Result<NonZeroU64>—memory.rs:562-569, called at:1007right after the retained> 0filter onmax_sequence_tokens(:1002-1005). - Doc rewrite matches the diff with the GLM-5.3-Flash NVFP4 TP4 11.0 GiB / 1,664 slot / 7.1 GiB floor example retained (
docs/prefix-cache-offload.md:1598-1599). - No scope expansion. None of closed #718's HTTP
X-Flare-Prefill-Only, scheduler anchoring, or Selene announce-barrier surface is carried; capture remains single-host by construction. The charter non-goals (disaggregation, cluster orchestration, non-NVIDIA backends, multi-model hosting) are untouched. No unrelated tooling, no docs/TODO churn, no bundled standalone scripts. - Compile-consistency of the fixture story checks out: every
PrepareInputsliteral either setsmax_sequence_pagesor uses struct-update syntax from one that does (helios/src/runtime_core/memory.rs:2038-2044then:2077-2080;selene/src/offload/tests.rs:451-454,:962-965,:540-543), so the reported green runs are consistent with the tree.PrepareInputsderivesCopy, so adding aNonZeroU64option does not disturb the by-value call sites.
Info / Nit (non-blocking, no action required)
- Description wording, not code. The body says the bound is passed "into
headroom_with_inputs_for_budget(whereheadroom_innerclampsminimum_pages)". The code clampschain_pages(selene/src/offload.rs:165-170);minimum_pagesreaches selene unmodified aslocal_pages(memory.rs:1143). Cosmetic, and per calibration a PR-description phrasing nuance is not a gate item. - Doc sentence neighbouring the new ceiling.
docs/prefix-cache-offload.md:1605-1606still says a capture with no resident ancestor "copies the full GPU chain", two sentences below the new ceiling at:1595-1597. Behaviour is safe (an over-long chain drops rather than overrunning the slab) and the paragraph pre-dates this PR; prose precision only. - Base label.
search_historyatmainreturnsf46a9922as the tip, which matches the body's "basef46a99220a" — the branch sits on the current main tip, so there is no base-drift issue.memory.rsat head is 3046 lines vs main's 3004, a +42 net consistent with this PR's own +43/−1 hunk. - Security / process. No obfuscation, prompt-injection attempt, external network or secret access, or instruction directed at reviewers appears in the diff or the PR conversation.
Explicitly not flagged (per calibration)
- No CI check run is observable, but the PR claims no failure and reports runs covering every crate
native-serving.ymltests — absence of observable check runs is not a finding. - No
docs/TODO.txtbookkeeping ask; no PR-description phrasing nit elevated aboveInfo / Nit. - The deliberately uncapped automatic-intake floor (
selene/src/offload.rs:178-180) is a disclosed design choice documented in both the body anddocs/prefix-cache-offload.md:1594-1597; it is a correctness/value-lens sizing matter, not a contract or verification gate. - The #737 merge-order overlap and the non-head RSS provenance are
Info / Nit/maintainer-judgement matters, not gate violations.
Conclusion: the diff satisfies every hard contract boundary, is vendored/pinned clean, carries the Layer 1 verification the testing hierarchy mandates for a startup-only sizing change with no Layer 2 or Layer 3 trigger, and contains no material scope or claim contradiction. No contract or verification gate blockers.