@muggleai/works 5.32.0-staging.286 → 5.32.0-staging.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-TM6IZEKH.js → chunk-S3PUEFGM.js} +167 -84
  3. package/dist/cli.js +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  6. package/dist/plugin/.codex-mcp.json +1 -1
  7. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  8. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  9. package/dist/plugin/.mcp.json +1 -1
  10. package/dist/plugin/skills/_shared/ci-check-to-command.md +2 -2
  11. package/dist/plugin/skills/_shared/dev-loop/publish.md +1 -1
  12. package/dist/plugin/skills/_shared/failure-mode-handling.md +12 -6
  13. package/dist/plugin/skills/_shared/telemetry-events/muggle-do-escalation.md +2 -2
  14. package/dist/plugin/skills/do/cleanup.md +2 -2
  15. package/dist/plugin/skills/do/e2e-acceptance.md +6 -3
  16. package/dist/plugin/skills/do/e2e-repair.md +41 -15
  17. package/dist/plugin/skills/do/fix-ci.md +8 -4
  18. package/dist/plugin/skills/do/open-prs/forward.md +2 -2
  19. package/dist/plugin/skills/muggle-do/SKILL.md +2 -2
  20. package/dist/plugin/skills/muggle-pr-followup/contract.md +2 -1
  21. package/dist/plugin/skills/muggle-pr-followup/output-templates/blocked-reminder.md +8 -0
  22. package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +5 -0
  23. package/dist/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +11 -4
  24. package/dist/release-manifest.json +3 -3
  25. package/package.json +1 -1
  26. package/plugin/.claude-plugin/plugin.json +1 -1
  27. package/plugin/.codex-mcp.json +1 -1
  28. package/plugin/.codex-plugin/plugin.json +1 -1
  29. package/plugin/.cursor-plugin/plugin.json +1 -1
  30. package/plugin/.mcp.json +1 -1
  31. package/plugin/skills/_shared/ci-check-to-command.md +2 -2
  32. package/plugin/skills/_shared/dev-loop/publish.md +1 -1
  33. package/plugin/skills/_shared/failure-mode-handling.md +12 -6
  34. package/plugin/skills/_shared/telemetry-events/muggle-do-escalation.md +2 -2
  35. package/plugin/skills/do/cleanup.md +2 -2
  36. package/plugin/skills/do/e2e-acceptance.md +6 -3
  37. package/plugin/skills/do/e2e-repair.md +41 -15
  38. package/plugin/skills/do/fix-ci.md +8 -4
  39. package/plugin/skills/do/open-prs/forward.md +2 -2
  40. package/plugin/skills/muggle-do/SKILL.md +2 -2
  41. package/plugin/skills/muggle-pr-followup/contract.md +2 -1
  42. package/plugin/skills/muggle-pr-followup/output-templates/blocked-reminder.md +8 -0
  43. package/plugin/skills/muggle-pr-followup/state-schemas.md +5 -0
  44. package/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +11 -4
@@ -1,6 +1,6 @@
1
1
  # E2E Repair Loop (Stage 7.5)
2
2
 
3
- Runs between Stage 7's posted walkthrough and Stage 8's watcher dispatch. A failing acceptance run means the change is not ready for a reviewer, so this stage root-causes every failure and either repairs it in-pipeline or puts one decision in front of the user. The watcher is armed only once this stage clears.
3
+ Runs between Stage 7's posted walkthrough and Stage 8's watcher dispatch, and again whenever the watcher finds the PR's `muggle-walkthrough` check red on failed cases ([`fix-ci.md`](fix-ci.md) Step 2.5). A failing acceptance run means the change is not ready for a reviewer, so this stage root-causes every failure and either repairs it in-pipeline or puts one decision in front of the user. The watcher is armed only once this stage clears.
4
4
 
5
5
  ## Turn preamble
6
6
 
@@ -15,6 +15,8 @@ Runs between Stage 7's posted walkthrough and Stage 8's watcher dispatch. A fail
15
15
  - The PR opened by [`open-prs/forward.md`](open-prs/forward.md) — repo and number, for the escalation event and the refresh path.
16
16
  - `repairIteration` — how many times this stage has already run in this session, read from `iterations/<NNN>.md`.
17
17
 
18
+ Entered from fix-ci, the failing cases come from the red check instead of a Stage 6 report: the check run's summary (each failed or inconclusive case, its failing step, its run link) and the walkthrough comment's hidden `muggle-e2e-result` record (the same cases with their test case ids). The run-level verdict is `FAIL` when any case failed, else `INCONCLUSIVE`. A walkthrough settled by a `NO_APP_LOGIC_CHANGE` skip keeps the last full run beneath it, record included; those failures are this head's and enter the loop like any other.
19
+
18
20
  ## Wave cycles
19
21
 
20
22
  `state.md` records `Wave: on` → the loop runs once for the wave per [`wave-e2e.md`](wave-e2e.md): repairs land in each failure's `implicatedRepo` (`unknown` is `ask`), re-runs use the wave stack, and every wave PR's walkthrough and title are refreshed after each pass.
