sched: address R2 fail-closed and fault-proof findings

This commit is contained in:
lda
2026-09-08 10:27:37 +07:00 Verified
parent 3cd61be96d
commit cf8d28f1ff
5 changed files with 113 additions and 30 deletions
+16 -5
View File
@@ -100,10 +100,13 @@ class WorkflowRunApi:
max_steps=limits.max_steps,
)
# Durable admission ordering: recheck -> allocate/freeze -> persist
# admission -> materialize view -> dispatch captured -> persist
# stopped -> reconcile. A failed durable admission never dispatches,
# and dispatch never re-resolves the deployment.
# Durable admission ordering for manual runs: deployment recheck ->
# allocate/freeze -> persist admission -> materialize view -> dispatch
# captured -> persist stopped. A failed durable admission never
# dispatches, and dispatch never re-resolves the deployment.
# TODO(T11): hold the single-owner admission lock around this sequence
# once scheduler ownership lands; manual recheck here is only
# deployment validation (no schedule/capacity/overlap yet).
store = self._run_store()
run_id = store.allocate_run_id()
environment = create_pinned_environment(
@@ -119,6 +122,9 @@ class WorkflowRunApi:
max_steps=limits.max_steps,
)
materialize_admitted_view(store=store, admission=admission)
# TODO(T10): record a dispatch mark between materialize and execute so
# crash-after-dispatch (abandoned, failed without replay) is
# distinguishable from pending-dispatch (safe to dispatch later).
plan = raw_plan_from_artifact(admission.environment.root_artifact)
captured_tree = saved_subgraph_tree_from_snapshots(
admission.environment.child_artifacts
@@ -282,7 +288,12 @@ class WorkflowRunApi:
}
async def inspect_run(self, *, run_id: str) -> RunResult:
"""Return one durable stopped-run summary without debug trace entries."""
"""Return one durable stopped-run summary without debug trace entries.
Admitted runs with no stopped checkpoint fail closed here (no
fabricated trace/output); checkpoint-free inspection arrives with
the scheduling administration surface (T13).
"""
record, run = load_stored_run(self._run_store(), run_id)
environment = record.environment
return _run_payload(