Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fd75da4
feat(lifecycle): isolate verdict admission and its finite models
alphastorm Nov 14, 2026
74af085
fix(lifecycle): classify record entries and normalize executable attr…
alphastorm Nov 14, 2026
a712a09
test(lifecycle): keep baseline stop fixture with baseline loop
alphastorm Nov 14, 2026
2eff111
test(lifecycle): walk every recorded role over reader outcomes
alphastorm Nov 14, 2026
1c03a36
fix(lifecycle): keep unreadable recorded roles non-quiescent
alphastorm Nov 14, 2026
8fee7bd
test(lifecycle): reproduce ambiguous roles and launcher evidence
alphastorm Nov 14, 2026
d84a969
fix(lifecycle): distinguish malformed and unrecorded role evidence
alphastorm Nov 14, 2026
2bf75c3
test(lifecycle): pin uncertain identity refusals at every consumer
alphastorm Nov 14, 2026
8341ad1
fix(lifecycle): preserve actionable evidence in admission refusals
alphastorm Nov 14, 2026
ab9861c
test(lifecycle): reproduce unreadable configured-port evidence
alphastorm Nov 14, 2026
9698b13
fix(lifecycle): refuse an unreadable configured-port probe
alphastorm Nov 14, 2026
a29d23d
test(lifecycle): require the specific retained-job refusal reason
alphastorm Nov 14, 2026
3d3850c
test(lifecycle): require counter proof and manual uncertainty recovery
alphastorm Nov 14, 2026
59f8b78
fix(lifecycle): name uncertain PIDs and manual record recovery
alphastorm Nov 14, 2026
de42788
test(lifecycle): require coherent launcher and census fixtures
alphastorm Nov 14, 2026
f5f23bf
test(lifecycle): keep fake launcher and census identity coherent
alphastorm Nov 14, 2026
7c7b0d3
test(lifecycle): scope launcher evidence to launch and quiescence
alphastorm Nov 14, 2026
87544e6
fix(lifecycle): consult launcher before launch or quiescence
alphastorm Nov 14, 2026
453f7c3
test(lifecycle): reject recovery advice legacy stop cannot perform
alphastorm Nov 14, 2026
4e1ef58
test(lifecycle): supply explicit fake stop logger
alphastorm Nov 14, 2026
7a63250
test(lifecycle): fake lookup rather than legacy comparison
alphastorm Nov 14, 2026
528e3da
fix(lifecycle): name manual recovery outside legacy stop selection
alphastorm Nov 14, 2026
5f03d1e
test(controller): retain private admission refusal evidence
alphastorm Nov 14, 2026
41a3246
fix(controller): keep refusal details in private experiment evidence
alphastorm Nov 14, 2026
0cba10d
test(lifecycle): expose independent legacy admission decisions
alphastorm Nov 14, 2026
92e6b92
test(lifecycle): close the inventory over retained legacy readers
alphastorm Nov 14, 2026
df6ba9b
test(lifecycle): execute stop custody gate and candidate rescans
alphastorm Nov 14, 2026
59b7541
test(lifecycle): require local state reasons and truthful references
alphastorm Nov 14, 2026
38db8af
docs(lifecycle): describe verdict rows at their definition
alphastorm Nov 14, 2026
82d125d
test(lifecycle): walk launch fencing and manual cleanup advice
alphastorm Nov 14, 2026
eca19d4
test(lifecycle): allow already-ended candidates in recovery lists
alphastorm Nov 14, 2026
6359fdc
fix(lifecycle): fence launches before manual survivor cleanup
alphastorm Nov 14, 2026
985bead
test(lifecycle): expose wildcard and census admission bypasses
alphastorm Nov 14, 2026
276135e
test(lifecycle): reject reader stars and inventory census entry points
alphastorm Nov 14, 2026
3d2ec44
test(lifecycle): expose scoped census alias masking
alphastorm Nov 14, 2026
94fc9f1
test(lifecycle): reject conflicting reader alias bindings
alphastorm Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions omp_strata/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def cmd_install(args: argparse.Namespace) -> int:
with lifecycle.FileLock(layout.lock_file):
if getattr(args, "idle_generation", None) is not None:
lifecycle.idle_generation(layout, expected=args.idle_generation)
root = lifecycle.verdict(layout)
if not root.quiescent:
raise lifecycle.LifecycleError(f"install refused: the root is {root.state}; {root.refusal}")
record = install_mod.install(layout, log=eprint)
_print({k: record[k] for k in ("profile_id", "runtime_identity_sha256", "strata_commit",
"mtp_tensor_manifest_sha256", "python")})
Expand Down
406 changes: 355 additions & 51 deletions omp_strata/lifecycle.py

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion scripts/experiment_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,11 @@ def require_idle(self, layout, deadline, *, locked=False):
try:
return lifecycle.idle_generation(layout, expected=self.admission_generation,
timeout=max(0, deadline - time.monotonic()))
except lifecycle.LifecycleError:
except lifecycle.LifecycleError as exc:
private = layout.root / "evidence/experiments"
with self.root_fence(), self.output_fence(private):
with (private / f"{time.time_ns()}.err").open("xb") as diagnostic:
diagnostic.write(f"prior_candidate_generation_unproved: {exc}\n".encode("utf-8", "backslashreplace"))
raise ExperimentError("prior_candidate_generation_unproved") from None

