@muggleai/works 5.27.0-staging.230 → 5.27.0-staging.231

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.
@@ -9,7 +9,7 @@
9
9
  "name": "muggleai",
10
10
  "source": "./plugin",
11
11
  "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.",
12
- "version": "5.27.0-staging.230"
12
+ "version": "5.27.0-staging.231"
13
13
  }
14
14
  ]
15
15
  }
@@ -3292,11 +3292,11 @@ function createCheckRun(repo, checkRun, run) {
3292
3292
  function commentWithStatus(comments, status) {
3293
3293
  return comments.find((comment) => classifyComment(comment.body) === status);
3294
3294
  }
3295
+ function designatedComment(comments) {
3296
+ return comments.find((comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */);
3297
+ }
3295
3298
  function reserveComment(pr, comments, run) {
3296
- const claimed = comments.some(
3297
- (comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */
3298
- );
3299
- if (claimed) return false;
3299
+ if (designatedComment(comments)) return false;
3300
3300
  return postPrComment(pr, renderReservedComment(), run);
3301
3301
  }
3302
3302
  function settleDependencyBotComment(pr, comments, login, run) {
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-N7DYL5J4.js';
2
+ import { runCli } from './chunk-F5KU5ZP2.js';
3
3
  import './chunk-A3YLVNL7.js';
4
4
 
5
5
  // src/cli/main.ts
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-N7DYL5J4.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-F5KU5ZP2.js';
2
2
  export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-A3YLVNL7.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.27.0-staging.230",
4
+ "version": "5.27.0-staging.231",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.27.0-staging.230",
7
+ "@muggleai/works@5.27.0-staging.231",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.27.0-staging.230",
3
+ "version": "5.27.0-staging.231",
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.27.0-staging.230",
5
+ "version": "5.27.0-staging.231",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.27.0-staging.230",
7
+ "@muggleai/works@5.27.0-staging.231",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -46,6 +46,8 @@ existing=$(gh api "repos/<owner>/<repo>/issues/<prNumber>/comments" \
46
46
 
47
47
  Match only comments carrying one of those markers — never every comment the loop user wrote — so an unrelated reply is never overwritten.
48
48
 
49
+ While a run is in flight, the comment carries a "new E2E run in progress" banner above the previous run's walkthrough. The PATCH replaces the whole body, banner included; never carry the banner or the previous walkthrough into the new body.
50
+
49
51
  Report back: PR URL, whether an overflow comment was involved, and whether this was a fresh post or an update.
50
52
 
51
53
  **Modes B/C (`render-for-new-pr` / `embed`)** — do not post, do not touch `gh`. Return the CLI output verbatim as your report:
@@ -47,6 +47,7 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
47
47
  | `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 |
48
48
  | `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 |
49
49
  | `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 |
50
+ | `PreToolUse` (muggle local execute/replay) | `guardrail-walkthrough-rerun.sh` | record | a browser run is about to start in a working tree (the tool call's `cwd`) whose branch has a PR, and that PR's walkthrough comment already shows a run or a skip | — | a detached job puts a "new E2E run in progress" banner, with its UTC start time, on top of the walkthrough the run will replace. The comment underneath is untouched, so the walkthrough check judges it as before; the run's own walkthrough replaces the whole body, banner included. A reserved placeholder or a comment already bannered is left alone |
50
51
  | `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 |
51
52
  | `Stop` | `guardrail-terminal-gate.sh` | **enforce** | a PR went terminal this session and the next-options offer hasn't run since — an AskUserQuestion, or, while the session owns an open PR's watch slot, a closing message that asks the user | — | **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) |
52
53
  | `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 |
@@ -40,10 +40,10 @@
40
40
  "hooks": [
41
41
  {
42
42
  "type": "command",
43
- "command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-classify-gate.sh\"",
43
+ "command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-classify-gate.sh guardrail-walkthrough-rerun.sh",
44
44
  "async": false,
45
45
  "timeout": 10,
46
- "commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-classify-gate.sh\""
46
+ "commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-classify-gate.sh guardrail-walkthrough-rerun.sh"
47
47
  }
48
48
  ]
49
49
  }
@@ -58,7 +58,7 @@
58
58
  "hooks": [
59
59
  {
60
60
  "type": "command",
61
- "command": "set -- guardrail-classify-gate.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
61
+ "command": "set -- guardrail-dispatch.sh guardrail-classify-gate.sh guardrail-walkthrough-rerun.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
62
62
  "async": false,
63
63
  "timeout": 1
64
64
  }
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+
4
+ # Walkthrough rerun notice (PreToolUse/muggle local execution tools).
5
+ # A browser run about to start on a working tree whose branch has a PR will
6
+ # replace that PR's walkthrough, so the comment gets a banner saying a new run
7
+ # is in progress before the run starts — never a decision, always {}. The
8
+ # provider calls run in a detached job, keyed on the tree the tool call names.
9
+ #
10
+ # The pre-filter re-states the execution tool names, like the classify gate's,
11
+ # so an unrelated payload never pays Node cold-start. `[-_]` because Codex
12
+ # reports an MCP tool with underscores where the server spells hyphens.
13
+
14
+ guardrail_script_dir="${BASH_SOURCE[0]%/*}"
15
+ [[ $guardrail_script_dir == "${BASH_SOURCE[0]}" ]] && guardrail_script_dir=.
16
+ . "$guardrail_script_dir/guardrail-lib.sh"
17
+
18
+ GUARDRAIL_SUBCOMMAND="walkthrough-rerun-notice"
19
+
20
+ guardrail_wants() {
21
+ guardrail_payload_matches 'muggle[-_]local[-_](execute[-_]test[-_]generation|execute[-_]replay)'
22
+ }
23
+
24
+ if guardrail_is_hook_script; then
25
+ guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
26
+ fi
@@ -265,6 +265,7 @@ var GuardrailBackgroundJob = /* @__PURE__ */ ((GuardrailBackgroundJob2) => {
265
265
  GuardrailBackgroundJob2["SettleBranchWalkthroughSkipped"] = "settle-branch-walkthrough-skipped";
266
266
  GuardrailBackgroundJob2["SettleWalkthroughUnreasoned"] = "settle-walkthrough-unreasoned";
267
267
  GuardrailBackgroundJob2["SettleWalkthroughNoAppLogicChange"] = "settle-walkthrough-no-app-logic-change";
268
+ GuardrailBackgroundJob2["NoteWalkthroughRerun"] = "note-walkthrough-rerun";
268
269
  GuardrailBackgroundJob2["ScanWatchPrStates"] = "scan-watch-pr-states";
269
270
  GuardrailBackgroundJob2["CommitDeferredState"] = "commit-deferred-state";
270
271
  return GuardrailBackgroundJob2;
@@ -613,6 +614,9 @@ var WALKTHROUGH_SKIPPED_MARKER = "<!-- muggle-pr-walkthrough-status:skipped -->"
613
614
  var WALKTHROUGH_COMMENT_HEADING = "### Muggle AI \u2014 PR visual walkthrough";
614
615
  var REPORT_SENTINEL_TAG = new RegExp(`<!--\\s*${REPORT_SENTINEL}[^>]*-->\\s*`, "g");
615
616
  var LAST_FULL_RUN_OPENING = "<details><summary>Last full E2E run on this PR</summary>";
617
+ var RERUN_NOTICE_OPENING = "<!-- muggle-pr-walkthrough-rerun -->";
618
+ var RERUN_NOTICE_CLOSING = "<!-- /muggle-pr-walkthrough-rerun -->";
619
+ var RERUN_NOTICE_BLOCK = new RegExp(`${RERUN_NOTICE_OPENING}[\\s\\S]*?${RERUN_NOTICE_CLOSING}\\s*`, "g");
616
620
  var SHORT_SHA_LENGTH = 7;
617
621
  var GH_COMMENT_TIMEOUT_MS = 1e4;
618
622
 
@@ -1772,12 +1776,28 @@ ${headline} Muggle verified \`${"NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */}\`
1772
1776
  }
1773
1777
  function lastFullRunOf(body) {
1774
1778
  const status = classifyComment(body);
1775
- if (status === "reported" /* Reported */) return body.replace(REPORT_SENTINEL_TAG, "").trim();
1779
+ if (status === "reported" /* Reported */) {
1780
+ return withoutRerunNotice(body).replace(REPORT_SENTINEL_TAG, "").trim();
1781
+ }
1776
1782
  if (status !== "skipped" /* Skipped */) return null;
1777
1783
  const start = body.indexOf(LAST_FULL_RUN_OPENING);
1778
1784
  if (start === -1) return null;
1779
1785
  return body.slice(start + LAST_FULL_RUN_OPENING.length).replace(/\s*<\/details>\s*$/, "").trim();
1780
1786
  }
1787
+ var formatUtcMinute = (date) => `${date.toISOString().slice(0, 16).replace("T", " ")} UTC`;
1788
+ function hasRerunNotice(body) {
1789
+ return body.includes(RERUN_NOTICE_OPENING);
1790
+ }
1791
+ function withoutRerunNotice(body) {
1792
+ return body.replace(RERUN_NOTICE_BLOCK, "");
1793
+ }
1794
+ function withRerunNotice(body, startedAt) {
1795
+ return `${RERUN_NOTICE_OPENING}
1796
+ > **A new E2E run is in progress** \u2014 started ${formatUtcMinute(startedAt)}. The results below are from the previous run; this comment updates when the new run finishes.
1797
+ ${RERUN_NOTICE_CLOSING}
1798
+
1799
+ ` + withoutRerunNotice(body);
1800
+ }
1781
1801
  function classifyComment(body) {
1782
1802
  if (body.includes(REPORT_SENTINEL)) return "reported" /* Reported */;
1783
1803
  if (!body.includes(WALKTHROUGH_SLOT_MARKER)) return "not-designated" /* NotDesignated */;
@@ -1797,11 +1817,11 @@ function walkthroughVerdict(bodies) {
1797
1817
  function commentWithStatus(comments, status) {
1798
1818
  return comments.find((comment) => classifyComment(comment.body) === status);
1799
1819
  }
1820
+ function designatedComment(comments) {
1821
+ return comments.find((comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */);
1822
+ }
1800
1823
  function reserveComment(pr, comments, run) {
1801
- const claimed = comments.some(
1802
- (comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */
1803
- );
1804
- if (claimed) return false;
1824
+ if (designatedComment(comments)) return false;
1805
1825
  return postPrComment(pr, renderReservedComment(), run);
1806
1826
  }
1807
1827
  function reserveWalkthroughComment(prUrl, run = defaultGhRunner) {
@@ -1837,13 +1857,22 @@ function settleWalkthroughCommentForNoAppLogicChange(prUrl, detail, run = defaul
1837
1857
  if (!pr || !declared) return false;
1838
1858
  const comments = listPrComments(pr, run);
1839
1859
  if (comments === null) return false;
1840
- const designated = comments.find(
1841
- (comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */
1842
- );
1860
+ const designated = designatedComment(comments);
1843
1861
  const lastFullRun = designated ? lastFullRunOf(designated.body) : null;
1844
1862
  const body = renderNoAppLogicChangeComment(declared, readPrHeadSha(pr, run), lastFullRun);
1845
1863
  return designated ? patchPrComment(pr, designated.id, body, run) : postPrComment(pr, body, run);
1846
1864
  }
1865
+ function noteWalkthroughRerunStarted(prUrl, run = defaultGhRunner, startedAt = /* @__PURE__ */ new Date()) {
1866
+ const pr = parsePrUrl(prUrl);
1867
+ if (!pr) return false;
1868
+ const comments = listPrComments(pr, run);
1869
+ if (comments === null) return false;
1870
+ const designated = designatedComment(comments);
1871
+ if (!designated) return false;
1872
+ if (classifyComment(designated.body) === "pending" /* Pending */) return false;
1873
+ if (hasRerunNotice(designated.body)) return false;
1874
+ return patchPrComment(pr, designated.id, withRerunNotice(designated.body, startedAt), run);
1875
+ }
1847
1876
  function settleWalkthroughCommentAsUnreasoned(prUrl, run = defaultGhRunner) {
1848
1877
  return settleWith(prUrl, renderUnreasonedSkipComment(), run);
1849
1878
  }
@@ -2580,6 +2609,10 @@ function classifyGate() {
2580
2609
  const reason = `Test case ${decision.testCaseId} has no pre-execution classification this session. Run muggle-test Step 6f for it first: classify replay-vs-regen per _shared/failure-mode-handling.md \xA7A, then emit one muggle-local-telemetry-event-emit with eventType "pre-execution-classification" for this test case. That step is what calls muggle-remote-test-script-list, which is the only place this run learns the test case has never passed or has failed repeatedly \u2014 cheap now, ~5 minutes of browser time to rediscover after the fact. If this execution genuinely has no classification step (a single user-picked target), say why and run \`echo "MUGGLE_CLASSIFY_SKIP: <reason>"\` \u2014 that records the skip for the rest of the session.`;
2581
2610
  return denyTool(reason, host);
2582
2611
  }
2612
+ function walkthroughRerunNotice() {
2613
+ startBackgroundJob("note-walkthrough-rerun" /* NoteWalkthroughRerun */, [], input.tool_input?.cwd ?? input.cwd);
2614
+ return "{}";
2615
+ }
2583
2616
  function stageGate() {
2584
2617
  const state = readState(sessionId);
2585
2618
  const decision = stageGateDecision(state, unreadMandatoryStages(state));
@@ -2857,6 +2890,7 @@ var handlers = {
2857
2890
  "record-stage-read": recordStageRead,
2858
2891
  "record-stage-signals": recordStageSignals,
2859
2892
  "classify-gate": classifyGate,
2893
+ "walkthrough-rerun-notice": walkthroughRerunNotice,
2860
2894
  "stage-gate": stageGate,
2861
2895
  "debug-path-gate": debugPathGate
2862
2896
  };
@@ -2906,6 +2940,11 @@ function settleWalkthroughNoAppLogicChangeJob() {
2906
2940
  if (prUrl && detail) settleWalkthroughCommentForNoAppLogicChange(prUrl, detail);
2907
2941
  return "{}";
2908
2942
  }
2943
+ function noteWalkthroughRerunJob() {
2944
+ const prUrl = defaultPrWalkthroughLookup.branchPrUrl();
2945
+ if (prUrl) noteWalkthroughRerunStarted(prUrl);
2946
+ return "{}";
2947
+ }
2909
2948
  function scanWatchPrStatesJob() {
2910
2949
  const scannedSessionId = jobArgs[0] ?? "unknown";
2911
2950
  const state = readState(scannedSessionId);
@@ -2927,6 +2966,7 @@ var backgroundJobs = {
2927
2966
  ["settle-branch-walkthrough-skipped" /* SettleBranchWalkthroughSkipped */]: settleBranchWalkthroughSkippedJob,
2928
2967
  ["settle-walkthrough-unreasoned" /* SettleWalkthroughUnreasoned */]: settleWalkthroughUnreasonedJob,
2929
2968
  ["settle-walkthrough-no-app-logic-change" /* SettleWalkthroughNoAppLogicChange */]: settleWalkthroughNoAppLogicChangeJob,
2969
+ ["note-walkthrough-rerun" /* NoteWalkthroughRerun */]: noteWalkthroughRerunJob,
2930
2970
  ["scan-watch-pr-states" /* ScanWatchPrStates */]: scanWatchPrStatesJob,
2931
2971
  ["commit-deferred-state" /* CommitDeferredState */]: commitDeferredStateJob
2932
2972
  };
@@ -55,6 +55,10 @@ echo "$$" > "${slot}/watch.pid"
55
55
  started=$(date +%s)
56
56
  fails=0
57
57
  unseeded=0
58
+ # Set once the first iteration has run. Until then the window cannot roll the
59
+ # loop over, so a start-up slow enough to spend the whole window still gets one
60
+ # look at the PR rather than handing back a watch that never polled.
61
+ has_iterated=""
58
62
 
59
63
  # In-memory floors, above the on-disk watermark. The watermark is advanced by
60
64
  # the session after it handles a wave; these stop the loop re-reporting an event
@@ -105,10 +109,11 @@ while :; do
105
109
  # the line is the owning session's cue to re-arm, and ending here is what
106
110
  # frees the lease that re-arm needs. A loop that ran on past its monitor would
107
111
  # keep that lease and heartbeat fresh while reporting to no one.
108
- if watcher_window_elapsed "$started" "$(date +%s)"; then
112
+ if [ -n "$has_iterated" ] && watcher_window_elapsed "$started" "$(date +%s)"; then
109
113
  echo "ROLLOVER pr=$pr_number monitor window of ${MUGGLE_PR_WATCH_MONITOR_WINDOW}s elapsed — re-arm to keep watching"
110
114
  exit 0
111
115
  fi
116
+ has_iterated=1
112
117
  touch "${slot}/watch-heartbeat" 2>/dev/null
113
118
 
114
119
  # No watermark yet means the arming session has not finished seeding. Wait
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.26.0",
3
- "buildId": "run-230-1",
4
- "commitSha": "54c8bb1e0fefcdcf964b24052e8de997645d4097",
5
- "buildTime": "2026-10-27T05:46:20Z",
3
+ "buildId": "run-231-1",
4
+ "commitSha": "f40a2af32882991d5aa0270402d2345a4842dcc7",
5
+ "buildTime": "2026-10-27T06:19:37Z",
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.27.0-staging.230",
4
+ "version": "5.27.0-staging.231",
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.27.0-staging.230",
4
+ "version": "5.27.0-staging.231",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.27.0-staging.230",
7
+ "@muggleai/works@5.27.0-staging.231",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.27.0-staging.230",
3
+ "version": "5.27.0-staging.231",
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.27.0-staging.230",
5
+ "version": "5.27.0-staging.231",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
package/plugin/.mcp.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.27.0-staging.230",
7
+ "@muggleai/works@5.27.0-staging.231",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -46,6 +46,8 @@ existing=$(gh api "repos/<owner>/<repo>/issues/<prNumber>/comments" \
46
46
 
47
47
  Match only comments carrying one of those markers — never every comment the loop user wrote — so an unrelated reply is never overwritten.
48
48
 
49
+ While a run is in flight, the comment carries a "new E2E run in progress" banner above the previous run's walkthrough. The PATCH replaces the whole body, banner included; never carry the banner or the previous walkthrough into the new body.
50
+
49
51
  Report back: PR URL, whether an overflow comment was involved, and whether this was a fresh post or an update.
50
52
 
51
53
  **Modes B/C (`render-for-new-pr` / `embed`)** — do not post, do not touch `gh`. Return the CLI output verbatim as your report:
@@ -47,6 +47,7 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
47
47
  | `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 |
48
48
  | `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 |
49
49
  | `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 |
50
+ | `PreToolUse` (muggle local execute/replay) | `guardrail-walkthrough-rerun.sh` | record | a browser run is about to start in a working tree (the tool call's `cwd`) whose branch has a PR, and that PR's walkthrough comment already shows a run or a skip | — | a detached job puts a "new E2E run in progress" banner, with its UTC start time, on top of the walkthrough the run will replace. The comment underneath is untouched, so the walkthrough check judges it as before; the run's own walkthrough replaces the whole body, banner included. A reserved placeholder or a comment already bannered is left alone |
50
51
  | `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 |
51
52
  | `Stop` | `guardrail-terminal-gate.sh` | **enforce** | a PR went terminal this session and the next-options offer hasn't run since — an AskUserQuestion, or, while the session owns an open PR's watch slot, a closing message that asks the user | — | **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) |
52
53
  | `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 |
@@ -40,10 +40,10 @@
40
40
  "hooks": [
41
41
  {
42
42
  "type": "command",
43
- "command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-classify-gate.sh\"",
43
+ "command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-classify-gate.sh guardrail-walkthrough-rerun.sh",
44
44
  "async": false,
45
45
  "timeout": 10,
46
- "commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-classify-gate.sh\""
46
+ "commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-classify-gate.sh guardrail-walkthrough-rerun.sh"
47
47
  }
48
48
  ]
49
49
  }
@@ -58,7 +58,7 @@
58
58
  "hooks": [
59
59
  {
60
60
  "type": "command",
61
- "command": "set -- guardrail-classify-gate.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
61
+ "command": "set -- guardrail-dispatch.sh guardrail-classify-gate.sh guardrail-walkthrough-rerun.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
62
62
  "async": false,
63
63
  "timeout": 1
64
64
  }
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+
4
+ # Walkthrough rerun notice (PreToolUse/muggle local execution tools).
5
+ # A browser run about to start on a working tree whose branch has a PR will
6
+ # replace that PR's walkthrough, so the comment gets a banner saying a new run
7
+ # is in progress before the run starts — never a decision, always {}. The
8
+ # provider calls run in a detached job, keyed on the tree the tool call names.
9
+ #
10
+ # The pre-filter re-states the execution tool names, like the classify gate's,
11
+ # so an unrelated payload never pays Node cold-start. `[-_]` because Codex
12
+ # reports an MCP tool with underscores where the server spells hyphens.
13
+
14
+ guardrail_script_dir="${BASH_SOURCE[0]%/*}"
15
+ [[ $guardrail_script_dir == "${BASH_SOURCE[0]}" ]] && guardrail_script_dir=.
16
+ . "$guardrail_script_dir/guardrail-lib.sh"
17
+
18
+ GUARDRAIL_SUBCOMMAND="walkthrough-rerun-notice"
19
+
20
+ guardrail_wants() {
21
+ guardrail_payload_matches 'muggle[-_]local[-_](execute[-_]test[-_]generation|execute[-_]replay)'
22
+ }
23
+
24
+ if guardrail_is_hook_script; then
25
+ guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
26
+ fi
@@ -265,6 +265,7 @@ var GuardrailBackgroundJob = /* @__PURE__ */ ((GuardrailBackgroundJob2) => {
265
265
  GuardrailBackgroundJob2["SettleBranchWalkthroughSkipped"] = "settle-branch-walkthrough-skipped";
266
266
  GuardrailBackgroundJob2["SettleWalkthroughUnreasoned"] = "settle-walkthrough-unreasoned";
267
267
  GuardrailBackgroundJob2["SettleWalkthroughNoAppLogicChange"] = "settle-walkthrough-no-app-logic-change";
268
+ GuardrailBackgroundJob2["NoteWalkthroughRerun"] = "note-walkthrough-rerun";
268
269
  GuardrailBackgroundJob2["ScanWatchPrStates"] = "scan-watch-pr-states";
269
270
  GuardrailBackgroundJob2["CommitDeferredState"] = "commit-deferred-state";
270
271
  return GuardrailBackgroundJob2;
@@ -613,6 +614,9 @@ var WALKTHROUGH_SKIPPED_MARKER = "<!-- muggle-pr-walkthrough-status:skipped -->"
613
614
  var WALKTHROUGH_COMMENT_HEADING = "### Muggle AI \u2014 PR visual walkthrough";
614
615
  var REPORT_SENTINEL_TAG = new RegExp(`<!--\\s*${REPORT_SENTINEL}[^>]*-->\\s*`, "g");
615
616
  var LAST_FULL_RUN_OPENING = "<details><summary>Last full E2E run on this PR</summary>";
617
+ var RERUN_NOTICE_OPENING = "<!-- muggle-pr-walkthrough-rerun -->";
618
+ var RERUN_NOTICE_CLOSING = "<!-- /muggle-pr-walkthrough-rerun -->";
619
+ var RERUN_NOTICE_BLOCK = new RegExp(`${RERUN_NOTICE_OPENING}[\\s\\S]*?${RERUN_NOTICE_CLOSING}\\s*`, "g");
616
620
  var SHORT_SHA_LENGTH = 7;
617
621
  var GH_COMMENT_TIMEOUT_MS = 1e4;
618
622
 
@@ -1772,12 +1776,28 @@ ${headline} Muggle verified \`${"NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */}\`
1772
1776
  }
1773
1777
  function lastFullRunOf(body) {
1774
1778
  const status = classifyComment(body);
1775
- if (status === "reported" /* Reported */) return body.replace(REPORT_SENTINEL_TAG, "").trim();
1779
+ if (status === "reported" /* Reported */) {
1780
+ return withoutRerunNotice(body).replace(REPORT_SENTINEL_TAG, "").trim();
1781
+ }
1776
1782
  if (status !== "skipped" /* Skipped */) return null;
1777
1783
  const start = body.indexOf(LAST_FULL_RUN_OPENING);
1778
1784
  if (start === -1) return null;
1779
1785
  return body.slice(start + LAST_FULL_RUN_OPENING.length).replace(/\s*<\/details>\s*$/, "").trim();
1780
1786
  }
1787
+ var formatUtcMinute = (date) => `${date.toISOString().slice(0, 16).replace("T", " ")} UTC`;
1788
+ function hasRerunNotice(body) {
1789
+ return body.includes(RERUN_NOTICE_OPENING);
1790
+ }
1791
+ function withoutRerunNotice(body) {
1792
+ return body.replace(RERUN_NOTICE_BLOCK, "");
1793
+ }
1794
+ function withRerunNotice(body, startedAt) {
1795
+ return `${RERUN_NOTICE_OPENING}
1796
+ > **A new E2E run is in progress** \u2014 started ${formatUtcMinute(startedAt)}. The results below are from the previous run; this comment updates when the new run finishes.
1797
+ ${RERUN_NOTICE_CLOSING}
1798
+
1799
+ ` + withoutRerunNotice(body);
1800
+ }
1781
1801
  function classifyComment(body) {
1782
1802
  if (body.includes(REPORT_SENTINEL)) return "reported" /* Reported */;
1783
1803
  if (!body.includes(WALKTHROUGH_SLOT_MARKER)) return "not-designated" /* NotDesignated */;
@@ -1797,11 +1817,11 @@ function walkthroughVerdict(bodies) {
1797
1817
  function commentWithStatus(comments, status) {
1798
1818
  return comments.find((comment) => classifyComment(comment.body) === status);
1799
1819
  }
1820
+ function designatedComment(comments) {
1821
+ return comments.find((comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */);
1822
+ }
1800
1823
  function reserveComment(pr, comments, run) {
1801
- const claimed = comments.some(
1802
- (comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */
1803
- );
1804
- if (claimed) return false;
1824
+ if (designatedComment(comments)) return false;
1805
1825
  return postPrComment(pr, renderReservedComment(), run);
1806
1826
  }
1807
1827
  function reserveWalkthroughComment(prUrl, run = defaultGhRunner) {
@@ -1837,13 +1857,22 @@ function settleWalkthroughCommentForNoAppLogicChange(prUrl, detail, run = defaul
1837
1857
  if (!pr || !declared) return false;
1838
1858
  const comments = listPrComments(pr, run);
1839
1859
  if (comments === null) return false;
1840
- const designated = comments.find(
1841
- (comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */
1842
- );
1860
+ const designated = designatedComment(comments);
1843
1861
  const lastFullRun = designated ? lastFullRunOf(designated.body) : null;
1844
1862
  const body = renderNoAppLogicChangeComment(declared, readPrHeadSha(pr, run), lastFullRun);
1845
1863
  return designated ? patchPrComment(pr, designated.id, body, run) : postPrComment(pr, body, run);
1846
1864
  }
1865
+ function noteWalkthroughRerunStarted(prUrl, run = defaultGhRunner, startedAt = /* @__PURE__ */ new Date()) {
1866
+ const pr = parsePrUrl(prUrl);
1867
+ if (!pr) return false;
1868
+ const comments = listPrComments(pr, run);
1869
+ if (comments === null) return false;
1870
+ const designated = designatedComment(comments);
1871
+ if (!designated) return false;
1872
+ if (classifyComment(designated.body) === "pending" /* Pending */) return false;
1873
+ if (hasRerunNotice(designated.body)) return false;
1874
+ return patchPrComment(pr, designated.id, withRerunNotice(designated.body, startedAt), run);
1875
+ }
1847
1876
  function settleWalkthroughCommentAsUnreasoned(prUrl, run = defaultGhRunner) {
1848
1877
  return settleWith(prUrl, renderUnreasonedSkipComment(), run);
1849
1878
  }
@@ -2580,6 +2609,10 @@ function classifyGate() {
2580
2609
  const reason = `Test case ${decision.testCaseId} has no pre-execution classification this session. Run muggle-test Step 6f for it first: classify replay-vs-regen per _shared/failure-mode-handling.md \xA7A, then emit one muggle-local-telemetry-event-emit with eventType "pre-execution-classification" for this test case. That step is what calls muggle-remote-test-script-list, which is the only place this run learns the test case has never passed or has failed repeatedly \u2014 cheap now, ~5 minutes of browser time to rediscover after the fact. If this execution genuinely has no classification step (a single user-picked target), say why and run \`echo "MUGGLE_CLASSIFY_SKIP: <reason>"\` \u2014 that records the skip for the rest of the session.`;
2581
2610
  return denyTool(reason, host);
2582
2611
  }
2612
+ function walkthroughRerunNotice() {
2613
+ startBackgroundJob("note-walkthrough-rerun" /* NoteWalkthroughRerun */, [], input.tool_input?.cwd ?? input.cwd);
2614
+ return "{}";
2615
+ }
2583
2616
  function stageGate() {
2584
2617
  const state = readState(sessionId);
2585
2618
  const decision = stageGateDecision(state, unreadMandatoryStages(state));
@@ -2857,6 +2890,7 @@ var handlers = {
2857
2890
  "record-stage-read": recordStageRead,
2858
2891
  "record-stage-signals": recordStageSignals,
2859
2892
  "classify-gate": classifyGate,
2893
+ "walkthrough-rerun-notice": walkthroughRerunNotice,
2860
2894
  "stage-gate": stageGate,
2861
2895
  "debug-path-gate": debugPathGate
2862
2896
  };
@@ -2906,6 +2940,11 @@ function settleWalkthroughNoAppLogicChangeJob() {
2906
2940
  if (prUrl && detail) settleWalkthroughCommentForNoAppLogicChange(prUrl, detail);
2907
2941
  return "{}";
2908
2942
  }
2943
+ function noteWalkthroughRerunJob() {
2944
+ const prUrl = defaultPrWalkthroughLookup.branchPrUrl();
2945
+ if (prUrl) noteWalkthroughRerunStarted(prUrl);
2946
+ return "{}";
2947
+ }
2909
2948
  function scanWatchPrStatesJob() {
2910
2949
  const scannedSessionId = jobArgs[0] ?? "unknown";
2911
2950
  const state = readState(scannedSessionId);
@@ -2927,6 +2966,7 @@ var backgroundJobs = {
2927
2966
  ["settle-branch-walkthrough-skipped" /* SettleBranchWalkthroughSkipped */]: settleBranchWalkthroughSkippedJob,
2928
2967
  ["settle-walkthrough-unreasoned" /* SettleWalkthroughUnreasoned */]: settleWalkthroughUnreasonedJob,
2929
2968
  ["settle-walkthrough-no-app-logic-change" /* SettleWalkthroughNoAppLogicChange */]: settleWalkthroughNoAppLogicChangeJob,
2969
+ ["note-walkthrough-rerun" /* NoteWalkthroughRerun */]: noteWalkthroughRerunJob,
2930
2970
  ["scan-watch-pr-states" /* ScanWatchPrStates */]: scanWatchPrStatesJob,
2931
2971
  ["commit-deferred-state" /* CommitDeferredState */]: commitDeferredStateJob
2932
2972
  };
@@ -55,6 +55,10 @@ echo "$$" > "${slot}/watch.pid"
55
55
  started=$(date +%s)
56
56
  fails=0
57
57
  unseeded=0
58
+ # Set once the first iteration has run. Until then the window cannot roll the
59
+ # loop over, so a start-up slow enough to spend the whole window still gets one
60
+ # look at the PR rather than handing back a watch that never polled.
61
+ has_iterated=""
58
62
 
59
63
  # In-memory floors, above the on-disk watermark. The watermark is advanced by
60
64
  # the session after it handles a wave; these stop the loop re-reporting an event
@@ -105,10 +109,11 @@ while :; do
105
109
  # the line is the owning session's cue to re-arm, and ending here is what
106
110
  # frees the lease that re-arm needs. A loop that ran on past its monitor would
107
111
  # keep that lease and heartbeat fresh while reporting to no one.
108
- if watcher_window_elapsed "$started" "$(date +%s)"; then
112
+ if [ -n "$has_iterated" ] && watcher_window_elapsed "$started" "$(date +%s)"; then
109
113
  echo "ROLLOVER pr=$pr_number monitor window of ${MUGGLE_PR_WATCH_MONITOR_WINDOW}s elapsed — re-arm to keep watching"
110
114
  exit 0
111
115
  fi
116
+ has_iterated=1
112
117
  touch "${slot}/watch-heartbeat" 2>/dev/null
113
118
 
114
119
  # No watermark yet means the arming session has not finished seeding. Wait