@muggleai/works 5.26.0-staging.208 → 5.26.0-staging.209
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-mcp.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/.mcp.json +1 -1
- package/dist/plugin/agents/acceptance-tester.md +18 -2
- package/dist/plugin/hooks/README.md +5 -4
- package/dist/plugin/hooks/codex-hooks.json +2 -2
- package/dist/plugin/hooks/hooks.json +2 -2
- package/dist/plugin/scripts/guardrail-record-delegation.sh +25 -0
- package/dist/plugin/scripts/guardrail-walkthrough-gate.sh +6 -6
- package/dist/plugin/scripts/guardrails.mjs +161 -32
- package/dist/plugin/skills/do/background-e2e.md +89 -0
- package/dist/plugin/skills/do/e2e-acceptance.md +4 -0
- package/dist/plugin/skills/do/e2e-repair.md +1 -1
- package/dist/plugin/skills/do/open-prs/forward.md +3 -3
- package/dist/plugin/skills/do/pre-flight.md +4 -3
- package/dist/plugin/skills/do/wave-e2e.md +3 -3
- package/dist/plugin/skills/do/wave-or-stream.md +51 -0
- package/dist/plugin/skills/muggle-do/SKILL.md +6 -2
- package/dist/release-manifest.json +3 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-mcp.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/agents/acceptance-tester.md +18 -2
- package/plugin/hooks/README.md +5 -4
- package/plugin/hooks/codex-hooks.json +2 -2
- package/plugin/hooks/hooks.json +2 -2
- package/plugin/scripts/guardrail-record-delegation.sh +25 -0
- package/plugin/scripts/guardrail-walkthrough-gate.sh +6 -6
- package/plugin/scripts/guardrails.mjs +161 -32
- package/plugin/skills/do/background-e2e.md +89 -0
- package/plugin/skills/do/e2e-acceptance.md +4 -0
- package/plugin/skills/do/e2e-repair.md +1 -1
- package/plugin/skills/do/open-prs/forward.md +3 -3
- package/plugin/skills/do/pre-flight.md +4 -3
- package/plugin/skills/do/wave-e2e.md +3 -3
- package/plugin/skills/do/wave-or-stream.md +51 -0
- package/plugin/skills/muggle-do/SKILL.md +6 -2
- /package/dist/{chunk-HOKMW4AL.js → chunk-PQVRAFNE.js} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Background E2E — one acceptance run per change, off the main thread
|
|
2
|
+
|
|
3
|
+
A session that fixes several unrelated bugs opens several PRs, and each needs the E2E run of its own change: a walkthrough rendered from another change's run vouches for code that run never exercised. Running each Stage 6 inline also stalls the session on the browser while the next fix waits. So each change's Stage 6 runs in a background `muggle:acceptance-tester`, and the main session moves on to the next change.
|
|
4
|
+
|
|
5
|
+
## Changes
|
|
6
|
+
|
|
7
|
+
A **change** is what gets one E2E run and one report: a whole wave, or one PR of a stream. How a session's PRs group into waves and streams is defined once, in [`wave-or-stream.md`](wave-or-stream.md); this lane runs every change of a stream, a wave included.
|
|
8
|
+
|
|
9
|
+
- Each change has its own session directory (`state.md`, `iterations/`), branch and worktree — one per member for a wave. Pre-flight splits a request that bundles unrelated fixes this way ([`pre-flight.md`](pre-flight.md)).
|
|
10
|
+
- Changes cannot share a checkout: the background run tests one change's tree while the session edits another's. Every change gets a worktree, whatever `autoUseWorktree` says.
|
|
11
|
+
|
|
12
|
+
## Lane
|
|
13
|
+
|
|
14
|
+
`state.md` records the lane Stage 6 runs in:
|
|
15
|
+
|
|
16
|
+
- `E2E lane: background` — the session has other work in front of it when this change reaches Stage 6: another change still being built, queued, or in its own run.
|
|
17
|
+
- `E2E lane: inline` — a lone change with nothing else to do. Handing it off buys nothing and costs the run the session's context.
|
|
18
|
+
|
|
19
|
+
Decide the lane when the change reaches Stage 6, not at pre-flight; a change that ran inline in an earlier cycle can run in the background now.
|
|
20
|
+
|
|
21
|
+
## One local run at a time
|
|
22
|
+
|
|
23
|
+
Local runs share one studio browser and the stack's ports, and two studio runs at once corrupt each other — both report infra failures that read as product signal. So:
|
|
24
|
+
|
|
25
|
+
- At most one local acceptance-tester is in flight from this session. Further changes queue in the order they reached Stage 6.
|
|
26
|
+
- No inline local run starts while a background one is in flight, and the main session neither starts nor stops services meanwhile — the agent owns the local stack for its run.
|
|
27
|
+
- A run against a preview or staging URL drives the cloud rather than the local studio and needs no queue.
|
|
28
|
+
|
|
29
|
+
Each change's `state.md` tracks its place: `E2E dispatch: queued` → `running — dispatched <ISO-8601>` → `reported — <verdict> (<runIds>)`.
|
|
30
|
+
|
|
31
|
+
## Brief
|
|
32
|
+
|
|
33
|
+
The agent knows only its brief. Pass every value itself, never a pointer to the conversation:
|
|
34
|
+
|
|
35
|
+
- The change's slug and absolute session directory.
|
|
36
|
+
- Repo, worktree path, branch, base branch, and the head SHA under test — for a wave, one entry per member, from its `Wave members` block.
|
|
37
|
+
- The PR URL when the PR already exists (a repair re-run, or a PR opened outside `muggle-do`) — for a wave, every member's. Muggle reads PR URLs from the brief to know which PR's walkthrough is waiting on this run, so leave none out and add none that belong to another change.
|
|
38
|
+
- `Validation`, `localUrl`, `projectId`, and test-credential status from `state.md`.
|
|
39
|
+
- The `e2eScope` from impact analysis, verbatim; a Stage 7.5 re-run passes only its affected test cases.
|
|
40
|
+
- The acceptance criteria from `requirements.md`.
|
|
41
|
+
- `wallTimeBudgetSec`.
|
|
42
|
+
- The absolute path of [`e2e-acceptance.md`](e2e-acceptance.md) as the stage to execute — plus [`wave-e2e.md`](wave-e2e.md) for a wave — with the rules in the two sections below.
|
|
43
|
+
|
|
44
|
+
Dispatch it as `subagent_type: "muggle:acceptance-tester"` (bare `acceptance-tester` where the plugin namespace is absent), in the background. A harness with no background agents runs every change's Stage 6 inline, one after another.
|
|
45
|
+
|
|
46
|
+
## The agent's run
|
|
47
|
+
|
|
48
|
+
1. Start the stack from the change's worktree: [`muggle-test-prepare`](../muggle-test-prepare/SKILL.md) with the worktree as the directory override for the repo's services — for a wave, every member's worktree for its own repo's services, per [`wave-e2e.md`](wave-e2e.md) Stage 6. Confirm by process cwd that each service runs its worktree — a port that answers may be serving another change's branch.
|
|
49
|
+
2. Execute `e2e-acceptance.md` from Step 0.5 through Step 7 over the brief's scope, in its own context. A wave runs each case once against the combined stack and names each failure's `implicatedRepo`.
|
|
50
|
+
3. Append the Stage 6 marker to the change's `iterations/<NNN>.md`: that file's report, plus `Tested: <owner/repo>@<sha>` — one line per member for a wave.
|
|
51
|
+
4. Return the same report as its final message.
|
|
52
|
+
|
|
53
|
+
## What the agent never does
|
|
54
|
+
|
|
55
|
+
- Dispatch another agent or fork. It runs every step itself; a re-delegated run escapes the queue and lands on the browser alongside the next one.
|
|
56
|
+
- Edit code, commit, push, open or edit a PR, post or edit a comment, or arm a watcher. Every PR write stays in the main session, the one place that knows which change a PR belongs to.
|
|
57
|
+
- Declare a skip marker. A `SKIPPED` verdict returns its code; the main session declares it from the PR's worktree, where it is verified and where it settles that PR alone.
|
|
58
|
+
- Stop the stack it started.
|
|
59
|
+
|
|
60
|
+
## When the report returns
|
|
61
|
+
|
|
62
|
+
On the agent's completion notification, the main session:
|
|
63
|
+
|
|
64
|
+
1. **Checks freshness.** Every `Tested:` line must name its branch's current head. A branch that moved since dispatch — any member's, for a wave — makes the report stale: queue the change again and post nothing.
|
|
65
|
+
2. **Records it** — `E2E dispatch: reported — …` in `state.md`.
|
|
66
|
+
3. **Continues that change from Stage 7**, in its worktree. [`open-prs/forward.md`](open-prs/forward.md) opens its PR with this report — every member's PR for a wave, in the wave order of [`wave-e2e.md`](wave-e2e.md) Stage 7; when a PR already exists, the report settles that PR's walkthrough through Mode A with its number and repo passed explicitly — never from the current branch, since the session's cwd may be another change's worktree.
|
|
67
|
+
4. **Runs Stage 7.5** inline. A repair pass's re-run returns to this lane, behind any local run in flight.
|
|
68
|
+
5. **Arms the change's watcher** once 7.5 clears (Stage 8).
|
|
69
|
+
6. **Dispatches the next queued change.**
|
|
70
|
+
|
|
71
|
+
An agent that ends without a report is dispatched once more; a second miss runs that change's Stage 6 inline.
|
|
72
|
+
|
|
73
|
+
## PRs opened outside `muggle-do`
|
|
74
|
+
|
|
75
|
+
A session that fixed bugs by hand and opened each PR itself follows the same lane, one acceptance-tester per PR. With no pre-flight or impact analysis, the main session resolves the run first: `muggle-test`'s change detection and test-case selection over that PR's diff against its base, its questions answered in the main session — the agent has no user to ask. The brief then carries the selected test cases, project and URL in place of `e2eScope`, and names [`../_shared/dev-loop/run.md`](../_shared/dev-loop/run.md) as the procedure. The main session posts the returned report to that PR through [`muggle-pr-visual-walkthrough`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A, number and repo explicit.
|
|
76
|
+
|
|
77
|
+
## Enforcement
|
|
78
|
+
|
|
79
|
+
- Dispatching a background acceptance-tester holds the E2E and debug-path Stop gates off for a bounded window, and for that window the walkthrough gate sets aside the PRs its brief names — the session is never steered into a second browser run alongside the agent's.
|
|
80
|
+
- A walkthrough posted to one PR settles that PR only; every other PR the session opened is still checked for its own.
|
|
81
|
+
- A skip declaration settles only the PRs of the working tree it is declared in — the PRs opened from it and its branch's PR, never another change's.
|
|
82
|
+
- Every PR's walkthrough check stays red until its slot is settled, so a change whose run never came back cannot pass as tested.
|
|
83
|
+
|
|
84
|
+
## Invariants
|
|
85
|
+
|
|
86
|
+
- One run and one report per change per full cycle; a wave is one change.
|
|
87
|
+
- At most one local acceptance run in flight from the session.
|
|
88
|
+
- Every PR write happens in the main session.
|
|
89
|
+
- A report settles only the PRs of the change it tested, at the SHA it tested.
|
|
@@ -67,6 +67,10 @@ For a `local-e2e` block, use `localUrl`, `projectId`, and the working-tree path
|
|
|
67
67
|
|
|
68
68
|
`state.md` records `Wave: on` → this stage runs **once for the whole wave**, not per repo, per [`wave-e2e.md`](wave-e2e.md): the wave stack starts from every member's worktree, test cases are selected against the union of diffs, each case runs once, and each failure names its `implicatedRepo`. The steps below apply with those changes.
|
|
69
69
|
|
|
70
|
+
### Step 0.45: Background lane
|
|
71
|
+
|
|
72
|
+
When other work is in front of the session as this change reaches Stage 6, the main session runs none of the steps below: it records `E2E lane: background`, queues the change, and dispatches a background `acceptance-tester` to execute them per [`background-e2e.md`](background-e2e.md). Executing as that agent, follow its rules — in particular, a `SKIPPED` exit returns its code in the report and runs no `MUGGLE_E2E_SKIP` echo; the main session declares it from the PR's worktree once the report returns.
|
|
73
|
+
|
|
70
74
|
### Step 0.5: Readiness check
|
|
71
75
|
|
|
72
76
|
A `local-e2e` cycle runs these before any `muggle-local-execute-*` call, every cycle — even when pre-flight already reported the app ready, since a server can die while stages 2–5 run and a healthy one fast-exits:
|
|
@@ -78,7 +78,7 @@ One question, listing each unrepairable failure with its bucket, failing step, a
|
|
|
78
78
|
|
|
79
79
|
## Step 5: Close the loop
|
|
80
80
|
|
|
81
|
-
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.
|
|
81
|
+
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.
|
|
82
82
|
|
|
83
83
|
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.
|
|
84
84
|
|
|
@@ -12,7 +12,7 @@ Forward pipeline's Stage 7. Invoked by `/muggle-do` after stages 1–6 of a fres
|
|
|
12
12
|
|
|
13
13
|
- Per-repo: name, path, branch.
|
|
14
14
|
- Requirements: goal, acceptance criteria.
|
|
15
|
-
- **Optional** E2E acceptance report from stage 6. Produced by [`../e2e-acceptance.md`](../e2e-acceptance.md); schema in [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md).
|
|
15
|
+
- **Optional** E2E acceptance report from stage 6. Produced by [`../e2e-acceptance.md`](../e2e-acceptance.md) — inline, or returned by this change's background acceptance-tester ([`../background-e2e.md`](../background-e2e.md)); schema in [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md). Only this change's own report: a sibling change's run never settles this PR.
|
|
16
16
|
|
|
17
17
|
## Wave cycles
|
|
18
18
|
|
|
@@ -48,8 +48,8 @@ Forward pipeline's Stage 7. Invoked by `/muggle-do` after stages 1–6 of a fres
|
|
|
48
48
|
- `gitlab` → open the change via [`../../_shared/vcs/gitlab/mr-create.md`](../../_shared/vcs/gitlab/mr-create.md): `glab mr create --source-branch <branch> --target-branch <base> --title "..." --description "..."`. Capture the MR URL and iid.
|
|
49
49
|
|
|
50
50
|
6. **Settle the designated walkthrough comment.** Creating the PR reserves one comment for the walkthrough, marked `muggle-pr-walkthrough` and empty until settled — the PR's walkthrough check fails while it stays that way.
|
|
51
|
-
- E2E report exists → fire [`postPRVisualWalkthrough`](../../muggle-preferences/preference-gates/postPRVisualWalkthrough.md); on skip, leave the comment to the gate's own skip record. Otherwise invoke [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) Mode A with the PR number — it fills the reserved comment in place.
|
|
52
|
-
- No E2E report (validation was `unit-only` or `skip`) → now that the PR exists, re-declare the skip Stage 6 recorded with the same code: `echo "MUGGLE_E2E_SKIP: <CODE>: <detail>"`, codes per [`../e2e-acceptance.md`](../e2e-acceptance.md). An accepted code settles the
|
|
51
|
+
- E2E report exists → fire [`postPRVisualWalkthrough`](../../muggle-preferences/preference-gates/postPRVisualWalkthrough.md); on skip, leave the comment to the gate's own skip record. Otherwise invoke [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) Mode A with the PR number and repo passed explicitly — it fills the reserved comment in place. Explicit because a session carrying several changes may sit in another change's worktree, where the current branch's PR is the wrong one.
|
|
52
|
+
- No E2E report (validation was `unit-only` or `skip`), or a `SKIPPED` report → now that the PR exists, re-declare the skip Stage 6 recorded with the same code, from this PR's worktree: `echo "MUGGLE_E2E_SKIP: <CODE>: <detail>"`, codes per [`../e2e-acceptance.md`](../e2e-acceptance.md). An accepted code settles only the PRs of that worktree's change — the PRs opened from it and its checked-out branch's PR; a free-text reason is rejected and leaves it unsettled. A PR whose title says `[UNIT-ONLY]` still owes reviewers the why. The write runs detached, so confirm it landed: the walkthrough Stop gate holds the turn while the PR still shows the placeholder, and its block names a foreground command that prints `{"settled":true}` once the PR reads back the skip — run it, never a hand-written PATCH.
|
|
53
53
|
|
|
54
54
|
7. **Overflow comment:** if the walkthrough skill returned a non-null `comment`, post it once using the provider resolved in Step 5 — `github` per [`../../_shared/vcs/github/top-level-comment.md`](../../_shared/vcs/github/top-level-comment.md), `gitlab` per [`../../_shared/vcs/gitlab/mr-note.md`](../../_shared/vcs/gitlab/mr-note.md). End the posted body with the signature line (command `/muggle-do`) per [`../../_shared/vcs/post-signature.md`](../../_shared/vcs/post-signature.md). Never post when `comment` is `null`.
|
|
55
55
|
|
|
@@ -36,7 +36,7 @@ Before asking anything, gather every fact you can resolve without the user:
|
|
|
36
36
|
- Is the current checkout already a worktree? `git -C <repo> rev-parse --is-inside-work-tree` plus `git -C <repo> worktree list`.
|
|
37
37
|
- Is the current checkout on the latest base? `muggle checkout-freshness --cwd <repo> --json` fetches and reports the verdict and `behindBy`. However stale or foreign the current checkout, a new worktree starts from `origin/<base>`, never from it.
|
|
38
38
|
10. **`autoE2ETest` preference.** Read the session-context preferences line. Unset → treat as `always` (this gate's default — opposite of the system-wide `ask` default). `ask` → surface in Q13. `always` → no question; stage 6 runs.
|
|
39
|
-
11. **Wave
|
|
39
|
+
11. **Wave or stream?** Group the task's PRs per [`wave-or-stream.md`](wave-or-stream.md). Parts of one change across repos form a **wave** ([`wave-e2e.md`](wave-e2e.md)): record each member's worktree path for the `Wave members` block, or `Wave: off — <reason>` when one fails a wave condition. Unrelated fixes — "fix these three bugs" — form a **stream**: one change per fix, each with its own slug, session directory, branch, worktree, PR and E2E run ([`background-e2e.md`](background-e2e.md)). When unsure, a stream. The questionnaire's answers apply to every change unless a fix names another repo; state the grouping in Q1's options so the user sees how many PRs ship and which share a run.
|
|
40
40
|
12. **CI check present?** For each GitHub repo, whether `.github/workflows/muggle-walkthrough.yml` exists on its default branch. Missing and [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) resolves to `ask` → surface in Q14.
|
|
41
41
|
|
|
42
42
|
## The consolidated questionnaire
|
|
@@ -44,7 +44,7 @@ Before asking anything, gather every fact you can resolve without the user:
|
|
|
44
44
|
Present **one `AskUserQuestion`** (or the platform's structured-selection equivalent) that collects every remaining decision. Use detected values as defaults whenever possible. Questions to include, in this order:
|
|
45
45
|
|
|
46
46
|
1. **Task scope clarification** — only if the task description is genuinely ambiguous. Offer 2–3 interpretations as options plus "Other — type a clarification." If the task is unambiguous, omit.
|
|
47
|
-
2. **Repo(s) to modify** — pre-selected with the best silent match. "Confirm <repo>" / "Change repo" / "Multi-repo (list them)". When multi-repo
|
|
47
|
+
2. **Repo(s) to modify** — pre-selected with the best silent match. "Confirm <repo>" / "Change repo" / "Multi-repo (list them)". When multi-repo, state in the option whether the PRs ship as a wave — one change, tested together in one E2E run — or a stream of independent changes, each tested on its own, per step 11 and [`wave-or-stream.md`](wave-or-stream.md) — no separate question.
|
|
48
48
|
3. **Branch name** — default: `users/<user>/<slug>` derived from the task. "Use default" / "Use different name (type)".
|
|
49
49
|
4. **Validation strategy** — the single most important question. Options:
|
|
50
50
|
- **Local E2E** (Muggle Test Electron against a running localhost) — default if a dev server was detected.
|
|
@@ -81,6 +81,7 @@ After the user answers, write **`state.md`** with every resolved value, verbatim
|
|
|
81
81
|
- Repos: <repo1>, <repo2>
|
|
82
82
|
- Wave: <on | off — reason | N/A (single repo)>
|
|
83
83
|
- Wave members: <one line per repo when on — `<owner/repo> → <worktree path> (branch <branch>)`; see wave-e2e.md>
|
|
84
|
+
- Sibling changes: <slugs of this session's other changes, or none; see background-e2e.md>
|
|
84
85
|
- Branch: <branch-name>
|
|
85
86
|
- Validation: <strategy>
|
|
86
87
|
- Local URL: <url or N/A>
|
|
@@ -113,4 +114,4 @@ Return control to the muggle-do driver with a one-line summary: `pre-flight comp
|
|
|
113
114
|
- Exactly **one** user turn. Zero follow-up questions inside this stage.
|
|
114
115
|
- Silent detection **must** run before the questionnaire — never ask for a value you can detect.
|
|
115
116
|
- Every detected value is a default, not a lock — the user can always override via "Type a different …".
|
|
116
|
-
- Missing `state.md` or `iterations/001.md` at the end of this stage is a stage failure.
|
|
117
|
+
- Missing `state.md` or `iterations/001.md` at the end of this stage is a stage failure. Several changes → one session directory each, all written before Stage 2 starts on the first.
|
|
@@ -6,14 +6,14 @@ So a wave is tested as one: start every repo's service from its wave branch, run
|
|
|
6
6
|
|
|
7
7
|
## When a cycle is a wave
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
What makes PRs a wave rather than a stream of independent changes is defined in [`wave-or-stream.md`](wave-or-stream.md): the PRs need each other to work. A wave additionally needs all of these, decided at pre-flight and recorded in `state.md`:
|
|
10
10
|
|
|
11
11
|
- Two or more repos carry changes this cycle.
|
|
12
12
|
- Each changed repo gets exactly **one** PR — no stacked PRs, no second PR in the same repo.
|
|
13
13
|
- Validation is `local-e2e`.
|
|
14
14
|
- Every wave repo that serves part of the stack can run locally. A repo that only ships a library or config consumed by another wave repo is still a wave member; it just contributes no service of its own.
|
|
15
15
|
|
|
16
|
-
Anything else is not a wave: each PR runs Stage 6 on its own, as
|
|
16
|
+
Anything else is not a wave: each PR is a change of its own and runs Stage 6 on its own — in the background when other work is in flight, per [`background-e2e.md`](background-e2e.md). A wave can run in that background lane too, as one change: its brief carries every member ([`wave-or-stream.md`](wave-or-stream.md#the-acceptance-testers-brief)). Two PRs in one repo, or one repo whose service cannot start locally, fall back to per-PR runs — record the reason in `state.md` as `Wave: off — <reason>`.
|
|
17
17
|
|
|
18
18
|
## What pre-flight records
|
|
19
19
|
|
|
@@ -57,7 +57,7 @@ The SHAs are what the run tested. A result is only valid for the PRs at those SH
|
|
|
57
57
|
1. **Open every PR first**, before settling any walkthrough. Each PR's walkthrough names its siblings, so all PR numbers must exist before the first one is written.
|
|
58
58
|
2. **Body.** Add a `## Wave` section to each PR's body, after `## Validation`: one line per sibling PR (`owner/repo#n`), and the line `Tested together — merge all PRs in this wave together.`
|
|
59
59
|
3. **Title.** Every PR in the wave takes the same E2E prefix. A wave run with failures retitles every member `[E2E FAILING]`, not only the implicated one — the run tested them as one change.
|
|
60
|
-
4. **Walkthrough.** Settle each PR's designated walkthrough comment with the **same** E2E report through [`muggle-pr-visual-walkthrough`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A, passing that PR's number and repo explicitly — Mode A otherwise looks up the PR from the current branch, which in a multi-repo cycle is the wrong repo. The runs, screenshots, and dashboard links are identical on every PR; only the PR it is posted to differs.
|
|
60
|
+
4. **Walkthrough.** Settle each PR's designated walkthrough comment with the **same** E2E report through [`muggle-pr-visual-walkthrough`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A, passing that PR's number and repo explicitly — Mode A otherwise looks up the PR from the current branch, which in a multi-repo cycle is the wrong repo. The runs, screenshots, and dashboard links are identical on every PR; only the PR it is posted to differs. A `SKIPPED` wave run is re-declared from each member's worktree in turn: a declaration settles only the PR of the tree it runs in.
|
|
61
61
|
5. **Record the PR numbers** on the `Wave members` lines in `state.md` (`… (branch <branch>) → PR #<n>`), so a later cycle on any one PR can find its siblings. Every slot a wave PR's watcher runs from gets the same `Wave` block.
|
|
62
62
|
|
|
63
63
|
## Stage 7.5 — repair across the wave
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Wave or stream — how a session's PRs group into changes
|
|
2
|
+
|
|
3
|
+
A session that opens more than one PR has opened a **wave**, a **stream**, or both, and each is tested differently. The grouping decides how many E2E runs the session owes and which report each PR carries, so it is settled once, at pre-flight, and every later stage reads it from `state.md`.
|
|
4
|
+
|
|
5
|
+
## Wave
|
|
6
|
+
|
|
7
|
+
One change split across repos. The PRs only work together: the frontend PR calls an endpoint the backend PR adds; a library PR ships a type its consumers adopt in theirs.
|
|
8
|
+
|
|
9
|
+
- One PR per repo, all carrying parts of the same change.
|
|
10
|
+
- **One** E2E run against the combined stack, every service started from its member's branch. The same report goes on every PR in the wave, and they merge together.
|
|
11
|
+
- Procedure: [`wave-e2e.md`](wave-e2e.md).
|
|
12
|
+
|
|
13
|
+
## Stream
|
|
14
|
+
|
|
15
|
+
Unrelated changes that ship in the same session: separate bugs, separate tasks. Each PR stands alone — it would pass review and work in production if none of the others ever merged.
|
|
16
|
+
|
|
17
|
+
- Each PR is its own change, with its own session directory, branch, worktree, E2E run and report.
|
|
18
|
+
- Each run goes to a background acceptance-tester while the session moves on, one local run at a time.
|
|
19
|
+
- Procedure: [`background-e2e.md`](background-e2e.md).
|
|
20
|
+
|
|
21
|
+
A session can hold both. A wave for one feature, opened alongside unrelated fixes, is one change in the stream: it gets one wave run, and each fix gets its own.
|
|
22
|
+
|
|
23
|
+
## Deciding
|
|
24
|
+
|
|
25
|
+
For each pair of PRs, ask whether either needs the other to work.
|
|
26
|
+
|
|
27
|
+
| Answer | Grouping |
|
|
28
|
+
| :----- | :------- |
|
|
29
|
+
| Yes, and they are in different repos | Same wave |
|
|
30
|
+
| Yes, and they are in the same repo | A stack, not a wave: each PR is tested on its own branch, which already carries the PRs beneath it |
|
|
31
|
+
| No | Separate changes in the stream |
|
|
32
|
+
|
|
33
|
+
A wave also needs every serving repo to run locally ([`wave-e2e.md`](wave-e2e.md#when-a-cycle-is-a-wave)). Interdependent PRs whose stack cannot start together are tested per PR; record why as `Wave: off — <reason>`.
|
|
34
|
+
|
|
35
|
+
**When unsure, treat them as a stream.** A stream PR that needed a sibling fails visibly, and its repair loop names the missing piece. A wave that should have been a stream puts one change's report on another change's PR — the evidence reviewers trust most, vouching for code it never ran.
|
|
36
|
+
|
|
37
|
+
## Recording
|
|
38
|
+
|
|
39
|
+
Pre-flight writes the grouping into `state.md`; no later stage re-derives it from branch names or diffs.
|
|
40
|
+
|
|
41
|
+
- **Wave** — one session directory for the wave, with `Wave: on` and its `Wave members` block ([`wave-e2e.md`](wave-e2e.md#what-pre-flight-records)).
|
|
42
|
+
- **Stream** — one session directory per change, each listing the others under `Sibling changes`.
|
|
43
|
+
|
|
44
|
+
A change that grows a second repo mid-cycle has become a wave: record the new member before Stage 6, never after a run has already been posted per PR.
|
|
45
|
+
|
|
46
|
+
## The acceptance-tester's brief
|
|
47
|
+
|
|
48
|
+
A background run tests exactly one change, so its brief names exactly that change's PRs ([`background-e2e.md`](background-e2e.md#brief)):
|
|
49
|
+
|
|
50
|
+
- **A stream change** — its one repo, worktree, branch, head SHA and PR.
|
|
51
|
+
- **A wave** — every member's repo, worktree, branch, head SHA and PR. The agent starts the combined stack per [`wave-e2e.md`](wave-e2e.md) Stage 6, reports `Tested:` once per member, and names each failure's `implicatedRepo`.
|
|
@@ -25,7 +25,11 @@ Runs an autonomous dev cycle from requirements to PR. **Fire and review:** user
|
|
|
25
25
|
| 7.5 | E2E repair loop | [`../do/e2e-repair.md`](../do/e2e-repair.md) |
|
|
26
26
|
| 8 | Hand off to watcher | [`../muggle-pr-followup/SKILL.md`](../muggle-pr-followup/SKILL.md) |
|
|
27
27
|
|
|
28
|
-
**
|
|
28
|
+
**Waves and streams.** A session's PRs are either a **wave** — one change split across repos — or a **stream** of independent changes, or both; [`../do/wave-or-stream.md`](../do/wave-or-stream.md) defines which is which, and pre-flight decides it once.
|
|
29
|
+
|
|
30
|
+
**Multi-repo waves.** When a task's PRs need each other to work — one PR per repo — they form a wave: every repo's service starts from its branch, Stage 6 runs **one** E2E pass against the combined stack, and that same result is posted to every PR in the wave. See [`../do/wave-e2e.md`](../do/wave-e2e.md); pre-flight decides whether a cycle is a wave.
|
|
31
|
+
|
|
32
|
+
**Streams — several changes in one session.** Unrelated fixes — several bugs in one request, or a second task while the first is still in flight — are separate changes, each with its own session directory, worktree, PR, and E2E run; a wave is one change among them. When a change reaches Stage 6 while other work is in front of the session, its run goes to a background `acceptance-tester` and the session moves on; the report comes back to the main session, which carries that change through Stages 7–8. One local run at a time, and a PR's walkthrough only ever carries its own change's run. See [`../do/background-e2e.md`](../do/background-e2e.md).
|
|
29
33
|
|
|
30
34
|
Stage 7 dispatches one watcher per opened PR as its last action, gated on Stage 7.5's clearance — a cycle with unrepaired E2E failures never reaches a watcher.
|
|
31
35
|
|
|
@@ -36,7 +40,7 @@ The pipeline table lists **pointers, not summaries**. Open each stage's file and
|
|
|
36
40
|
**Bootstrap before any code, in order:**
|
|
37
41
|
1. Emit telemetry — [`../_shared/telemetry-emit.md`](../_shared/telemetry-emit.md), `skillName: "muggle-do"`.
|
|
38
42
|
2. Create `~/.muggle-ai/muggle-do/sessions/<slug>/` with `state.md` + `iterations/001.md` (pre-flight owns this; do it even when running unattended).
|
|
39
|
-
3. `TodoWrite` one item per stage 1–8, Stage 7.5 included — these stages are the checklist; never swap in your own decomposition.
|
|
43
|
+
3. `TodoWrite` one item per stage 1–8, Stage 7.5 included — these stages are the checklist; never swap in your own decomposition. Several changes → one set of stage items per change.
|
|
40
44
|
|
|
41
45
|
**Per stage:** read the file → execute it → append a marker to `iterations/<NNN>.md` 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.
|
|
42
46
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"release": "5.18.0",
|
|
3
|
-
"buildId": "run-
|
|
4
|
-
"commitSha": "
|
|
5
|
-
"buildTime": "2026-10-26T07:
|
|
3
|
+
"buildId": "run-209-1",
|
|
4
|
+
"commitSha": "dd6d2ee2dd78002fb82d350df6d625cfd97fa18c",
|
|
5
|
+
"buildTime": "2026-10-26T07:50:08Z",
|
|
6
6
|
"serviceName": "muggle-ai-works-mcp"
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muggleai/works",
|
|
3
3
|
"mcpName": "io.github.multiplex-ai/muggle",
|
|
4
|
-
"version": "5.26.0-staging.
|
|
4
|
+
"version": "5.26.0-staging.209",
|
|
5
5
|
"description": "13 years of Microsoft hyperscale engineering, packaged as a harness for your AI coding agent.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
4
|
-
"version": "5.26.0-staging.
|
|
4
|
+
"version": "5.26.0-staging.209",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
package/plugin/.codex-mcp.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
|
-
"version": "5.26.0-staging.
|
|
3
|
+
"version": "5.26.0-staging.209",
|
|
4
4
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
5
|
-
"version": "5.26.0-staging.
|
|
5
|
+
"version": "5.26.0-staging.209",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/plugin/.mcp.json
CHANGED
|
@@ -30,6 +30,8 @@ The orchestrator provides a dispatch prompt with:
|
|
|
30
30
|
|
|
31
31
|
- **What to do:** Run tests, import tests, manage preferences, check status, or repair.
|
|
32
32
|
- **For testing:** Target URL and what to test — a feature description, acceptance criteria, or "run regression on recent changes."
|
|
33
|
+
- **For a background change run:** one change's brief — its session directory, repo, worktree, branch, head SHA, validation target, project, scope, and the absolute path of the stage file to execute. Read that file and execute its steps yourself, starting the app from the brief's worktree; its tool calls are the run. Every value you need is in the brief — the conversation that wrote it is not available to you.
|
|
34
|
+
- **For a background wave run:** the same brief, carrying every member of the wave — a change split across repos whose PRs only work together — each with its own repo, worktree, branch, head SHA and PR, plus the wave stage file. Start every member's services from that member's worktree, run each test case once against the combined stack, and name the member each failure implicates. A brief whose PRs are unrelated changes is a stream, not a wave: test only the one change it names, and leave its siblings to their own runs.
|
|
33
35
|
- **For import:** Path to test files or documents to import.
|
|
34
36
|
- **For preferences:** Which preference to view or change, or "show all."
|
|
35
37
|
- **For status/repair:** No additional input needed.
|
|
@@ -81,6 +83,16 @@ For each **passed** test, list the name only:
|
|
|
81
83
|
### {Test Name} — PASS
|
|
82
84
|
```
|
|
83
85
|
|
|
86
|
+
### When Running a Background Change Run
|
|
87
|
+
|
|
88
|
+
Return the report in the Output format of the stage file the brief named, followed by one line naming what the run tested — one line per member for a wave run, and each failed test naming its `implicatedRepo` (the member whose change the failing step points at, or `unknown`):
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Tested: {owner/repo}@{head sha}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The orchestrator posts the report only while every listed SHA is still its branch head, and only to that change's PRs — for a wave, the same report to every member's PR. A run that could not start reports its verdict and reason in the same format — never return without a report.
|
|
95
|
+
|
|
84
96
|
### When Importing Tests
|
|
85
97
|
|
|
86
98
|
Report:
|
|
@@ -108,5 +120,9 @@ Report:
|
|
|
108
120
|
3. **Describe problems from the user's perspective.** "The checkout button is not clickable after adding an item to the cart" — not "onClick handler missing on Button component in CartPage.tsx."
|
|
109
121
|
4. **Do not modify application code.** Report findings; coding agents act on them.
|
|
110
122
|
5. **Do not decide when to run.** The orchestrator dispatches; you execute and report.
|
|
111
|
-
6. **Do not choose local vs remote.** The `muggle-test` skill handles routing based on the target URL and user preferences.
|
|
112
|
-
7. **Use skills, not raw MCP tools.** The orchestrator pastes the full skill text into your dispatch prompt. Follow the skill's instructions exactly.
|
|
123
|
+
6. **Do not choose local vs remote.** The `muggle-test` skill handles routing based on the target URL and user preferences; in a background change run, the brief's validation target decides.
|
|
124
|
+
7. **Use skills, not raw MCP tools.** The orchestrator pastes the full skill text into your dispatch prompt. Follow the skill's instructions exactly. A background change run is the one exception: the stage file its brief names is the procedure, and its MCP calls are its steps.
|
|
125
|
+
8. **Never dispatch another agent or fork.** Run every step in your own context. A run handed further down escapes the orchestrator's one-local-run-at-a-time queue and lands on the browser alongside the next run; two studio runs at once corrupt each other.
|
|
126
|
+
9. **Never run alongside another local run.** Before your first local execution, list the local run results; if a run is still executing, return `BLOCKED — another local run in flight` instead of starting one.
|
|
127
|
+
10. **Never write to a PR or the repo.** No commits, pushes, PR edits, comments, walkthrough posts, or watcher arms — the orchestrator owns every PR write, because only it knows which change a PR belongs to.
|
|
128
|
+
11. **Never declare a skip marker in a background change run.** Return the skip code in the report; the orchestrator declares it from the PR's own worktree, where it settles that PR alone.
|
package/plugin/hooks/README.md
CHANGED
|
@@ -35,22 +35,23 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
|
|
|
35
35
|
| Hook event | Wrapper | Strength | Condition | Preference | Effect |
|
|
36
36
|
| :--------- | :------ | :------- | :-------- | :--------- | :----- |
|
|
37
37
|
| `PostToolUse` (Bash) | `guardrail-pr-opened.sh` | advise | a `gh pr create`/`gh pr ready` just succeeded | `autoWatchPR` | start a `muggle-pr-followup` watcher on the new PR |
|
|
38
|
-
| `PostToolUse` (Bash + muggle execute/replay MCP tools) | `guardrail-record-tests.sh` | record | a unit-test command passed, an E2E run happened (execute/replay call), or an `echo "MUGGLE_E2E_SKIP: <reason>"` marker declared E2E un-runnable, or a walkthrough carrying the `build-pr-section` sentinel was posted / declared un-postable via `echo "MUGGLE_WALKTHROUGH_SKIP: <reason>"` | — | set `unitTestsGreen` / `e2eRun` / `e2eSkipped` / `
|
|
38
|
+
| `PostToolUse` (Bash + muggle execute/replay MCP tools) | `guardrail-record-tests.sh` | record | a unit-test command passed, an E2E run happened (execute/replay call), or an `echo "MUGGLE_E2E_SKIP: <reason>"` marker declared E2E un-runnable, or a walkthrough carrying the `build-pr-section` sentinel was posted / declared un-postable via `echo "MUGGLE_WALKTHROUGH_SKIP: <reason>"` | — | set `unitTestsGreen` / `e2eRun` / `e2eSkipped` / `walkthroughPostedPrUrls` / `walkthroughSkipped` session state. A post settles only the PR its output names (`gh pr comment`/`create` print it; a `gh api` comment edit returns `html_url`); a post whose output names none is timestamped (`walkthroughPostedAt`), and a scan begun after it decides. An accepted skip records the working tree it was verified in and settles only that tree's change: the PRs opened from it (`prWorkingTrees`, tracked in `e2eSkipCoveredPrs`) and its checked-out branch's PR |
|
|
39
39
|
| `PostToolUse` (Bash) | `guardrail-pr-terminal.sh` | advise | a PR just went terminal — a `gh pr merge`/`gh pr close` success line or the `TERMINAL pr=N` line the watch scripts print in a shell result (never bare `"state":"MERGED"` metadata). Not registered on `Monitor`: a Monitor call returns before its script prints anything, so its result never carries that line | — | record `terminalPending`, direct the post-merge handoff: finalize the watcher slot, tear down per `autoCleanup`, offer next options via AskUserQuestion |
|
|
40
40
|
| `PostToolUse` (AskUserQuestion) | `guardrail-offer-ran.sh` | record | a next-options offer ran while a terminal PR was pending | — | clear `terminalPending` — the only exit for the post-merge Stop gate |
|
|
41
|
+
| `PostToolUse` (Agent, Task) | `guardrail-record-delegation.sh` | record | a `muggle:acceptance-tester` was launched into the background — its response carries no finished report yet | — | append to `e2eDelegations` with the PR URLs its brief names; for a bounded window the E2E and debug-path gates hold off, and the walkthrough gate sets those PRs aside, so the session is never steered into a second browser run alongside the agent's. Shares the AskUserQuestion group's dispatch |
|
|
41
42
|
| `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone: the state store drops a write that cannot take the session's lock in time, so a second writer for one emit could lose either record | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use |
|
|
42
43
|
| `PostToolUse` (Read) | `guardrail-record-stage-read.sh` | record | a markdown file under a `skills/` directory was opened | — | append to `stagesRead` — how the stage gate tells a stage that was read from one that was skipped |
|
|
43
44
|
| `PostToolUse` (Bash + muggle telemetry-event-emit / user-feedback-create) | `guardrail-record-stage-signals.sh` | record | a Step 6f `pre-execution-classification` emit, debug-path evidence for a failed run (a `*-failure-classified\|resolved` emit or feedback naming it), or a `MUGGLE_STAGE_SKIP` / `MUGGLE_CLASSIFY_SKIP` / `MUGGLE_DEBUG_SKIP` marker | — | set `classifiedTestCaseIds` / `debuggedRuns` / the matching skip flag |
|
|
44
45
|
| `PostToolUse` (Bash) | `guardrail-record-comment-replies.sh` | record | an unresolved-thread fetch named review threads still awaiting an answer (classified by the `<!-- muggle-do:bot -->` marker, never the author login), a threaded reply the provider **confirmed** answered comments in one, or a `MUGGLE_REPLY_SKIP` marker deferred them | — | claim each thread and cover the comments answered, in the per-PR ledger beside the muggle-do slot |
|
|
45
46
|
| `PreToolUse` (Bash, `if` a command names `gh`/`glab`) | `guardrail-report-format.sh` | **enforce** | a `gh pr comment\|create\|edit` body — or a `gh api … issues/comments/<id>` PATCH editing one — reads like an E2E report but lacks the `build-pr-section` sentinel | — | **deny** — render via `muggle build-pr-section` instead |
|
|
46
47
|
| `PreToolUse` (muggle local execute/replay) | `guardrail-classify-gate.sh` | **enforce** | `muggle-test` is the skill in play and the target test case has no `pre-execution-classification` this session | — | **deny** — run Step 6f first (it calls `muggle-remote-test-script-list`, which is where the run learns the case has never passed) or record a legitimate skip via `MUGGLE_CLASSIFY_SKIP`. Scoped to `muggle-test`, so the single-target skills that legitimately skip classification are untouched; fails open when the test case can't be resolved |
|
|
47
|
-
| `Stop` | `guardrail-e2e-gate.sh` | **enforce** | unit tests passed this session, no E2E ran yet, and no skip was recorded | `autoE2ETest` | **block** the turn until E2E runs via `muggle-test` or a `MUGGLE_E2E_SKIP` marker records a legitimate skip (full message once, one-line reminders after; releases after 3 blocks) |
|
|
48
|
+
| `Stop` | `guardrail-e2e-gate.sh` | **enforce** | unit tests passed this session, no E2E ran yet, and no skip was recorded | `autoE2ETest` | **block** the turn until E2E runs via `muggle-test` or a `MUGGLE_E2E_SKIP` marker records a legitimate skip (full message once, one-line reminders after; releases after 3 blocks). Quiet while a background acceptance-tester is in flight |
|
|
48
49
|
| `Stop` | `guardrail-terminal-gate.sh` | **enforce** | a PR went terminal this session and the AskUserQuestion next-options offer hasn't run since | — | **block** the turn until the post-merge handoff runs (full message once, one-line reminders after; releases after 3 blocks; nothing but the offer resets the counter) |
|
|
49
50
|
| `Stop` | `guardrail-watch-gate.sh` | **enforce** | a PR opened this session that is still open and has no live watch — no session slot for it is terminal, stopped by its owner, or carries a `watch-heartbeat` touched within 15 minutes; a slot that is only seeded does not count | `autoWatchPR` | **block** the turn until the watch is armed per `muggle-pr-followup`'s `arm-watcher.md` or a `MUGGLE_WATCH_SKIP` marker records a legitimate skip (releases after 3 blocks). A PR clears once the session sees it go terminal or a provider lookup reports it merged or closed — what lets a PR whose slot post-merge cleanup deleted through. The lookup runs in a detached scan queued at turn end; a PR it has not reached yet still blocks, and one it could not reach fails open |
|
|
50
51
|
| `Stop` | `guardrail-watch-follow-through-gate.sh` | **enforce** | a `muggle-pr-followup` watch this session owns (the slot's `owner.json`) recorded due work in `watch-due.env` — a branch behind or conflicting with its base, or a head whose checks settled red — and `last_seen.json` records no attempt for it: no `conflict_resolve_attempts` entry for the rebase key (enforced under `autoRebase=always` while catch-up budget is left), no `ci_fix_attempts` entry for the red head. An escalation entry with no attempt behind it counts for nothing, and re-arming the watch changes nothing | `autoRebase` | **block** the turn, naming each PR and its `/muggle-do rebase` or `fix ci` dispatch. No release after N blocks: only a recorded attempt, a newer head in the slot's `prs.json`, or the user's literal `HOLD WATCH #<pr-number>` clears it. The hold must come from a turn the user typed — never a tool result, a loaded skill, a hook's message, a task notification, a compaction summary, or the agent's own text — and is kept for the session once read. Reads local files only, never a provider: the pre-filter is a builtins glob for a non-empty `watch-due.env` whose `owner.json` names the session, so Node starts only when a slot has due work |
|
|
51
|
-
| `Stop` | `guardrail-walkthrough-gate.sh` | **enforce** | an E2E acceptance run happened this session and a PR in play — opened this session or on the working branch — carries no walkthrough in its body or comments; or an E2E skip was accepted and a PR
|
|
52
|
+
| `Stop` | `guardrail-walkthrough-gate.sh` | **enforce** | an E2E acceptance run happened this session and a PR in play — opened this session or on the working branch — carries no walkthrough in its body or comments; or an E2E skip was accepted and a PR it covers still shows the empty placeholder instead of the skip's record | `postPRVisualWalkthrough` | **block** the turn until the walkthrough is posted via `muggle-pr-visual-walkthrough` or a `MUGGLE_WALKTHROUGH_SKIP` marker records a legitimate skip. For a PR an accepted E2E skip covers, the block hands over the foreground `settle-walkthrough-skipped <pr> <session>` command, which prints `{"settled":true}` once the PR reads back the skip, and re-queues the detached write; a PR the skip does not cover is a different change and is told to run its own E2E or declare its own skip from its tree (releases after 3 blocks; an unreachable PR fails open to not-owed). A skip accepted before its PR existed is written straight into the PR's slot when it opens from the same tree. The provider lookups run in a detached scan, queued when the gate arms, when a PR opens, and at each turn end; the gate decides on the last scan for the session's current PRs, begun after the last observed post, and stays open until one lands. Each PR is checked for its own walkthrough: a post to one PR settles only that one, and opening another re-arms the check. A PR whose own background run is in flight is set aside |
|
|
52
53
|
| `Stop` | `guardrail-stage-gate.sh` | **enforce** | a skill invoked this session declared `mandatoryStages` and one of those files was never opened | — | **block** the turn until the stages are read or a `MUGGLE_STAGE_SKIP` marker records a legitimate skip (releases after 3 blocks) |
|
|
53
|
-
| `Stop` | `guardrail-debug-path-gate.sh` | **enforce** | a local execution returned a non-passing run this session and nothing routed it through `_shared/debug-failed-run.md` | — | **block** the turn until the run is diagnosed (its `*-failure-classified` emit or feedback naming it) or a `MUGGLE_DEBUG_SKIP: <runId> <reason>` marker clears that run (releases after 3 blocks) |
|
|
54
|
+
| `Stop` | `guardrail-debug-path-gate.sh` | **enforce** | a local execution returned a non-passing run this session and nothing routed it through `_shared/debug-failed-run.md` | — | **block** the turn until the run is diagnosed (its `*-failure-classified` emit or feedback naming it) or a `MUGGLE_DEBUG_SKIP: <runId> <reason>` marker clears that run (releases after 3 blocks). Quiet while a background acceptance-tester is in flight — its failed runs land in this session's state and it debugs them itself |
|
|
54
55
|
| `Stop` | `guardrail-comment-reply-gate.sh` | **enforce** | this session claimed a review thread and left one of its comments uncovered | — | **block** the turn until each comment gets its threaded reply per `do/per-comment-replies.md` or a `MUGGLE_REPLY_SKIP: <comment-id> <reason>` marker defers it (releases after 3 blocks). The claim is the signal, not a push, so a round that answers a question with no code change is caught too; a thread another session claimed never blocks this one |
|
|
55
56
|
| `Stop` | `guardrail-capability-claim.sh` | **enforce** | the closing turn tells the user a login- or code-gated flow can't be tested, reached, or verified | — | **block** once, citing `_shared/identity-and-inbox.md`: the managed profile's live inbox, provisioned number, stored TOTP secret, credentials, and CAPTCHA solver clear exactly that blocker. Reads the claim out of the transcript, since a Stop payload carries no message text. Per-sentence matching, and a sentence naming a voice call, an OAuth-only provider, or a deployment with no number provisioned never fires — those limits are real. Nudges once per session, then stays quiet, so a misread costs one turn |
|
|
56
57
|
| `UserPromptSubmit` | `guardrail-build-router.sh` | advise | a build/implement/fix request (first one this session) | `autoRouteBuildToMuggleDo` | route the work through `muggle-do` (build delegated to superpowers) |
|
|
@@ -102,10 +102,10 @@
|
|
|
102
102
|
"hooks": [
|
|
103
103
|
{
|
|
104
104
|
"type": "command",
|
|
105
|
-
"command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-offer-ran.sh
|
|
105
|
+
"command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-offer-ran.sh guardrail-record-delegation.sh",
|
|
106
106
|
"async": false,
|
|
107
107
|
"timeout": 10,
|
|
108
|
-
"commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-offer-ran.sh
|
|
108
|
+
"commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-offer-ran.sh guardrail-record-delegation.sh"
|
|
109
109
|
}
|
|
110
110
|
]
|
|
111
111
|
}
|
package/plugin/hooks/hooks.json
CHANGED
|
@@ -133,11 +133,11 @@
|
|
|
133
133
|
]
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
|
-
"matcher": "AskUserQuestion",
|
|
136
|
+
"matcher": "AskUserQuestion|Agent|Task",
|
|
137
137
|
"hooks": [
|
|
138
138
|
{
|
|
139
139
|
"type": "command",
|
|
140
|
-
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-offer-ran.sh
|
|
140
|
+
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-offer-ran.sh guardrail-record-delegation.sh",
|
|
141
141
|
"async": false,
|
|
142
142
|
"timeout": 1
|
|
143
143
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -uo pipefail
|
|
3
|
+
|
|
4
|
+
# Background acceptance-tester observer (PostToolUse/Agent|Task). Records that
|
|
5
|
+
# a change's E2E was handed to a muggle:acceptance-tester running in the
|
|
6
|
+
# background, so the E2E, walkthrough and debug-path Stop gates hold off rather
|
|
7
|
+
# than steer the main session into a second browser run alongside the agent's.
|
|
8
|
+
# Emits no directive.
|
|
9
|
+
#
|
|
10
|
+
# Pre-filter: most dispatches are other agents, so only a payload naming the
|
|
11
|
+
# acceptance-tester spawns Node. Degrades to {}.
|
|
12
|
+
|
|
13
|
+
guardrail_script_dir="${BASH_SOURCE[0]%/*}"
|
|
14
|
+
[[ $guardrail_script_dir == "${BASH_SOURCE[0]}" ]] && guardrail_script_dir=.
|
|
15
|
+
. "$guardrail_script_dir/guardrail-lib.sh"
|
|
16
|
+
|
|
17
|
+
GUARDRAIL_SUBCOMMAND="record-delegation"
|
|
18
|
+
|
|
19
|
+
guardrail_wants() {
|
|
20
|
+
guardrail_payload_matches 'acceptance-tester'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
|
|
24
|
+
guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
|
|
25
|
+
fi
|
|
@@ -11,11 +11,11 @@ set -uo pipefail
|
|
|
11
11
|
# it fires on EVERY turn end. There is no command payload to key off, so the
|
|
12
12
|
# pre-filter reads the same per-session state file guardrails.mjs uses and only
|
|
13
13
|
# spawns Node when the gate could actually fire — i.e. an acceptance run or an
|
|
14
|
-
# unsettled skip is recorded and the walkthrough is neither
|
|
15
|
-
# On the overwhelming majority of turns (no E2E this session)
|
|
16
|
-
# absent or carries neither, so we return {} in-shell and
|
|
17
|
-
# cold-start — which also means the gate's `gh` lookups only
|
|
18
|
-
# that could genuinely owe a walkthrough. Degrades to {}.
|
|
14
|
+
# unsettled skip is recorded and the walkthrough is neither verified on every
|
|
15
|
+
# PR nor skipped. On the overwhelming majority of turns (no E2E this session)
|
|
16
|
+
# the state file is absent or carries neither, so we return {} in-shell and
|
|
17
|
+
# never pay Node cold-start — which also means the gate's `gh` lookups only
|
|
18
|
+
# ever run on turns that could genuinely owe a walkthrough. Degrades to {}.
|
|
19
19
|
|
|
20
20
|
guardrail_script_dir="${BASH_SOURCE[0]%/*}"
|
|
21
21
|
[[ $guardrail_script_dir == "${BASH_SOURCE[0]}" ]] && guardrail_script_dir=.
|
|
@@ -25,7 +25,7 @@ GUARDRAIL_SUBCOMMAND="walkthrough-gate"
|
|
|
25
25
|
|
|
26
26
|
guardrail_wants() {
|
|
27
27
|
guardrail_load_state || return 1
|
|
28
|
-
guardrail_state_has '"
|
|
28
|
+
guardrail_state_has '"walkthroughsVerified": true' && return 1
|
|
29
29
|
guardrail_state_has '"walkthroughReleased": true' && return 1
|
|
30
30
|
guardrail_state_has '"walkthroughSkipped": true' && return 1
|
|
31
31
|
guardrail_state_has '"e2eRun": true' && return 0
|