Skip to content

[Fix] Fix --disable-flashinfer - #1389

Merged
merrymercy merged 1 commit into
mainfrom
fix-bug
Sep 11, 2024
Merged

merrymercy merged 1 commit into
mainfrom
fix-bug

Conversation

@merrymercy

Copy link
Copy Markdown
Collaborator

@merrymercy merrymercy changed the title Fix --disable-flashinfer [Fix] Fix --disable-flashinfer Sep 11, 2024
@merrymercy
merrymercy merged commit 15c75e4 into main Sep 11, 2024
@merrymercy
merrymercy deleted the fix-bug branch September 11, 2024 11:36
@ByronHsu

Copy link
Copy Markdown
Collaborator

thanks!

timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…her than a second scanner

Prior-art gate first (per order): sgl-project#1328's own file
(test_weg2_xchg_refusal_reachability_1328.py) already answers "can
production reach this raise/verdict at all" via a name-based AST
reference graph (_Index/build_index/reachable), with an empty-allowlist
ratchet plus a frozen, classified UNWIRED_DEBT for the exceptions, and a
synthetic-tree plant-proof (TestTheRatchetCanFail) that RED/GREENs its
own failure mode. sgl-project#1306 (test_weg2_wcode_uniqueness_1263.py) answers a
different question (is one W-code used twice) and isn't the right host.
Extended sgl-project#1328's file rather than building a second walker.

THE NEW QUESTION sgl-project#1389 ASKS, different from sgl-project#1328's: does the code that
READS a producer's log-line marker run under the SAME precondition the
producer's own construction requires? Five real instances from one
night (2026-09-13/14):