def reservation(self, *, require_closed_port=False):
Expand Down
58 changes: 47 additions & 11 deletions tests/unit/test_experiment_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from omp_strata import cli, install, lifecycle
from omp_strata.common import atomic_write_json, sha256_file
from scripts import experiment_loop as loop
from tests.unit.test_lifecycle_evidence import complete_table
from tests.unit.test_process_jobs import KernelStub

BASELINE = "win11-rtxpro6000-iq3s-262k-slots4-parking-strata0.2.3-omp18.12.6"
Expand Down Expand Up @@ -292,8 +293,8 @@ def test_import_has_no_native_or_controller_effects(self):
def test_pending_start_cannot_be_overwritten_by_another_start(self):
root = self.root / "pending"
root.mkdir()
layout = SimpleNamespace(run_record=root / "run.json", lock_file=root / "lock",
profile=SimpleNamespace(data={"server": {}}))
layout = SimpleNamespace(run_record=root / "run.json", install_record=root / "install.json", lock_file=root / "lock",
strata=root / "runtime" / "strata", profile=SimpleNamespace(data={"server": {}}))
atomic_write_json(layout.run_record, {"state": "launching", "launch_id": "existing"})
before = layout.run_record.read_bytes()
with patch.object(lifecycle, "verify_install_fast") as verify, self.assertRaisesRegex(
Expand Down Expand Up @@ -432,6 +433,35 @@ def native_adapter(self):
adapter.check_root(create=True)
return adapter

def test_idle_refusal_keeps_private_detail_without_opening_the_public_reason(self):
adapter = self.native_adapter()
layout = adapter.layouts["candidate"]
private = layout.root / "evidence/experiments"
for locked, cause in itertools.product((False, True), ("cannot-say", "survivor", "census")):
with self.subTest(locked=locked, cause=cause):
recorded = fixture_process(101).as_dict()
recorded["created"] = "Fri Nov 13 12:34:56 2026"
atomic_write_json(layout.run_record, {"state": "stopped", "server": recorded})
rows = {101: lifecycle.procs.ProcInfo(101, 0, "Fri Nov 13 12:34:57 2026", recorded["exe"])}
required = ("server pid 101", "cannot prove", "by hand", str(layout.run_record))
if cause == "survivor":
rows = {77: lifecycle.procs.ProcInfo(77, 0, "77", str(layout.strata / "orphan"))}
required = ("unrecorded[77]", "pid 77", "inspect", "end", "by hand", "`status`")
elif cause == "census":
required = ("process census unavailable", "fake census fault", "retry `status`")
before = set(private.glob("*.err"))
with patch.object(lifecycle, "process_table", return_value=complete_table(rows),
side_effect=lifecycle.procs.TableUnavailable("fake census fault") if cause == "census" else None), \
patch.object(lifecycle.ProcessJob, "scan", side_effect=AssertionError("must refuse before scan")), \
self.assertRaises(loop.ExperimentError) as failure:
adapter.require_idle(layout, time.monotonic() + 10, locked=locked)
self.assertEqual("prior_candidate_generation_unproved", str(failure.exception))
added = set(private.glob("*.err")) - before
self.assertEqual(1, len(added))
diagnostic = added.pop().read_text(encoding="utf-8")
for detail in required:
self.assertIn(detail, diagnostic)

def ready_adapter(self):
adapter = self.native_adapter()
layout = adapter.layouts["candidate"]
Expand Down Expand Up @@ -681,7 +711,7 @@ def command(arm, script, args, timeout, **kwargs):
with patch.object(loop.nvfp4, "staging_preflight"), \
patch.object(lifecycle, "keygen", side_effect=effect), \
patch.object(lifecycle, "verify_install_fast", side_effect=effect), \
patch.object(lifecycle, "running", return_value={}), \
patch.object(lifecycle, "process_table", return_value=complete_table({})), \
patch.object(lifecycle.ProcessJob, "scan", return_value={}), \
patch.object(lifecycle, "_job_kernel", return_value=KernelStub()):
try:
Expand Down Expand Up @@ -1005,7 +1035,7 @@ def test_experimental_start_skips_gpu_census_but_ordinary_start_keeps_it(self):
patch.object(lifecycle, "FileLock", MemoryLock), \
patch.object(lifecycle, "verify_install_fast", return_value={"runtime_identity_sha256": "fixture"}), \
patch.object(lifecycle, "read_key", return_value="fixture"), \
patch.object(lifecycle, "running", return_value={}), \
patch.object(lifecycle, "process_table", return_value=complete_table({})), \
patch.object(lifecycle, "port_in_use", return_value=False), \
patch.object(lifecycle, "gpu_facts", return_value={}) as census, \
patch.object(lifecycle, "gpu_busy", return_value=None), \
Expand Down Expand Up @@ -1056,9 +1086,13 @@ def information(handle, pointer):
lifecycle.directory_identity(path)

def test_partial_record_never_matches_admitted_empty_digest(self):
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / "run.json"
layout = SimpleNamespace(run_record=path)
with tempfile.TemporaryDirectory() as directory, patch.object(lifecycle, "port_in_use", return_value=False):
root = Path(directory)
path = root / "run.json"
# The stand-in carries what the lifecycle's one verdict reads: records, runtime directory, served port.
layout = SimpleNamespace(run_record=path, install_record=root / "install.json",
strata=root / "runtime" / "strata",
profile=SimpleNamespace(data={"server": {"listen_host": "127.0.0.1", "port": 1}}))
empty = lifecycle.idle_generation(layout)
atomic_write_json(path, {})
with self.assertRaisesRegex(lifecycle.LifecycleError, "partial"):
Expand Down Expand Up @@ -1094,7 +1128,7 @@ def __init__(self, manifest, bindings, kernel, cut, parent_exits, publication, p
root = Path(bindings["candidate_root"])
root.mkdir(parents=True)
self.layouts = {"candidate": SimpleNamespace(root=root, state=root, run_record=root / "run.json", lock_file=root / "lock",
install_record=root / "install.json",
install_record=root / "install.json", strata=root / "runtime" / "strata",
profile=SimpleNamespace(fingerprint=manifest["candidate"]["profile_fingerprint"], multi_gpu=False,
data=manifest["candidate"]["config"] | {"model": manifest["candidate"]["model"]}))}
self.owned_runs, self.launch_requests, self.launch_jobs, self.owned_commands = {}, {}, {}, {}
Expand All @@ -1106,7 +1140,7 @@ def __init__(self, manifest, bindings, kernel, cut, parent_exits, publication, p
atomic_write_json(self.layouts["candidate"].run_record, {
"state": "launching" if preexisting == "pending" else "ready",
"profile_fingerprint": self.layouts["candidate"].profile.fingerprint,
"wrapper": {"pid": 900}, "launch_id": "prior-generation"})
"wrapper": fixture_process(900).as_dict(), "launch_id": "prior-generation"})
kernel.live[900] = object() # Outside this invocation's job; never adopt/kill it.

reservation = FakeAdapter.reservation
Expand Down Expand Up @@ -1194,7 +1228,9 @@ def model_schedules():
patch.object(lifecycle, "read_key", return_value="fixture"), \
patch.object(lifecycle, "runtime_checks", side_effect=lambda *args, **kwargs: {
"ready": 101 in kernel.live}), \
patch.object(lifecycle, "port_in_use", return_value=False):
patch.object(lifecycle, "port_in_use", return_value=False), \
patch.object(lifecycle, "process_table",
side_effect=lambda: complete_table({pid: fixture_process(pid) for pid in kernel.live})):
result_dir = loop.run(manifest, host, bindings=local, evidence_dir=root / str(index) / "evidence",
lock_directory=root / str(index) / "locks")
result = loop.report(result_dir)
Expand Down Expand Up @@ -1245,7 +1281,7 @@ def command(arm, script, args, timeout):
"--root", str(layout.root)])
cli.cmd_install(parsed)
adapter.command = command
with patch.object(lifecycle, "running", return_value={}), \
with patch.object(lifecycle, "process_table", return_value=complete_table({})), \
patch.object(lifecycle.ProcessJob, "scan", return_value={}), \
patch.object(loop.nvfp4, "staging_preflight"), \
patch.object(install.fetch_mod, "fetch", side_effect=fetch_boundary):
Expand Down
Loading
Loading