fix(runtime): restrict running effects to launch results and index history

Only the native detached launch (bg_job_id) or a bridge's explicit detachment
marks an operation's own work as RUNNING. A listing that reports some other
download/model/job as running settled normally; treating it as running left
the claim pending forever and could block required artifacts.

EffectHistory now indexes outcomes per effect once, removing a cubic scan in
assessment over long run lineages.

Adds adversarial coverage: browser page operations stay fail-closed through
the real dispatcher with effects enabled (no claim, never dispatched),
scheduler task triggers stay unverified admission, and assessment scales.
This commit is contained in:
Alexandre Teixeira
2026-10-02 20:13:24 +01:00
parent 3953ea2444
commit 75243fe0b0
4 changed files with 64 additions and 6 deletions
+4 -1
View File
@@ -191,9 +191,12 @@ def _execution(result: Any, facts: ProducerFacts) -> ExecutionOutcome:
return ExecutionOutcome.INTERRUPTED
if facts.timed_out:
return ExecutionOutcome.TIMED_OUT
# Only launch-shaped results mean this operation's own work continues:
# the native detached launch, or a bridge's explicit detachment. A listing
# that merely reports some other thing as "running" is not.
if isinstance(result.get("bg_job_id"), str) and facts.exit_code == 0:
return ExecutionOutcome.RUNNING
if result.get("detached") is True or result.get("status") == "running" or result.get("running") is True:
if result.get("detached") is True:
return ExecutionOutcome.RUNNING
denied = bool(result.get("blocked") or result.get("approval_required")
or facts.failure_kind.endswith("_denied"))