1-3. W7/W10 (P and D) and W9: count_marker() gates in launcher.py read
   markers ('sgl-project#706 canonical KV page active', 'canonical GDN blob
   active', 'sgl-project#1233 HICACHE BIGRAM KEYS FORCED') that only
   managers/cache_controller.py's HiCacheController ever prints, built
   only inside mem_cache/registry.py:192's `if
   ctx.enable_hierarchical_cache:` -- the gates ran unconditionally.
   ALREADY FIXED (sgl-project#1386 follow-ups 2/3, commits 683ccc5/2ef1a0979d).
4. W45: launcher.py's carrier census reads 'sgl-project#915 PREFETCH LIMIT', whose
   producer (mem_cache/prefetch_budget.py's log_prefetch_limit) is a
   no-op whenever its caller passes no cache_controller. ALREADY FIXED
   (sgl-project#1386 follow-up 4, d6c3d19).
5. The W100 guard bound to _weg2_xchg_inject_from_peer, which runs zero
   times on the metal (the real call site is _weg2_xchg_bounce_leg) --
   DESK10's own test passed because it checks the same wrong function.
   UNFIXED, in files locked to DESK10 (weight_updater.py) -- reported as
   a finding, not fixed here.
6. A wait-loop entry-vs-condition race (P enters 03:19:28Z, the
   condition it waits for exists at 03:19:32Z) -- no expressible static
   form found.

THE MECHANISM (ThePresenceRatchet): for each registered (gate anchor,
guard names, producer anchor, producer guard names) tuple,
_guard_chain_by_line walks the file's AST once and maps every line to
the source text of every enclosing `if` test (presence, not polarity --
an `if X: skip / else: gate` shape records X for lines in EITHER
branch, since both fix shapes in the corpus are exactly that). Two
per-entry checks (gate side guarded, producer side guarded) plus a
DEBT_SIZE_ON_THE_LINE-style pinned corpus size (4) so a removed entry
cannot silently pass -- the corpus itself is the required "does the
scan find the known corpus" probe (sgl-project#1341/sgl-project#1306's own lesson: a scan
that finds nothing reads green).

Instances 5 and 6 are DECLARED BOUNDARIES (PRESENCE_RATCHET_BOUNDARIES),
not invented rules: sgl-project#1328's own RESOLUTION docstring already states the
honest bound this ratchet shares (name-based resolution can call an
unwired path wired, never the reverse; no ordering/timing semantics).
Instance 5 gets one structural fact this file CAN verify without
touching the locked source -- the exact AST call-site count and line of
the wrapper _weg2_xchg_inject_from_peer (1, at weight_updater.py:1045)
-- pinned so a future desk can diff DESK10's rewire against it.

Tests: ThePresenceRatchet (4 corpus checks + shape/naming pins),
TestThePresenceRatchetCanFail (synthetic plant-proof: unguarded shape
RED, guarded shape GREEN, ambiguous/absent anchors reported not
silently misread), TestTheBoundariesAreDeclaredNotInvented (boundary
entries carry real reasons; the W100 wrapper's call-site count is
pinned). 10 new tests, all green; full file 27/27 green (17 pre-existing
+ 10 new).

Manually verified both required danger-direction mutants: (1) removed
one entry from PRESENCE_GATES -- exactly
test_the_corpus_cannot_shrink_or_grow_silently goes red, the two
per-entry scans stay green over what remains (proving the corpus-size
pin, not the per-entry logic, is what catches a silent removal);
restored, diff empty. (2) reverted the REAL launcher.py's W7/W10 group P
guard to its historical, unconditional pre-fix shape -- the ratchet goes
red against the ACTUAL file, not just a synthetic one, naming the exact
entry; restored, diff empty (git diff confirmed clean before
re-committing).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…against sgl-project#1348's coverage dumps

The presence ratchet (previous commit) and sgl-project#1328's reachability ratchet both
answer STATIC questions -- can production reach this raise, does a gate's
guard chain match its producer's. Neither can see instance 5: the W100
guard bound to _weg2_xchg_inject_from_peer has a real AST call site
(weight_updater.py:1045, inside _weg2_xchg_inject_weights) and reads WIRED
to both instruments, correctly by their own rules, while the real boot
routes around it through _weg2_xchg_bounce_leg instead ("laeuft am Metall
NULL MAL"). Name-based AST resolution can call a dead path wired, never
the reverse -- sgl-project#1328's own docstring already names this honest bound. The
order's own diagnosis: AST is the wrong tool for this half; the answer is
EXECUTION EVIDENCE, composed from two instruments already in the tree
rather than a third scanner.

entry_evidence() crosses sgl-project#1328's already-resolved function against
weg2/lane_coverage.py's (sgl-project#1348) per-boot-per-rank JSON dump: a function is
"entered" iff the dump's `executed` set for its file contains any line in
(def_lineno, end_lineno] -- deliberately excluding the def line itself.
latest_dump_of_tag() finds the most recent dump (by boot_token's own
epoch) among whatever `phase_coverage_{group}_rank*.json` files exist
under a directory, filtered to a given boot-tag prefix.

THREE TRAPS, each named in the order and each with its own test:
1. "Never executed" != "dead" -- a guard whose body ran and whose
   condition read false is ALIVE; this ratchet only asks whether the body
   was entered at all, never which branch inside it fired
   (test_falle_1_a_condition_that_ran_and_read_false_is_not_a_finding).
2. No dump (or a dump of a DIFFERENT boot tag) is NOT-MEASURED, never a
   silent green -- the sgl-project#1306 trap in new clothes
   (test_falle_2_no_dump_is_not_measured_never_green, which also proves a
   weg2ring1 dump can never answer a weg2xsn31 question -- the named
   counter-case, a parallel ring-arm boot of a different form).
3. `imported_before_arm=True` marks a module whose import-time lines (the
   def line itself among them) ran before the tracer armed and so read
   unexecuted despite the module having genuinely run (#1352f). The
   discriminator excludes the def line from evidence entirely and reads
   `imported` (never a body-line proxy) for "was this module loaded" --
   tested in both directions (a genuine body hit under
   imported_before_arm=True still reads entered; a stray def-line-only
   hit never reads entered on its own).

CALIBRATION: EXECUTION_WATCHLIST's one entry is
_weg2_xchg_inject_from_peer, tag weg2xsn31, groups P and D, cited to
BOOT_weg2xsn31_0913_4.md VERSUCH 8 (2026-09-14, window 2thy75): the
`WEG2-XCHG COLLECT tag=%s pieces=0` marker this function's collect path
would print appears zero times in either P.log or D.log across the whole
boot. The boot's own P.log confirms its rank dumps were written
(`lane_coverage: final dump .../phase_coverage_P_rank0.json legs=0` at
03:21:36Z, PP0) -- but by the time this ratchet was built, those files
were no longer on disk (this shared box's evidence directory is a scratch
location every concurrent boot can write into without a dedicated
--evidence-dir, and something later removed them). The required mutant's
own fixture therefore RECONSTRUCTS the dump from the boot's own printed
log lines (legs=0, PP0, cited file:line) rather than claiming to replay
the original bytes -- stated explicitly in the test class docstring so
nobody mistakes it for the literal file.

TheExecutionRatchet.test_the_watchlist_against_the_live_evidence_tree is a
best-effort REPORT against whatever is currently on the shared box (never
a pinned assertion, since other seats' concurrent boots mutate this
directory continuously) -- run just now, it correctly prints NOT
MEASURABLE for both P and D, matching the fact just established that the
real dumps are gone.

Tests: TheExecutionRatchet (2 cases) + TheExecutionRatchetCanFail (7
cases, all hermetic, synthetic dumps in temp dirs). 9 new, all green; full
file 36/36 green (27 prior + 9 new).

Manually verified the required danger-direction mutant: entry_evidence
short-circuited to always return "entered" -- exactly
test_the_instance_5_case_is_reported_not_entered (the required
calibration case) and test_falle_3_the_def_line_itself_is_never_used_as_evidence
go red; restored, diff empty.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…ly its content

Side-finding from sgl-project#1389's execution ratchet, promoted to its own defect:
the xsn31/8 coverage dump (VERSUCH 8, 2026-09-14, window 2thy75) is GONE,
even though the boot's own P.log proves it was written
("lane_coverage: final dump .../phase_coverage_P_rank0.json legs=0" at
03:21:36Z). Root cause: sgl-project#1348's dump_filename(rank, group) derives
phase_coverage_{group}_rank{N}.json with no boot identity at all, so two
boots of the SAME group/rank sharing sgl-project#1292's shared, reused evidence
directory write the identical filename and the later one silently wins.
boot_token was already IN the dump's content (precisely so a reader could
detect a stale one -- MF2's own tests) but never consulted on the WRITE
path. sgl-project#1292's own precedent (W18 Weg2PhaseFootprintCollision,
mem_ledger/activation_probe.py) refuses on a DIFFERING profile digest --
but two boots of the SAME form share one digest, so W18 never fires for
exactly this case, which is what cost tonight's evidence.

THE FIX IS AT THE IDENTITY, NOT AT CLEANUP (SHM-RESIDUE-NUR-PER-HALTER's
sibling for this instrument -- never clean by pattern; the fix is that two
boots stop competing for one name):

- lane_coverage.py: new _boot_subdir(boot_token) sanitises the token
  (":" -> "_", path separators stripped) into a per-boot directory name.
  arm() and write_expect_manifest() now write under
  <directory>/<_boot_subdir(token)>/... instead of flat at <directory> --
  <directory> itself is unchanged (still sgl-project#1292's shared, published path;
  only where THIS module's own artefacts land inside it moves), so no
  launcher call site needed a signature change (boot_token was already
  threaded through both call sites). A reader now sees which boot an
  artefact belongs to FROM ITS PATH, without opening the file.
- Defense in depth: a write that would still clobber an EXISTING file
  carrying a DIFFERENT boot_token (only reachable if two tokens sanitise
  to the same subdirectory, or a caller reuses a bare directory) is
  refused by name (W106 Weg2LaneCoverageCollision, logged text matching
  sgl-project#1292's own W18 shape and this module's "never raise at the caller"
  discipline) rather than silently overwritten -- keyed on the boot,
  which is exactly the axis W18's profile-digest key cannot see.
- scripts/weg2/lane_coverage_diff.py: the EXPECT manifest and dump glob
  now prefer <dump_dir>/<_boot_subdir(token)>/... when --boot-token is
  given, falling back to the flat root (backward compatible with every
  existing fixture and any pre-fix dump still on disk) -- otherwise the
  ingest's own flat, non-recursive glob would go blind on every dump this
  fix's write-side now produces.

test_weg2_lane_coverage_1348.py: 8 pre-existing tests that call arm()
directly and then check a flat-root path updated to the new
<dir>/<_boot_subdir(token)>/... shape (the tests exercise the SAME
behaviour; only the path literal moved with it) plus one whose ingest
call needed --boot-token added (its manifest write and dump write are no
longer at the same flat location without it). Also discovered and fixed a
pre-existing environment gap unrelated to this change: the `coverage`
PyPI package was not installed on this box at all, which made every
arm()-driving test fail with ModuleNotFoundError regardless of this
patch; installed system-wide (pip install --break-system-packages
coverage) since the instrument cannot function without it in ANY
worktree or session.

New file test_weg2_lane_coverage_boot_identity_1395.py (8 cases):
_boot_subdir's sanitisation (colons, empty token, path separators); two
arm() calls of the identical group/rank/directory with different
boot_token both survive on disk with their own correct token (the
required mutant's own baseline) plus the write_expect_manifest analogue;
the W106 defense-in-depth refusal for both arm() and
write_expect_manifest, proven to leave the foreign file untouched; and a
same-token re-arm is NOT a collision.

Manually verified the required danger-direction mutant: _boot_subdir
monkeypatched to always return "" (the pre-sgl-project#1395, bare-directory
behaviour) -- exactly test_both_dumps_survive_with_their_own_boot_token
and its sibling manifest test go red (the second boot's arm() overwrites
the first boot's dump, so only one token survives on disk). Restored,
diff empty. Full regression: test_weg2_lane_coverage_1348.py (44/44),
test_weg2_lane_coverage_boot_identity_1395.py (8/8),
test_weg2_xchg_refusal_reachability_1328.py (36/36),
test_weg2_xchg_manifest_1311.py + test_weg2_xchg_manifest_join_1330.py
(81/81, confirming the untouched, locked xchg_manifest.py's own
independent naming scheme is unaffected).
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