@@ -48,11 +50,12 @@ Map each bucket to exactly one disposition. Buckets are defined in [`../_shared/
48
50
  | `product-uxux` (regen) | `repair` | The product blocks the agent because the feature does not work. |
49
51
  | `stale-script` (replay) | `regenerate` | Selectors moved; the product is fine. Regenerating is self-healing, not a code change. |
50
52
  | `transient` (regen) | `retry` | Once, then re-bucket the second result. A twice-transient failure is `infra`. |
53
+ | `test-precondition` (either) | `repair-test` | The product is right for the data it has; the test asserts on state it never created. Repair the test case, never the product. |
51
54
  | `infra` (either) | `ask` | A Muggle Test bug. Nothing in this repo fixes it. |
52
55
  | `agent-course` (regen) | `ask` | The agent needs steering, which is the user's `muggle-feedback` call to make. |
53
56
  | `unclassified` | `ask` | No bucket, no automatic action. |
54
57
 
55
- A `repair` disposition requires a named defect: the failing step, expected-versus-actual, and the code path it implicates. Without one it is `ask`, whatever the bucket said.
58
+ A `repair` disposition requires a named defect: the failing step, expected-versus-actual, and the code path it implicates. A `repair-test` disposition requires one too: the asserted state, the evidence the account lacks it (the frame, the record list), and the test-case change that would create it. Without one either is `ask`, whatever the bucket said.
56
59
 
57
60
  **A failure the diff cannot explain may predate it.** When a `product-defect` or `product-uxux` failure names no code path the diff touched, replay the same test case against a checkout of the base before repairing anything: a worktree at the base tip's full SHA, with its own stack claim and services, under the same runSettings record. If that run fails the same way, its disposition is `baseline` — the defect is on the base, not this change's to fix — and the entry carries that run's id as `baselineRunId` into the walkthrough report ([`../muggle-pr-visual-walkthrough/e2e-report-assembly.md`](../muggle-pr-visual-walkthrough/e2e-report-assembly.md)). If it passes, the change caused the failure and the original disposition stands. A `baseline` entry is never re-run or waived; when every remaining failure is `baseline`, the loop clears.
58
61
 
@@ -64,50 +67,73 @@ An Inconclusive entry Stage 6 recorded as `primary failed` never executed either
64
67
 
65
68
  ## Step 3: Act
66
69
 
67
- Process dispositions in order — `retry`, then `regenerate`, then `repair` — so cheap self-healing runs before any code change.
70
+ Process dispositions in order — `retry`, then `regenerate`, then `repair-test`, then `repair` — so cheap self-healing runs before any code change.
68
71
 
69
72
  - **`retry`** — re-execute the case unchanged through the Stage 6 loop. Re-bucket the result and fold it back into Step 2.
70
73
  - **`regenerate`** — regenerate the script for that test case, then re-replay. One regeneration per test case per iteration, matching Stage 6's own cap.
74
+ - **`repair-test`** — update the test case with `muggle-remote-test-case-update` so it produces the state it asserts on: a setup step that creates the record, a seeded precondition, or a prerequisite test case it chains after. Keep the assertion as written — an edit that stops checking the behavior is not a repair. Then regenerate its script and re-run. No product code changes, so nothing is pushed.
71
75
  - **`repair`** — re-enter [`build.md`](build.md) with the named defects as this iteration's requirements amendment, then run [`unit-tests.md`](unit-tests.md) and refresh the PR through [`open-prs/update.md`](open-prs/update.md). Impact analysis does not re-run; the change is scoped to a known defect.
72
76
  - **`ask`** — collect every `ask` failure and present **one** `AskUserQuestion` (Step 4). Never one picker per failure.
73
77
 
74
78
  ## Step 4: The user decision
75
79
 
76
- One question, listing each unrepairable failure with its bucket, failing step, and dashboard link. Options:
80
+ One question, listing each unrepairable failure with its bucket, failing step, and dashboard link. Options — the same four in every form the decision takes:
77
81
 
78
82
  1. **Repair anyway** — the user names what the fix should be; the loop treats it as a `repair` disposition and re-enters Step 3.
79
83
  2. **Give feedback and rerun** — invoke `muggle-feedback` for the run, then re-execute in regen mode. The right answer for `agent-course`.
80
- 3. **Waive and ship** — record the waiver in `state.md`, retitle the PR `[E2E FAILING]`, and clear to Stage 8.
84
+ 3. **Waive and ship** — record `E2E waived: <test case ids> — <the user's words>` in `state.md`, retitle the PR `[E2E FAILING]`, and clear to Stage 8. Only the user's own pick or words waive. The walkthrough check stays red on the posted run; merging past it is the user's call.
81
85
  4. **Stop here** — leave the PR open and unwatched; the user takes it from there.
82
86
 
83
- **Unattended runs.** When the cycle was started autonomously there is nobody to ask. Do not skip the loop — run Steps 1–3 in full, then treat a surviving `ask` as an automatic waive: emit the escalation event, retitle `[E2E FAILING]`, and clear to Stage 8. A readiness halt (Step 0) is not an `ask` and is never auto-waived. Silently arming the watcher on a red run is the failure this stage exists to prevent.
87
+ A case `state.md` already records as waived never reaches the question again.
88
+
89
+ **Unattended runs.** When the cycle was started autonomously there is nobody to ask, and nobody's waiver to record. Do not skip the loop — run Steps 1–3 in full, then leave a surviving `ask` as an **open decision**, never a waiver:
90
+
91
+ 1. Write the decision into `state.md`, replacing any earlier one:
92
+ ```
93
+ ## E2E decision
94
+ - Head: <head sha>
95
+ - <test case name> (<test case id>) — <bucket> — step <n>: <what failed> — <run link>
96
+ - Options: repair with direction | feedback and rerun | waive | stop
97
+ ```
98
+ 2. Retitle the PR `[E2E FAILING]` and emit the escalation event.
99
+ 3. End the turn's final message with the decision request — one line per case naming its bucket, then the four options.
100
+ 4. Clear to Stage 8 as `decision-pending`. The armed watcher sees the walkthrough check red, fix-ci finds this decision for the head and escalates without repeating the repair, and the watcher's blocked reminder carries the cases and options until the user answers.
101
+
102
+ A readiness halt (Step 0) is not an `ask` and never becomes a decision. Silently arming the watcher on a red run, or waiving one nobody looked at, is the failure this stage exists to prevent.
103
+
104
+ Entered from fix-ci, Step 4 always takes the unattended form, and fix-ci's escalation ([`fix-ci.md`](fix-ci.md) Step 6) stands in for the Stage 8 clearance.
105
+
106
+ The user's answer — to the question, or to the decision request after it was printed — runs that option over the listed cases and removes the `## E2E decision` block.
84
107
 
85
108
  ## Step 5: Close the loop
86
109
 
87
- After a `repair`, `regenerate`, or `retry` pass, re-run [`e2e-acceptance.md`](e2e-acceptance.md) over the affected test cases only, increment `repairIteration`, and return to Step 0. A change whose `state.md` records `E2E lane: background` re-runs through that lane ([`background-e2e.md`](background-e2e.md)), queued behind any local run in flight, with this PR's URL in the brief.
110
+ After a `repair`, `repair-test`, `regenerate`, or `retry` pass, re-run [`e2e-acceptance.md`](e2e-acceptance.md) over the affected test cases only, increment `repairIteration`, and return to Step 0. A change whose `state.md` records `E2E lane: background` re-runs through that lane ([`background-e2e.md`](background-e2e.md)), queued behind any local run in flight, with this PR's URL in the brief.
88
111
 
89
- The loop is bounded at **3** repair iterations, the same bound the cycle guardrail already applies to E2E failures. On the third exhausted iteration, waive automatically: retitle `[E2E FAILING]`, record the surviving failures in `result.md`, and clear to Stage 8. A PR a reviewer can see is worth more than a loop that never terminates.
112
+ The loop is bounded at **3** repair iterations, the same bound the cycle guardrail already applies to E2E failures. On the third exhausted iteration, the surviving failures go to Step 4 as `ask`, each with its last bucket — the question when attended, the open decision when not.
90
113
 
91
114
  ## Telemetry
92
115
 
93
- Steps 1–3 emit the `*-classified` / `*-resolved` pair per [`../_shared/failure-mode-handling.md`](../_shared/failure-mode-handling.md) section D, with `userAction` set to the disposition this stage took (`repair`, `regenerate`, `retry`) rather than a human pick. A failure that reaches Step 4 records the user's actual choice.
116
+ Steps 1–3 emit the `*-classified` / `*-resolved` pair per [`../_shared/failure-mode-handling.md`](../_shared/failure-mode-handling.md) section D, with `userAction` set to the disposition this stage took (`repair`, `repair-test`, `regenerate`, `retry`) rather than a human pick. A failure that reaches Step 4 records the user's actual choice.
94
117
 
95
- Every waive — user-picked, unattended, or iteration-capped — also emits `muggle-do:escalation` with `kind: "e2e-unrepairable"` per [`../_shared/telemetry-events/muggle-do-escalation.md`](../_shared/telemetry-events/muggle-do-escalation.md).
118
+ Every waive the user picked, and every open decision left for them, also emits `muggle-do:escalation` with `kind: "e2e-unrepairable"` per [`../_shared/telemetry-events/muggle-do-escalation.md`](../_shared/telemetry-events/muggle-do-escalation.md).
96
119
 
97
120
  ## Output
98
121
 
99
122
  **Verdict in:** `<Stage 6 verdict>`
100
123
  **Repair iterations:** `<n>` of 3
101
124
  **Repaired:** test case → root cause → commit subject
125
+ **Test repaired:** test case → missing precondition → test-case change
102
126
  **Regenerated:** test case → new script id
103
- **Waived:** test case → bucket → reason
127
+ **Waived:** test case → bucket → the user's words
128
+ **Decision pending:** test case → bucket → failing step
104
129
  **Verdict out:** `<verdict after the final re-run>`
105
- **Clearance:** `green` | `waived — <reason>` | `iteration-cap`
130
+ **Clearance:** `green` | `waived — <reason>` | `decision-pending`
106
131
 
107
132
  ## Invariants
108
133
 
109
- - Stage 8 is unreachable while clearance is unresolved — the only exits are green, waived, or iteration-capped.
110
- - No bucket auto-repairs without a named defect.
134
+ - Stage 8 is unreachable while clearance is unresolved — the only exits are green, waived by the user, or decision-pending.
135
+ - No waiver without the user's own pick or words; an unattended run or a spent iteration budget leaves a decision, never a waiver.
136
+ - No bucket auto-repairs without a named defect; `repair-test` changes the test case, never product code.
111
137
  - One `AskUserQuestion` per stage run, never one per failure.
112
138
  - An unattended run still executes Steps 1–3; only Step 4 collapses.
113
- - Re-runs are scoped to the affected test cases, never the whole suite.
139
+ - Re-runs are scoped to the affected test cases, except when entered from fix-ci: the walkthrough is replaced wholesale, so that re-run covers the whole suite.
@@ -43,14 +43,17 @@ How long a check takes to run — a 45-minute eval included — is never a reaso
43
43
 
44
44
  ### Step 2.5 — Red E2E walkthrough check
45
45
 
46
- 1. **Read why.** Fetch the check run's summary per [`../_shared/vcs/github/pr-checks.md`](../_shared/vcs/github/pr-checks.md) and record its `completed_at`. It names every failed or inconclusive case, its failing step, and its run. Take the test case ids from the walkthrough comment's hidden `<!-- muggle-e2e-result:v1 {…} -->` record — the newest comment carrying one.
47
- 2. **Repair each case** per [`e2e-repair.md`](e2e-repair.md) Steps 1–3: root-cause to a bucket, then retry, regenerate, or repair the code. This stage is unattended, so a case whose disposition is `ask` is out of scope — record it for Step 6 and never open a picker.
46
+ The check run's summary says which red this is ([`../_shared/ci-check-to-command.md`](../_shared/ci-check-to-command.md)): **did not pass** — the walkthrough reports failed or inconclusive cases — takes items 1–5; **still empty** — no walkthrough posted — takes the empty-comment branch below. A walkthrough whose E2E run is in progress keeps the check pending, never red.
47
+
48
+ 1. **Read why.** Fetch the check run's summary per [`../_shared/vcs/github/pr-checks.md`](../_shared/vcs/github/pr-checks.md) and record its `completed_at`. It names every failed or inconclusive case, its failing step, and its run. Take the test case ids from the walkthrough comment's hidden `<!-- muggle-e2e-result:v1 {…} -->` record — the newest comment carrying one. A comment settled by a `NO_APP_LOGIC_CHANGE` skip — a rebase or a minor cycle on this head — carries the last full run beneath it, and its failures stand: the skip clears nothing, so they take this same path. Drop every case `state.md` records as `E2E waived:`; if none remain, go to Step 6. If `state.md`'s `## E2E decision` names this head, the repair already ran on it and the user owes the answer: go to Step 6.
49
+ 2. **Repair each case** per [`e2e-repair.md`](e2e-repair.md) Steps 1–3: root-cause to a bucket, then retry, regenerate, repair the test (`test-precondition`), or repair the code. This stage is unattended, so a case whose disposition is `ask` is recorded for Step 6 with its bucket and failing step — never a picker, never a waiver.
48
50
  3. **Re-run the whole suite** through [`e2e-acceptance.md`](e2e-acceptance.md) — every test case the walkthrough listed, passing ones included. The walkthrough is replaced wholesale and the check judges all of it, so a re-run scoped to the failures would post a walkthrough that drops the cases that passed.
49
51
  4. **Order the settle after the push.** If Step 2 changed code, run Steps 3–4 below first, so the new head carries the fix. Then settle the walkthrough comment with the re-run's report via [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A; editing the comment re-runs the check against the head. With no code change (only retries and regenerations) there is nothing to push — the comment edit alone re-runs the check.
50
52
  5. **Wait for the fresh verdict** before Step 5's respawn: poll the check run until one completes later than the `completed_at` recorded in item 1, for up to 5 minutes. A watcher respawned sooner reads the stale red verdict and spends a fix attempt on a run already repaired. On timeout, respawn anyway — the per-SHA budget still bounds it.
51
53
 
52
54
  An empty-comment failure (no run ever posted) skips items 1–2. Pick the branch from `state.md`:
53
55
 
56
+ - **This PR's E2E run queued or running** (`E2E dispatch: queued` or `running`) → wait: that run posts the walkthrough, and the Step 1 exception covers this cycle. Never run a second suite or write into the comment the walkthrough builder is about to fill.
54
57
  - **`local-e2e` or `staging-replay`** → run the suite and settle the comment with its report.
55
58
  - **`unit-only`, `skip`, or no `## Pre-flight answers` block at all** (a poll-only session — auto-track, or bootstrap on a PR it found no testable surface for) → settle it with the skip code that holds per [`e2e-acceptance.md`](e2e-acceptance.md): `NO_WEB_SURFACE` when the repo serves nothing to drive, `NO_APP_LOGIC_CHANGE` (detail opening with the PR's merge-base commit) when every path the PR changed is docs, tests, lint or CI config, else `NOT_APPLICABLE` with the reason no browser run can reach the change. Run `echo "MUGGLE_E2E_SKIP: <CODE>: <detail>"` from the PR's working tree. The write runs detached, so confirm it landed: run the foreground command the walkthrough gate's block names until it prints `{"settled":true}`, never a hand-written PATCH. Never `NO_PR`: the guardrail refutes it whenever the session handled a PR.
56
59
  - **A poll-only PR whose change a browser run *can* reach** → no code holds, so do not cite one. Escalate per Step 6, naming the missing E2E decision; the owner chooses run, project or waive.
@@ -86,10 +89,10 @@ Respawn the watcher per [`respawn-watcher.md`](respawn-watcher.md). CI on the ne
86
89
 
87
90
  ### Step 6 — Escalate (budget spent or out of scope)
88
91
 
89
- When the failing checks are all out of scope, a non-deterministic check is red again after its re-run on this head (Step 2.6), this is the head's third cycle (`ci_fix_attempts[red_sha]` reached 3 in Step 1) and it could not push a fix, or Step 1 found the budget already spent:
92
+ When the failing checks are all out of scope, a non-deterministic check is red again after its re-run on this head (Step 2.6), Step 2.5 left a walkthrough case it could not repair (an `ask`, an open decision on this head, or only waived cases), this is the head's third cycle (`ci_fix_attempts[red_sha]` reached 3 in Step 1) and it could not push a fix, or Step 1 found the budget already spent:
90
93
 
91
94
  1. Add `red_sha` to `last_seen.ci_escalated_shas` so the SHA is not re-fixed. This cycle's Step 1 attempt is what makes the entry count.
92
- 2. Emit one terminal message naming the unresolved checks.
95
+ 2. Emit one terminal message naming the unresolved checks. When `muggle-walkthrough` is among them with cases not waived, the message is the E2E decision request instead — per [`e2e-repair.md`](e2e-repair.md) Step 4's unattended form: each case with its bucket and failing step, then the four options (repair with direction, feedback and rerun, waive, stop). Write that decision to `state.md`'s `## E2E decision` block, and the same cases to `last_seen.e2e_decision` (`head_sha` plus one `{name, testCaseId, bucket, failedStep}` per case, whole-file rewrite) — the watcher's blocked reminder reads it to put the decision in front of the owner. Only waived cases left → `last_seen.e2e_decision` lists them with `waived: true`, and no question is asked again.
93
96
  3. Emit the cycle event with `outcome: "ci-escalated"` (Step 7).
94
97
  4. **Respawn the watcher** per [`respawn-watcher.md`](respawn-watcher.md). Escalation stops fix-ci from re-dispatching this SHA — but the poller must keep running: it reminds on the `ci_escalated` block and catches a new push, a new review, or the user's own fix. Skipping respawn here is the silent-stop bug the helper exists to prevent.
95
98
 
@@ -100,5 +103,6 @@ Emit one `muggle-do:cycle` event ([`../_shared/telemetry-events/muggle-do-cycle.
100
103
  ## Guardrails
101
104
 
102
105
  - Max 3 fix attempts per SHA; out-of-scope checks escalate immediately rather than churn. A walkthrough repair or a re-run that pushes nothing keeps the head SHA, so the same budget bounds it.
106
+ - A red walkthrough never ends silent or self-waived: it is repaired, or it escalates with a decision request the watcher keeps in front of the owner. Only the user's own words waive a case.
103
107
  - A non-deterministic check is re-run once per head before it escalates — never escalated on its first red, never re-run twice on one head.
104
108
  - No PR replies; the fix commit is the response.
@@ -78,7 +78,7 @@ Runs once Stage 6 has recorded this change's verdict; a Stage 6 readiness halt n
78
78
 
79
79
  ## Stage 7.5 gate
80
80
 
81
- The E2E repair loop ([`../e2e-repair.md`](../e2e-repair.md)) runs once Stage 7 has settled the walkthrough, and before the handoff below. Proceed only on its `green`, `waived`, or `iteration-cap` clearance — handing a red run to a watcher puts it in front of reviewers with nobody looking at the failures. When Stage 6 recorded `PASS` or `SKIPPED` the loop clears in its own Step 0 at no cost, so there is never a reason to skip it.
81
+ The E2E repair loop ([`../e2e-repair.md`](../e2e-repair.md)) runs once Stage 7 has settled the walkthrough, and before the handoff below. Proceed only on its `green`, `waived`, or `decision-pending` clearance — handing a red run to a watcher with no decision asked puts it in front of reviewers with nobody looking at the failures. When Stage 6 recorded `PASS` or `SKIPPED` the loop clears in its own Step 0 at no cost, so there is never a reason to skip it.
82
82
 
83
83
  ## Stage 8 handoff
84
84
 
@@ -109,7 +109,7 @@ If `prs.json` is empty, **do not arm** — record the reason in `result.md` and
109
109
  **Skipped:** repo → reason (when `autoCreatePR` short-circuited)
110
110
  **Tested head:** repo → `already the PR head` | `force-pushed <short-sha> (Stage 6 synced onto a moved base)`
111
111
  **Overflow comments posted:** repo → PR #
112
- **Stage 7.5:** `green` | `waived — <reason>` | `iteration-cap`
112
+ **Stage 7.5:** `green` | `waived — <reason>` | `decision-pending`
113
113
  **Stage 8:** `Watching <N> PR(s) — one watch loop per PR, armed per arm-watcher.md` | `No PRs to watch — stage 8 not armed`
114
114
  **Errors:** repo → message
115
115
 
@@ -50,7 +50,7 @@ The pipeline table lists **pointers, not summaries**. Open each stage's file and
50
50
  **Per stage:** read the file → execute it → append one marker line to `iterations/<NNN>.md`, always in the form `Stage <N> done — <evidence>`, citing the evidence that file requires (jest exit code, E2E verdict + `runId`, screenshot path). A stage is done only when its evidence is written, never on recollection.
51
51
 
52
52
  ### "Autonomous" / "without my intervention" collapses exactly one thing
53
- Best-effort the Stage-1 questionnaire and don't ask. It does **not** license skipping telemetry, session artifacts, requirements, unit tests, E2E (`autoE2ETest` defaults to `always`), browser verification, the gate below, the Stage-7.5 repair loop, or the watcher hand-off. Stage 7.5 investigates and repairs unattended too; only its user decision collapses, into an automatic waive. Run the whole pipeline silently — never a shortcut.
53
+ Best-effort the Stage-1 questionnaire and don't ask. It does **not** license skipping telemetry, session artifacts, requirements, unit tests, E2E (`autoE2ETest` defaults to `always`), browser verification, the gate below, the Stage-7.5 repair loop, or the watcher hand-off. Stage 7.5 investigates and repairs unattended too; only its user decision is deferred — left open for the user and carried by the watcher, never waived on their behalf. Run the whole pipeline silently — never a shortcut.
54
54
 
55
55
  ### Definition of Done — gates before Stages 5.5 and 7
56
56
  Each line holds, or is waived by a one-line reason written into `state.md` (silence is not a waiver).
@@ -105,5 +105,5 @@ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/
105
105
  - Stage 1 and Stage 7.5's user decision are the only user-facing forward stages. Stages 2–7 don't ask mid-cycle; blocker → pre-flight bug.
106
106
  - Same stage failing 3× → escalate.
107
107
  - Each route's entry file declares the stage files every run of that route opens, and a Stop gate holds the turn until they are read. A turn that ends before its route's last stage — a readiness halt, an escalation, a pause for a background run — records why with `echo "MUGGLE_STAGE_SKIP: <reason>"`.
108
- - 3 repair iterations reach E2E with failures → waive, ship with `[E2E FAILING]`, and hand to the watcher.
108
+ - 3 repair iterations reach E2E with failures → put the surviving failures to the user (an open decision when unattended), ship with `[E2E FAILING]`, and hand to the watcher.
109
109
  - Address-reviews escalation (ambiguous or design-adjustment) does not block the watcher; user resolves on GitHub.
@@ -172,6 +172,7 @@ Act on the verdict:
172
172
  ```
173
173
  /muggle-do fix ci <check-1> <check-2> ... on <pr-url> slug=<slug>
174
174
  ```
175
+ A red `muggle-walkthrough` is named like any other red check — the executor reads its summary and decides between repairing failed E2E cases and posting a walkthrough still owed. The watcher never tells them apart, and never skips the dispatch because the only red check is the walkthrough.
175
176
  4. Append a dispatching line to `followup.log`; emit a `tick` event with `checks_red: <count>`, `dispatched_ci_fix: true`.
176
177
  5. Exit. The dev cycle owns the PR; its respawn restarts the watcher, whose next tick re-checks CI on the new head SHA — CI itself is the verify loop.
177
178
  - `block-conflict-escalated`, `block-ci-escalated`, `block-reviews-escalated` → blocked pending a human (Step 7).
@@ -182,7 +183,7 @@ Act on the verdict:
182
183
  Any tick that did not dispatch. The Step 6 verdict says **why** it idled. It is **blocked pending a human** on a `block-*` verdict, a durable block only the user can clear:
183
184
 
184
185
  - `block-conflict-escalated` — a rebase `/muggle-do` attempted and gave up on (a semantic conflict, or `autoResolveConflicts=never`), reason `conflict_escalated`. This block clears on its own when the base moves: the new `base_tip_sha` yields a key the set does not contain, and the branch re-arms for a fresh rebase attempt;
185
- - `block-ci-escalated` — CI the fix-ci stage gave up on, or a red head that spent all 3 fix-ci attempts, reason `ci_escalated`;
186
+ - `block-ci-escalated` — CI the fix-ci stage gave up on, or a red head that spent all 3 fix-ci attempts, reason `ci_escalated`. When `last_seen.e2e_decision` names this head, the block is an E2E decision the user owes, and the reminder carries its cases and options ([`output-templates/blocked-reminder.md`](output-templates/blocked-reminder.md));
186
187
  - `block-reviews-escalated` — an ambiguous review in `last_seen.escalated_review_ids` awaiting the user's direction, with the actionable set empty, reason `reviews_escalated`;
187
188
  - `block-rebase-budget-exhausted` — reason `rebase_budget_exhausted` (Step 6).
188
189
 
@@ -26,5 +26,13 @@ The watcher's one-line nudge to the loop owner, emitted every tick a PR sits blo
26
26
  ```
27
27
  ⏳ acme/widget#142 awaiting you (2h): the failing checks on <short-sha> need your call — fix and push, or advise here. → <pr-url>/checks
28
28
  ```
29
+ - **`ci_escalated` with `last_seen.e2e_decision` on this head** — E2E cases the repair loop could not fix. Name every case with its bucket and failing step, then the four options; never the generic CI line, which hides the decision:
30
+ ```
31
+ ⏳ acme/widget#142 awaiting you (2h): E2E on <short-sha> — Billing debit shows tokens (test-precondition, step 4), Checkout (infra, step 2) — reply: repair <direction> | feedback+rerun | waive | stop. → <pr-url>/checks
32
+ ```
33
+ Every case `waived: true` → the user already decided; say so instead of asking again:
34
+ ```
35
+ ⏳ acme/widget#142 awaiting you (2h): muggle-walkthrough stays red on <short-sha> only for cases you waived (Checkout) — merge past it, or re-run E2E. → <pr-url>/checks
36
+ ```
29
37
 
30
38
  The reminder repeats every blocked tick (at the normal `1m` cadence) until the owner acts; the watcher stops it the moment the fingerprint moves (a push, a new review, or a CI/deploy change).
@@ -112,6 +112,10 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
112
112
  "conflict_escalated_keys": ["<head-sha>..<base-tip-sha>", ...],
113
113
  "catch_up_rebases": <int>,
114
114
  "rebase_budget_exhausted": <bool>,
115
+ "e2e_decision": {
116
+ "head_sha": "<sha>",
117
+ "cases": [{ "name": "<test case>", "testCaseId": "<id>", "bucket": "<bucket>", "failedStep": <int>, "waived": <bool> }]
118
+ },
115
119
  "blocked": {
116
120
  "reason": "conflict_escalated" | "ci_escalated" | "reviews_escalated",
117
121
  "since": "<ISO-8601>",
@@ -140,6 +144,7 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
140
144
  - `conflict_escalated_keys`: `rebase_key`s whose rebase `/muggle-do` gave up on (attempts exhausted, or a conflict under `autoResolveConflicts=never`). Suppresses rebase dispatch **only while `conflict_resolve_attempts[key] >= 1`**; an entry with no attempt behind it is ignored and the rebase dispatches anyway.
141
145
  - `catch_up_rebases`: how many rebases this PR has been dispatched for across its whole life. A plain counter, deliberately unkeyed: the two fields above key on `rebase_key`, which changes on every base advance and so hands an active base an unlimited supply of fresh budgets. Nothing resets this one, which makes it the only cap that binds. Capped by [`../muggle-preferences/preference-gates/maxCatchUpRebases.md`](../muggle-preferences/preference-gates/maxCatchUpRebases.md) — 20 by default, `never` for unbounded. Incremented by the rebase cycle on every push, whatever the outcome.
142
146
  - `rebase_budget_exhausted`: set by the tick once `catch_up_rebases` reaches the cap, recording why the watch blocks with reason `rebase_budget_exhausted`. The verdict judges exhaustion from the counter and the cap, never from this flag, so raising the preference resumes rebases at once.
147
+ - `e2e_decision`: the walkthrough cases a fix-ci cycle could not repair on `head_sha`, each with its failure bucket and failing step — written alongside the `ci_escalated_shas` entry when `muggle-walkthrough` is among the escalated checks. `waived: true` marks a case the user already waived. The blocked reminder reads it for a `ci_escalated` block whose `head_sha` matches ([`output-templates/blocked-reminder.md`](output-templates/blocked-reminder.md)); one naming another head is stale and ignored. The verdict script never reads it.
143
148
 
144
149
  The escalation sets and attempt counters are written by the `/muggle-do` cycles that ran, and only by them. The dispatch decision that reads them lives in [`../../scripts/pr-watch-verdict.mjs`](../../scripts/pr-watch-verdict.mjs) ([`contract.md`](contract.md) Step 6), not in prose.
145
150
 
@@ -32,7 +32,11 @@ For each result:
32
32
  2. `viewUrl` — from the run result (deep-links to the specific run).
33
33
  3. `status` — from `muggle-local-run-result-get`.
34
34
  4. If failed: also capture `failureStepIndex`, `error`, `artifactsDir` from the run result.
35
- 5. If the caller hands over a `baselineRunId` for a failed entry — a run of the same test case against the base that failed too — set it on the entry. `build-pr-section` credits it only after checking the run itself: same test case, failed, same runSettings record, and a stack that served a base commit between the PR's fork point and the base tip. A credited failure reads "also fails on base" and stops holding the walkthrough check red; a refused one is named on stderr and stays a plain failure. Pass `--base <branch>` when the PR does not target the remote's default branch.
35
+ 5. `runSummary` — the run's closing halt step, which the script stores as `summaryStep` apart from `steps[]` (replays drop the recorded halt from `steps[]` too). Set it on every entry whose action script you fetched, passed, failed and inconclusive alike; the walkthrough renders it as the row closing the step list.
36
+ - `summaryStep` present → `{ isRecorded: true, headline, status, verdict, blockingIssues, screenshotUrl }`: `headline` is `structuredSummary.summaryHeadline`, else `briefExplanation`; `status` is `structuredSummary.status` (`success` · `bug_detected` · `goal_unachievable`); `verdict` and `blockingIssues` are the text after `Verdict:` and `Blocking Issues:` in `comment`; `screenshotUrl` is `operation.screenshotUrl`. Omit any of the last four the step does not carry.
37
+ - `summaryStep` absent → `{ isRecorded: false }`: the run died before summarizing, and the walkthrough says so on that test.
38
+ - Omit `runSummary` only when no action script exists to read — a run that never started or the last-resort stub below.
39
+ 6. If the caller hands over a `baselineRunId` for a failed entry — a run of the same test case against the base that failed too — set it on the entry. `build-pr-section` credits it only after checking the run itself: same test case, failed, same runSettings record, and a stack that served a base commit between the PR's fork point and the base tip. A credited failure reads "also fails on base" and stops holding the walkthrough check red; a refused one is named on stderr and stays a plain failure. Pass `--base <branch>` when the PR does not target the remote's default branch.
36
40
 
37
41
  ## Last-resort: no cloud refs on the run result
38
42
 
@@ -70,7 +74,8 @@ If called from `muggle-do`: `e2e-acceptance.md` already produces this shape, eac
70
74
  "replayShortId": "<run shortId, when it has one>",
71
75
  "viewUrl": "<viewUrl from run result>",
72
76
  "status": "passed",
73
- "steps": [{ "stepIndex": 0, "action": "click", "description": "Click 'Accept all' to dismiss the cookie consent dialog.", "screenshotUrl": "..." }]
77
+ "steps": [{ "stepIndex": 0, "action": "click", "description": "Click 'Accept all' to dismiss the cookie consent dialog.", "screenshotUrl": "..." }],
78
+ "runSummary": { "isRecorded": true, "headline": "<summaryHeadline>", "status": "success", "verdict": "<Verdict: text>", "blockingIssues": "<Blocking Issues: text>", "screenshotUrl": "<summaryStep.operation.screenshotUrl>" }
74
79
  },
75
80
  {
76
81
  "name": "<failed test case title>",
@@ -82,7 +87,8 @@ If called from `muggle-do`: `e2e-acceptance.md` already produces this shape, eac
82
87
  "status": "failed",
83
88
  "steps": [{ "stepIndex": 0, "action": "click", "description": "Click 'Sign in' to open the login form.", "screenshotUrl": "..." }],
84
89
  "failureStepIndex": 0,
85
- "error": "<error message from run result>"
90
+ "error": "<error message from run result>",
91
+ "runSummary": { "isRecorded": true, "headline": "<summaryHeadline>", "status": "bug_detected", "verdict": "<Verdict: text>", "blockingIssues": "<Blocking Issues: text>", "screenshotUrl": "..." }
86
92
  },
87
93
  {
88
94
  "name": "<inconclusive test case title>",
@@ -93,7 +99,8 @@ If called from `muggle-do`: `e2e-acceptance.md` already produces this shape, eac
93
99
  "viewUrl": "<viewUrl from run result, or project-level fallback URL>",
94
100
  "status": "inconclusive",
95
101
  "steps": [{ "stepIndex": 0, "action": "navigate", "description": "Workflow started at the app's URL.", "screenshotUrl": "..." }],
96
- "reason": "<one short sentence: why neither pass nor fail applies>"
102
+ "reason": "<one short sentence: why neither pass nor fail applies>",
103
+ "runSummary": { "isRecorded": false }
97
104
  }
98
105
  ]
99
106
  }