=3.10","schema_version":1,"sha256":"da07e5b564960dbd288e8d39ada481f9549101b0a9ca6629c88033f0e8d908b7","source_hash":"3d55fcb9c1021ebf424f0363f4c69a3574191b572844cd4b075f19b22cf77545"}
+{"builder":"scripts/build_codex_plugin.py","python_requires":">=3.10","schema_version":1,"sha256":"2aad922f5ca25f8b930efcadedcd13bbeeea9ce2a32eceebeab73b1e72b6d956","source_hash":"565602d788fd0b1410967fac6138fd5127689bafa7935cf8b216e8fadcbbcc55"}
diff --git a/src/marginal/killer_demo.py b/src/marginal/killer_demo.py
index 2d270ba..cab15eb 100644
--- a/src/marginal/killer_demo.py
+++ b/src/marginal/killer_demo.py
@@ -12,6 +12,7 @@
from .adapters import funded_call
from .budget import BudgetLimits
+from .controls import ActionOutcomeStatus, NoProgressConfig, NoProgressDetector
from .models import Action, Cost
from .policy import MarginalPolicy, PolicyConfig
from .treasury import Treasury
@@ -577,6 +578,67 @@ def render_killer_demo_svg(result: dict[str, Any]) -> str:
)
+_NO_PROGRESS_OBSERVATIONS: tuple[tuple[str, str, str], ...] = (
+ ("patch:apply", "w#4f2a", "e#91c0"),
+ ("verify:targeted", "w#8b13", "e#2d77"),
+ ("verify:targeted", "w#8b13", "e#2d77"),
+ ("verify:targeted", "w#8b13", "e#2d77"),
+)
+
+
+def build_no_progress_trace() -> list[dict[str, Any]]:
+ detector = NoProgressDetector()
+ rows: list[dict[str, Any]] = []
+ for tick, (semantic_key, state_hash, evidence_hash) in enumerate(
+ _NO_PROGRESS_OBSERVATIONS, start=1
+ ):
+ signal = detector.evaluate(semantic_key, state_hash, evidence_hash)
+ rows.append(
+ {
+ "tick": tick,
+ "action": semantic_key,
+ "state": state_hash,
+ "evidence": evidence_hash,
+ "outcome": ActionOutcomeStatus.SUCCESS.value,
+ "reason_code": signal.reason_code,
+ "reason": signal.reason,
+ "should_recommend_stop": signal.should_recommend_stop,
+ "enforcement_eligible": signal.enforcement_eligible,
+ }
+ )
+ detector.observe(semantic_key, state_hash, evidence_hash, ActionOutcomeStatus.SUCCESS)
+ return rows
+
+
+def render_no_progress_trace() -> str:
+ rows = build_no_progress_trace()
+ width = max(len(str(row["action"])) for row in rows)
+ lines = [
+ "# MARGINAL no-progress pattern",
+ "# illustrative deterministic sequence, replayed from the shipped control",
+ "# not provider telemetry, not an enforcement benchmark",
+ f"# threshold: max_same_evidence_completions="
+ f"{NoProgressConfig().max_same_evidence_completions}",
+ "",
+ ]
+ for row in rows:
+ lines.append(
+ f"t{row['tick']} {str(row['action']).ljust(width)} outcome={row['outcome']} "
+ f"state={row['state']} evidence={row['evidence']} -> {row['reason_code']}"
+ )
+ lines.append(f" {row['reason']}")
+ lines.extend(
+ [
+ "",
+ "Shadow Mode records the stop recommendation; the action still executes.",
+ "Earned Enforcement is separate. It requires an adapter with real blocking",
+ " capability and sufficient local evidence, and this",
+ " illustration grants none of it.",
+ ]
+ )
+ return "\n".join(lines) + "\n"
+
+
def build_killer_demo_playback(result: dict[str, Any]) -> dict[str, Any]:
baseline_outputs = {
(item["stage"], item["name"]): item["output"] for item in result["baseline_actions"]
@@ -1085,6 +1147,45 @@ def render_killer_demo_css() -> str:
.proof-card h3 { margin: 0 0 8px; }
.proof-card p, .proof-card li { color: var(--muted); font-size: 12px; line-height: 1.55; }
.proof-card code { color: #dce6f0; font: 11px var(--mono); }
+.pattern { margin: 0 0 42px; }
+.snippet {
+ margin-top: 14px;
+ border: 1px solid #222d38;
+ border-radius: 12px;
+ background: #05080c;
+ overflow: hidden;
+}
+.snippet-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ gap: 12px;
+ padding: 10px 13px;
+ border-bottom: 1px solid #222d38;
+ color: var(--muted);
+ font: 800 9px var(--mono);
+ letter-spacing: .08em;
+}
+.snippet-copy { padding: 7px 12px; font-size: 9px; }
+.snippet-body {
+ margin: 0;
+ max-height: 340px;
+ overflow: auto;
+ padding: 13px;
+ color: #9eabb7;
+ font: 11px/1.55 var(--mono);
+ white-space: pre;
+ scrollbar-width: thin;
+}
+.snippet-body:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
+.snippet-status {
+ min-height: 15px;
+ margin: 0;
+ padding: 0 13px 11px;
+ color: var(--lime);
+ font: 10px var(--mono);
+}
.legacy-contract { display: none; }
.footer {
display: flex;
@@ -1183,6 +1284,9 @@ def render_killer_demo_js() -> str:
stages: $$('[data-stage]'),
baselineLane: $('[data-lane="baseline"]'),
marginalLane: $('[data-lane="marginal"]'),
+ copyTrace: $('[data-action="copy-trace"]'),
+ trace: $("#no-progress-trace"),
+ copyStatus: $("#copy-status"),
};
function metric(lane, name) {
@@ -1370,6 +1474,51 @@ def render_killer_demo_js() -> str:
dom.pause.disabled = true;
}
+ function announceCopy(message) {
+ if (dom.copyStatus) dom.copyStatus.textContent = message;
+ }
+
+ function copyWithSelection(text) {
+ const restore = document.activeElement;
+ const holder = document.createElement("textarea");
+ holder.value = text;
+ holder.setAttribute("readonly", "");
+ holder.setAttribute("aria-hidden", "true");
+ holder.style.position = "fixed";
+ holder.style.top = "-1000px";
+ holder.style.opacity = "0";
+ document.body.appendChild(holder);
+ holder.select();
+ let copied = false;
+ try {
+ copied = document.execCommand("copy");
+ } catch (error) {
+ copied = false;
+ }
+ holder.remove();
+ if (restore instanceof HTMLElement) restore.focus();
+ return copied;
+ }
+
+ function copyTrace() {
+ if (!dom.trace) return;
+ announceCopy("");
+ const text = dom.trace.textContent || "";
+ const copied = () => announceCopy("No-progress trace copied.");
+ const blocked = () =>
+ announceCopy("Copy was blocked. Select the trace and copy it manually.");
+ if (navigator.clipboard && navigator.clipboard.writeText) {
+ navigator.clipboard.writeText(text).then(copied, () => {
+ if (copyWithSelection(text)) copied();
+ else blocked();
+ });
+ return;
+ }
+ if (copyWithSelection(text)) copied();
+ else blocked();
+ }
+
+ dom.copyTrace?.addEventListener("click", copyTrace);
dom.run?.addEventListener("click", playRace);
dom.pause?.addEventListener("click", pauseRace);
dom.step?.addEventListener("click", () => {
@@ -1384,7 +1533,7 @@ def render_killer_demo_js() -> str:
document.addEventListener("keydown", (event) => {
const tag = document.activeElement?.tagName || "";
- if (["INPUT", "SELECT", "TEXTAREA", "BUTTON"].includes(tag)) return;
+ if (["INPUT", "SELECT", "TEXTAREA", "BUTTON", "PRE"].includes(tag)) return;
if (event.code === "Space") {
event.preventDefault();
state.playing ? pauseRace() : playRace();
@@ -1464,6 +1613,7 @@ def render_killer_demo_html(result: dict[str, Any]) -> str:
Race
Proof
+ Pattern
Trace
GitHub ↗
@@ -1649,6 +1799,44 @@ def render_killer_demo_html(result: dict[str, Any]) -> str:
+
+
+ QUOTABLE MECHANISM · ILLUSTRATIVE
+ The no-progress pattern, in four lines.
+
+ Same semantic action, successful outcome, unchanged workspace state, no new evidence.
+ That is the sequence MARGINAL treats as a no-progress repetition candidate. The trace
+ below is replayed from the shipped control over a fixed synthetic observation
+ sequence, so it is an illustration of the mechanism and not provider telemetry,
+ a production run, or an enforcement benchmark.
+
+
+
+ no-progress-trace.txt
+ COPY TRACE
+
+
{{NO_PROGRESS_TRACE}}
+
+
+
+ Shadow Mode records that recommendation and still lets the action execute. Earned
+ Enforcement is a separate authority that an adapter has to earn from local evidence,
+ and nothing on this page grants it.
+
+
+
+
MARGINAL Killer Demo
Same verified outcome. Far fewer tokens, lower cost, lower latency.
@@ -1685,6 +1873,7 @@ def render_killer_demo_html(result: dict[str, Any]) -> str:
"{{SCENARIO}}": html.escape(str(result["scenario"])),
"{{VERIFIER}}": html.escape(str(result["defect"]["verifier"])),
"{{DISCLAIMER}}": html.escape(str(result["disclaimer"])),
+ "{{NO_PROGRESS_TRACE}}": html.escape(render_no_progress_trace()),
"{{BASELINE_TOKENS}}": f"{baseline['tokens']:,}",
"{{MARGINAL_TOKENS}}": f"{marginal['tokens']:,}",
"{{BASELINE_CALLS}}": str(baseline["calls"]),
diff --git a/tests/test_killer_demo_interactive.py b/tests/test_killer_demo_interactive.py
index 571e5f9..28100e4 100644
--- a/tests/test_killer_demo_interactive.py
+++ b/tests/test_killer_demo_interactive.py
@@ -2,11 +2,14 @@
from pathlib import Path
+from marginal.controls import ActionOutcomeStatus, NoProgressDetector
from marginal.killer_demo import (
build_killer_demo_playback,
+ build_no_progress_trace,
render_killer_demo_css,
render_killer_demo_html,
render_killer_demo_js,
+ render_no_progress_trace,
run_killer_demo,
)
@@ -89,3 +92,80 @@ def test_committed_interactive_assets_are_generated(tmp_path: Path) -> None:
for name in ("demo.css", "demo.js"):
assert (committed / name).read_bytes() == (tmp_path / name).read_bytes()
+
+
+def test_no_progress_trace_is_replayed_from_the_shipped_control() -> None:
+ rows = build_no_progress_trace()
+
+ assert [row["reason_code"] for row in rows] == [
+ "NO_PROGRESS_CLEAR",
+ "NO_PROGRESS_CLEAR",
+ "NO_PROGRESS_OBSERVED",
+ "NO_PROGRESS_ENFORCEMENT_ELIGIBLE",
+ ]
+ assert [row["should_recommend_stop"] for row in rows] == [False, False, False, True]
+ assert [row["enforcement_eligible"] for row in rows] == [False, False, False, True]
+
+ assert [row["action"] for row in rows] == [
+ "patch:apply",
+ "verify:targeted",
+ "verify:targeted",
+ "verify:targeted",
+ ]
+
+ detector = NoProgressDetector()
+ for row in rows:
+ signal = detector.evaluate(row["action"], row["state"], row["evidence"])
+ assert signal.reason_code == row["reason_code"]
+ assert signal.reason == row["reason"]
+ detector.observe(
+ row["action"],
+ row["state"],
+ row["evidence"],
+ ActionOutcomeStatus.SUCCESS,
+ )
+
+
+def test_no_progress_snippet_is_labeled_and_keeps_the_authority_boundary() -> None:
+ snippet = render_no_progress_trace()
+
+ assert "illustrative deterministic sequence" in snippet
+ assert "not provider telemetry, not an enforcement benchmark" in snippet
+ assert "max_same_evidence_completions=2" in snippet
+ assert "t2 verify:targeted" in snippet
+ assert "t4 verify:targeted" in snippet
+ assert "Shadow Mode records the stop recommendation" in snippet
+ assert "Earned Enforcement is separate." in snippet
+
+
+def test_interactive_html_publishes_a_copyable_no_progress_trace() -> None:
+ rendered = render_killer_demo_html(run_killer_demo())
+
+ required = (
+ 'id="no-progress"',
+ 'data-action="copy-trace"',
+ 'id="no-progress-trace"',
+ 'id="copy-status"',
+ 'aria-live="polite"',
+ 'aria-label="Illustrative no-progress trace"',
+ "tabindex=",
+ "NO_PROGRESS_ENFORCEMENT_ELIGIBLE",
+ "not provider telemetry",
+ )
+ for phrase in required:
+ assert phrase in rendered, phrase
+
+
+def test_copy_affordance_keeps_keyboard_and_reduced_motion_support() -> None:
+ css = render_killer_demo_css()
+ js = render_killer_demo_js()
+
+ assert ".snippet-body" in css
+ assert ".snippet-body:focus-visible" in css
+ assert "prefers-reduced-motion" in css
+
+ assert "function copyTrace" in js
+ assert "restore.focus()" in js
+ assert '"PRE"' in js
+ assert "ArrowRight" in js
+ assert "fetch(" not in js
From eb7d375e96f87498f76eb324abc1bb5c7c7e6b9e Mon Sep 17 00:00:00 2001
From: abhinandanjoshii <113920019+abhinandanjoshii@users.noreply.github.com>
Date: Fri, 11 Sep 2026 12:38:03 +0530
Subject: [PATCH 2/2] fix: rebuild the Codex plugin runtime for the current
source tree
---
plugins/marginal/runtime/marginal_runtime.pyz | Bin 750206 -> 750023 bytes
plugins/marginal/runtime/provenance.json | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/marginal/runtime/marginal_runtime.pyz b/plugins/marginal/runtime/marginal_runtime.pyz
index fd4736e956de9d10c134ee890e5c579fe8dba342..c8c17fc3b907d0c214e53dabe9d6ce5cd810f152 100644
GIT binary patch
delta 544
zcmezOMECe(-G&y%7N!>F7M2#)Eo_B9IWw;7+MBU3GMH_z`pI@HZ2RT__Swws%R<|pL(Ys$>g?YG@8zm1r$EPHQhan+ku%UnsfSt
zXikagETP;2)2D9a6yRZif+dX?HcUU4#cj*KfkyB6J6$}7+n%YEcX~t)kpEj~`p0~3;pwY$xJ{XAg&`b$2`;v2qFf@=`E$9o
zn6`<*Ma8D47Xqz*Da(aywTdiU0o!x|IWAs^s$;o8pSe$emD?fJ8QRLPY)-0K;fb4}>Gy2b2c-NDCO!lL~>M(Ku)N
er9y58rht#rMT&q5t1YGn7jdhyoe1Iv1~dR-yS5kr
delta 619
zcmYk2%WD%+6vi_*ZQ{(au@Es-EsOy{YvV#))J4-;T@;E&8Y~txI!P|`$~^LDu`aB_
zNTE=1Q;uMLbg3X13FZ%Q;YJs_w74j`&_Z0e(QZc1bfk81xO~6we&2n({gUy&W^Q|e
z$GoW5<#o4W)lKn8&Ft-T36W0w=4R~E)S+}bJ;~jQGAB1QF4r~Pb$MB~os3&^)EckX
z(dfjFCFDA<&TzZLk5fQu=Pt&dM)AqfX!ixX%xhcOlH<-P#R`|HO}8@*extFoM{d-V
z5}7l_ieA^~49DJzmAU1}uA+v`3mf@3%`O^|Mrv>5;ZE}Zt+AoP6uax=I~B6*@(}LU
zAS?XFiD3DNiyE9^4^(_ll0CbJJvxjC-|@UocpmV+4x_>w{Gh`*w$Q|s0mISPO%V?^
z#XfWm7+|X{Trp_VFZ^s!X8Ie-CRI5;UN>Qc4JL3k(65rXZo)V_wKrIkn5|HwmD(0D
zyp@uA@kNCy*ZOzh>3*pP{{+|{_=hbRW7f$~EL$)k__%JtBwNmf?6D0ZKF>)Byk=9*
zy0neQSgR035V?2Vn}`{(jL4Lko`O)4;?tmOf3|%nzRo^mu!78B;zg&v;0yh
p3QJ_aB%3~O&7}tqJ;DQ37-jLFc(qC!Pn^b;Djbf@=OGe_`~`Rp*pvVO
diff --git a/plugins/marginal/runtime/provenance.json b/plugins/marginal/runtime/provenance.json
index 29bf54b..3e53404 100644
--- a/plugins/marginal/runtime/provenance.json
+++ b/plugins/marginal/runtime/provenance.json
@@ -1 +1 @@
-{"builder":"scripts/build_codex_plugin.py","python_requires":">=3.10","schema_version":1,"sha256":"2aad922f5ca25f8b930efcadedcd13bbeeea9ce2a32eceebeab73b1e72b6d956","source_hash":"565602d788fd0b1410967fac6138fd5127689bafa7935cf8b216e8fadcbbcc55"}
+{"builder":"scripts/build_codex_plugin.py","python_requires":">=3.10","schema_version":1,"sha256":"b39f7844b1284e2d7dde4223e1fd5f54d194afc39d8ff85c2b7c1c3f2ac8c0b2","source_hash":"033cdfa97274975b3814519313f82c3aee356dcd510ad3cf717b9fe4063ade22"}