- Re-check input identities inside every loadpath and pain-axis probe
child before it imports torch or loads a model.
- Require the allowed inputs directory and every directory above it to be
real directories, so a same-device link cannot replace the root.
- Walk each input path component by component as written, applying '..'
only after the directory before it is checked, so a symlinked directory
followed by '..' cannot be collapsed away; relative Hugging Face
snapshot links still work.
- Capture identities before hashing at fetch and resume and require them
unchanged afterwards, so the stored snapshot describes the hashed bytes.
- Narrow the documentation to exactly what is checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address review r1 of the symlinked-inputs option:
- Lock the allowed directory's device and require every input component
to sit on it, so a mount under the directory cannot stand in for it.
- Walk each input path with lstat and reject any symlinked directory,
even one inside the allowed directory; only the final snapshot-to-blob
link is followed.
- Record each validated input's path, device, inode, size and mtime, and
have every model-loading worker re-check them before it starts. The
window between that check and the load is documented as accepted for a
single-owner input cache.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cover a cached input reached through a symlinked parent directory that
leaves the allowed inputs directory, both at fetch and after fetch, and
refuse adding --symlink-inputs on resume of a root created without it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--symlink-inputs now takes the directory the cached inputs must live in.
Fetch refuses a cached file that resolves outside it and refuses a cache
miss rather than downloading. Fetch and every resume fail closed when an
input link is broken, leaves the allowed directory, has been replaced by a
regular file, or no longer matches its recorded hash. validate_fetch reads
the policy from the run manifest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an opt-in --symlink-inputs option. Fetch then links each cached pinned
snapshot file into the run root with a symlink to its resolved cache path,
instead of a hard link, so the inputs can sit on a different filesystem from
the root without a full copy. Fetch still records every file's hash through
the link and each resume re-verifies them. The option is locked in the
manifest only when set, so existing roots resume unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The harness only knew the small models, so the Gitea #116 Phase B runs
at 32B/72B could not select their official S1/S2 ablation layers. Add
both from appC_ablation/02_ablation_large_models.py at the pinned
4d75cd90: Qwen_2.5_32B_instruct ("chat", 32, 38) and
Qwen_2.5_72B_instruct ("chat", 48, 60). The S2 layers match the shipped
4.2 steering references (L38, L60). The appendix-D and recovery scripts
take --name from this table, so they gain the same choices.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex r1 on #381: a lowered --min-free-disk-gb did not enforce its
cached-input premise. A cache miss still downloaded and a failed hard
link silently fell back to a full copy, so a root admitted at 70-140 GB
could pull or copy ~108 GB. Below the 250 GB default, fetch now refuses
a snapshot that is not completely cached or cannot be hard-linked; the
same guard applies when an incomplete fetch is resumed. The default and
unlowered floors keep the download and copy fallbacks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Qwen3.8 campaign refuses a new root below 250 GB free. That floor
assumes both pinned snapshots (~108 GB) are downloaded; when they are
already in the local Hugging Face cache on the root's filesystem, fetch
hard-links them and that share is not needed. An operator can now lower
the initial admission explicitly (at least the 70 GB resume reserve).
The value is locked in the manifest only when set, so existing roots
resume unchanged, and must be repeated on resume.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex r1 on #380: iter(source) only mapped TypeError, so an __iter__
raising OSError, csv.Error or StopIteration (directly or as a PEP 479
RuntimeError) still leaked. Apply the same narrow provider-error and
cause-checked RuntimeError mapping at initialization; normal exhaustion
in next() is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups from the #379 review:
- A StopIteration raised inside the live discovery generator (for
example from distribution.metadata["Name"]) became a RuntimeError under
PEP 479 and escaped the contract mapping. Only the converted form is
mapped; unrelated RuntimeErrors still surface.
- OSError and other provider errors raised while iterating a caller
supplied distribution source now map to ContractError.
- An OSError from os.close in _regular_file_digest no longer escapes the
finally block raw; a failed close never reports a digest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
installed_package_set_digest() normalized csv/Key/Type/Unicode errors from a
distribution's metadata, version and METADATA/RECORD reads, but an unreadable
metadata file (OSError, e.g. PermissionError) or a provider whose lookup
exhausts an iterator (StopIteration) escaped the contract instead of
surfacing as LMS_DEPENDENCY_DRIFT. Catch both.
Tests: a provider raising PermissionError/OSError from METADATA/RECORD reads
and StopIteration from .version and .metadata maps to ContractError.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r2:
- The exempt checkout egg-info path was fully resolved, so a symlink to
another checkout's or a user-site egg-info resolved to that install and
exempted it. Canonicalize only the checkout root and append
obliteratus.egg-info unresolved; a symlinked egg-info, or one resolving
outside the checkout, raises ContractError.
- A RECORD field over csv.field_size_limit made distribution.files raise
csv.Error outside the normalization. Catch it wherever RECORDs are
parsed, so it maps to LMS_DEPENDENCY_DRIFT.
Tests: a symlinked checkout egg-info pointing at an external install that
is also visible (and one pointing back inside the checkout); an oversized
RECORD field for obliteratus and a third-party distribution, directly and
through both GPU candidate tiers; the site-containment guard on its own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r1: the exemption dropped any obliteratus.egg-info outside the
prefix sites, so a user-site, system-site or other-checkout install could
hide behind an approved digest. Exempt only the canonical
<checkout>/obliteratus.egg-info of the source tree this module runs from
(model_identity.py parents[2]); from an installed wheel that path is
inside a site dir and nothing is exempt. Every other visible obliteratus
distribution fails closed again.
A malformed RECORD made distribution.files raise ValueError outside the
normalization; it is now ContractError, so model_session reports
LMS_DEPENDENCY_DRIFT.
Tests: conflicting external egg-info (dir and file, before and after the
wheel on sys.path), symlinked checkout paths, prefix egg-info from a wheel,
malformed RECORD -> LMS_DEPENDENCY_DRIFT on both GPU candidate tiers, and
PEP 660 / .egg-link editable layouts failing closed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A non-editable install from a checkout leaves an untracked, gitignored
obliteratus.egg-info in the source root. The llama-tp gate and its TP
workers run with the checkout on sys.path, so importlib.metadata also
discovered that egg-info. installed_package_set_digest() enumerates every
visible distribution, so the stale build artifact broke the live package
identity (LMS_DEPENDENCY_DRIFT) before any hardware evidence was written.
model_identity now locates exactly one .dist-info for obliteratus under
the active prefix's purelib/platlib, requires its RECORD to own the
package that PathFinder finds there, and fails closed otherwise (no
wheel, egg-only, duplicate or disagreeing installs, ownership mismatch).
A setuptools source-tree obliteratus.egg-info outside the site dirs is
excluded from the inventory only after that wheel is found. All other
metadata/RECORD and duplicate checks are unchanged; a clean install keeps
the same digest.
run_conditional_gate.py refuses llama-tp-local-gpu up front (not_run,
exit 2, actionable message) when the checkout root holds an
obliteratus.egg-info, before any probe or GPU time; --allow-missing does
not bypass it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r4: inherited GIT_TRACE* survived sanitization, and a trace aimed at
/dev/stdout corrupted the captured SHA and status ("local", dirty). This
was the third surviving-GIT_* finding, so close the class: drop every
inherited GIT_* variable and set only GIT_OPTIONAL_LOCKS=0,
GIT_TERMINAL_PROMPT=0 and GIT_NO_LAZY_FETCH=1.
The sanitizer test now requires exactly those three GIT_* names (including
when an unknown GIT_* control is inherited). A real-git regression test
aims each of GIT_TRACE, GIT_TRACE_SETUP, GIT_TRACE2, GIT_TRACE2_EVENT and
GIT_TRACE2_PERF at /dev/stdout and requires the checkout's clean HEAD.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r3: GIT_REDIRECT_STDIN/STDOUT/STDERR survived sanitization. On Git
for Windows, GIT_REDIRECT_STDOUT sends output past the capture pipe, so a
dirty tree would read as clean and HEAD could fall back to "local".
Drop them, and GIT_CONFIG_NOSYSTEM, which the documented list already
claimed. Set GIT_TERMINAL_PROMPT=0 and GIT_NO_LAZY_FETCH=1 and run git
with stdin closed. The sanitizer test asserts all of these.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r2: "stage budgets + one stalled collective" only holds where a
cooperative deadline is checked. PROBE's DISTILL tail, surgery's
post-EXCISE restoration and VERIFY's rollback run unchecked.
Restore the pre-PR process-group timeouts (VERIFY 4 s; PROBE, surgery and
model 5 s). The observed flake was the 5 s EXCISE stage budget, and the
original collective limits held under the same load. Each reaper is now
checked stage budgets + (collectives outside stage clocks + each unchecked
interval + each stage's longest overshoot interval) x collective timeout +
one stalled collective + exit. Counts are named constants with production
source pointers: model 45 s, PROBE 520 s, surgery 695 s, VERIFY 914 s,
VERIFY rank-exit setup 638 s. The short oracles are unchanged from r2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r2: inherited GIT_DIR / GIT_WORK_TREE / GIT_INDEX_FILE and similar
variables override git -C, so the resolver could report another
repository's HEAD or dirty state. Drop every repository-, index-,
object-store-, namespace- and config-selecting variable before running
git, and set GIT_OPTIONAL_LOCKS=0 so status never writes the index.
The real-repository test fixture builds its git environment from the same
helper (plus stripping any other GIT_* variable) so the two cannot drift.
A new test redirects GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE to a second
repository, with and without an invalid GITHUB_SHA, and requires the
checkout's own HEAD and dirty state.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r1:
- The model gloo ordinary worker runs three sequential gathers, so its
reaper is now 3 x collective + exit (120 s) instead of 60 s.
- VERIFY rank_exit had inherited the 30 s ordinary collective limit and
the 240 s reaper, so a hung survivor could still pass. It gets back its
own 4 s group limit, an 18 s failure reaper that starts after setup,
and an in-rank assertion that the survivor fails within 12 s of the
verify_before boundary. A reaper-killed survivor now fails the test.
State the reaper policy at each file's constants: a collective timeout
bounds one stalled wait, so each reaper covers the stage budgets in its
window plus one stalled collective plus cleanup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r1: a non-empty but invalid GITHUB_SHA short-circuited the
resolver to "local" even when the repository HEAD was valid. Validate
each source on its own and fall back to "local" only if both fail.
Move the git helpers to scripts/conditional_gate_metadata.py and use them
from conditional_gate_summary.py too, so the workflow summary records the
same git_sha and git_dirty. Add summary-producer cases and a real
temporary-repository test for clean, tracked-dirty and untracked states.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a contended host (load ~16, nice 10) three live VERIFY tests failed
with LMS_EXCISE_TIMEOUT: the 5 s EXCISE setup budget, which those tests
do not exercise, ran out during spawn, torch import and rendezvous. The
same file passed 71/71 alone.
Name the budgets, raise only the ones that are not under test (ordinary
EXCISE/VERIFY/PROBE stages and collectives), and derive each outer
reaper from the stage budgets it must outlast. Timeout, rank-loss and
hang oracles keep their short limits and unchanged assertions. Healthy
runs do not wait longer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gate runs on lab hosts have no GITHUB_SHA, so every report said
git_sha "local" and the evidence could not be tied to a commit from the
summary alone. Resolve GITHUB_SHA, then git rev-parse HEAD of the
script's repository, then "local"; accept only 40/64-char lowercase hex.
Add git_dirty (tracked changes at report time; null when git is
unavailable). schema_version stays 1; the field is additive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 54f600e (both regressions from r6):
- The direct-chain shortcut returned an ancestor hook from one direct
registration while a hooked container alias disagreed (FP32 -> BF16
flip). Only the projection's own hook still short-circuits; ancestor
hooks require agreement across all indexed paths, including container
aliases, or resolution raises.
- Automatic input-device resolution still enumerated the whole graph
downward and exhausted the budget on an alias-free 48 x 128 expert model,
so resolve_input_execution_device raised before its CPU-storage
fallback. It now uses the budgeted parent index and walks upward from the
target.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 5a4835e: with no manifest global shape, a sharded head fell back
to mutable config.vocab_size, so 16-row shards with config vocab 16 passed
on both ranks. A vocab-sharded head now needs the manifest global row
extent corroborated by the live local weight shape and a complete even
shard layout (local rows x world size, per-rank start/end and rank
shards); config alone never establishes it, and anything else fails closed
with LMS_VERIFY_FORWARD_CONTRACT in baseline and post-edit revalidation.
Docs state the exact rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of f962934:
- The traversal budget was checked per pop, after materializing all
children and queueing copied path sets, so wide or deep trees could
exhaust memory first. The walk is now a lazy DFS with one mutable path;
every edge read (including pruned edges) and every generated state is
charged before it happens.
- Admission scanned the whole model per layer, rejecting large alias-free
models (48 layers x 128 experts). A decisive own or direct-chain hook now
skips alias enumeration, and one reusable parent index per admission call
derives ancestry upward from the target.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 579125a:
- For a vocab-sharded head the observed logits width was accepted as the
vocabulary, so identical shard-width outputs passed. The width must now
match the manifest global row extent (config as fallback); without a
trusted extent VERIFY fails closed with LMS_VERIFY_FORWARD_CONTRACT.
- Refusal decisions took argmax over the full padded width, so a model-only
column could win and hide a refusal. Selection is restricted to tokenizer
ids; full-width log_softmax and finiteness checks are unchanged.
- Adds real 2-process gloo cases (padded vocab, shard-width mismatch, rank
width disagreement) asserting identical exact codes and rollback, and
tightens the gloo code-agreement test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of ced0acb:
- Per-segment paths could compose into a cycle (attention.parent = layer
gave projection -> layer -> attention -> layer -> root and picked the
layer CPU hook over attention CUDA hook). Composed routes must now be
acyclic and segment walks may not cross other ancestry anchors; proven
direct edges are kept.
- Resolution work was unbounded (shared-subgraph re-expansion, 64^3
products). Alias walks now fail closed past 10,000 node visits and
composition past 256 paths, with deterministic budget tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VERIFY's batch forward vote required logits.shape[2] == plan.vocab_size,
where plan.vocab_size is the tokenizer vocabulary. Models commonly pad
their output vocabulary beyond the tokenizer (the TP2 fixture: 32 vs 9;
also Llama-3, Qwen), so VERIFY rejected them, and any contract or
forward failure was reported as LMS_VERIFY_NONFINITE. Found on 2x A100
(llama-tp-local-gpu baseline: logits (2,2,32), tokenizer vocab 9, all
finite).
- New closed codes LMS_VERIFY_FORWARD_FAILED (forward raised) and
LMS_VERIFY_FORWARD_CONTRACT (logits type/layout/shape/vocab/device/
dtype or rank disagreement); NONFINITE is finiteness-only. Votes run in a
fixed order so every rank raises the same code.
- Output width must equal the model's own vocabulary (replicated head
weight, out_features or config; observed and rank-agreed width for a
sharded head), be >= the tokenizer vocabulary, and match between the
pristine and post-edit evaluations. Token ids stay tokenizer-bounded.
Memory admission accounts for the full output width.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 9eabacc: lstat/O_NOFOLLOW only protected the final path
component, so a symlinked ancestor (e.g. /var/run) was accepted and
mkdir(parents=True) followed ancestors before validation. The opt-in log
directory is now walked from "/" one component at a time with
O_DIRECTORY|O_NOFOLLOW relative to the parent fd, missing components are
created 0700 relative to that fd, relative paths and ".." are rejected,
and ownership/permissions are checked on the final opened fd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 6496f18:
- An unregistered projection fell back to [projection, attention, layer,
model] and skipped the layer's known registered path (e.g. a hooked
model.model), so a CPU root could win over a CUDA backbone.
- The projection path was taken relative to the layer, so an alias
registered before self_attn could bypass the attention module's hook.
Ancestry is now composed from independent segments (projection ->
attention, attention -> layer, layer -> root), each with all registered
alias paths. A direct unregistered attribute proves only its own edge.
Every composed path must agree; a gap without a decisive nearer hook
raises "unresolved attention ancestry" (fail closed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 91227c3: toggling Transformers progress bars also flips
huggingface_hub global and per-group progress state, and the disable ran
outside the restore boundary. The guard now captures the Transformers
flag and the Hub global and group state, disables inside try/finally, and
restores each piece exactly (best effort per piece, never masking the
original exception). Only the resource tracker is pre-started; forkserver
is not claimed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of e3ab98d: OBLITERATUS_TP_WORKER_LOG_DIR accepted existing
world-writable or symlinked directories. It must now be a private
(owner-only, no group/other write) non-symlink directory owned by the
current user, and log files are created relative to an O_NOFOLLOW
directory fd with O_EXCL and mode 0600; anything else fails closed. The
launch/wait fd test now tracks each launch's descriptors separately so it
no longer depends on fd number reuse.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of f28d02a: rows were accepted by minimum length, so a row missing
its diagonal X could map GPU0->GPU1 as NV12 and satisfy --require-link
nvlink while the reciprocal row said PHB. parse_topology now requires
exactly one complete row per header GPU, an X diagonal, known link tokens
(NV#, PIX, PXB, PHB, NODE, SYS) and symmetric links, and raises
otherwise so diagnostics record an error instead of a false pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Native TP load set ParameterManifestEntry.local_value_digest and
replicated_value_digest with model._tensor_digest (sha256 of raw bytes),
while EXCISE (_build_operation_plan) and VERIFY (_logical_state_roots with
require_manifest_values) compare probe_contracts.tensor_digest (dtype +
shape + bytes). The pristine-digest check could therefore never pass on
the native TP path: both ranks of llama-tp-local-gpu on 2x A100 failed
EXCISE with "mutable parameter storage or pristine digest changed".
Load now uses probe_contracts.tensor_digest and the raw-bytes helper is
deleted; hashing failures keep LMS_RUNTIME_PROFILE_MISMATCH. A CPU
contract test builds the manifest through the real load-validation path
and feeds it to the real EXCISE admission and VERIFY value checks
(accept unchanged, reject one-element mutation), plus BF16/FP32 digest
identity.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 4acb271:
- Explicit [projection, attention, layer, model] ancestry skipped real
hook owners such as Llama's model.model and any container between layer,
attention and projection. Attention admission now builds the complete
registered path through THIS layer (projection -> layer -> root) and only
falls back to the explicit list for unregistered wrappers.
- Alias enumeration via named_modules(remove_duplicate=False) recursed
through registered back-references. It is now an iterative walk with a
path-local ancestor guard and a 64-path bound.
- The target's own hook decides before any alias scan, and the
unsupported-hook message no longer mentions the input embedding.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pytest replaces sys.stdout/sys.stderr with capture objects, so print()
never reached fd 1/2 and the fail-closed tests could not trip. Write the
canaries with os.write on the real descriptors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On 2x A100 the native TP2 session failed in two ways inside the fd
redirect containment:
- a multiprocessing.resource_tracker started lazily during the redirect
inherited the sink pipe as stdout, so the reader never saw EOF and
teardown hard-exited 70;
- transformers' "Loading weights" progress bar wrote to stderr and
tripped LMS_DIAGNOSTIC_REDACTION_FAILED.
Start the resource tracker before redirecting, and disable transformers
progress bars while either guard is active (restored afterwards). Real
output still fails closed; a hung reader still exits 70.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>