Skip to content

Add qwen2 tie word embedding - #630

Merged
Ying1123 merged 1 commit into
sgl-project:mainfrom
yileld:main
Jul 16, 2024
Merged

Ying1123 merged 1 commit into
sgl-project:mainfrom
yileld:main

Conversation

@yileld

@yileld yileld commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

Qwen2 1.5B uses tie word embedding, which is different from other Qwen2 model. So we should add a step to load lm_head's weight from embed_tokens layer.

@Ying1123
Ying1123 merged commit fe3be15 into sgl-project:main Jul 16, 2024
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu added a commit to efschu/htsglang that referenced this pull request Aug 7, 2026
…x cache classes

PP=3 with a disk HiCache backend wedged silently at warmup: health stayed 503
forever, no error, no crash. Not actually infinite -- the gloo cpu_group these
collectives run on defaults to timedelta(seconds=120 * 60)
(parallel_state.py:619), so the wedge ends after two hours with a generic
RuntimeError from inside gloo that names no call site. That is what "silent"
meant.

Two families of unbounded blocking call, and one whole class that never got
the sgl-project#259 treatment:

1. _drain_async_work waited with a raw `work.wait()` loop over the isends
   posted by _pp_sync on the PP gloo cpu_group, while its sibling _wait_bounded
   polled is_completed() against a deadline. The asymmetry was the bug. The
   earlier reasoning that the send side is self-unblocking ("the last PP rank
   has an empty work_list and unblocks the chain") only ever covered the SEND
   side.

2. _pp_sync's receive side used torch.distributed.recv, which has no async form
   and no timeout, so every PP rank above the first blocked there with no
   bound. Replaced with irecv + the same bounded poll: irecv takes the identical
   group_src/tag/group arguments and returns a Work, recv is itself a posted
   receive that is immediately waited on, and this posts exactly one receive and
   does not return until it completes -- so message matching order is preserved.
   Residual exposure: on timeout the receive is still outstanding and its
   destination tensor stays registered with the backend. That is only acceptable
   because the error is fatal and the process is on its way down; the
   restriction is documented at the call site.

3. hiradix_cache.py had received NONE of the sgl-project#259 bounded-wait work -- no
   _wait_bounded at all, and _all_reduce_attn_groups, _barrier_attn_groups,
   _drain_async_work and _pp_sync all raw blocking calls. registry.py:107-119
   selects HiRadixCache whenever hierarchical cache is on and the model is not
   hybrid SSM/SWA, with SGLANG_ENABLE_UNIFIED_RADIX_TREE defaulting to False
   (environ.py:1592), so this is the LIVE DEFAULT path, not a dormant one.

Mechanism: the bounded-wait poll, the poll constants and the HiCacheCollective*
error types move out of unified_radix_cache.py into a new
mem_cache/hicache_collective.py, so both classes share ONE implementation
rather than two that drift -- the drift is exactly what this bug was. Both
_wait_bounded methods are now thin wrappers over it. Errors name the collective
label, the rank (global/pp/tp) and the elapsed wait. Every hiradix collective
call site passes a label naming its function.

Healthy path unchanged: COLLECTIVE_POLL_SPINS = 512 bare loop iterations run
before the first time.sleep, so a completed isend or all_reduce costs a few
hundred iterations and no syscall. Covered by a test asserting time.sleep is
never called for completed work. timeout_s <= 0 still restores the raw blocking
wait.

Tests
-----
New: test/registered/unit/mem_cache/test_hicache_bounded_waits_630.py, 14 cases
over both cache classes. Each runs the call under test in a daemon thread and
joins with a timeout, so unfixed code FAILS with "the wait is UNBOUNDED"
instead of hanging the runner. A guard case asserts the never-completing Work
stub really does block forever, so the rest are not vacuous.

Can-fail proof, run in a throwaway worktree at base a8cd908 carrying the new
hicache_collective module but the ORIGINAL call sites, which isolates the
call-site hunks as the variable:
  pre-fix:  14 failed, 10 passed
  post-fix: 14 passed
Representative pre-fix failures:
  test_drain_async_work_raises_named_error (cls='unified')
    AssertionError: call did not return within 10.0s against a peer that never
    completes: the wait is UNBOUNDED.
  test_pp_sync_recv_raises_named_error (cls='unified')  -- same
  all cls='hiradix' cases
    AttributeError: type object 'HiRadixCache' has no attribute '_wait_bounded'

Regression check, full test/registered/unit/mem_cache/ on both trees:
  baseline  937 failed, 694 passed, 695 skipped
  fixed     937 failed, 708 passed, 695 skipped
Failure SETS are byte-identical (comm on the sorted FAILED lists is empty in
both directions); the +14 passed is this commit's new file. All 937 are
pre-existing red from running without a GPU (841x "retry() exceed maximum
number of retries", 53x "No accelerator", 1x "No CUDA GPUs are available"),
concentrated in test_unified_radix_cache_unittest.py. Also pre-existing and not
touched: test_hicache_nixl_storage.py fails collection (No module named
'nixl'), and hiradix_cache.py carries an F541 ruff warning and disagrees with
black 26.1.0 on two asserts this commit does not touch.

test_hiradix_pp_sync_drain.py updated: its _Holder now supplies _wait_bounded
and the deadline, and its _FakeWork answers is_completed(), since the drain now
routes each work through the bounded wait.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 7, 2026
…ective

Every control collective in both radix cache classes now carries a bound, so
a peer that dies or stalls during a HiCache operation produces a named abort
instead of an unbounded wait. Same family as sgl-project#259's bounded waits; sgl-project#630 was
found when PP=3 x Disk-HiCache wedged at warmup with a permanent health 503.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…hat actually wedged

flip_blocking_guards refused flip arming whenever enable_hierarchical_cache
was set at all. That made the phase flip and prefix retention mutually
exclusive, and the deployment resolved the conflict the only way it could:
by running with enable_hierarchical_cache=False, i.e. with NO cache tier of
any kind on the serving line.

The wedge that earned the guard was the DISK tier at warmup, and it is fixed.
9da9dfd bounded the collectives (mem_cache/hicache_collective.py); that
commit is an ancestor of the currently deployed 9925a2e, and its suite
passes. The guard outlived its defect by several months of deploys.

The fix shape is not invented here -- it is three lines below, in the same
function. The kv-session-offload clause was already converted from "is it
CONFIGURED" to "what is it DOING" (sgl-project#656, kvso_flip_contract) for exactly this
reason. This applies the same correction to HiCache: the guard now names the
storage backend, so the device+host-local configuration can carry a prefix
cache across the flip while the disk tier stays refused pending its own
evidence.

Deliberate invariant change: test_phase_flip_runtime.test_guards asserted the
old "enabled => refused" contract and is updated in this commit rather than
left to break, with the reason recorded at the assertion.

Tests, hermetic (CUDA_VISIBLE_DEVICES=""):
  test_hicache_flip_guard_703.py ......... new, red first
      (red: "Lists differ: ['hierarchical cache (sgl-project#630: ...)'] != []")
  test_phase_flip_runtime.py ............. updated contract
  test_hicache_bounded_waits_630.py ...... 14 passed + 14 subtests
  test_kvso_flip_contract_631.py ......... precedent clause unaffected
  -> 106 passed, 17 subtests passed, 53.59s

Can-fail proof: test_storage_backend_still_blocks asserts the guard STILL
fires for file/mooncake/hf3fs. A change that merely deleted the clause passes
the enabling test and fails that one.

Not claimed: that this restores cache HITS. Measured on the live instance,
the device radix tree currently retains zero KV tokens (kv_evictable_tokens=0
on all three ranks, cache_hit_rate=0, 15861/15861 prefill lines at
cached-token 0, including three byte-identical requests). This commit removes
the blocker; whether a tier on top then hits is a separate open defect.

Lint: ruff/codespell findings in this file (lines 2255, 6276, 1439-1443) are
pre-existing and outside the changed region; not touched.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…r the flag stays unusable

The previous commit narrowed flip_blocking_guards, which gates flip ARMING.
A live boot then proved that insufficient:

  ValueError: --enable-phase-flip V1 refuses: --enable-hierarchical-cache
  (sgl-project#630: PP x disk HiCache wedges at warmup).

_handle_phase_flip carries its own copy of the same stale clause and refuses
at ServerArgs parse time, before a scheduler exists. Two guards, one defect;
narrowing either alone leaves --enable-hierarchical-cache unbootable, so they
move together and now say the same thing: the DISK tier is what wedged, and
that is what stays refused.

The can-fail test earned its place here. Its first version passed vacuously --
the fixture never reached the blocker list, because the validator walks the
whole phase-flip surface first and returned early on a stub with the flip
disabled. It failed with "'hierarchical' not found in ''", which is exactly
the signal a can-fail assertion exists to produce; the fixture now supplies a
minimal valid flip config so the HiCache clause is genuinely exercised.

Tests, hermetic (CUDA_VISIBLE_DEVICES=""):
  test_hicache_flip_guard_703.py ......... 6 passed + 3 subtests
      TestHiCacheFlipGuard703 ............ runtime clause
      TestHiCacheFlipV1Blocker703 ........ boot-time clause (new)
  test_phase_flip_runtime.py ............. updated contract
  test_hicache_bounded_waits_630.py ...... sgl-project#630 root fix still green
  -> 87 passed, 17 subtests passed, 51.46s
  ruff clean on the changed test file.

Still not claimed: that HiCache now HITS. The device radix tree retains zero
KV tokens on the live instance (kv_evictable_tokens=0 on all three ranks,
cache_hit_rate=0). These two commits remove the blockers; retention is the
open defect behind them.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…ing my own stage-1 conservatism

Stage 1 narrowed both copies of the guard to refuse only when a storage
backend was configured, "pending its own evidence". That reservation does not
survive contact with the evidence: it is the SAME evidence that cleared the
host tier. The sgl-project#630 wedge was PP x disk HiCache at warmup, its root fix is
9da9dfd (bounded collectives), that commit is an ancestor of every deployed
commit since, and test_hicache_bounded_waits_630.py passes 14 tests + 14
subtests hermetically. A guard cannot be justified by a defect a green suite
says is fixed.

Keeping the disk tier refused was conservatism rather than caution, and it
blocked the thing the retention design actually depends on. Host RAM cannot be
the retention store: the flip's own host weight images take 20.50 GB of the
25.87 GB usable, leaving ~5.37 GB, which is a staging buffer and not a store.
Disk is the store.

WHAT REMAINS GATED, and why it is not this list: the KV key's
_{pp_size}_{pp_rank} suffix. That suffix is a claim about BYTES -- a PP-written
page really does hold only one stage's layers -- and it drops only when sgl-project#706's
whole-page format makes a page complete across stages. Refusing the backend
never protected those bytes; it only prevented anyone from reaching them. The
two decisions were conflated in stage 1 and are separated here.

Tests, hermetic (CUDA_VISIBLE_DEVICES=""):
  test_hicache_flip_guard_703.py ......... rewritten for the stage-2 contract
  test_phase_flip_runtime.py ............. contract updated a second time
  test_hicache_bounded_waits_630.py ...... the fix this rests on, still green
  test_kvso_flip_contract_631.py ......... precedent clause unaffected
  -> 106 passed, 25 subtests passed, 52.10s. ruff clean.

Can-fail proofs, both copies: test_other_guards_still_fire pins dual-group,
tree-cache-without-enumeration and PD disaggregation; test_other_v1_blockers_
still_fire pins --dp-size and --dual-group-lane. A change that returned no
guards unconditionally passes every removal assertion and fails these.

Still not claimed: that HiCache hits. The device radix tree retains zero KV
(kv_evictable_tokens=0 on all three ranks, cache_hit_rate=0). That defect is
upstream of all of this and gates the acceptance test.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…is gone

Review-gate addition to e141dab. Removing the sgl-project#630 refusal was right -- the
defect it named has an ancestor root fix and a green can-fail suite -- but this
path did wedge once for real, and silence is not the same as confidence.

Corridor canon is warning-not-blocker, so the first flip arm that carries a
disk tier says so exactly once, naming the defect (sgl-project#630), the commit that fixed
it (9da9dfd, bounded collectives), and the suite that keeps it fixed
(test_hicache_bounded_waits_630.py). The point is attribution: if a warmup hang
ever reappears on this path, that line turns a bisect into one grep.

Once, not per arm: a per-arm line on an auto-policy flip would be noise, and
noise is how a real warning gets filtered out.

Tests, hermetic (CUDA_VISIBLE_DEVICES=""):
  test_warns_once_and_does_not_block ..... fires, carries all three attribution
      tokens, and returns NO guard -- the warning must never become a blocker
  test_silent_without_a_disk_tier ........ can-fail boundary: host-only HiCache
      must not trip it. An unconditional warning passes the test above and
      fails this one.
  test_silent_when_hierarchical_cache_is_off
  -> 109 passed, 27 subtests passed, 52.05s across the guard + sgl-project#630 + kvso
     suites. ruff clean.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…re before the seam

WHERE PREFIXES DIE ACROSS A FLIP, traced rather than assumed:

* The radix tree survives. `scheduler.tree_cache` is assigned once
  (scheduler.py:726) and the cutover never reassigns it.
* Device rows survive by design: build_flip_live_slots_fn enumerates "radix
  tree values UNION parked requests' rows" and the sgl-project#297 reshard relocates
  them BY ROW ID between the two phase pools.
* THE HOST TIER DOES NOT, and not through a missing call. There are two
  device KV pools (phase_flip_runtime.py:1788); the TP stack builds with
  pp_size=1 (phase_flip_boot.py:174,248) so it spans all 16 attention layers
  while a PP stage spans 7/5/4. HiRadixCache binds its host pool to the pool
  that existed when it was BUILT -- the boot one -- and the scheduler's
  allocator is likewise assigned once and never reassigned. In the phase that
  did not build it, the host tier therefore mirrors a pool that is not live.
  So a prefix's only route across a flip is the geometry-free disk tier,
  which is what sgl-project#706 slices 1-2 made nameable from both phases.

THE WRITE-BACK GAP: it is opportunistic, and nothing closes it at the seam.
Device->host is eager only under write_through (threshold 1) or
write_through_selective (2); under write_back a prefix is staged ONLY under
eviction pressure. Host->storage is a separate asynchronous stage on the
backup thread. The flip neither forces the staging nor waits for the queue:
grepping the whole flip path for cache_controller / write_backup / hiradix
returns ZERO hits. And no existing API can be leaned on -- writing_check only
completes writes already issued, detach_storage_backend DROPS pending backups,
HiCacheController.reset() clears every queue outright (pending backup work is
lost, not drained), and flush_cache is a wipe despite the name.

THE HOOK (mem_cache/hicache_flip_writeback.py, flag-gated, default off):
stages the tree's un-backed prefixes, lets the storage stage run, and WAITS
for the acknowledgements under a deadline. Placed BEFORE anything moves in
PhaseFlipRuntime._execute -- ordering is the whole content of the hook, since
that is the last moment at which reading the bound pool reads live bytes.

Two refusals, at the two right altitudes:
* PARSE time (ServerArgs): --phase-flip-writeback requires
  --phase-flip-canonical-kv-page and --enable-phase-flip. Without the neutral
  format the pages written at the seam still carry the geometry of the phase
  that wrote them, so the IO would be spent for a hit that cannot happen.
* SEAM time: the hook NEVER raises into the flip. With requests already
  parked, a raise climbs into the event loop and takes down an instance that
  was serving fine in its current phase; a prefix that misses the store costs
  a later cache miss, which is the cheaper failure. Logged, not thrown.
The wait is bounded for the same reason (sgl-project#630 wedge shape): whatever is not
acknowledged in time stays in flight and is reported, and the flip proceeds.

Tests (hermetic, CUDA_VISIBLE_DEVICES=""), 16 new:
* test_flip_writeback_703.py (10) -- a flip-shaped sequence run twice against
  the REAL canonical store through the REAL file backend, with the tree and
  controller faked to the write_back policy's timing. RED: without the hook
  the store is empty at the seam and the post-flip TP-geometry reader misses
  every key. GREEN: with the hook in the same slot, the reader gets the prefix
  back byte for byte. Plus both refusals, the deadline bound under a fake
  clock, idempotence, and the off-by-default gate.
* test_canonical_kv_page_args_706.py (+6) -- the argument-time refusals.

Regression, same env, base c3e9487 vs this commit:
  unit/mem_cache   940 failed / 779 passed -> 940 failed / 862 passed (+83)
  unit/server_args   1 failed / 626 passed ->   1 failed / 639 passed (+13)
  unit/managers      4 failed / 2145 passed -> 4 failed / 2145 passed
  scheduler/test_phase_flip_runtime.py: 67 passed (the file the hook edits)

SIZING ESTIMATE for what this can be worth is in
evidence-665-f1/PLAN_PERF_PIPELINE_2026-08-16.md, labelled as an estimate:
GDN state is 74.8 MiB per retained node against 32,768 B/token of KV, so
retention is state-dominated below 2,394 tokens of prefix; restore beats
re-prefill by 8-10x (8k prefix 0.17s vs 1.35s, 50k 0.86s vs 8.42s). The 12
GDN slots are a SIZING cap that retention does not raise -- what retention
changes is the price of exceeding it. No speedup number is claimed for the
5-9 queue: the traffic's true prefix-reuse rate is not measured here, and
today's realised share is zero (#cached-token: 0 on 41,952 batches).

Live A/B is boot-gated and belongs to F4-r4's window list.

CAN-FAIL PROOF (mutation applied, suite re-run, reverted; named tests are the
ones that went red):
  N1  hook stages nothing
      -> test_with_the_hook_the_prefix_survives,
         test_the_hook_is_what_made_the_difference,
         test_already_staged_nodes_are_not_rewritten,
         test_a_backup_that_never_acknowledges_does_not_hold_the_flip
  N2  canonical-store refusal removed
      -> test_refused_without_the_canonical_format, and ONLY that one
  N3  storage stage never started (writing_check not called)
      -> test_with_the_hook_the_prefix_survives,
         test_the_hook_is_what_made_the_difference, +1
  N4  deadline ignored (bound multiplied by 1000)
      -> test_a_backup_that_never_acknowledges_does_not_hold_the_flip
  N5  gate removed (hook runs with the flag off)
      -> test_gate_is_off_by_default, test_no_scheduler_is_a_safe_no_op
Restored tree re-verified green after every mutation (10 passed).

Note on scope discipline: black/isort reformatted unrelated imports in
phase_flip_runtime.py on the first pass. That file is under a
minimal-change constraint, so it was reverted and the hook re-applied by
hand; the diff there is 30 insertions, 0 deletions.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
… it is not bound to

REACHABILITY VERDICT FIRST: LATENT, not live -- and it stops being latent on
exactly the boot sgl-project#703/sgl-project#706 are aiming at.

`HiCacheController` exists only when a hierarchical cache is built, and today's
serving flagset (evidence-665-f1/argv_*.txt) carries --enable-phase-flip with
its whole family and NO hicache flags, so no controller is constructed and none
of this I/O is reachable on the live line. What makes it reachable is the
combination flip + hierarchical cache, which nothing refuses any more: the sgl-project#630
blocker was deliberately removed from both the boot-time and the runtime guard
lists so that a prefix cache could ride the flip. That is the intended
configuration of the next boot.

FAILURE SHAPE: silent corruption, BOTH directions -- not a dead cache.
`cache_controller.__init__` captures the device pool once
(`token_to_kv_pool_allocator.get_kvcache()`), the scheduler's allocator is
likewise assigned once, and the cutover reassigns neither. Both transfers name
the captured object directly:
* WRITE (`backup_from_device_all_layer(self.mem_pool_device, ...)`, :866)
  during the TP phase reads the PP pool's rows -- the stale cutover snapshot at
  best, unbacked pages under the flip's VA-backed pools at worst -- and those
  bytes are keyed by TOKEN CONTENT and, under sgl-project#706, persisted to disk. A page
  claiming tokens it does not hold is a wrong ANSWER later, in either phase,
  and it survives a reboot.
* LOAD (`load_to_device_per_layer(self.mem_pool_device, ...)`, :994) fills rows
  in the PP pool that the model does not read, while the radix tree reports the
  prefix resident -- so the scheduler skips recomputing it and attention reads
  rows nobody filled. Also a wrong answer, also silent.

THE CUT (minimal, per the fix-direction call): refuse device-tier I/O while the
flip routes to its TP stack. A refused write is a prefix not cached; a refused
load is a prefetch that does not land. Misses are the correct failure here and
they are cheap; both alternatives are wrong output. The host and storage tiers
are untouched, and the PP phase resumes normal staging after the next flip --
which is also why sgl-project#703's flip-time writeback (running at the seam, in the bound
phase) composes with this rather than being blocked by it.

NO FLAG, deliberately: `phase_flip_tp_routing_active()` is False whenever the
flip's secondary groups were never built, so every deployment without
--enable-phase-flip is byte-identical by construction and cannot enter the
guarded state. An off switch would exist only to restore the corrupting
behaviour. The predicate encodes "the binding belongs to the boot phase" in ONE
place, so the real fix (rebinding the controller's pool at the cutover, which
touches a once-assigned binding) has a single site to update.

Tests (hermetic, CUDA_VISIBLE_DEVICES=""), 11 new:
* test_hicache_phase_guard_718.py -- the guard is invisible when the flip is
  not routing (proved by an EXPLODING pool that the real prologue reaches);
  both directions are refused when it is; the refusal happens BEFORE any pool
  is touched (the executable form of "it does not copy against the wrong
  pool"); each direction warns once and names its own hazard; an unreadable
  phase module fails OPEN, since disarming every deployment on an import error
  would be a bigger outage than the hazard.
* TestReachability -- the premise, pinned so it cannot rot: hierarchical cache
  is off by default, and flip + hierarchical cache is ACCEPTED. If a refusal is
  ever added back, that test says the guard's premise changed.

Regression, same env, base c3e9487 vs this commit:
  unit/mem_cache   940 failed / 779 passed -> 940 failed / 873 passed (+94)
  unit/managers      4 failed / 2145 passed -> 4 failed / 2145 passed
cache_controller.py diff: 14 insertions, 0 deletions.

NOT done here, and named: rebinding the controller to the active phase's pool
is the real fix and would make the device tier usable in BOTH phases instead of
one. It touches the once-assigned binding that three other subsystems read, so
it wants its own slice and its own flag.

CAN-FAIL PROOF (mutation applied, suite re-run, reverted):
  P1  guard removed from write()
      -> test_write_is_refused_while_the_flip_routes_to_tp,
         test_the_refusal_happens_before_any_pool_is_touched
  P2  guard removed from load()
      -> test_load_is_refused_while_the_flip_routes_to_tp, +1
  P3  predicate never disarms
      -> 5 failures, i.e. every claim the guard makes
  P4  warns on every operation (the once-set bypassed)
      -> NOTHING FAILED at first. Real test gap: the once-test counted the
         FIRST call's output and then made a second call whose silence it never
         asserted, so a warn-every-time regression would have passed. Closed
         with assertNoLogs on the repeat call, for both directions; the
         mutation now fails test_each_direction_warns_once.
  P5  fails CLOSED on an unreadable phase module
      -> NOTHING FAILED at first, and for a worse reason: the test named the
         import-failure path but never exercised it -- it called the real
         predicate, which returns False here because no flip groups exist. So
         it was pinning a different fact under a misleading name. Split in two:
         the honest one (no flip groups -> not disarming) keeps its assertion
         under an accurate name, and a new test replaces the phase module with
         one that cannot supply the predicate, which is what an import failure
         looks like from inside the guard. The mutation now fails
         test_an_unreadable_phase_module_fails_OPEN.
Restored tree re-verified green after every mutation (12 passed).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…the first Flip+HiCache boot

Everything mechanical is landed (canonical format 04c6736, GDN blob
a38f39f, sharded backend 19f4c68, cutover rebind ec117fa,
ReadBufferPool, sgl-project#718 disarm). This is the boot that composes them, and its one
open cost, priced.

THE OPEN COST, stated first and found by inspection: sgl-project#719's rebind refuses
unless the incoming phase owns a shape-matched host pool, and that pool HAS NO
BUILDER -- phase_pools_for reads scheduler.phase_flip_host_pools
(hicache_phase_binding.py:287) and nothing in the tree writes it. So the
rebind refuses at every cutover today, logged and never raised, with sgl-project#718
keeping the device tier disarmed in the phase that did not build the binding.
That is a safe state, and the design recommends booting IN it.

HOST-RAM BUDGET, from the deployed [32,16,16] cut. A host row is that rank's
OWN layers x 2048 B, so PP rows are 16,384 / 8,192 / 8,192 B while a TP row is
32,768 B on every rank -- multipliers 2.00x / 4.00x / 4.00x, i.e. 16/own_layers.
Against the MEASURED pinned load (C1 at 591add2: 25.87 GB usable, 20.50 GB
of flip weight images, 5.37 GB remainder):

  rows fitting in 5.37 GB   rank0        rank1/2
  PP pool only (today)      327,759      655,518
  BOTH pools                109,253      131,104

So the second pool cuts the host tier to a third on rank0 and a fifth on ranks
1-2 at fixed budget; at the 9.01 GB the C1 boot actually requested it needs
~27 GB on rank0's ratio against 5.37 available -- it does not fit, and not
marginally.

WHICH INSTRUMENT BINDS, because reasoning from free -g gives the wrong answer:
the PINNED budget refuses first (it already refused 29.51 GB at C1), while the
sgl-project#721 available floor of 24.3 G has ~12.7 G of slack today (available 37 G). A
second host pool is refused by the pinned check long before it threatens the
OOM floor.

MARKED ABSENT rather than estimated: whether the 9.01 GB host-pool figure is
one rank's or an aggregate, and the per-rank split of the three weight images.
The refusal message does not say and no ledger entry resolves it, so every
number is given per rank AND against the shared 5.37 GB remainder, so the
conclusion does not depend on the ambiguity.

RECOMMENDATION: the first boot does NOT add the second pool. It does not fit,
and the cross-phase path does not need it -- sgl-project#706 made the DISK tier
geometry-neutral, sgl-project#703 pushes warm prefixes there before the cutover, and both
phases resolve the same content key (100 GB disk = 3,051,758 canonical-page
tokens against a 5.37 GB host staging tier). The safe states are the DEFAULT
states, so nothing has to be remembered.

Also in the document: the exact flag set and env (including why
--phase-flip-rebind-hicache is deliberately NOT set), the boot-before-hold
sequence with the two log lines whose ABSENCE is the stop condition, the sgl-project#630
PP=3 x disk-HiCache warmup wedge with its root fix (9da9dfd) and what to
watch anyway, acceptance (byte-identical cross-phase continuation with A-vs-A
first -- the sgl-project#718 shape is a WRONG ANSWER, not a miss; hits counted from log
lines because cache_hit_rate reads 0.0 with real hits; ReadBufferPool overflow
counter zero; the sgl-project#720 falsifier pair), and the ranked risk list.

Design only. No boot, no GPU. The boot goes on the window list.
Symlinked beside the other DESIGN_706 docs in evidence-665-f1/.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…not fixed

Withdrawing my own sgl-project#703 removal, on measurement.

WHAT HAPPENED. On 2026-08-16 I retired this clause in four steps
(58658aa, 7336c08, e141dab, 61d7572), arguing verbatim that "the
wedge's root fix is 9da9dfd (bounded collectives) ... A guard cannot be
justified by a defect that a green suite says is fixed."

Both halves were wrong.

* 9da9dfd BOUNDED the wait. It converted a silent two-hour gloo hang into a
  named 600 s HiCacheCollectiveTimeoutError. That is valuable and it is exactly
  what fired below -- but a deadline is not a repair, and I called it a root fix.
* test_hicache_bounded_waits_630.py asserts only that the bounded calls raise ON
  SCHEDULE and post the same operation `recv` would, against mocked Work objects
  and fake groups. It proves the wait is bounded. It never proves two real ranks
  rendezvous, which is the thing that fails. I rested a removal on a suite that
  proved something weaker than the claim.

MEASURED, 2026-08-17 10:57:50 -> 11:08:39, first event round after startup, on
--enable-hierarchical-cache --hicache-storage-backend file over PP=3 -- exactly
the configuration this clause used to refuse:

    PP0  pp_sync/isend[0]->pp1   waited 649.1 s
    PP1  pp_sync/recv<-pp0       waited 649.2 s
    PP2  pp_sync/recv<-pp1       waited 649.1 s

All three ranks were INSIDE the collective. PP0's send and PP1's matching
receive were both posted -- same group, same tag (P2PTag.HIRADIX_PP_SYNC), same
0-dim int payload -- and they did not rendezvous. So the hypotheses on offer are
refuted: not a missing participant, not an unconstructed handler, not an
init-order race (PP1 had posted), not sgl-project#259's numel mismatch (the payload is a
scalar), and not a tag collision (HIRADIX_PP_SYNC is disjoint from
GRAMMAR_PP_SYNC and DEFAULT). The mechanism is still unrooted. That is precisely
why the honest response is a guard and not a comment.

WHY THE GUARD RATHER THAN FIXING THE COLLECTIVE, which would be preferable:
fixing it is not desk-fundable today. Both ranks post correctly, so there is
nothing to correct from static reading; naming the mechanism needs a live
multi-process reproduction, and I will not ship a speculative change to a
collective on a serving line.

NARROWER THAN THE ORIGINAL. The pre-sgl-project#703 clause refused ANY storage backend
under a flip, which made the phase flip and any prefix retention mutually
exclusive -- the state whose only answer was serving with no cache tier at all.
This one refuses only what has wedged on metal: a PIPELINE (pp_size > 1)
carrying a storage-backed tier. Device+host-local tiers and single-stage flips
stay reachable, and tests pin that so it cannot quietly widen back.

WHY THE REMOVAL LOOKED SAFE, which is the part worth keeping: my sgl-project#703 suite
covers pp_size=3 with NO backend, and a disk backend at pp_size=1 -- never the
combination this rig actually runs. The configuration that wedges was never
tested, so the suite was green and uninformative about it.

COST, named because a restored guard is a real loss: the sgl-project#706 disk-tier
validation is blocked again until the collective is rooted. The trade is eleven
minutes of wedge and a dead instance versus an immediate refusal that names the
reason -- and the boot it blocks could not complete anyway. Remove this only
when a test proves two ranks RENDEZVOUS, not when one proves a wait expires.

TESTS  test/registered/unit/managers/test_pp_disk_hicache_guard_630.py, 7 passed
+ 4 subtests. Mutation-proven: disabling the clause turns 3 red. Can-fails pin
what sgl-project#703 unblocked -- device+host-local tier, pp_size=1 with a disk tier, and
hierarchical cache off must all still arm -- so a future widening fails here.
Regression: managers 12 failed / 2302 passed, the 12 baseline unchanged and the
+7 are these; test_hicache_flip_guard_703 and test_phase_flip_runtime stay green
(74 passed), because the narrowing preserves every case they cover.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
Merged the serving lineage in. Three doc conflicts: exec won two on CONTENT,
not category -- its edits correct my own run-card (--hicache-size takes an
integer number of gigabytes, so my '5G' would have failed the boot the card
exists to drive) and retract a NOTE_545 claim with a real attach/detach run
behind it. Docs-keep-mine would have shipped a bad flag value.

sgl-project#630 did NOT clear, and the reason is a cross-lane contradiction rather than a
missing patch: sgl-project#703 removed the PARSE-TIME blocker because the runtime twin was
gone (7336c08), exec restored the runtime twin (90e84ad), and restoring
the parse-time one would refuse the very boot this train's own run-card tells
F4-r4 to perform. Left failing with the decision named.

sgl-project#612 declared, sgl-project#584 both constants filed with differentiated verdicts.

New: exec's double-billing fix reds two sgl-project#550 admission tests. Its credit-back is
sound only under the invariant its own comment states (registration follows
allocation); sgl-project#550's fixture registers without allocating. Not patched -- either
the fixture is impossible or the credit-back under-charges, and rewriting one
lane's test to match another's model would erase the question.

Zero UNEXPLAINED new failures: three remain, each with cause and owner.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…velock rooted

ROOT CAUSE. bounded_wait polled `work.is_completed()` against a deadline and
only called `work.wait()` once the poll had already succeeded. For gloo that
never happens: `is_completed()` REPORTS state, `wait()` DRIVES the transfer.
With both peers polling, neither side advances the exchange, so every rank sits
until its own deadline. The sgl-project#630 bound, written to stop a hang, produced a
livelock -- and it is what wedged the Flip+HiCache boot on 2026-08-17 for eleven
minutes, ending in three simultaneous timeouts with every op correctly posted.

PROVEN, not argued. A 3-process REAL-gloo harness driving the REAL
UnifiedRadixCache._pp_sync / _drain_async_work (no mocks; a mock cannot fail the
way this failed), evidence-665-f1/repro_pp_sync_630.py, no CUDA and no serving:

  timeout_s = 8.0 (the poll)     -> pp_sync/isend[0]->pp1, recv<-pp0, recv<-pp1
                                    all time out -- the metal wedge, label for
                                    label
  timeout_s = 0.0 (wait() escape) -> rendezvous; rank 1 receives rank 0's values

Raw gloo isend/irecv on the same group with the same tag rendezvous fine when
waited, which is what isolated the defect to this wrapper rather than to gloo,
to the tag space, or to group identity.

Hypotheses this refutes, all of which were live before the harness existed: not
a missing participant (all three ranks were inside the collective), not an
unconstructed handler, not an init-order race (PP1 had posted its recv), not
sgl-project#259's numel mismatch (0-dim scalar payload, one call site), not a tag collision
(HIRADIX_PP_SYNC is disjoint from GRAMMAR_PP_SYNC and DEFAULT), and not the
storage tier (the repro carries none).

THE FIX. Hand the deadline to the wait itself: `work.wait(timeout=...)` blocks,
so the transfer progresses, and raises on expiry, so a dead peer still cannot
park a rank for the group's two-hour timeout. Both properties at once, which is
what the poll was reaching for and missed. Backends that report expiry by
returning False rather than raising are handled too.

TESTS  test/registered/unit/mem_cache/test_pp_sync_rendezvous_630.py, 3 passed:
three real processes over real gloo assert (a) the ring rendezvouses WITH THE
BOUND ACTIVE -- running it green only with the timeout disabled is what hid this
-- (b) downstream ranks actually RECEIVE rank 0's values, since a wait that
returned without transferring would satisfy (a), and (c) a dead peer still
raises the named bounded error, which is sgl-project#630's own property and must survive
the fix. Mutation-proven: restoring the passive poll turns (a) and (b) red while
(c) stays green, which is exactly the discrimination the old suite lacked.

THREE STUBS WERE UNFAITHFUL and are corrected, in _WedgedWork
(test_hicache_bounded_waits_630), _FakeWork (test_hicache_collective_wedge) and
_FakeWork (test_hiradix_pp_sync_drain). All three modelled a `wait()` that
ignores a deadline -- two blocked forever, one took no arguments at all --
because the code under test never passed one. They encoded the defect's own
assumption, so they could not have caught it. They now block only when UNTIMED
and raise when the deadline expires, which is what a real gloo Work does
(measured).

REGRESSION  mem_cache 940 failed / 1010 passed against a pre-fix baseline of
940 / 1007 captured on the reverted tree: ZERO new failures, +3 are these tests.
The one regression found on the way (test_hiradix_pp_sync_drain, TypeError on
the new kwarg) is the third stub, fixed here rather than worked around.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…n criterion

The clause restored earlier today named its exit condition verbatim: "Remove
this only when a test proves two ranks RENDEZVOUS, not when one proves a wait
expires." That test now exists, and the defect it guarded against is rooted
rather than deferred.

ROOT CAUSE (e4f1ae2): bounded_wait polled work.is_completed() and only
called work.wait() once the poll had already succeeded. is_completed() REPORTS,
wait() DRIVES -- two polling peers never advanced the exchange, so each sat
until its own deadline. The sgl-project#630 bound was itself the livelock. Fixed by handing
the deadline to the wait.

THE EVIDENCE IS OF THE RIGHT KIND THIS TIME, which is the entire point of the
withdrawal that preceded it. test_pp_sync_rendezvous_630.py runs THREE REAL
PROCESSES over a REAL gloo group and asserts the ring rendezvouses with the
bound ACTIVE, that downstream ranks actually receive rank 0's values, and that a
dead peer still raises the named bounded error. Mutation-proven. A mock suite
could not produce any of those three facts, and resting the earlier removal on
one is exactly what made it wrong.

The guard's test file becomes the RECORD: this configuration has been gated and
ungated three times, and the history is written into it because the failure mode
is procedural, not mechanical. It now pins the current state (no refusal) plus
one thing more -- that the rendezvous suite is still present. Deleting that
suite would silently return this configuration to the state that wedged:
ungated, with nothing proving ranks exchange.

If it wedges again: restore the clause, and do not accept a green mock suite as
grounds to lift it a third time.

TESTS  3 passed + 3 subtests. Boot validation follows under a fresh claim; this
commit only makes that boot reachable.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…ct the sgl-project#550 fixtures

sgl-project#630: the parse-time blocker is back, narrowed to match 90e84ad EXACTLY
(pp_size > 1 AND enable_hierarchical_cache AND a storage backend), with the
same reason string and a pointer to the runtime twin. Refusing at parse costs a
second; the runtime twin fires after a full weight load, which cost 11 minutes
and a dead instance. The sgl-project#703 comment is rewritten to the new truth with its
provenance: 9da9dfd BOUNDED the wait and never rooted the desync, and
test_hicache_bounded_waits_630.py proves only that a bounded call raises on
schedule against mocked Work objects.

test_v1_blockers_named now names a storage backend, because the narrowed guard
deliberately no longer refuses the device+host-local tier.

DESIGN_706_BOOT.md gains PRECONDITION 0 -- this boot is BLOCKED until the
pp_sync rendezvous is rooted -- so the refused boot and the run-card that
describes it cannot drift apart, and it names what stays reachable meanwhile.

sgl-project#550 DETERMINATION, from the producers rather than from either model. Every
consumer except one goes through check_and_register_pinned_post. The exception
is weights_arena.py:428 (_register_image_post), and it registers BEFORE it
allocates -- lines 439-460 do the allocation -- so exec's stated invariant
'registration FOLLOWS allocation for every producer' is literally inaccurate.
But the gap closes inside the same call, so any LATER checker sees bytes that
are already allocated and the credit-back is sound where it is used. No
producer leaves a registered-but-unallocated post standing on a success path.

So the fixtures encoded an impossible machine, and they are corrected on
physics:  is read LIVE, so an allocated 30 GB post cannot coexist
with a static 40 GB available, and it cannot stay 40 GB after 20 GB is
allocated. Both tests keep their exact intent -- a post must not be admitted on
its own arithmetic, and the second post must see the first -- with numbers a
machine can actually be in.

Residual, named not buried: on the weights_arena allocation-FAILURE path the
post stays registered with nothing allocated, and there the credit-back would
under-charge. Narrow, real, and owned by sgl-project#706/sgl-project#695.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…etermined, latecomers in

Ledger updated with T1-T4. Six suites now at zero failures (mem_ledger,
server_args, boot_matrix, mem_cache plus the two already clean); the two
remaining deltas are the cluster-b inherited set and one order-dependent
pollution pair that passes alone and under filters.

No unexplained failures remain.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…oject#550's audit

The comment on the credit-back said it was sound "because registration FOLLOWS
allocation for every producer of a post". That is FALSE, and it was a
misreading of weights_arena on my part: `_register_image_post` declares the post
BEFORE `_alloc_host_image` allocates (:458 vs :476), deliberately, so the
registry can refuse an over-commitment at the DECLARATION rather than discover
it at the allocation.

The fix itself stands; only its stated justification was wrong, and a future
reader would have verified the wrong property. What actually makes the credit
sound is weaker and sufficient: by the time a LATER post is weighed, the EARLIER
posts' allocations have COMPLETED, so their bytes are already absent from
`available` -- which is what was measured (MemAvailable 33.62 GB while the
schedulers held 86.51 GB resident on a 126.75 GB box).

The real hazard is a post registered whose allocation NEVER happens: credited
back without ever being resident, so the next admission is charged too little
and the registry waves through the over-commitment it exists to refuse. sgl-project#550
found that window independently and closed it (`_unregister_image_post` on the
raising path). The comment now names that as the standing obligation on any
future producer that can leave a post registered with nothing behind it.

TESTS  23 passed + 3 subtests across the sgl-project#706 double-count, sgl-project#550 registry,
sgl-project#630 rendezvous and guard suites together -- the two fixes compose.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…, and a lift has THREE twins

Part 2 completes the sweep begun in 46e3e30. Scope as stated there: 181
candidate lines over python/sglang/srt (tests excluded), 170 fork-owned.

HEADLINE: the TREE is healthy on this axis. Zero DANGLING guards -- every
ticket citation resolved to a real commit history or a checkable artifact --
and zero guards needing a lift decision. The rot is concentrated in the
planner's REJECTION REGISTER, which part 1 covered.

THE ONE VERIFIED STALE-TEXT, fixed: server_args.py:2275 said park-tier routing
happens at exhaustion sites "once the sgl-project#236 budget lands". sgl-project#236 landed;
park_instead_of_demote is live and called at kv_session_offload.py:3404. The
conditional clause is dropped.

A CLASSIFICATION I REJECTED AFTER CHECKING IT MYSELF, and the reason it matters
more than the row does. The sweep flagged barlink_path_rates.py:21 ("the
measurement does not exist yet") as stale because sgl-project#278 closed and
load_nccl_reference is implemented. That is wrong: the LOADER existing is not
the MEASUREMENT existing. The scripts that would produce the data exist
(scripts/gpu_battery/s06_nccl_reference.*, scripts/probe/nccl_reference.py), no
data file does, and the consumer at :448 explicitly handles that case by
keeping the paths PLACEHOLDER. The docstring is CORRECT. Fixing it would have
replaced a true statement with a false one -- which is the exact failure mode
this axis is most likely to commit, so it is recorded rather than quietly
dropped.

THE SHARPEST FIND, and it is on this audit's own axis turned against the test
suite: test/registered/unit/server_args/test_phase_flip_args.py:88 still
asserts that enable_hierarchical_cache=True raises a ValueError matching
"sgl-project#630". sgl-project#703 stage 2 REMOVED that blocker. The test is RED on
train/0817-control right now -- verified failing at the untouched base commit
with both my edits reverted, so it is not this sweep's doing.

That upgrades a lesson the sgl-project#703 lift already half-knew. That lift was careful
about TWINS: it moved the parse-time and runtime clauses together because
"fixing only the runtime clause is not enough ... both must move together or
the flag is still unusable". THERE WAS A THIRD TWIN. The test pinning the gate
did not move, so a careful lift still left behind a red test asserting the
presence of what it had just deliberately removed.

So the lift-evidence bar in the audit gains a fifth item: the tests that pin a
gate move WITH it. Two twins were not enough; there are three.

NOT FIXED HERE: rewriting a test assertion is not behaviour-neutral for the
suite, so it falls outside this sweep's one permitted write. Filed as its own
item, with the repair named (drop the sgl-project#630 row from that loop and point at
test_hicache_bounded_waits_630.py, which the code comments already name as the
active protection).

COUNTS, with one discrepancy I am NOT resolving by picking a side: I counted 21
provenance-shaped lines inside my 181-line candidate union; the sweep counted
187 across the whole tree without that pre-filter. Different denominators, both
defensible, neither reconciled line by line. Both agree on the shape -- the
large majority of #NNN mentions are settled narration and only a handful are
live conditions that could expire. Stated rather than averaged.

STILL-VALID substantive set spot-checked: the HiCache phase-rebind refusal
(nothing in the tree ever sets the host pool it waits for), the sgl-project#578
stage-table refusal (reads liftable in isolation; the full trace shows sgl-project#584's
canon fills what it can and this raise is the designed fallback for what it
cannot), the sgl-project#452 CUDA-graph refutation (reconfirmed three times, never
reversed), the KVSO/HiCache opt-in gate, and topk>1 under uneven DCP.

Two loose citations named: layers/dcp/owner.py:127 and
layers/attention/triton_backend.py:432 both cite "sgl-project#76", which is an unrelated
ticket -- scale analogies written as if they were pointers. The guards are
valid; the citations misdirect a reader exactly as the drifted anchors do.

Suite: server_args 663 passed, 91 subtests, 1 failed -- the pre-existing
test_v1_blockers_named above, verified identical at the untouched base.
Catalog updated same step. codespell clean.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…ation; delete lineage B

train/0818-desk-410-reconcile (through 9509c7b) merged into train/0817-desk.
21 conflict hunks across 11 files, resolved on DESIGN_410 / NOTE_411's own
verdicts. The two lineage-B modules are deleted IN THIS COMMIT, so there is no
window where both are importable.

DELETED WITH THE MERGE: mem_cache/session_manifest.py, mem_cache/session_bundle.py,
and test_session_manifest_410.py -- the B test that imported a deleted module.
Leaving it would have errored the suite; the reconcile branch had already
dropped it. pin_ledger.py STAYS: the reconciliation keeps and extends it (the
`unpinned` shortfall field) and hicache_storage consumes it -- which is why the
briefed three-file set was corrected to two.

NON-OBVIOUS HUNKS, with the authority:

* evictor hunks 2/3 -> THEIRS. NOTE_411 "Step 2: A's evictor moves to ALLOCATED
  bytes ... the evictor and the pin ledger share one unit".
* evictor hunk 4 -> OURS, and this one departs from the incoming text on
  evidence: theirs inlines a flat stat loop, while this train has already
  refactored that into the injectable `_iter_existing` and applies
  `self._allocated_size(st)` in `_scan_existing_files`. The VERDICT (allocated
  accounting) is satisfied; taking theirs would have duplicated the stat and
  regressed sharded-layout support.
* evictor hunks 0/1 -> OURS / UNION. Theirs predates A's `writer_count`,
  `path_for_stem` and `iter_existing` ctor params; the union keeps those AND
  theirs' pin-ledger param.
* http_server / scheduler / tokenizer_control_mixin -> OURS. Theirs predates
  the phase-flip and session-handover imports; taking it would have deleted
  live wiring.
* server_args -> UNION. Two disjoint flag blocks (phase flip, session
  checkpoints); both must exist.
* AUDIT_421 F6 cells -> merged, naming BOTH credits (sgl-project#286's first consumer and
  sgl-project#410's checkpoint tier). Both statements are true; a table cell cannot hold
  two rows.
* test_unwired_features_421 -> UNION, so theirs' positive pin class survives
  alongside ours' retirement note.

THREE INCOHERENCES THE TEXTUAL MERGE HID, found by running the suites:

1. DUPLICATE METHODS. Both lineages define the same methods in different
   places, so git merged both and the SECOND silently shadowed the first. An
   AST audit over every merged file found five: `stats` and `_allocated_size`
   in the evictor, `capacity_stats`, `pin_checkpoint`, `unpin_checkpoint` and
   `pin_stats` in hicache_storage. Resolved per pair -- ours' `capacity_stats`
   (a strict superset, it adds `file_path`), theirs' pin methods (the
   authority's `_pin_path`/`unpinned` version), ours' `_allocated_size` (same
   behaviour, richer docstring), and ours' `stats` with theirs' unique
   `accounting_overshoot_bytes` key folded in. http_server's pair is NOT a
   merge artifact: two different FastAPI handlers that share a name, present at
   HEAD before this merge.
2. EVICTION STOPPED REMOVING FILES. Hunk 5's incoming block extended past the
   comment into the removal line, replacing `self._path_for_stem(evict_stem)`
   with a flat join. This backend injects the sharded resolver, so `os.remove`
   missed, the entry left the LRU and the bytes stayed -- the cap silently
   stopped holding. Restored to the injected resolver; line 466 already stats
   through it and the two must not disagree.
3. `_pin_path` WAS FLAT ON A SHARDED STORE. The reconciliation wrote it as a
   flat join because its own lineage had no sharding. Here that names a path
   the store never writes, so `pin_checkpoint` dropped every stem as "missing"
   and pinned NOTHING while reporting success. `_pin_path` now delegates to
   `_existing_path` (sharded, else legacy flat, else the path it would occupy),
   which preserves the property the reconciliation actually asked for -- "the
   ledger must stat exactly what the evictor unlinks" -- under this layout.

Gates: mem_cache 1157 passed / 0 failed; managers 19 failed / 2507 passed,
IMPROVED on the established 22 and exactly the cluster-b inherited set;
mem_ledger 514/0; server_args 681/0; boot_matrix 159/0; spec 13F/711P;
entrypoints 4F/450P/3E; planner 1F/2880P; distributed 27F/2769P -- every one
at or better than its established count.

Also verified present rather than assumed: 54ffc4d (the corrected
pp_with_spec register row) is an ancestor, and test_phase_flip_args no longer
asserts the sgl-project#630 hierarchical-cache refusal -- F4-r4's lift (be93340)
removed that third twin, and the file is 23 passed / 0 failed here.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…sport failure as timeout

MEASURED 2026-08-17 18:39:07, on a boot killed by an external process exit:

    HiCacheCollectiveTimeoutError: 'pp_sync/isend[2]->pp2' did not complete
    within 600s (waited 34.3s)

34.3 s against a 600 s bound -- the sentence contradicts itself. The real cause
was one frame underneath: `gloo ... Connection closed by peer [127.0.1.1]`, i.e.
the peer PROCESS HAD DIED.

`Work.wait(timeout=...)` raises RuntimeError for BOTH expiry and transport
failure, and the sgl-project#630 bounding wrapper reported every one as a timeout. An
operator reading "timeout" goes hunting for a slow rank and finds a healthy one,
while the corpse is on another node. That is the wrong-instrument-reading class
this session has been clearing, and this instance is mine -- introduced with the
bounded wait.

THE DISCRIMINATOR IS NUMERIC, not a string match on the backend's wording: if
the wait returned before its own deadline, the deadline is not what ended it.
Backend messages change between versions; arithmetic does not. Under 95 % of the
bound the failure is reported as `HiCacheCollectiveError` naming a dead or
disconnected peer and carrying the underlying error text; at or past the bound it
remains `HiCacheCollectiveTimeoutError` as before.

Ruff clean. The existing bounded-wait and rendezvous suites are unaffected: they
exercise expiry at or beyond the deadline, which still raises the timeout type.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 20, 2026
…evidence a message is coming

A PP rank could enter an unbounded blocking receive for a proxy that nobody
would ever send. Measured twice: the last rank holds a ScheduleBatch and blocks
in _pp_recv_proxy_tensors for its slot, while both upstream ranks carry
cur_batch=None and report themselves idle -- so no rank will produce the
message it waits for. Health keeps answering, forward counters keep looking
sane, and the process sits there until it is killed.

THE CONTRACT. _pp_wait_for_proxy_readiness runs immediately before the
blocking receive and demands POSITIVE evidence: the CHAN_DICT sent counter
having moved past local_consumed, i.e. the upstream provably posted. On a
healthy boot that evidence is already there and the function returns at once,
so the receive path is unchanged.

IT IS A PRESENCE SIGNAL, NOT A TIMER, and that distinction is the whole
design. "Wait N seconds then give up" is sgl-project#630, a livelock this codebase already
has on record: ranks that time out, retry, time out again, make no progress and
look alive throughout. Here the budget is only a backstop -- the raise fires
solely when the budget is fully exhausted AND the counter never moved once.
A timing-out Work.wait() on the transport was never an option either: a
timed-out gloo wait destroys the pair, so the peer then sees "Connection closed
by peer".

The inbox is consulted before the counters, and that case was found by running
the regression rather than by foresight: a message already stashed for this
exact consumer (for instance one the armed drain took off the wire) leaves the
counters reading "caught up", so counters alone would have called a delivered
message absent.

TRANSPORT COVERAGE, STATED RATHER THAN IMPLIED. This covers "the upstream never
posted" uniformly across the gloo-metadata and NCCL-payload halves, because a
sender that never got there never advanced its counter either. It does NOT
cover "posted, then stalled mid-transfer". That limitation is written into the
docstring; the measured specimens are all the never-posted case.

DEFAULT PATH UNCHANGED: with pp_flip_counters None -- an ordinary boot without
phase flip -- the check is a no-op, verified directly rather than assumed.
Budget 30 s via SGLANG_PP_PROXY_READINESS_BUDGET_S, tagged HAND PIN sgl-project#789.

THIS IS A BACKSTOP, NOT THE HANDLER FOR THE COMMON CASE, and it must not be
wired alone. The ordinary divergence on this shape -- one rank admits, the
others do not -- would otherwise reach this contract, never move the counter,
and raise after the budget: a crash on every cache hit, which is only a
bounded, diagnosable version of the same fatality. That case belongs to sgl-project#791's
decision model, which excludes a request no rank can honour and degrades it
instead. sgl-project#791 must therefore be wired ahead of this, so that by the time the
contract can fire, something genuinely different is broken.

TESTS. test_pp_proxy_readiness_contract_789.py, 4 green. Its neutered case is
the red and the can-fail in one: with the readiness call patched out the path
is byte-identical to the pre-sgl-project#789 code, and the victim rank genuinely hangs
against two idle upstreams -- proven a hang rather than a fast error by a
bounded outer driver that finds it alive at the deadline with no result.

Disclosed: the source edits preceded the red-first test, an ordering deviation.
It is remediated by that neutered case being exactly the pristine path, not by
argument.

The one-line harness repairs to test_pp_drain_completeness_787 and
test_pp_flip_leftover_proxy_757 bind the new method on holders that predate it;
no assertion was touched.

Verified together in one run: 30 passed across the 789, 787, 757, 788, 633 and
791 suites.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 20, 2026
…, so the degrade terminates

sgl-project#791 lets a rank that cannot honour a told prefix length exclude itself and be
re-admitted later. Nothing made the retry DIFFERENT. PP0 would re-match the
same prefix, tell the same too-long length, the downstream would exclude it
again, and the request would never complete while the server looked alive.
That is sgl-project#630's shape exactly: a bounded, graceful path that makes no forward
progress is still a livelock, and this codebase already has that defect on
record. "It degrades" is not a termination argument.

WHAT THIS ADDS. PPAdmissionCongruenceGuard keeps a rank-local
_learned_floor[rid] and clamps PP0's fresh local match down to the OBSERVED
shortfall carried back on the retraction. The floor is learned, never guessed:
it is the coverage the downstream actually reported, so the request loses
exactly the tokens that were missing rather than all of its reuse. That is why
option (2) was chosen over a one-shot told=0 pin -- both terminate, but this one
makes the degrade RARE instead of merely finite.

TERMINATION IS WELL-FOUNDED, not hopeful. Every new retraction lowers the floor
strictly below the told that just failed, so the sequence is strictly
decreasing over non-negative integers: it can neither cycle nor descend
forever. Measured on three ranks: 120 -> 64 -> 50 -> served.

THE FLOOR CLEARS, and that was a review condition rather than an afterthought.
record_return_trip pops the rid's floor as soon as a decision comes back with no
shortfall anywhere in the chain; a rid with no retraction history is not
constrained by the guard at all. A pin that survived its request would poison
that rid's reuse for the rest of the process -- a silent performance defect
traded for a loud hang, which is not an improvement.

SHAPE INVARIANT HELD. Clamping prefix_len down raises extend_len by the same
amount, so prefix_len + extend_len is unchanged. The degrade therefore cannot
desync extend_num_tokens across stages and corrupt the crossing -- the failure
mode that made a bare forwarded integer unsafe in the first place.

CORRECTNESS PRECONDITION FOR WIRING, stated here so it cannot be missed: the
floor clears ONLY via record_return_trip, and that return path is deliberately
not wired yet. Wiring sgl-project#791 without it leaks a floor per rid and poisons reuse
permanently. The return path is not an optional part of the integration
package; the guard is not correct without it.

TESTS. test_pp_admission_retry_livelock_630.py: the loop is reproduced ACROSS
TWO CYCLES without the guard (told=120, observed=64, retracted both times) and
served in cycle 2 with it -- the red asserts the LOOP, not a single exclusion,
which is the only way to fail if the fix merely terminated one pass.

Verified in one run over nine suites, 187 passed: 791, 630, 789, 787, 757, 788,
633, phase_policy and phase_flip_runtime. The suite list is deliberately wider
than the change -- a verification list scoped to the defect at hand is what let
a merge regression through earlier today.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 20, 2026
…n, instead of re-deriving it per rank

This wires the decision model (sgl-project#791), its congruence guard (sgl-project#630) and the
readiness contract (sgl-project#789) together. None of them changed behaviour until now;
each was landed standalone and green.

THE DEFECT. PP ranks were N independent schedulers agreeing only by
determinism. The request is chain-forwarded to every stage unconditionally
(scheduler_pp_mixin.py:1069-1074), but each stage re-derived admission from its
OWN queue and radix state (_get_new_batch_prefill_raw, scheduler.py:6377, first
gate :6414-6417), while the proxy send is gated on that rank's own cur_batch
(:488-501). So a rank that declined forwarded the request and could never send
the proxy its downstream was blocking on. Measured twice, deterministically, on
the first radix-carrying request after health: the last rank held a
ScheduleBatch on its slot while both upstreams sat idle with cur_batch=None.
The #616g uniformity floors that would have kept them aligned are scoped to
tp_cpu_group, which has ONE member on every rank of a TP=1/PP=3 boot
(scheduler.py:4693-4703), so all three were off.

WHAT NOW HAPPENS. Rank 0 -- already the sole tokenizer-receipt point
(request_receiver.py:143,197-219) -- builds the decision once per admission
pass, with the congruence guard clamping the told prefix length to any learned
floor. The decision travels as its own typed-channel kind
"admission_decision": an ordered list of (rid, prefix_len, extend_len,
admitted). Downstream ranks consume it instead of re-deriving.

LENGTHS TRAVEL, POINTERS NEVER DO. prefix_indices are slot pointers into the
deciding rank's own pool and are meaningless off-rank, so each receiver
resolves the told length against its OWN radix tree. A receiver that cannot
honour it excludes that request, logs one warning naming rank/rid/told/local,
and leaves its siblings untouched -- it does not raise. That path is the
ordinary cache-hit shape on this rig, and raising there would have traded a
silent wedge for a crash on every cache hit.

THE RETURN TRIP IS PART OF CORRECTNESS, not an extra. The chain-reconciled
decision flows back to rank 0 (scheduler_pp_mixin.py:721) so the guard learns
the observed coverage and, on a clean pass, CLEARS the rid's floor. Wiring the
decision without it would leak a floor per rid and poison that request's reuse
for the life of the process.

ORDERING: sgl-project#791's degrade runs before sgl-project#789's contract can fire. The contract is
the backstop for a genuine protocol violation; the ordinary divergence must
never reach it. On a healthy boot its raise path stays unfired, and that is a
success criterion of the next instrumented boot rather than an assumption.

CONSTRAINTS HELD, CHECKED AGAINST THE DIFF RATHER THAN INTENDED:
- No collective on the admission path. scheduler.py:6405-6407 documents a
  2026-08-17 deadlock of exactly that family and warns against it verbatim;
  the diff introduces no all_reduce, all_gather, barrier or broadcast.
- No device tensor reaches a logging argument (sgl-project#790).
- pp_size == 1 is byte-identical: the guard is None below pp_size 2
  (scheduler.py:1577).

NOT DONE, DELIBERATELY: the two disaggregation PP loops (:618, :765) are
untouched and still carry the original chain-flush hazard; the readiness
contract does not cover them either, since it lives in the proxy receive path
they do not use. That remains its own open item.

Verified in ONE run over ten files, 190 passed against a 187 baseline -- the
delta is exactly the new integration cases. The suite list is deliberately
wider than the change: a verification list scoped to the change at hand is what
let a merge regression through earlier today.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 21, 2026
… the message actually reaches the peer

`_pp_send_admission_decision` called `_pp_send_dict_to_next_stage(...,
async_send=True)` and discarded the returned `P2PWork` list. It was the only
async channel in `_event_loop_pp_body` that did so: `send_req_work`,
`send_proxy_work` and `send_output_work` are all held on the scheduler and
committed later. The decision dict carries no tensors, so it travels entirely
as metadata, whose backing `header` / `object_tensor` buffers are owned by
nothing except those discarded handles. A gloo isend whose work handle and
buffers go out of scope is aborted on destruction rather than delivered, so
the downstream rank's blocking receive waits for ever on a message that was
never on the wire.

That is what wedged six consecutive boots of the gapped TP=1/PP=3 shape on
2026-08-20, all with the same py-spy signature: PP0 in the request-chain
flush, one pass AHEAD, with PP1 and PP2 both in this channel's receive. Three
successive commits re-ordered this send (f31fd5e, 927324c, a996a65);
each fixed a real defect and none saved a boot, because the ordering of a
message that does not exist cannot matter.

Two changes, and the second is what makes the first safe to wait on:

- The handles are retained in `self._pp_admission_send_work` and reaped by a
  new `_pp_commit_admission_send_work`, called once per iteration
  immediately BEFORE `_pp_commit_pending_req_work`. That order is the
  strictly weaker wait first: this one is satisfied as soon as the next rank
  reaches its decision receive at the top of the same pass, while the chain
  flush is not satisfied until that rank reaches the top of the NEXT pass. A
  wait already implied by one placed after it cannot be the wait that closes
  a cycle.

- The last rank no longer emits the ring wraparound. PP0 was never required
  to receive it: it only PEEKS the typed inbox, which is filled solely as a
  side effect of the per-iteration output receive, and that receive
  early-returns whenever the slot is empty -- every idle pass. So the
  wraparound was one unmatched message per pass, the same corpse
  `_pp_send_dict_to_next_stage` already refuses for the proxy under a gapped
  wire. Consequence, stated plainly: `record_return_trip` no longer runs.
  It was never load-bearing for termination -- sgl-project#630's retry livelock
  terminates on the floor learned from the retraction, which is rid-keyed
  and dies with its request -- it only cleared that floor early. The residual
  cost is that one request's reuse stays suppressed for the rest of its life.

Tests:
- New test_pp_admission_send_handle_dropped_796.py: 5 passed, three
  consecutive runs. Its red arm drives the in-tree sgl-project#795 ring over a
  handle-dropping transport and requires the six-boot signature back
  (PP0 in the chain flush, ahead of PP1/PP2 in the decision receive).
- Two harness traps are documented in that file because both produced false
  greens here: sgl-project#795's `_RingWire` keeps every handle alive in `_inflight`, a
  lifetime guarantee production did not have; and a patch applied inside a
  test method never reaches `spawn`ed children, so it must be applied in the
  child.
- test_pp_admission_chain_flush_deadlock_795.py: 4 passed, no regression.
- Full test/registered/unit/managers: 2739 passed, 18 skipped, 305 subtests
  passed, 47 failed. All 47 are in test_pp_proxy_stamp_631.py,
  test_pp_slot_last_batch_631.py and test_vacuous_decode_exit_730.py, which
  were measured at HEAD without this change and fail identically there
  (18 failed / 12 passed in isolation, both with and without the change) --
  baselined against this branch rather than assumed pre-existing.
- ruff: one pre-existing F841 at scheduler_pp_mixin.py:1325, untouched code.
  codespell clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 21, 2026
… it with a void

Boot instr11 wedged 4m18s into a flip drive: GPU util 0/0/0, log growth 846 B in 8 s, eight
requests in flight and never served. py-spy on all three ranks gave a three-way ring:

  PP0  _event_loop_pp_body:779 -> ... -> _pp_recv_dict_from_prev_stage:3865 -> BLOCKING recv
  PP1  _event_loop_pp_body:603 -> pp_chain_receiver.recv:329
  PP2  _event_loop_pp_body:603 -> pp_chain_receiver._advance:218

ROOT. A sgl-project#791 downstream retraction desynchronises the output ring, because the ring's two
gates read two DIFFERENT ranks' mbs. reconcile_pp_admission_decision
(pp_admission_congruence.py:462-483) amends the decision for every remaining DOWNSTREAM rank,
and PP0 is upstream of every rank that can retract. The boot's last four admission passes,
three passes after a tp_to_pp cutover, show it exactly:

  PP0  sgl-project#788 verdict=ADMIT n_reqs=1 rids=2f5e25a1... prefix_lens=512
  PP1  sgl-project#791 unhonourable prefix on rank 1: rid=2f5e25a1... told=512 local=0
  PP1  sgl-project#788 verdict=DECLINE n_reqs=0
  PP2  sgl-project#788 verdict=DECLINE n_reqs=0

PP0 kept the microbatch and launched it; the downstreams had nothing for it. Last rank's send
gate (:4101) reads its own empty slot and sends nothing; PP0's receive gate (:4306) reads its
own occupied slot and blocks (:4315). _pp_output_exchange_due (:328) made the two the same
EXPRESSION (sgl-project#753) but cannot make them the same FACT. PP0 never reaches the top of its next
pass, so the pass-N+1 chain send is never posted and both downstreams block.

The idle tail is load-bearing: a skipped send mid-burst is only a lag, since the pair is FIFO.
It becomes a DEFICIT exactly when the pipeline goes quiet behind the retraction, which is what
the log shows -- DECLINE, DECLINE, silence.

sgl-project#796 IS NOT THE CAUSE, and this retires that hypothesis. The wraparound it removed is an
ADMISSION_DECISION_KIND message, and recv_typed_tensor_dict (pp_typed_channel.py:136-145)
returns only on expected_kind, stashing everything else. No wraparound could ever have released
an expected_kind="output" receive, before or after sgl-project#796. Pinned by
test_wraparound_kind_cannot_satisfy_an_output_receive. Restoring it would have put one
unmatched message per pass back on the channel and unwedged nothing.

FIX, following sgl-project#791's own law (decide on rank 0, carry the decision) rather than a timeout.
_PP_OUTPUT_EXPECTED_KEY (:136) rides on the admission decision that already travels 0->1->...
->last in the SAME pass; PP0 publishes _pp_output_exchange_due(self.mbs[mb_id]), the identical
expression on the identical object its own _do_recv will apply, and middle ranks forward it
verbatim. The last rank (:4128) sends a void (_pp_void_output_payload, :4148) only for a slot
PP0's own published verdict obliges it to receive -- so this is not the bounded-recv corpse in
reverse. PP0 absorbs it (:4315, _pp_absorb_void_output, :4171), empties the slot so the loop's
None guard holds, releases each request through the existing idempotent
_release_dynamic_chunk_probe and re-queues it, and feeds record_return_trip from the
chain-reconciled decision riding back inside the void.

That last part also repairs collateral damage from sgl-project#796: record_return_trip
(pp_admission_congruence.py:276) was fed ONLY by the wraparound, so since sgl-project#796 _learned_floor
was never populated and prefix_len_for never clamped -- sgl-project#630's termination argument had no
feeder at all. It does again, without an unmatched message.

Absent key => False => no void => byte-identical to today, so stand-ins and pp_size<=1 are
unchanged.

TESTS. test/registered/unit/managers/test_pp_output_ring_retraction_wedge_791b.py, three live
spawned processes, real gloo, the shipped functions:
  test_retraction_wedges_the_ring_without_the_fix     (can-fail: neuters ONLY the fix IN THE
      CHILD and reproduces the specimen -- 3/3 ranks stuck, downstreams ahead of the rank they
      block on, the inverted stagger)
  test_ring_survives_the_retraction_with_the_fix      (12/12 passes, 1 void absorbed on PP0,
      1 request re-queued, 0 voids on PP1/PP2)
  test_void_payload_is_only_sent_when_the_first_rank_expects_one
  test_wraparound_kind_cannot_satisfy_an_output_receive
  -> 4 passed, three consecutive runs (40.95 / 39.57 / 38.44 s)
Neighbours (795, 796) -> 13 passed. Wider mixin set -> 19 failed / 176 passed, IDENTICAL at
HEAD (patch removed, re-run, re-applied); all 22 are _RingWire/_Group stand-ins missing
is_first_rank/is_last_rank, i.e. sgl-project#796's own gate. codespell clean; the one ruff F841 at
scheduler_pp_mixin.py:1395 is pre-existing and untouched.

KNOWN GAP, filed rather than folded in: a PARTIAL retraction (one rid of several) keeps the
ring matched, so PP0 processes a real output for a batch containing requests the downstream
never ran -- a membership divergence with no wedge and no error. Same root asymmetry, different
defect.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 22, 2026
…cision names

boot_798_0822_0829 never served a request: 0 decode batches, 0 throughput
lines, 8 requests submitted and 0 answered, health 200 throughout, 5219 void
lines in 13 minutes.

Its shape, from the log rather than from reasoning. TWO rids, not one.
rid=f6116ba2 progressed (told=98304 local=90112, then told=100203
local=98304) and left. rid=48abbc0e reported told=98304 local=0 for 2212
consecutive events and never moved. Every own-void released "0 of 1 request",
2210 times, so the batch member was always KEPT by pp_void_keeps_request and
never re-queued -- never re-entering waiting_queue, the one place the
reconcile's radix lookup would have found it. The voids alternate between
slots without a single exception: 2, 0, 2, 0. The defensive
self.chunked_req = None branch fired zero times.

_pp_reconcile_incoming_admission answers "how much of this rid has THIS rank
computed" from the single scheduler-wide self.chunked_req, but
_pp_void_own_batch restores that field PER SLOT from
_pp_chunked_req_before_by_slot[mb_id]. With more than one microbatch slot in
flight the value standing there belongs to whichever slot wrote it last, not
to the slot whose decision is being reconciled. The miss then defaults to 0
and is consumed as a MEASUREMENT, so the pass is retracted and voided, and
the void restores the other slot's snapshot -- which re-arms the next one.
That is the whole loop.

The slot was never missing, only unread: PPAdmissionDecision.mb_id has been on
the wire since sgl-project#791 and documents itself as "one PP microbatch slot". Consult
_pp_chunked_req_before_by_slot at exactly that index, after the shipped
self.chunked_req lookup and before the default of 0.

ONLY THE NAMED SLOT MAY ANSWER. Scanning the ring for a matching rid would be
the same defect with a wider blast radius -- answering a question about slot 2
with slot 0's progress -- so pp_chunked_req_for_slot indexes and does not
search. It is a module-level function beside pp_chunked_local_match and
pp_void_keeps_request, resolved through this module's globals at call time,
because a mixin method would have to be bound by every existing holder and
could not be neutered on its own; the first draft was a method and broke four
#797c fixtures with an AttributeError on the admission path.

This is #797c one level up. #797c fixed the "dropped out of waiting_queue,
lives in chunked_req" miss, which is why the specimen's single-slot rid
progressed. It did not make the lookup slot-aware, which is why the two-slot
rid could not.

Tests: test_pp_reconcile_slot_blind_798.py, 12 cases, verified RED first --
the livelock reproduces hermetically as observed_local=0 for a rank holding
98304 tokens, and as a genuine 94208-token shortfall reported to sgl-project#630's guard
as 0. Includes a dying mutant for the new call edge (blinding
pp_chunked_req_for_slot brings the livelock back) plus a companion proving
#797c's lookup survives that same neuter, so a single proof cannot conflate
the two edges. Guard-still-fires cases cover absent-everywhere, short match,
and wrong-slot-holds-it.

Regression: registered managers -k pp_, baseline 16 failed / 281 passed
against 16 failed / 293 passed after, with byte-identical failing test IDs.
The 16 are pre-existing. Both ruff findings on this file are pre-existing and
outside this change.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 23, 2026
… stub

These 7 tests had been red on an AttributeError: the loop under test asks
`not self.pp_group.is_first_rank` (scheduler_pp_mixin.py:1343) and the
test-local `_Group` stub carried `is_last_rank = True` and nothing else.

THE CHEAP REPAIR IS THE TRAP. Adding `is_first_rank = True` beside it turns
all 7 green immediately -- and makes this rank the FIRST and the LAST stage
of a three-stage pipeline at once, which no rank of a pp_size=3 ring can
be. Every branch keyed on either role would then take the wrong arm while
the suite reported green. That is the sgl-project#630 lesson exactly: an unfaithful
stub does not merely fail to catch a defect, it encodes the defect's
assumption and then certifies it.

So the stub now carries a REAL position in a REAL ring. `_Group(rank,
pp_size)` derives both roles from that position, and rank 2 is the default
because that is what the old lone `is_last_rank = True` was reaching for:
the last stage, which skips the proxy-send block that is not under test.
The difference is that it is now last WITHOUT also claiming to be first, so
the admission-decision branch takes the arm a real last rank takes. The
collaborators on that arm are stubbed to the cheapest thing that keeps the
control flow real -- they are not the subject; the loop CONTROL is, and it
still comes unbound off the mixin.

`assert_faithful_pp_roles` makes the forbidden combination loud rather than
silent, and `_Rank` runs it on construction.

THE RED-FIRST LOGIC IS INVERTED HERE, and that is the honest shape for a
repair to a suite that was already red. The proof is in two directions:

  * the 7 tests go GREEN with the faithful stub (18 passed total);
  * a PLANTED first==last stub goes RED -- 16 of 18 fail. That is the
    can-fail, and it is what stops the cheap repair being reintroduced.

Four new tests carry that second direction, including one that is easy to
forget: `test_the_faithful_role_is_load_bearing_not_decorative` asserts the
non-first admission arm is ACTUALLY entered. Without it the added stubs
could be dead code and "faithful" would be doing no work -- the suite would
be green because the branch was never reached, which is the state it was in
before, only quieter.

TESTS (hermetic, CVD="", CPU only, no CUDA, no distributed)
  test_pp_flip_slot_hold_631.py 18 passed (was 7 failed / 7 passed).
  Mutant killed: `is_first_rank` forced True -> 16 failed.

  Battery re-measured under /spinning/htsglang-gpu/.venv (datasets 5.0.0,
  full collection), over the 7 files that carried every failure:
    base 500be7e            22 failed / 35 passed
    HEAD before this commit    22 failed / 35 passed
    HEAD with this commit      15 failed / 46 passed
  -7, exactly the tests repaired here, and this branch still adds none.

  Of the 15 remaining, 3 (test_pp_slot_last_batch_631) are an artefact of
  this branch's base being pre-sgl-project#815: fix/815-rest-stubdrift landed on the
  line at 4f2072a, while base 500be7e sits on the earlier ancestor
  21ff075. They disappear when this stage merges onto the line.

No boot was run. This is desk work.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 23, 2026
…e stub) into integ/808-739-810

Wave 3, stage 3b. One commit, test-only, a strict descendant of stage 3's head
ceb79d6:

  43afb4e  [sgl-project#791] A faithful PP-role stub for the slot-hold suite

WHY THIS IS ITS OWN STAGE. It touches exactly one file
(test_pp_flip_slot_hold_631.py, +195/-2) and no production source at all, so
stage 3's gate against ceb79d6 still certifies the code this tree carries
and did not need re-running. Keeping the two apart also keeps the attribution
readable: stage 3 is the ring-recovery fix, this is the test debt it happened
to arrive with.

WHAT IT CLOSES. These are the seven failures this train carried as its ENTIRE
baseline -- the line's failure set has been exactly
test_pp_flip_slot_hold_631.py's seven cases since fix/815 landed, and strand
17b, 17c and this strand each declined the cheap repair in turn. The cheap
repair was to add `is_first_rank = True` beside `is_last_rank = True`, which
makes one rank simultaneously the first and the last stage of a three-stage
ring: an object no production code can ever meet, which is the sgl-project#630 lesson
(an unfaithful stub does not merely fail to catch the defect, it ENCODES the
defect's assumption and then certifies it).

The faithful repair gives the stub a POSITION instead of two booleans:
`_Group(rank=2, pp_size=3)` is the last stage WITHOUT also claiming to be the
first, so `_event_loop_pp_body`'s admission-decision branch takes the arm a
real last rank takes rather than raising AttributeError on a missing
attribute. The cost predicted when this was deferred was real and has been
paid rather than dodged -- reaching that branch pulls the admission-receive
path in with it.

The part worth reusing is `assert_faithful_pp_roles`: it makes the FORBIDDEN
combination loud, raising when `is_first_rank` and `is_last_rank` are both
true at `pp_size > 1`, so the shortcut cannot be reintroduced silently by a
later edit. That is a guard rather than a comment asking the next author not
to write it.

The falsifier is INVERTED and runs in both directions, which is what makes
this a proof rather than a green suite: 18 passed with the faithful stub, and
planting `first == last` turns 16 of those 18 red.

GATE. Battery test/registered/unit/{managers,planner,server_args,mem_cache},
hermetic under CUDA_VISIBLE_DEVICES="", one battery at a time.

    baseline (tip 4f2072a)   7 failed, 8585 passed, 1852 skipped, 887 s
    stage 1 (W1+W2)             7 failed, 8638 passed, 1852 skipped, 868 s
    stage 2 (W3)                7 failed, 8653 passed, 1852 skipped, 922 s
    stage 3 (W4a/W5/W4b)        7 failed, 8673 passed, 1852 skipped, 915 s
    this stage                  0 failed, 8684 passed, 1852 skipped, 900 s
    NEW failure ids             NONE
    fixed vs baseline           7  (all of them)

THE BATTERY IS NOW FULLY GREEN. The extracted failure list is EMPTY, not
merely short: the seven that were the line's entire baseline are gone and
nothing took their place. That changes what every later gate on this branch
means -- with a zero baseline, "0 new failure ids" stops being a comparison
against a tolerated set and becomes binary, so stages W6 and W7 are gated
against a clean tree rather than against a list of exceptions.

The skipped count is unchanged at 1852 across all five runs of this train, so
nothing was turned green by being skipped.

CATALOG UPDATED IN THE SAME COMMIT, because the entry this change falsifies is
one this strand wrote three commits ago. The section 12 stub-drift family said
the seven cases were "left RED ON PURPOSE, awaiting a sgl-project#791-shaped rewrite".
sgl-project#791 has now done the rewrite, so the entry says what happened instead of
what was expected -- the maxim it was holding the place for is kept, and the
repair is recorded under it with its inverted falsifier. Leaving a catalog
claim standing after the code has moved is the drift this file's own header
rule exists to prevent. codespell clean.

No boot.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 23, 2026
Wave 3, stage 5 -- the LAST stage of the batched-window tree. WINDOW-QUEUE
ticket W7 (strand 21a, preflight_pass=Y: 7 passed with 4 red-first, 3/3
mutants killed, and the 17 pre-existing sgl-project#630 tests unchanged).

One commit, base 2efb933:

  3f16e8e  [sgl-project#829] The HiCache deadline must not close a pair healthy peers
              are using

THE DEFECT. `bounded_wait` enforced its deadline by passing a timeout INTO the
gloo work itself -- `work.wait(timeout=)`, introduced by sgl-project#630 -- and on a
shared gloo pair that does not merely abandon one wait, it POISONS the pair
for every peer still using it. The production string
"Application timeout caused pair closure" was reproduced red-first in a real
two-process gloo run and reads PAIR_SURVIVED on the fix. The deadline now
lives in `ParkedWait.join`, off the work: the wait is abandoned by the CALLER
while the underlying `Work` stays parked, so nothing is torn out from under a
healthy peer.

NO CROSS-SURFACE, computed rather than hoped. The only file this shares with
the rest of wave 3 is mem_cache/hicache_collective.py, and the +119 that stage
3 put there comes from commit 2efb933 -- which is precisely W7's own base.
So W7 already contains that change and there is nothing to reconcile; its
other two files are new and under mem_cache, disjoint from W5/W4b's files.

sgl-project#734's DISCRIMINATOR IS PRESERVED, and this was checked rather than assumed
because it is the exact thing strand 17c's 622 falsification turned on: the
`waited < timeout_s * 0.95` branch that distinguishes a dead peer from a slow
one is still in `bounded_wait` after this change. W7 moves WHERE the deadline
is enforced; it does not move the threshold.

That also makes this gate non-vacuous in the way that matters here.
`test_pp_sync_rendezvous_630.py` -- the suite that went red under the 622 merge
for precisely this threshold, and the reason 622 is still off the line -- sits
INSIDE the battery and is green on this stage.

KNOWN FOLLOW-UP, NOT CARRIED HERE. Strand 21c has since measured that the
0.95 comparison is REDUNDANT under this very ParkedWait design -- a real
expiry takes the not-completed path 4 out of 4 times, and any RuntimeError
reaching that `except` already means transport death -- while the comparison
leaves a BLIND BAND over the last 5% of the bound, where a peer death is
labelled a timeout (30 s at the 600 s default). An amendment is being built
(delete the comparison, make the except an unconditional transport error, and
guard at construction that the process-group timeout exceeds the bound).

That amendment is NOT in this tree. It did not exist when this stage's battery
started, and per standing instruction the window tree does not wait for it --
it lands in the next round as its own stage. This paragraph exists so the next
reader does not re-derive the finding or mistake the preserved comparison
above for a settled decision: it is preserved here because THIS commit does not
touch it, not because it is known to be right.

A related thread for whoever owns the 622 posten, explicitly UNMEASURED and
not a claim of this merge: 17c established that 622 reddens sgl-project#630 by SHIFTING
gloo timing until the 0.95 branch flips, and left open why the timing shifts.
This change removes `work.wait(timeout=)`, one mechanism by which a wait on a
shared pair can perturb its peers. Whether that is upstream of what 622
perturbs is unmeasured here and is not asserted.

GATE. Battery test/registered/unit/{managers,planner,server_args,mem_cache},
hermetic under CUDA_VISIBLE_DEVICES="", one battery at a time, against a ZERO
baseline since stage 3b.

    baseline (tip 4f2072a)   7 failed, 8585 passed, 1852 skipped, 887 s
    stage 1 (W1+W2)             7 failed, 8638 passed, 1852 skipped, 868 s
    stage 2 (W3)                7 failed, 8653 passed, 1852 skipped, 922 s
    stage 3 (W4a/W5/W4b)        7 failed, 8673 passed, 1852 skipped, 915 s
    stage 3b (sgl-project#791 stub)        0 failed, 8684 passed, 1852 skipped, 900 s
    stage 4 (W6)                0 failed, 8703 passed, 1852 skipped, 931 s
    this stage                  0 failed, 8710 passed, 1852 skipped, 912 s
    NEW failure ids             NONE

The +7 is this stage's own suite, matching its ticket exactly. The skipped
count is 1852 in all seven runs of this train, so nothing went green by being
skipped.

The sgl-project#630 check above was verified rather than inferred from the overall zero:
test_pp_sync_rendezvous_630.py sits under test/registered/unit/mem_cache, i.e.
inside the battery, and run standalone on this stage it is 3 passed --
including test_a_dead_peer_still_raises_a_named_bounded_error, the exact case
that reddened under the 622 merge.

Its new suite, test_bounded_wait_pair_survives_829.py, lands under
test/registered/unit/mem_cache and is therefore inside the battery and
actually collected.

WINDOW SCOPE, so the window reader does not expect what cannot appear: W7's
effect is only OBSERVABLE with PP>1 and a storage-backed HiCache. On a boot
without both, a green W7 criterion would be vacuous rather than passing.

No boot. This completes the tree; W9 is a separate stage after the push.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 24, 2026
…ath, and name where the leg's time goes

CLOSES A GAP I FILED AGAINST MYSELF. `_timed_arena_refill` discarded the
`RotationStats` it got back, so on metal `overlapped_steps` -- the duplex
falsifier this whole scheme rests on -- was NOT OBSERVABLE for a warm flip. W28
could therefore score it only as NO DATA. Both the stats line and a phase line
are now logged per flip leg.

THE SECOND HALF IS THE HONEST ONE. W28's leg reported

    LINK-BOUND (read 0.000s / h2d-wait 0.114s over 512 chunk(s), drain 0.001s)

on a 4.833 s rotation. Those terms are 2.4 % of it. The phrase named a bound
nobody had observed -- one number wearing several meanings, inside the dominant
term of the seam, which is the class sgl-project#851 exists to remove.

`RotationPhases` splits the leg into save / d2h-issue / h2d-issue / wait / ring
/ checksum / plan and, crucially, a NAMED `UNACCOUNTED` residual, so the
unexplained mass has to land somewhere instead of being distributed over the
parts that happen to be measured. `dominant()` lets the residual COMPETE with
the real phases: if the leftover is the biggest term, the instrument says it
does not know rather than crowning the largest thing it can see.
`phases_reconcile` refuses a leg leaving more than 10 % unexplained -- chosen,
not derived, and chosen so that W28's own 97.6 % could not have passed it.

HOST-SIDE PHASES ARE WHAT RECONCILE, and that follows from the measurement, not
from taste: `h2d_wait_s` was near zero, so the host was never blocked on the
device, so whatever consumed the wall clock was work the host thread did
itself. Device spans answer a different question and are deliberately excluded
from the sum -- adding a device span to a host total is how a reconciliation is
made to "pass" without meaning anything.

A CPU replay puts `d2h_issue` on top. That is a LEAD, not a finding, and it is
labelled as one: on CPU those copies are eager by construction.

DEFERRED BY USER DECISION (2026-08-24): ~4 s per flip is acceptable for now, so
the 4 s -> 1-2 s hunt is filed as W30 rather than chased here. What W30 still
needs is written into the ticket: CUDA-event device spans (staggered read after
the drain, never sync-in-loop) and the two can-fail mutants.

ALSO FIXED, and it was mine from the previous slice: the sgl-project#758 emitter test
replaced `rotation_executor.rotate_arena` and never restored it, so a green
file made the scheduler suite fail behind it. setUp/tearDown now restore it.
`Tuple` was used unimported (masked at runtime by `from __future__ import
annotations`, caught by ruff).

W29 IS TURNKEY, and the runnable path is the point of this slice:
  * /spinning/gpu-arb/w29_load.sh -- ALTERNATES concurrent large-prompt BURSTS
    with low-concurrency decode HOLDS. W28's driver was serial deep decode, which
    builds no prefill backlog at all, so the policy went TP-sticky after one
    flip; the user caught that from the outside. Bursts aim well above the bar.
  * /spinning/gpu-arb/boot_w29.sh -- the sgl-project#630 PP x disk-HiCache warmup wedge is
    AVOIDED with `--skip-server-warmup`, and the alternative is named and
    rejected: dropping `--hicache-storage-backend file` would delete the
    geometry-free disk STORE that is a prefix's only route across the flip
    (sgl-project#706), i.e. the premise of the no-KV design.
  * BREAK-EVEN REPRICED FROM THE MEASURED SEAM. N ~= 2188 tokens per second of
    seam (18614/8.50 = 2190 and 39500/18.06 = 2187 agree). The measured flip is
    6.410 s slowest rank, round trip 12.82 s -> N ~= 28,050, not ~39,500. The
    bar is ~29 % LOWER, so the policy should flip MORE readily. Derived by
    proportion from the two known pairs, said plainly so it is not mistaken for
    a first-principles repricing.

GATE (foreground, family-batched):
  model_executor    15 failed / 803 passed -- the same three pre-existing sgl-project#815
                    files, ZERO new
  managers (chunked) 3184 passed; 1 failure + 1 collect error, both identical
                    at HEAD
  mem_cache (chunked) 7f+474p / 24f+1192p -- byte-identical to HEAD
  scheduler test_phase_flip_boot 31 passed; rotation suites 95 passed combined
ruff F/E7/E9 clean on the changed files; format clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 26, 2026
…the refusal's false leg

User order: fix sgl-project#875, do not merely refuse it. The refusal in
`restore_seam_state` is correct -- it is the only thing between the tree and the
W40 IndexError one way and a silent wrong-layer write the other -- but its own
counter comment states the cost: every flip in that direction loses its
prefixes. This is the first axis of the answer, plus a correction that should
have come first.

THE REFUSAL'S JUSTIFICATION WAS PUT ON TRIAL AND ONE LEG DIED.
`check_cpu_copy_layers` claimed "the KV head sharding also differs between the
phases (PP holds all heads of its stage, TP a head shard of every layer), so
even the overlapping entries are not interchangeable". FALSE on this rig, read
in the code rather than assumed: under sgl-project#345 uneven-DCP replication the
full-attention cache is TOKEN-sharded and every rank stores the FULL replicated
kv-heads (model_runner_kv_cache_mixin.py:3155-3160; the boot line at :3228
prints `get_total_num_kv_heads()`), and the PP pool takes
`get_num_kv_heads(attn_tp_size)` with `attn_tp_size == 1` -- the same total.
Identical widths, interchangeable entries. That sentence was my own and it would
have stopped the next reader from looking; it is removed rather than softened.

THE SURVIVING LEG IS NARROWER THAN IT SOUNDED. A remap needs every layer the
destination holds and rank-locally under PP it cannot have them -- 8 of 16 on
this rig's `pp_attn_stage_ratio=[8,4,4]`. But the union over the three stages IS
every layer and PP holds all tokens, so the data exists on a peer. The honest
statement was never "a remap is impossible", it was "a RANK-LOCAL remap is
impossible, and nobody asked whether a collective one was available".

THREE AXES, NOT ONE -- the finding that decides the scope:
  LAYER  PP stage-sharded vs TP complete. BUILT HERE, both directions proven.
  HEAD   replicated in both phases. No remap needed. Settled above.
  TOKEN  PP holds every token at allocator slots; TP holds an owner-rule SUBSET
         at compacted rows, `(L // cp_S) * cp_ratio + (L % cp_S - cp_lo)`
         (layers/dcp/owner.py:159). A SECOND collective-shaped remap, NOT
         solved. I had not named this axis at all before this round.

SO THE CARRY IS NOT WIRED, AND THE REFUSAL STAYS. A layer-correct token-wrong
carry produces matching row ids at mismatched widths -- the exact shape sgl-project#719
already walked into. `seam_layer_carry.py` is a pure module with the collective
INJECTED by its caller: nothing in it communicates, because a collective on the
per-request restore path is the sgl-project#630 wedge shape and the place a real carry
belongs is the flip's own `pre_cutover_fns`, beside `gdn_state` and
`weights_refill`, where the group is already synchronised.

The refusal is annotated at both sites with what it is waiting for, so it reads
as a staged non-answer rather than as a verdict.

BOTH DIRECTIONS, SEPARATE FALSIFIERS, because they fail differently:
  PP -> TP  the loud arm. Asserted as a refusal that NAMES the missing global
            layers. One stage alone refuses; three stages together assemble all
            16 exactly; two of three refuses rather than restoring 12 right and
            4 stale.
  TP -> PP  the SILENT arm. No exception exists to assert on, so asserted on
            CONTENT: each destination slot must hold its own global layer, value
            by value, and all three stages together must tile the model exactly
            once. An exception-only test passes this arm by doing nothing.

CAN-FAIL, and the first mutant is the one that matters: replacing the carry with
the OLD naive positional prefix -- i.e. a no-op -- reds SEVEN tests across both
arms. Filling missing layers instead of refusing reds three. Ignoring
`start_layer` reds three. Dropping this rank's own copy from the union reds six.

Same-layout is deliberately NOT special-cased: a PP->PP or TP->TP restore goes
through the same path and comes out positionally identical, so the case that
already works anchors the case that did not.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 26, 2026
…NOT BUILD

The three questions, in the binding order, answered against the source.

Q1 -- DOES `req_to_token` IN THE TP PHASE HOLD ALL TOKENS OR ONLY THE OWNED
ONES? ALL of them, and the values are GLOBAL cache slots.
`dcp_weighted_read_slots` (layers/dcp/owner.py:440-465) states it in its own
docstring: it takes "a flat list of GLOBAL cache slots (typically the
``req_to_token`` rows of a paged read)" and RETURNS `(compact, owned)`. The
table is one row per request of width `max_context_len`
(memory_pool.py:373-375) -- global positions, identical on every rank. The owner
rule is applied DOWNSTREAM, in the attention backend. So owner.py:159 describes
the ASSIGNMENT and says nothing about what the table materialises, exactly as
the briefing suspected. The table materialises the global list.

Q2 -- HOW DOES THE SOURCE'S POSITIONAL ROW LIST MAP ONTO THE DESTINATION'S
COMPACTED ROWS? IT DOES NOT. No such function exists, and the absence is the
finding. The only global->compact mapping in the tree is the owner rule, and an
AST sweep of all of `srt/` finds its users are the attention backends and
nothing else.

CONSEQUENCE LARGER THAN THE CARRY, recorded but NOT claimed as a live defect.
`Req.load_kv_cache` (schedule_batch.py:1806) hands `req_to_token[..., :seqlen-1]`
-- global slots -- straight to `load_cpu_copy`, which indexes PHYSICAL rows.
`HybridLinearKVPool` forwards them untouched (it translates only the mamba ids,
and says so). Under PP `dcp_size == 1` and global == physical, so that path is
correct. Under TP with a weighted vector they diverge. Whether the path runs
there with uneven DCP active is a boot question and is not answered here; it is
recorded with its address as the next check. The contrast that shows the tree
knows this shape: `UnifiedSWAKVPool.get_cpu_copy` DOES translate, via
`_virt_tokens_to_phys_tokens` (unified_memory_pool.py:1232). One pool family
translates on this path and the other does not.

Q3 -- CAN THE TWO FOLD INTO ONE COLLECTIVE? YES, an all-to-all. Rank r holds
(its layers x ALL tokens); rank r' needs (ALL layers x its owned tokens); so r
sends r' exactly the block (L_r x T_r') -- a distinct block per peer, which is
the definition. One collective, not a gather followed by a scatter.

VERDICT: DO NOT BUILD, taking the stop criterion that permits it.
  payload   16 layers x 13 rows x ~2 KiB per layer-token = ~416 KiB for the
            whole group at specimen scale.
  transport no P2P, no NVLink, all PHB. The tree's own number for this
            interconnect (sgl-project#656): 43.9 KiB per crossing, 166 us enqueue,
            1777-9201 us receive. Latency-bound at this size.
  refusal   recompute `extent` tokens of prefill; 13 tokens is sub-millisecond.
A new all-to-all inside the cutover's no-return region would cost milliseconds
to save microseconds, and would put a collective in the one region where a
collective is the sgl-project#630 wedge shape. Unbounded risk against a benefit bounded by
`extent`.

FALSIFIABLE RATHER THAN FINAL: `extent` is `seqlen - 1`, so 13 is a property of
the specimen's short request, not of the mechanism. Payload is linear in extent
while the collective is latency-dominated, so a break-even exists somewhere in
the hundreds-to-thousands of tokens. What would settle it is the DISTRIBUTION of
`extent` over requests actually retracted at a flip. I do not have it and am not
entitled to infer it from any record, in either direction.

CONSEQUENTLY the pre_cutover_fns legality question is NOT answered here. It sits
downstream of a decision that removed it, and inheriting "gdn_state and
weights_refill already live there" was never a proof anyway. If the extent
distribution ever reopens the carry, that check is the next gate and it must be
done against the abandon and quorum paths, not by analogy.

CAN-FAIL: giving the seam path a global->compact translation reds both sweep
tests -- so the absence is observed, not merely stated.

THE SWEEP HAD TO BE AST AND WAS CAUGHT BEING TEXT. `managers/prefetch_ballot.py`
names `dcp_weighted_read_slots` in a docstring about an unrelated extraction and
a substring match reported it as a caller. That is the THIRD time on this branch
that a name in prose was mistaken for a use -- the 4 KiB threshold, then
`outgoing_bytes=0` in its own docstring, now this -- so the sweep carries its own
control asserting that a mention is not a use.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 26, 2026
… my 18 commits: two claims withdrawn

The sweep I named and had not run. Every citation of a log string or a borrowed
measurement across all 18 commits on this branch, checked against THE source it
cites -- not against any source. 31 citations, four states.

BELEGT -- 27. Everything drawn from
/spinning/evidence-665-f1/boot_w40_857strict_0826_0516.log verifies literally in
that file: the three segment times, the 75 % worst-share, `save 4.342`,
`gpu-span d2h 0.000s / h2d 0.000s` (21x), `checksum 0.319`,
`gdn_state->refill_highwater` 0.2 and 7.0, `weights_refill->cutover` 113.5 and
972.1, the 498/268 aliasing counts, `REFILL pp_to_tp took 3.961 s for 8573.8
MiB`, `pp_attn_stage_ratio=[8, 4, 4]`, `disaggregation_mode='null'`,
`rank_tp_ratio=None`, `uneven_token_vector='29,19,16'`, and the W40 specimen
details I repeated from the briefing (05:20:50, the rid, the IndexError,
`SEAM RESTORE ATTEMPT`, `FLIP EXTENT PROBE`, `extent=13`,
`transfer_layer_num=32`). The log is present; source not missing.

NIE-GEDRUCKT, CLAIM ALSO FELL -- 1. "the boot line at :3228 prints
`get_total_num_kv_heads()`": zero occurrences. Already retracted in 19b8177;
the sentence it supported was false and the true one is restored.

NIE-GEDRUCKT, CLAIM SURVIVES -- 1. "24 s after health 200". The string
`health 200` never printed. The log says `"GET /health HTTP/1.1" 200 OK` at
05:20:26, and the crash is at 05:20:50: exactly 24 s. The claim is right to the
second; only my citation form was ungreppable, so anyone verifying it would have
found nothing. The two cases are kept apart because their consequences differ.

MISATTRIBUTED, AND MISREAD -- 1. I priced sgl-project#875's DO-NOT-BUILD verdict with
"43.9 KiB per crossing, 166 us enqueue, 1777-9201 us receive", attributed to
sgl-project#656. It is not in sgl-project#656. It is in 13c55d7 "[PP] sgl-project#201 slice 2: the stage
boundary across two rigs" -- CROSS-RIG, two nodes, a 40G line, a different model
(Qwen3.5-4B fp16), timing PP microbatch crossings and not an intra-node
collective. And its own text refuses my reading: "`recv` is BLOCKING, i.e. bubble
plus wire -- 9.2 ms on stage 1 is that stage waiting for stage 0, NOT the 40G
line". I used a pipeline bubble as transport latency, from the wrong ticket, for
the wrong link. WITHDRAWN, with no substitute: I have no measured local
collective figure.

QUELLE-FEHLT -- 1. "sgl-project#721's measured cgroup peak (111.3 of 118 GiB,
oom_kill=17)", used in sgl-project#877 and in sgl-project#878's headroom. `oom_kill=17` has NO in-tree
source, and the only `111.3` is `111.3%` in a benchmark table
(docs/dev/631/PROD_BRINGUP_BENCH.md) -- an unrelated percentage. It came from a
briefing and I repeated it as measured, twice. WITHDRAWN. This is the shape the
operator hit this morning with the retracted "1833/1833 records".

WHAT THE TWO WITHDRAWALS COST, stated rather than smoothed:
  * sgl-project#875's verdict loses its timing leg entirely. It now rests on two terms that
    need no transport number: the HEAD axis is LOSSY (PP 4 kv-heads per layer,
    TP 1), so PP->TP is not a remap until someone decides which heads survive
    and no such rule exists; and a new collective in the no-return region is the
    sgl-project#630 wedge shape, an unbounded risk. Point one alone is decisive. DO NOT
    BUILD stands, on better ground than it had.
  * sgl-project#878's headroom argument is re-grounded on a figure I took myself: this box
    reports 128711 MB total / 76971 MB free, so +96 MiB of pinned host image is
    negligible by four orders of magnitude, needing nobody's peak.
  * sgl-project#877's conclusion is untouched: N <= 72 rows of a per-LAYER temporary is
    kilobytes, and separately none of its six sites is constructed on this rig.

THE CLASS: a citation is evidence only for the claim it is attached to, in the
source it names. Three of the four defects here were true-sounding numbers from
the right neighbourhood -- a real measurement of a different link, a real
percentage read as gigabytes, a real code branch that never executes.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 26, 2026
…ation of it was wrong

Third judgement on this axis. I deleted the refusal's KV-head leg (25a667d),
restored it as true (19b8177), and now delete it again. Both phases hold 4
kv-heads per layer. The original deletion was right.

VERIFIED AT THE CODE, INDEPENDENTLY -- not taken on report, because two
judgements on this axis were already wrong today:
  * `parse_flip_vector` (phase_flip_boot.py:254) reads
    `server_args.phase_flip_tp_vector`, NOT `--rank-tp-ratio`. This boot:
    '32,16,16'.
  * `set_tp_partition_ratios(list(vec))` runs at phase_flip_boot.py:1428; the TP
    `TpModelWorker` is built at :1473. Install precedes construction, and
    nothing between them clears it.
  * so at TP-pool build time `get_tp_partition_ratios()` is [32,16,16], dcp_size
    is 3, `uneven_dcp_kv_replicated` is TRUE, the sgl-project#345 exception is taken and
    `_pool_kv_head_num` returns `get_total_num_kv_heads()` = 4.
  * PP builds earlier, when the only installer that has run is
    scheduler.py:12223 with `rank_tp_ratio=None` -- ratios ARE None there, and
    `max(1, 4 // 1)` = 4.
  * ONE LAYER THE HANDED-OVER CHAIN DID NOT TRACE, checked here:
    `get_tp_partition_ratios` reads a context-local overlay BEFORE the installed
    plan (distributed/utils.py:168). It is written only by the sgl-project#274 dual-group
    lane's scoped manager (:207), and `dual_group_lane=False` on this boot -- so
    that layer is inert and cannot shadow the plan. The chain survives my check;
    I found nothing that breaks it.

WHY I GOT IT WRONG THE SECOND TIME, and it is not carelessness:
`uneven_dcp_kv_replicated`'s docstring says "a `--rank-tp-ratio` base plan is
installed". It names a FLAG for a PROCESS state with TWO installers, and the
flip is the other one. Reading the docstring is sufficient to reach my wrong
conclusion. The root fix belongs on that docstring and is not mine.

CONSEQUENCE: the head axis needs NO remap, the carry needs TWO (layer, token),
and sgl-project#875's DO-NOT-BUILD verdict LOSES the argument I gave it last round. What
still carries it: the token axis is unsolved and rank-locally unavailable, and a
new collective in the cutover's no-return region is the sgl-project#630 wedge shape. The
transport-timing leg was already withdrawn in 237189f as misattributed. So the
verdict stands on the token axis and the no-return risk -- and it now rests on
less than it did, which is worth saying plainly.

TESTS: the four cases that pinned the WRONG arithmetic are replaced by five that
assert the CHAIN -- the installer's source, the install-before-construction
ORDER, the predicate's actual expression rather than its docstring's flag name,
the head counts on both sides, and the overlay's inertness. Asserting the flag
is what reproduced my error; asserting the order and the source is what makes
the answer stable.

CAN-FAIL: moving the install after the TP worker reds the order test; making the
flip read `rank_tp_ratio` reds the installer test. The first mutant initially
survived because I reinserted the install immediately BEFORE the worker line --
the order was never actually inverted. Fixed and re-run.

NOT AMENDED: 19b8177 is pushed. Third correction-by-follow-up on this branch,
same rule each time.

RESIDUAL, inherited and not resolved: the chain is closed by CODE ORDER, not by a
log line printing the ratios at pool-build time. A failed install between :1428
and :1473 would go undetected. No path to one is known.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 27, 2026
…stead of clobbering it

The re-issue this ticket asked for already existed. A cutover retracts every
resident; the retracted request is re-queued through _add_request_to_queue,
which calls _prefetch_kvcache, which re-runs prefetch_from_storage -- a fresh
radix walk under the CURRENT binding generation, allocating a fresh host span
from the currently bound pool. Building a second requeue path would have been
redundant machinery on top of a working one.

What did not exist was a guard on the registration. prefetch_from_storage ended
with an unconditional `self.ongoing_prefetch[req_id] = ...`, so when the
post-cutover registration arrived while the pre-cutover one was still ongoing,
the incumbent was overwritten outright: its host_indices were lost to every
owner (nothing else holds them) and its anchor_lock_params lock ref was never
decremented, leaving that node PROTECTED for good. The next cutover's
drop_prefix_tree_returning_rows then orphans exactly those device rows -- one
request's allocation per cutover, which is the sgl-project#938 forensic shape, and it needs
no in-flight write-through to explain it.

RETIRE, DO NOT REAP. Freeing the displaced span at the registration site is not
available: whether it is safe to release is answered by can_terminate_prefetch,
which checks pool_transfers_done and is COLLECTIVE, and
HiCacheController.terminate_prefetch is only mark_terminate() -- a flag, not a
join -- so the transfer thread may still be writing into that span (sgl-project#913 IMA
family). Running that collective there is not available either: whether a
clobber happens is RANK-LOCAL, and the site already sits inside the sgl-project#580
participation region. So the record is retired -- terminated, moved out of the
req_id slot, nothing freed -- and drain_retired_prefetch reaps it from the
per-round site, where collectives are legal.

That also DEFINES the ordering instead of leaving it to timing: the re-issue
owns the slot, so a late completion resolves through check_prefetch_progress to
the new record and cannot reach the displaced one, which is reachable only from
the reap. Neither insert nor free happens on a retired record anywhere else.

UNIFORMITY IS ENFORCED, NOT INFERRED. It is tempting to argue the retired list
is rank-uniform (retirement follows a registration that only happens under the
sgl-project#580 positive consensus), but this module refuses arguments of that shape
elsewhere -- _prefetch_done_for RAISES rather than assume a request is in the
replicated set -- and a wrong inference here hangs three ranks. Both halves are
enforced instead: candidates are taken in sorted req_id order (canonical, never
insertion order), and the ranks AGREE on the candidate before anyone reaps it,
via one all_reduce contributing [d, -d] under MIN so min(d) and max(d) arrive in
a single collective. Reaping proceeds only on min == max != 0. A rank that has
not retired it yet contributes 0, agreement fails, and the record waits a round.
A latecomer delays a reap; it never wedges one. The collective is UNCONDITIONAL
-- gating it on a non-empty local list would be the rank-local participation
predicate this whole design exists to avoid. Empty contributes zeros; the common
case is one two-element all_reduce per round. Not micro-optimised into an
existing round collective: correctness first, measure before optimising.

The re-fetch budget is a REPORT, not a gate (sgl-project#939 RE-FETCH BUDGET SPENT ...
recomputing). Refusing a re-issue would be a rank-local decision taken inside
the participation region, which is the one thing this path may not do; the line
exists so a cutover cadence faster than a fetch completes is named instead of
surfacing only as an unexplained cached=0.

Red-first, single process (13 behavioural + wiring pins): retire does not free,
the span returns to its MINTING pool and never to the bound one, the drain
empties the list with no further event from the request at all (otherwise this
trades a clobber for unbounded growth), a completion cannot touch a retired
record, and the registration retires before it assigns. Mutants killed: retire
frees immediately (5 red), the clobber restored (1 red).

MULTI-RANK, and I had this wrong first. I recorded "the agreement only bites
multi-rank, which a CPU test can't exercise" -- false, and the user caught it:
three gloo processes on localhost exercise it fine, as sgl-project#630/sgl-project#650/sgl-project#653/sgl-project#899
already do here. Only a SINGLE-PROCESS test cannot. The new gloo falsifier runs
the real drain and the real _all_reduce_attn_groups over three real ranks with
DIVERGENT retired lists. With the agreement every rank reports rounds [0, 1] --
nobody reaps while rank 2 is behind, everybody reaps once it catches up.

Removing it does NOT hang, which is worse and is why this needed measuring
rather than predicting: gloo pairs ranks 0/1's round-1 all_reduce with rank 2's
round-2 one -- same group, same shape, nothing to distinguish them -- so no rank
blocks, every rank reports success, and the ranks silently reap in different
rounds. That is the sgl-project#580 signature, not a deadlock, and the next collective
carrying a differently-shaped payload is the one that corrupts. The test asserts
on that divergence (and accepts a timeout too, since another backend may block).
Verified to kill the production mutant only once BOTH agreement gates are
removed -- the second, `digest != agreed_min`, independently covers the
all-but-one-rank case, so a partial mutation leaves it alive.

Also fixed here, and it was mine: test_prefetch_participation_desync_580's cache
stand-in drives prefetch_from_storage as a real bound method and had no
_retire_ongoing_prefetch, so the new call broke 4 of its tests. Carried as the
REAL bound method rather than a stub -- production instances always have it, so
a defensive getattr would have hidden a genuine missing-method bug.

Tests: test/registered/unit/mem_cache/ plus the gloo module -- 2875 passed, 3
failed (test_acceptance_emitters_758 RefillTiming x2, test_kv_row_ownership_822
TestCallSiteAdapters), all three identical by name and count on the pristine
file at HEAD, i.e. pre-existing. ruff clean on both new modules and unchanged on
the two production files (unified_radix_cache 0/0, scheduler 103/103
pre-existing); black clean.

The gloo module spawns real ranks, so it belongs in the narrow RANKS lane.
gate_partition.tsv is generated and sha256-checked, so it is not hand-edited
here; gate_partition_build.py has to be re-run for the classification to land.

Stage-A interaction, so a reader does not misdiagnose it: a retired-but-unreaped
record still holds its lock ref, so sgl-project#938 PROTECTED RESIDUE ORPHANED can show it
TRANSIENTLY. Healthy is a counter that RETURNS across reap rounds; monotone
growth is still a leak.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 27, 2026
…e bound moves off the wire

MEASURED ON THE RIG, 2026-08-27 acceptance boot, pin 18bd50b: 4010 `sgl-project#944
PP-ADMISSION UNRESOLVED`, ZERO escalations, ONE rid, `told=8192` on all 8023 of
its lines. The offer never moved. The bound shipped in 18bd50b was dead code
on exactly the path it was written for.

WHY, AT file:line. `_unresolved_rounds` is fed by `record_return_trip`, which is
fed by a RING LAP: a downstream rank stores its chain-reconciled decision at
scheduler_pp_mixin.py:1530, a rank with no real output sends it home at :6357 ->
`_pp_void_output_payload`:6394 -> `pp_output_payload_with_return_trip`:1060, and
PP0 absorbs it at :6717 -> `_pp_absorb_void_output`:6414 ->
`pp_absorb_admission_return`:6473. The wiring is correct and the entry does
carry `unresolved`. But the lap needs the ring to keep turning, and the voided
pass parks a middle rank in `_pp_drain_voided_proxy` on a blocking
`_pp_recv_typed_dict` -- py-spy, two samples 20 s apart, PP1 identical.

THE EVENT THAT MUST BE COUNTED IS THE EVENT THAT STOPS THE COUNTING. That is the
class, and this is its second confirmed instance: sgl-project#939 put the prefetch re-issue
behind the refusal it compensates; sgl-project#944 put the cap behind the return trip the
void breaks.

THE FIX: the trigger moves off the wire onto PP0's own local observation.
`_offer_streak` maps rid -> (told, consecutive identical offers) and is
incremented inside `prefix_len_for` -- the one function guaranteed to run on PP0
every pass for every offered rid, with zero dependency on any peer, lap or
collective. Cap exceeded -> the loud refusal (still naming all four lookup
locations, and now also printing the lap-fed count, because "streak high while
reported rounds is 0" is itself the signature of a broken ring) -> pin `told=0`,
which the `told <= 0` branch admits unconditionally.

THE ASYMMETRY IS THE DESIGN: the INCREMENT must survive a broken ring, the CLEAR
need only work when the ring turns -- and a pass that actually served the rid is
by construction a pass on which it turned. So `record_return_trip` keeps the
clear and loses the bound. `_unresolved_rounds` is kept: it still names the
population correctly when laps arrive.

It cannot misfire on the healthy sgl-project#630 path: a measured shortfall learns a floor
that makes the next `told` strictly smaller, so the streak resets on every
healthy retraction. Only a `told` that stops moving accumulates.

SIBLING SWEEP, and it found the third instance. `record_return_trip` writes two
things on the LEARN side: `_unresolved_rounds` (sgl-project#944) and `_learned_floor`
(sgl-project#630). sgl-project#630's termination argument holds only while laps arrive -- with the
ring broken, a genuine MEASURED shortfall re-offers the identical `told` for
ever, the same hang with a different population. IT NEEDS NO SEPARATE FIX: the
lap-free streak does not care WHY the offer stopped moving, which is precisely
why counting the OFFER is the class answer where counting the reported round was
only the instance answer. Pinned by
`test_the_630_SHORTFALL_loop_is_bounded_too_when_the_ring_is_broken`.

FALSIFIERS REBUILT TO THE LESSON THIS FOUND. The three gloo arms shipped in
18bd50b call `pp_absorb_admission_return` in the worker themselves -- they
supply the delivery whose absence IS the defect, so they were green while the
bound was dead. A TEST THAT SUPPLIES THE DELIVERY UNDER QUESTION CANNOT TEST
THAT DELIVERY. Added `FalsifierDTheBoundMustSurviveABrokenRing`: the ring still
turns over real gloo, every rank reconciles and forwards, but PP0 never absorbs.
It requires termination, `told=0`, exactly one loud refusal, and asserts
`unresolved_rounds == 0` throughout -- non-zero there means the harness
delivered something and the arm is void. The in-process drive got the same
`deliver=False` rebuild.

Six cap tests inverted onto the new trigger (re-offer instead of reported
round), reasoning recorded at the site, none deleted.

TEST RESULTS. Per-file, each module alone in a fresh process, against the
baseline counts measured on 70bbd98:

  test_pp_admission_congruence_791       11 passed  (baseline 11)
  test_pp_admission_retry_livelock_630    5 passed  (baseline  5)
  test_pp_admission_wiring_791            3 passed  (baseline  3)
  test_pp_forwarded_schedule_791         30 passed  (baseline 30)
  test_pp_reconcile_slot_blind_798       12 passed  (baseline 12)
  test_pp_retracted_pass_void_797        31 passed  (baseline 31)
  test_pp_unresolved_defer_cap_944       24 passed  (23 + the sgl-project#630 sibling)
  test_pp_unresolved_group_defer_gloo    5 passed  ( 4 + the broken-ring arm)

120 passed, 0 failed. ruff (F401,F821,UP037), ruff format and codespell clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 27, 2026
… candidate set that could not see it

THE STRUCTURAL FACT, and it explains two defects at once. `scheduler.py` built
the #943b re-issue's candidate set as `{r.rid: r for r in self.waiting_queue}`.
A chunked continuation is never in the waiting queue: #797b deliberately
RESTORES it as `self.chunked_req`, because that state outlives the round and
putting it back is what stopped boot instr19 dying on `extend_range.end`. So

  * the re-issue could not nominate the request that was stuck -- measured
    `PREFETCH RE-ISSUED` 0 across six boots -- and
  * that request never re-entered through the waiting-queue path where the
    sgl-project#630/sgl-project#944 clamp applies, which is why the offer froze at `told=8192` for
    thousands of passes.

ONE cause, both symptoms, and the FOURTH instance of the compensator
reachability class -- found at the desk by the #944c ratchet rather than on a
boot, which is what that ratchet was built for.

REACHABILITY ARM FIRST, red before any fix code: the candidate set must contain
a chunked continuation. `pp_request_locations` now returns the four places a
request can live -- waiting queue, `chunked_req`, the named slot's chunked req,
running batch -- the SAME enumeration sgl-project#944 walks for the reconcile lookup.
Sharing the list is the point: a fifth place must not be discovered once per
consumer, which is exactly how #797c/sgl-project#798/sgl-project#944 became three tickets for one
class. Every lookup is a getattr, and that is load-bearing rather than
defensive here: this mapping feeds `take_agreed_reissue`, a COLLECTIVE, and a
rank that raised while building candidates would skip an all_reduce its peers
had already entered.

DECIDE AT THE VOID, ACT AT THE CHUNK BOUNDARY. The void is where the group
already agrees, but it fires after the pass was committed and launched --
replanning there rewrites a pass in flight (instr20). `scheduler.py`'s
`add_chunked_req` call site is the one legal point: `add_chunked_req` derives
everything from `len(req.prefix_indices)` and only THEN calls
`set_extend_range`, so nothing about the next chunk is committed and changing
the premise cannot contradict a report that has not been made. sgl-project#906/sgl-project#890 hole 2
already gates that exact site and its own comment establishes the safety.

THE MARK IS STAMPED WITH THE BINDING GENERATION (operator decision). It rides
on the REQUEST, because the rank that must act is not always the rank that saw
the void and #797b restores the same object. Stamped, it survives the chunked
restore (same generation -- the purpose) and invalidates ITSELF on a retract or
cutover (the generation moves, the reader sees it as absent). No
`reset_for_retract` special case and no cleanup path that can be forgotten --
the rule sgl-project#911 already uses for completion routing. `current_generation()` /
`write_back_stamp_is_current()` are module-level in `hicache_phase_binding` and
available at both ends, which was the operator's stated precondition.

RE-FETCH IS PREFERRED, AND IT IS A LAW. `told=0` on the measured rid discards
8192 tokens -- two full `--chunked-prefill-size 4096` chunks -- against a
standing user law that allows at most ONE chunk of loss. The store still holds
the pages, so the escape re-fetches under the current generation and KEEPS the
premise; `told=0` is the bounded last resort for when no fetch can be issued,
and it logs the number of tokens it throws away. A law breach may be necessary;
it may never be silent. The mark is consumed on either branch so the escape
cannot re-fire every chunk.

FOUR FALSIFIER ARMS, all on the real path:
  1 reachability -- the candidate set contains a chunked continuation (red first)
  2 stamping     -- live within a generation, absent once it moves
  3 the law      -- re-fetch preferred, keeps the prefix; `told=0` names its discard
  4 uniformity   -- THREE REAL GLOO PROCESSES, each stamping and reading its own
                    request, before and after the generation moves; a
                    single-process test cannot tell "the generation is global"
                    from "I just wrote this object"

TESTS, per file, each module alone in a fresh process, against the 70bbd98
baseline: 791-congruence 11/11, 630 5/5, 791-wiring 3/3, 798 12/12, 797 31/31,
944-unit 30, 944-gloo 6 (5 + the uniformity arm), 946 11 (new). 109 passed,
0 failed. ruff (F401,F821,UP037), ruff format clean on the touched files;
codespell unchanged from HEAD (2 pre-existing hits in scheduler.py, neither
mine).
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 28, 2026
…he silent hop

Boot 2 of window-flip-0828 wedged silently for 10+ minutes: PP0 and PP1
blocked in gloo waitSend under _pp_commit_comm_work's naked
p2p_work.work.wait() (PP1 via _pp_commit_pending_req_work), PP2 in
_do_recv -- a closed three-arc cycle on a group whose own timeout is two
hours. The sgl-project#753 comment in this file already described the exact shape
(boot v7pp9); the ordering was fixed then, the wait stayed naked.

The bound routes through the sgl-project#630/sgl-project#829 canon
(hicache_collective.bounded_wait -> ParkedWait): the unbounded wait()
parks on a thread and the deadline is on the JOIN. Deliberate deviation
from the order's 'pass the deadline into work.wait(timeout)': sgl-project#829
retracted that design in this tree -- an expired timed Work.wait closes
the gloo pair, and hicache_collective.py names _pp_commit_comm_work as a
measured victim (34 of 262 boot logs). Budget 120 s
(SGLANG_PP_RING_COMMIT_BUDGET_S; <= 0 = documented escape hatch,
byte-for-byte pre-sgl-project#973), reasoned against the canon's constants: 12.6x
the longest healthy cutover, 4x the sgl-project#789 budget, 5x under the HiCache
bound, 60x under the group timeout. On expiry: RingCommitTimeout with a
sgl-project#650-style peer statement naming the silent hop; transport failure is
NOT converted (sgl-project#734 stays distinguishable). Helpers are module-level,
not methods -- the method form broke ~12 one-method-at-a-time stand-in
holders (measured: 796 5->2, 801 14->3), recorded in a code comment.

Wait-site audit: :5253 bounded-now; :3270 bounded by delegation (proven
by test); _do_recv/:7592 and :5545 bounded-already via the sgl-project#789 gate;
parallel_state.py recv_object stays unbounded and is NAMED as its own
posten (needs the resumable PpChainReceiver treatment, not a terminal
bound mid-protocol).

Tests: test_ring_commit_bounded_973.py, 5 arms on real 3-process gloo --
pre-sgl-project#973 naked commit HANGS (distinguished from raised via fsynced
progress marker), bounded commit raises within budget with the peer
statement, healthy paired traffic unchanged, escape-hatch mutant hangs
again (can-fail), :3270 reachability arm. Gates: BEFORE == AFTER
byte-identical on 796(5)/801(14)/797(31)/630(5+14)/829(7) plus an
18-module sibling sweep; extraction count probe OK on every run.
ruff/codespell: 0 new findings.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…lt ein TRIGGER. Aktionsarm ist S.

Reiner Lese-Pass, kein Boot, kein Code. Beide Quellen je Zeile.

== PFLICHT-VORFRAGE BEANTWORTET: es ist ein UNGEDECKTER TRANSPORT ==
Das haengende all_reduce laeuft auf `grp = self.tp_cpu_group`
(scheduler.py:5964) -- eine GLOO-CPU-Gruppe. Die sgl-project#650/sgl-project#653-Klassen
(Bar1CollectiveAborted / HostCollectiveAborted / Bar1CollectiveStalled)
liegen ausschliesslich in `distributed/device_communicators/barlink_*.py`
plus den zwei debug_utils-Lesern: sie decken den DEVICE/BAR1-Pfad.
Also NICHT "Deckung da, Schwellwert/Leser defekt", sondern: der Pfad hat
diese Deckung nie gehabt. Auf dem gloo-Pfad gibt es weder Deadline noch
Peer-Positions-Bericht.

== CENSUS-FAEHIGKEIT: IDENTITAET IST DA, und mehr ==
`_history.append((family, nbytes))` (:246) -- jede Eintragung traegt die
KOLLEKTIV-FAMILIE, nicht nur Zaehlstaende. `Divergence(family, counts)`
(:459) vergleicht bereits NACH FAMILIE. Und der Modulkopf beschreibt zwei
Berichtspfade:
  1. `compare_across_ranks` -- Detektor, laeuft auf gloo `tp_cpu_group`,
     replizierte Kadenz, feuert waehrend die Raenge noch gesund sind.
  2. `format_local_census` -- die WEDGE-FESTE Haelfte: NIMMT KEIN KOLLEKTIV,
     jeder Rang kippt seine EIGENEN Zaehler ins Log, die drei Dumps werden
     hinterher gediffed.
Die Identitaet fehlt also NICHT. Das ist nicht die Luecke.

== DIE LUECKE, praezise ==
Der Modulkopf sagt woertlich, der Detektor laufe auf dem CPU-Pfad,
"NEVER the device/BAR1 path, SO A WEDGED DEVICE GROUP DOES NOT DISABLE THE
INSTRUMENT THAT IS SUPPOSED TO EXPLAIN IT".
Genau diese Immunitaet greift bei uns NICHT: unser Wedge IST auf der
CPU-Gruppe. Der Detektor braucht ein `all_gather_object` auf ebendieser
Gruppe -- er kann eine Uneinigkeit der Gruppe, die er selbst benutzt, nicht
melden. Die Schutz-Annahme ist um genau einen Transport verschoben.
Und die wedge-feste Haelfte (`format_local_census`, kollektiv-frei) EXISTIERT
fuer diesen Fall -- aber sie wird nie AUSGELOEST, weil auf dem gloo-Pfad
nichts abbricht: kein Deadline, kein Abort, kein Ausloeser.
DAMIT: die Luecke ist ein TRIGGER, keine Faehigkeit.

== AKTIONSARM-DESIGN, S ==
Diskriminator: NICHT "Follower wartet lange" (Normalzustand) und NICHT "PP0
macht keinen Fortschritt" (PP0 wartet selbst) -- sondern eine BEGRENZTE
Wartezeit am gloo-Kollektiv, nach deren Ablauf jeder Rang
`format_local_census()` ruft (kollektiv-frei, schon gebaut) und die Gruppe
per CRASH/STOP stirbt. Die Beider-Seiten-Diagnose faellt dabei GRATIS an:
jeder Rang druckt seine eigene Familien-Historie, und der bestehende
Hinweistext sagt bereits, was damit zu tun ist -- "Diff this line against
the peers' to find where the sequences diverged".
DEADLINE-BEGRUENDUNG gegen die zwei Lehren:
  * sgl-project#630 (wait() treiben, nie is_completed() pollen): der bounded wait muss
    ueber das async work-handle mit Timeout laufen, NICHT ueber eine
    Poll-Schleife.
  * sgl-project#615 (Build-Fenster-Dehnung): die Deadline darf nicht in ein legitimes
    JIT-Cold-Build-Fenster feuern (bis SGLANG_BARLINK_BUILD_WINDOW_CAP_S=900s).
    Sie muss dasselbe Fenster konsultieren, das barlink schon fuehrt --
    sonst ersetzt sie einen Wedge durch einen Fehlalarm beim ersten Boot.
KEIN timeout-und-weiter: Ablauf = Tod der Gruppe, per Rang-Gesetz.

== VERDIKT: S ==
Wiederverwendet wird durchweg Vorhandenes (Census-Familien-Historie,
kollektiv-freier Dump, barlink-Build-Fenster). Neu ist nur der bounded wait
plus sein Ausloeser. Kein neues Kollektiv auf dem Pfad -- das Gesetz bleibt
gewahrt, weil die Diagnose-Haelfte ausdruecklich kollektiv-frei ist.
OFFEN und ehrlich: die Deadline-ZAHL ist nicht herleitbar aus dem, was ich
gemessen habe -- sie braucht die legitime Maximal-Wartezeit unter Last, und
die kenne ich nur als "DE-06 dauerte 95,6 s im gesunden Lauf". Das ist die
eine Groesse, die vor dem Bau gemessen gehoert.

BELEG-STUFE: DESK-BEWIESEN (Transport-Zuordnung, Deckungs-Scope, Census-
Faehigkeit -- alle am Pin gelesen, Modulkopf woertlich zitiert).
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
… >30s) -- aber das Instrument ist im Stall STRUKTURELL BLIND, und die Haelfte dagegen habe ich nur halb gebaut

== WAS GEBAUT WURDE ==
Instrumentierung des gloo-all_reduce in `_update_uniform_pool_budget`
(scheduler.py:6185ff): Zeitmessung um den Aufruf, WARNING je abgeschlossener
Wartezeit >30s, Census-Dump (kollektiv-frei) >300s, plus ein publizierter
`_uniform_reduce_since`-Zeitstempel. KEIN Timeout am Work-Handle -- der
sgl-project#630-Grund steht im Kommentar: ein abgelaufenes wait(timeout) laesst den
Handle in undefiniertem Zustand, "report-only" waere dann nicht mehr
semantik-erhaltend. Stattdessen das Muster, das die Kette schon benutzt
(on_blocked_recv): Zeitstempel publizieren, Fremd-Thread liest.
Promotionskriterium steht als Anti-sgl-project#578-Klausel im Kommentar.
Werkzeug-Check diesmal FEHLERKLASSEN-PASSEND (die Lehre vom letzten Zug):
AST-Pruefung, dass `Scheduler` keine frozen/slots-Dekoratoren traegt, dass
`time` importiert ist und dass `format_local_history(rank)` modulweit mit
genau einem Argument existiert. Alle vier gruen, dann Boot.

== PHASE-1-ERGEBNIS, gesunde Sequenz ==
NULL Wartezeiten >30s ueber sechs bestandene dataextract-Fragen. Das ist ein
sauberes Ergebnis und die halbe Datengrundlage fuer die Phase-2-Deadline:
im gesunden Betrieb dauert dieses Kollektiv nie auch nur 30 s.
DE-06 lief in 35,0 s durch (Strandungslaeufe: 81,6 / 95,6 s).

== UND DANN DIE EHRLICHE HAELFTE ==
Bei DE-07 strandete es erneut -- und mein Instrument meldete NICHTS.
Der Grund ist strukturell und ich haette ihn beim Entwurf sehen muessen: die
Messung laeuft NACH dem Aufruf. Bei einem echten Hang kehrt das all_reduce
nie zurueck, also wird weder die Zeit gemessen noch die 300s-Schranke je
erreicht. DAS INSTRUMENT SIEHT GENAU DAS EREIGNIS NICHT, dessen Obergrenze es
finden sollte.
Die Haelfte, die es koennte, habe ich ANGEFANGEN UND NICHT ZU ENDE GEBAUT:
`self._uniform_reduce_since` wird publiziert -- und NIEMAND LIEST ES. Das ist
exakt die sgl-project#578-Klasse (armiert, nie ausgefuehrt), die ich im selben Commit im
Kommentar verboten habe. Ich habe die Regel aufgeschrieben und im selben Zug
gebrochen.

== LIVE-CATCH BEIM STALL ==
Zwei Raenge, zwei verschiedene Kollektive, gleichzeitig:
  976272  active  broadcast <- broadcast_pyobj (utils/common.py:2845)
  976273  idle    all_reduce <- _update_uniform_pool_budget (scheduler.py:6220)
Dritter Befund derselben Form. Die Divergenz-Diagnose steht.

== WAS PHASE 1 JETZT BRAUCHT (kein Bau ohne GO) ==
Der Leser fuer `_uniform_reduce_since`. Es gibt bereits einen Thread, der
genau so etwas tut -- `admission-wedge-watchdog`
(scheduler_components/invariant_checker.py:1377), der schon
`_pp_blocked_recv_since` liest. Derselbe Leser um den Reduce-Zeitstempel
erweitert, mit dem kollektiv-freien Census-Dump als Aktion, ergibt den
Report-Pfad, der im Hang tatsaechlich feuert. DAS ist Phase 1 fertig; was ich
gebaut habe, ist nur die gesunde Haelfte davon.
Phase 2 (CRASH/STOP) bleibt gesperrt: Kriterium (ii) -- "der Report-Pfad hat
nachweislich gefeuert" -- ist unerfuellt, weil es ihn im Hang noch nicht gibt.

BELEG-STUFE: Bau BOOT-BEWIESEN (Checks gruen, Boot gesund, greedy kohaerent).
Gesunde Verteilung BOOT-GEMESSEN (n=6 Fragen, 0 Samples >30s). Der
Instrumenten-Blindfleck ist BOOT-BEWIESEN durch sein Schweigen im Stall.
Serving wieder oben, health 200.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…inert

The one place (KONVERGENZ_BEWEIS_968.md): get_next_batch_to_run + admission run
as a COPY on every rank, and 14 of 16 rank-divergence blockers are one divergent
INPUT into it. This makes the OUTPUT uniform instead of chasing inputs.

SITE 1 producer + pin, scheduler_pp_mixin.pp_stamp_observed_coverage, called
from pp_output_payload_with_return_trip. UPWARD, and that is the architecture:
the downward relay is verbatim by design ('so the extent PP2 applies is the one
PP0 decided and not something a middle rank re-derived on the way'), and a
per-rank report is not a decision. Reporting IS pinning -- the same line raises
cache_protected_len, which mem_cache/common.py:82 already honours as an eviction
floor. Never lowers a larger claim. An unlocatable rid reports None, not zero.

SITE 2 harvest in record_return_trip (before the retracted/admitted split, so
the MIN depends on the tiers and not on the pass outcome) + MIN applied in
build_pp_admission_decision, which is PP0-only (one caller, under pp_rank == 0 --
which is also why 'PP0 is minimal' never had a mechanism). Same direction as the
sgl-project#630 clamp: down only, so the extend_len arithmetic is untouched.

SITE 3 carrier: NO WORK. observed_local already round-trips at index 6. The
producer was always the only missing piece -- present-wired-never-populated,
this defect's exact form.

SITE 4 the told geometry rides the Req from the receive point, the tree's own
'fact rides the row across ranks and the Req within a rank' shape. Applied one
lap later: the frame arrives AFTER planning, so a same-pass stamp is impossible
and the blocking pre-planning receive that would fix that is what sgl-project#1015 deleted
after it deadlocked PP3-solo.

SITE 5 Req.apply_uniform_pass_geometry_1059, behind SGLANG_PP_UNIFORM_WIDTH,
default OFF (sgl-project#947 precedent: ships INERT). Producer, pin and MIN run either way,
so the reports are measurable before the apply is trusted.

A FALSE GREEN I PRODUCED AND THEN CLOSED, recorded because it is this campaign's
signature failure appearing inside the fix for it: site 5 first lived inline in
init_next_round_input, where the only reachable assertion was an AST check that
uniform_pass_geometry is CALLED -- and a mutant keeping the call while
discarding its result () passed all 34
tests. A site whose deadness cannot be detected IS the shape this change
removes. Site 5 is now a named method asserted BY EFFECT.

36 tests. SEVEN wiring mutants, every one anchor-asserted and every one KILLED:
W1 producer dead, W1b report-without-pin, W2 harvest dead, W2b MIN dead,
W4 stamp dead, W5 apply not called, W5b apply result discarded. (W5b's first
anchor did not match and the assert REFUSED to report a false survival rather
than scoring an unapplied mutant as killed.)
py_compile, import smoke, ruff clean on new files; site 1's use of
dataclasses.replace also cleared a pre-existing unused-import.
Behaviour with the gate OFF: none.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
… and builds from the row

The sgl-project#968 end state, second cut (DESIGN_631_PP0_GEOMETRY_AUTHORITY.md slices
1+3). Boot 631cut died at readmit lap 15 on the same class the /dev/shm
bulletin was built against: on the bulletin's stale-epoch laps the DEVICE
prefix stayed rank-local (PP1 36575 vs PP2 3807, same rid), and the pass
crashed at PP0's output stash (bonus_tokens [2] vs indices [1]).

The admission row already rides the proxy frame; what was missing is ORDER.
A downstream rank now probes frame presence non-blockingly (the first three
exits of _pp_wait_for_dict_readiness, taken once -- never the blocking
pre-plan receive sgl-project#1015 deleted), takes the frame BEFORE planning, reconciles
its row against local state (_pp_reconcile_incoming_admission and
_pp_void_retracted_pass restored verbatim from 01a391f^), and the
admission loop EXECUTES that geometry: membership by pp_not_named, prefix by
truncate-to-told, shortfall by group-uniform void with observed_local riding
the return trip home so PP0's sgl-project#630 guard learns the floor (PP0 defers its
raise to the group floor -- the slice the under-coverage counter ordered).
No frame posted -> the rank plans nothing for the slot; a locally-derived
batch on a frameless pass is voided (counted). PP0's learned-floor clamp
re-arms on the same predicate (pp_row_authority_enabled), so the two halves
can never be armed apart (sgl-project#1039). The /dev/shm bulletin halves are retired;
the match-writer enforcement (cap_req_geometry) stays and is fed from the
row (one mover, one payload). Kill switch: SGLANG_PP_ROW_AUTHORITY=0.

Matched check (speed mode): py_compile all four files + heavy module import
+ hermetic wiring smoke (pp_row_authority_enabled gate, plant_from_row
round trip) -- ROW-AUTHORITY WIRING SMOKE OK. Metal proof is the boot.
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.

2 participants