@muggleai/works 5.0.1 → 5.0.2
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/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/scripts/guardrails.mjs +2 -1
- package/dist/plugin/skills/_shared/github-cli-recipes/submitted-reviews.md +14 -6
- package/dist/plugin/skills/_shared/github-cli-recipes/unresolved-threads.md +6 -2
- package/dist/plugin/skills/_shared/github-cli-recipes.md +2 -2
- package/dist/plugin/skills/_shared/pr-followup-helpers/classify.md +2 -2
- package/dist/plugin/skills/_shared/pr-followup-helpers/echo-skip.md +6 -12
- package/dist/plugin/skills/_shared/pr-followup-helpers/reply-routing.md +1 -1
- package/dist/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +4 -4
- package/dist/plugin/skills/do/address-reviews.md +7 -7
- package/dist/plugin/skills/do/open-prs/forward.md +1 -1
- package/dist/plugin/skills/muggle-feedback/SKILL.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/SKILL.md +2 -2
- package/dist/plugin/skills/muggle-pr-followup/auto-track.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/bootstrap.md +8 -6
- package/dist/plugin/skills/muggle-pr-followup/contract.md +17 -14
- package/dist/plugin/skills/muggle-pr-followup/output-templates/bootstrap.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/output-templates/help.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/output-templates/watcher-log.md +2 -2
- package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +7 -7
- package/dist/plugin/skills/muggle-status/SKILL.md +1 -1
- package/dist/plugin/skills/muggle-test/SKILL.md +13 -51
- package/dist/plugin/skills/muggle-test/reference.md +35 -0
- package/dist/plugin/skills/muggle-test-import/SKILL.md +1 -10
- package/dist/plugin/skills/muggle-test-prepare/SKILL.md +1 -1
- package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +1 -1
- package/dist/release-manifest.json +4 -4
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/scripts/guardrails.mjs +2 -1
- package/plugin/skills/_shared/github-cli-recipes/submitted-reviews.md +14 -6
- package/plugin/skills/_shared/github-cli-recipes/unresolved-threads.md +6 -2
- package/plugin/skills/_shared/github-cli-recipes.md +2 -2
- package/plugin/skills/_shared/pr-followup-helpers/classify.md +2 -2
- package/plugin/skills/_shared/pr-followup-helpers/echo-skip.md +6 -12
- package/plugin/skills/_shared/pr-followup-helpers/reply-routing.md +1 -1
- package/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +4 -4
- package/plugin/skills/do/address-reviews.md +7 -7
- package/plugin/skills/do/open-prs/forward.md +1 -1
- package/plugin/skills/muggle-feedback/SKILL.md +1 -1
- package/plugin/skills/muggle-pr-followup/SKILL.md +2 -2
- package/plugin/skills/muggle-pr-followup/auto-track.md +1 -1
- package/plugin/skills/muggle-pr-followup/bootstrap.md +8 -6
- package/plugin/skills/muggle-pr-followup/contract.md +17 -14
- package/plugin/skills/muggle-pr-followup/output-templates/bootstrap.md +1 -1
- package/plugin/skills/muggle-pr-followup/output-templates/help.md +1 -1
- package/plugin/skills/muggle-pr-followup/output-templates/watcher-log.md +2 -2
- package/plugin/skills/muggle-pr-followup/state-schemas.md +7 -7
- package/plugin/skills/muggle-status/SKILL.md +1 -1
- package/plugin/skills/muggle-test/SKILL.md +13 -51
- package/plugin/skills/muggle-test/reference.md +35 -0
- package/plugin/skills/muggle-test-import/SKILL.md +1 -10
- package/plugin/skills/muggle-test-prepare/SKILL.md +1 -1
- package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Run real-browser end-to-end (E2E) acceptance tests on your web app from any AI coding agent. Generate test scripts from plain English, replay them on localhost, capture screenshots, and validate user flows like signup, checkout, and dashboards. Works across Claude Code, Cursor, Codex, and Windsurf.",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Ship quality products with AI-powered end-to-end (E2E) acceptance testing that validates your web app like a real user — from Claude Code and Cursor to PR.",
|
|
5
|
-
"version": "5.0.
|
|
5
|
+
"version": "5.0.2",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
|
@@ -64,12 +64,13 @@ function shouldRunE2E(state) {
|
|
|
64
64
|
|
|
65
65
|
// src/guardrails/detectBuildIntent.ts
|
|
66
66
|
var BUILD = /\b(implement|build|add|create|write|fix|refactor|wire up|hook up|make (a|the|it)|change the)\b/i;
|
|
67
|
+
var DEVCYCLE = /\bresolve\b[^.?!]{0,40}\bconflicts?\b|\bget\b[^.?!]{0,40}\bpr\b[^.?!]{0,40}\b(green|merged?|passing)\b/i;
|
|
67
68
|
var QUESTION = /^\s*(why|what|how|when|where|who|is|are|does|do|can you (explain|tell)|explain)\b/i;
|
|
68
69
|
function detectBuildIntent(prompt) {
|
|
69
70
|
const p = (prompt ?? "").trim();
|
|
70
71
|
if (!p || p.startsWith("/")) return false;
|
|
71
72
|
if (QUESTION.test(p)) return false;
|
|
72
|
-
return BUILD.test(p);
|
|
73
|
+
return BUILD.test(p) || DEVCYCLE.test(p);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
// src/guardrails/emit.ts
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
# Submitted reviews
|
|
1
|
+
# Submitted reviews
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Two consumers (this recipe links to neither — it is a shared primitive):
|
|
4
|
+
|
|
5
|
+
- the watcher's **body-only-review** check — a submitted review carrying a summary body but **no** line comments. Line-comment threads are dispatched from live thread state, not here.
|
|
6
|
+
- the address-reviews fetch of a **specific** review id.
|
|
4
7
|
|
|
5
8
|
```bash
|
|
6
9
|
gh api repos/<owner>/<repo>/pulls/<n>/reviews --paginate
|
|
7
10
|
```
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
Common filter:
|
|
10
13
|
|
|
11
14
|
- `submitted_at != null` (skip PENDING drafts)
|
|
12
|
-
- `id > last_seen.reviewId`
|
|
13
|
-
- `id` not in `last_seen.escalated_review_ids`
|
|
14
15
|
- `user.login` in the resolved allow-list
|
|
15
16
|
- `state` in `{CHANGES_REQUESTED, COMMENTED}`, OR `APPROVED` with a non-empty body or at least one line comment
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
The **watcher's body-only check** adds:
|
|
19
|
+
|
|
20
|
+
- the review has **no line comments** — `gh api repos/<owner>/<repo>/pulls/<n>/reviews/<id>/comments` returns `[]`. A review with line comments is dispatched from thread state, not here.
|
|
21
|
+
- `id > last_seen.lastBodyReviewId`
|
|
22
|
+
- `id` not in `last_seen.escalated_review_ids`
|
|
23
|
+
|
|
24
|
+
A reply posted by the loop surfaces as an implicit review, but it always carries the reply as a line comment, so it can never be body-only — the body-only filter excludes it structurally, no marker check needed. Thread-level echo protection is intrinsic to the marker rule in [`unresolved-threads.md`](unresolved-threads.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Unresolved comment threads
|
|
2
2
|
|
|
3
|
-
For the resolve-reminder stage. GraphQL only — REST does not expose `isResolved`.
|
|
3
|
+
For the watcher's dispatch trigger and the resolve-reminder stage. GraphQL only — REST does not expose `isResolved`/`isOutdated`.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
gh api graphql -F owner=<owner> -F name=<repo> -F number=<n> -f query='
|
|
@@ -11,9 +11,11 @@ query($owner: String!, $name: String!, $number: Int!) {
|
|
|
11
11
|
nodes {
|
|
12
12
|
id
|
|
13
13
|
isResolved
|
|
14
|
+
isOutdated
|
|
14
15
|
comments(first: 100) {
|
|
15
16
|
nodes {
|
|
16
17
|
databaseId
|
|
18
|
+
pullRequestReview { databaseId }
|
|
17
19
|
author { login }
|
|
18
20
|
body
|
|
19
21
|
createdAt
|
|
@@ -29,7 +31,9 @@ query($owner: String!, $name: String!, $number: Int!) {
|
|
|
29
31
|
Filter client-side to `isResolved == false`. Walk each thread's comments in `createdAt` order and classify by the loop marker (see [`../pr-followup-helpers/loop-signature.md`](../pr-followup-helpers/loop-signature.md)), not by `author.login` — the login is ambiguous under a shared account:
|
|
30
32
|
|
|
31
33
|
- **Addressed, awaiting resolve** — the **newest** comment carries the loop marker `<!-- muggle-do:bot -->`. The loop has replied and nothing newer is waiting. → resolve-reminder.
|
|
32
|
-
- **Unaddressed human comment** — the newest comment lacks the marker and is newer than the thread's newest loop-marked comment (or the thread has no loop comment yet). → actionable: the round should address it.
|
|
34
|
+
- **Unaddressed human comment** — the newest comment lacks the marker and is newer than the thread's newest loop-marked comment (or the thread has no loop comment yet). → actionable: the round should address it. The **watcher's dispatch trigger** additionally requires `isOutdated == false` — a thread whose anchored line has since changed is skipped, since re-surfacing a stale anchor risks answering a concern the change already mooted. The resolve-reminder stage ignores `isOutdated`.
|
|
33
35
|
- **Not addressed** — indeterminate (e.g. no comments).
|
|
34
36
|
|
|
37
|
+
Each comment exposes its owning review as `pullRequestReview.databaseId` — the watcher collects this from an actionable thread's newest comment to build its dispatch list.
|
|
38
|
+
|
|
35
39
|
A loop comment also cites a `<short-sha>` from `last_seen.pushed_shas[]` in its body, which tells *which* push addressed the thread.
|
|
@@ -9,10 +9,10 @@ Skills assume a working `gh auth status`. Auth errors surface verbatim from `gh`
|
|
|
9
9
|
| Recipe | Use case |
|
|
10
10
|
| :----- | :------- |
|
|
11
11
|
| [`pr-metadata`](github-cli-recipes/pr-metadata.md) | Snapshot PR state, head SHA, branch — watcher + bootstrap. |
|
|
12
|
-
| [`submitted-reviews`](github-cli-recipes/submitted-reviews.md) | Fetch
|
|
12
|
+
| [`submitted-reviews`](github-cli-recipes/submitted-reviews.md) | Fetch a review by id / watcher's body-only-review check. |
|
|
13
13
|
| [`pr-checks`](github-cli-recipes/pr-checks.md) | Check-run rollup for the head SHA — watcher's CI poll. |
|
|
14
14
|
| [`line-comments-for-review`](github-cli-recipes/line-comments-for-review.md) | Pull a review's line comments — `/muggle-do` per-comment routing. |
|
|
15
|
-
| [`unresolved-threads`](github-cli-recipes/unresolved-threads.md) | GraphQL
|
|
15
|
+
| [`unresolved-threads`](github-cli-recipes/unresolved-threads.md) | GraphQL unresolved-thread state — watcher's dispatch trigger + resolve-reminder. |
|
|
16
16
|
| [`reply-line-comment`](github-cli-recipes/reply-line-comment.md) | POST a threaded reply on a line comment. |
|
|
17
17
|
| [`top-level-comment`](github-cli-recipes/top-level-comment.md) | POST a top-level PR comment — resolve-reminder + overflow. |
|
|
18
18
|
| [`push-to-branch`](github-cli-recipes/push-to-branch.md) | Push + capture new SHA after address-reviews work. |
|
|
@@ -10,7 +10,7 @@ A review is a **self-loop** iff **every** line comment under it is a reply (`in_
|
|
|
10
10
|
|
|
11
11
|
If any comment in a reply-only wrapper **lacks** the marker, it is a **human follow-up** on an existing thread — not a self-loop. It carries reviewer intent; treat it as actionable and address it in this round (the caller's unresolved-thread sweep picks up the thread context).
|
|
12
12
|
|
|
13
|
-
Self-loops bypass the actionable/ambiguous decision entirely. Action:
|
|
13
|
+
Self-loops bypass the actionable/ambiguous decision entirely. Action: skip silently — a body-only echo folds its id into `lastBodyReviewId`; a line-comment echo already drops out of the actionable set via the marker. No push, no reply, no resolve-reminder, no escalation, no entry in `escalated_review_ids`. Telemetry: emit one `cycle` event with `outcome: "self-loop-skip"`.
|
|
14
14
|
|
|
15
15
|
Only reviews that survive the self-loop check proceed to classify below.
|
|
16
16
|
|
|
@@ -51,7 +51,7 @@ Reply shape (all replies for one review reference the same SHA):
|
|
|
51
51
|
| 1 comment: "won't this break the prod migration we did last week?" | Implicit change request gated on knowledge the loop can't access |
|
|
52
52
|
| Mixed: 2 concrete directives + 1 "rethink the whole approach" | The "rethink" subverts the others; escalate to confirm scope |
|
|
53
53
|
|
|
54
|
-
Escalate per the caller's procedure (add the review id to
|
|
54
|
+
Escalate per the caller's procedure (add the review id to `escalated_review_ids`, emit one terminal message, pause the PR).
|
|
55
55
|
|
|
56
56
|
## Borderline rule
|
|
57
57
|
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Echo protection (intrinsic under thread-state)
|
|
2
2
|
|
|
3
|
-
When `/muggle-do` posts a threaded reply to a review comment, GitHub surfaces that reply as a **new submitted review** under the same account
|
|
3
|
+
When `/muggle-do` posts a threaded reply to a review comment, GitHub surfaces that reply as a **new submitted review** under the same account, and the reply becomes the newest comment in its thread. The watcher must never read that as fresh feedback, or it replies to itself forever.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Under the thread-state dispatch trigger this is **intrinsic** — there is no "advance past the echo" step to get wrong:
|
|
6
6
|
|
|
7
|
-
A
|
|
7
|
+
- **Line-comment threads.** A thread is actionable only when its newest comment lacks the loop marker `<!-- muggle-do:bot -->` (see [`loop-signature.md`](loop-signature.md)). After the loop replies, the newest comment is the loop's own and carries the marker, so the thread drops out of the actionable set on its own.
|
|
8
|
+
- **Body-only reviews.** A loop reply always carries a line comment, so it is never body-only; the body-only check (no line comments, `id > lastBodyReviewId` — see [`../github-cli-recipes/submitted-reviews.md`](../github-cli-recipes/submitted-reviews.md)) excludes echoes structurally.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
1. Advance `last_seen.reviewId` past the echo's id (so it is not seen again), and
|
|
12
|
-
2. **Skip it** — never dispatch `/muggle-do` for it.
|
|
13
|
-
|
|
14
|
-
## Detection
|
|
15
|
-
|
|
16
|
-
Classify by the marker, never by `author.login` — under a shared account the loop posts as the PR author, so the login cannot tell echo from human. Fetch the review's comments; if the set is non-empty and every comment body contains `<!-- muggle-do:bot -->`, it is an echo. A review with at least one marker-less comment is human feedback and must be processed normally.
|
|
10
|
+
Classify by the marker, never by `author.login` — under a shared account the loop posts as the PR author, so the login cannot tell echo from human.
|
|
@@ -37,4 +37,4 @@ fix(ci): lint — remove unused import
|
|
|
37
37
|
|
|
38
38
|
- Never post a top-level comment in reply to a line-level comment. It loses thread context.
|
|
39
39
|
- Never `gh pr review --comment` for replies — that endpoint is for *new* reviews.
|
|
40
|
-
- Never reply twice to the same comment. The
|
|
40
|
+
- Never reply twice to the same comment. The loop marker on each posted reply is the re-entry guard — a thread whose newest comment is loop-marked is no longer actionable, so the next round won't re-reply.
|
|
@@ -9,7 +9,7 @@ One per watcher iteration (idle or not).
|
|
|
9
9
|
"session_slug": "<slug>",
|
|
10
10
|
"repo": "<owner>/<repo>",
|
|
11
11
|
"pr_number": <int>,
|
|
12
|
-
"
|
|
12
|
+
"actionable_threads": <int>,
|
|
13
13
|
"dispatched_review_ids": [<int>, ...],
|
|
14
14
|
"checks_red": <int>,
|
|
15
15
|
"dispatched_ci_fix": true | false,
|
|
@@ -19,9 +19,9 @@ One per watcher iteration (idle or not).
|
|
|
19
19
|
}
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
- `
|
|
23
|
-
- `dispatched_review_ids`: review ids handed to `/muggle-do`. Empty when idle.
|
|
22
|
+
- `actionable_threads`: count of actionable items this tick — unresolved, non-outdated threads whose newest comment is unmarked, plus body-only reviews past `lastBodyReviewId` — **after** filtering by the escalated set.
|
|
23
|
+
- `dispatched_review_ids`: owning review ids handed to `/muggle-do`. Empty when idle.
|
|
24
24
|
- `checks_red`: count of failing checks on the head SHA. `0` when reviews were dispatched (reviews preempt the CI poll) or CI was green/pending.
|
|
25
25
|
- `dispatched_ci_fix`: true when this tick dispatched `/muggle-do` with a fix-ci directive.
|
|
26
26
|
- `terminal`: true when this tick observed the PR merged or closed and wrote `result.md`.
|
|
27
|
-
- `idle`: true when
|
|
27
|
+
- `idle`: true when nothing was dispatched this tick.
|
|
@@ -13,16 +13,16 @@ The entry procedure for `/muggle-do`'s **address-reviews** mode — invoked by t
|
|
|
13
13
|
`$ARGUMENTS` carries:
|
|
14
14
|
- PR URL: `<owner>/<repo>#<n>` derivable from the URL.
|
|
15
15
|
- Session slug: `<slug>`.
|
|
16
|
-
-
|
|
16
|
+
- Owning review ids: one or more integers (the reviews whose actionable threads or body-only feedback the watcher flagged).
|
|
17
17
|
|
|
18
|
-
Exact phrasing comes from the watcher's dispatch (see [`../muggle-pr-followup/contract.md`](../muggle-pr-followup/contract.md
|
|
18
|
+
Exact phrasing comes from the watcher's dispatch (see [`../muggle-pr-followup/contract.md`](../muggle-pr-followup/contract.md)). Parse all three out of the directive text.
|
|
19
19
|
|
|
20
20
|
## Inputs from disk
|
|
21
21
|
|
|
22
22
|
Read from `~/.muggle-ai/muggle-do/sessions/<slug>/`:
|
|
23
23
|
|
|
24
24
|
- `prs.json` — to locate the PR's local checkout path (the `repo` field maps to a configured local repo) and capture `head_sha_before`.
|
|
25
|
-
- `last_seen.json` — for `pushed_shas[]` (used by the resolve-reminder stage) and to update
|
|
25
|
+
- `last_seen.json` — for `pushed_shas[]` (used by the resolve-reminder stage) and to update `lastBodyReviewId`.
|
|
26
26
|
- `state.md` — for the cached `loop_user` login (used by resolve-reminder thread classification).
|
|
27
27
|
|
|
28
28
|
## Procedure
|
|
@@ -37,10 +37,10 @@ Two sources, combined into one batch (dedupe by comment id):
|
|
|
37
37
|
|
|
38
38
|
**(a) The dispatched reviews.** For each review id in the input:
|
|
39
39
|
|
|
40
|
-
- Fetch reviews per [`../_shared/github-cli-recipes/submitted-reviews.md`](../_shared/github-cli-recipes/submitted-reviews.md) (
|
|
40
|
+
- Fetch reviews per [`../_shared/github-cli-recipes/submitted-reviews.md`](../_shared/github-cli-recipes/submitted-reviews.md) (no watermark; filter to the specific id).
|
|
41
41
|
- Fetch its line comments per [`../_shared/github-cli-recipes/line-comments-for-review.md`](../_shared/github-cli-recipes/line-comments-for-review.md).
|
|
42
42
|
|
|
43
|
-
**(b) Unaddressed comments on every unresolved thread.** Fetch unresolved threads per [`../_shared/github-cli-recipes/unresolved-threads.md`](../_shared/github-cli-recipes/unresolved-threads.md). For each thread classified **unaddressed human comment** — newest comment lacks the loop marker `<!-- muggle-do:bot -->` ([`loop-signature.md`](../_shared/pr-followup-helpers/loop-signature.md)) and post-dates the loop's last marked reply — add it to the batch,
|
|
43
|
+
**(b) Unaddressed comments on every unresolved thread.** Fetch unresolved threads per [`../_shared/github-cli-recipes/unresolved-threads.md`](../_shared/github-cli-recipes/unresolved-threads.md). For each thread classified **unaddressed human comment** — newest comment lacks the loop marker `<!-- muggle-do:bot -->` ([`loop-signature.md`](../_shared/pr-followup-helpers/loop-signature.md)) and post-dates the loop's last marked reply — add it to the batch — unresolved thread state, not any review-id watermark, is the authority here. This is how a human thread follow-up (a marker-less reply) gets addressed. **Exclude** comments whose review id is in `last_seen.escalated_review_ids` — paused awaiting the user, not re-work.
|
|
44
44
|
|
|
45
45
|
Group (a) and (b) into one combined batch.
|
|
46
46
|
|
|
@@ -101,7 +101,7 @@ Invoke [`per-comment-replies.md`](per-comment-replies.md) with the actionable re
|
|
|
101
101
|
|
|
102
102
|
- `last_seen.cycles_completed` += 1
|
|
103
103
|
- `last_seen.last_pushed_sha` = the new head SHA (update.md already wrote this; verify)
|
|
104
|
-
- `last_seen.
|
|
104
|
+
- `last_seen.lastBodyReviewId` = max(body-only input review ids ∪ last_seen.lastBodyReviewId) — line-comment threads need no watermark; they fall out of the actionable set once the per-comment reply carries the loop marker.
|
|
105
105
|
|
|
106
106
|
### Step 5.5 — Resolve-reminder (runs every round)
|
|
107
107
|
|
|
@@ -145,5 +145,5 @@ Do **not** push, do **not** post replies, do **not** run resolve-reminder. The c
|
|
|
145
145
|
## Invariants
|
|
146
146
|
|
|
147
147
|
- One `/muggle-do` invocation = at most one push and one resolve-reminder, regardless of how many reviews are in the batch.
|
|
148
|
-
- Every input review id ends up
|
|
148
|
+
- Every input review id ends up either handled (its thread answered with a loop-marked reply, or — for a body-only review — folded into `lastBodyReviewId`) or in `escalated_review_ids` (skipped) — never both, never neither.
|
|
149
149
|
- The watcher is respawned exactly when the PR is still open at the end of the cycle.
|
|
@@ -46,7 +46,7 @@ Write `~/.muggle-ai/muggle-do/sessions/<slug>/prs.json` per [`../../muggle-pr-fo
|
|
|
46
46
|
[{ "repo": "owner/repo", "number": 142, "url": "...", "head_sha": "...", "state": "open" }]
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Seed `~/.muggle-ai/muggle-do/sessions/<slug>/last_seen.json` per [`../../muggle-pr-followup/state-schemas.md`](../../muggle-pr-followup/state-schemas.md#last_seenjson) — empty
|
|
49
|
+
Seed `~/.muggle-ai/muggle-do/sessions/<slug>/last_seen.json` per [`../../muggle-pr-followup/state-schemas.md`](../../muggle-pr-followup/state-schemas.md#last_seenjson) — empty-watermark shape with `pushed_shas: []`. Forward mode never has prior reviews to skip, so `lastBodyReviewId: 0`.
|
|
50
50
|
|
|
51
51
|
**Do not** seed `cycle.json` or `requirements.md`. The watcher is a dumb pipe; `/muggle-do` reads reviews off GitHub.
|
|
52
52
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: muggle-feedback
|
|
3
|
-
description: Use when the user wants to flag that a generated Muggle Test action script — or one specific step in it — did the wrong thing,
|
|
3
|
+
description: "Use when the user wants to flag that a generated Muggle Test action script — or one specific step in it — did the wrong thing, so Muggle can analyze and regenerate affected scripts. Covers any report that a script or step is wrong, broken, or misbehaving (clicked the wrong element, step N did not work, broken at the submit step), whether from a recent local/remote run or a pasted Muggle dashboard run/script URL. Also lists, views, or deletes previously submitted feedback. Triggers on /muggle-feedback, give feedback on this run, the test was wrong, flag this run."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Muggle Test Feedback
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: muggle-pr-followup
|
|
3
|
-
description: Use
|
|
3
|
+
description: "Use when the user wants a pull request's incoming review feedback handled for them — it watches one PR's review thread and, each time a reviewer submits new comments, dispatches the work to address them. Engage on PR-review-follow-up intent: \"watch my PR and address review comments as they come in\", \"keep an eye on PR #123 and respond to reviewer feedback\", \"babysit my PR's review thread\", \"I'm stepping away — handle my PR's reviews while I'm gone\". This is PR-review-specific automation — prefer it over the generic loop skill. It only watches and dispatches; the actual edits and replies are muggle-do. Not for posting test results to a PR (use muggle-pr-visual-walkthrough)."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# muggle-pr-followup
|
|
@@ -34,7 +34,7 @@ Bootstrap accepts three optional trailing flags:
|
|
|
34
34
|
|
|
35
35
|
- `--slug=<name>` — override the default `<repo>-pr<n>` slug
|
|
36
36
|
- `--resume` — opt in to reusing an existing session slot (default is refuse on conflict)
|
|
37
|
-
- `--forward-only` — pin
|
|
37
|
+
- `--forward-only` — pin `lastBodyReviewId` past existing **body-only** reviews (skip history on those). Line-comment threads are always picked up from live thread state, regardless of this flag.
|
|
38
38
|
|
|
39
39
|
## Preferences
|
|
40
40
|
|
|
@@ -51,7 +51,7 @@ For each PR URL in the track list, run the [`bootstrap.md`](bootstrap.md) proced
|
|
|
51
51
|
- **Existing slot → skip silently** (never the slot-conflict abort); add it to the *skipped* list.
|
|
52
52
|
- **`caller = "auto-track"`** in the bootstrap telemetry event.
|
|
53
53
|
|
|
54
|
-
Everything else is unchanged: URL parse, metadata + terminal-PR abort, slug,
|
|
54
|
+
Everything else is unchanged: URL parse, metadata + terminal-PR abort, slug, `lastBodyReviewId` 0 (line-comment threads are picked up live from thread state; body-only reviews from id 0), and the `prs.json`/`last_seen.json`/`state.md` writes minus the pre-flight block.
|
|
55
55
|
|
|
56
56
|
### Step 5 — Print the summary
|
|
57
57
|
|
|
@@ -17,7 +17,7 @@ Bootstrap asks **one** questionnaire — the E2E validation context the loop wil
|
|
|
17
17
|
- `<pr-url>` matches `https?://github\.com/[^/]+/[^/]+/pull/\d+` — required.
|
|
18
18
|
- `--slug=<name>` overrides the default `<repo>-pr<n>` slug.
|
|
19
19
|
- `--resume` opts into refreshing an existing slot instead of refusing on conflict.
|
|
20
|
-
- `--forward-only` pins
|
|
20
|
+
- `--forward-only` pins `lastBodyReviewId` past existing **body-only** reviews (skip history on those). It does **not** affect line-comment threads — those are always picked up from live thread state. Default is `0`.
|
|
21
21
|
|
|
22
22
|
## Procedure
|
|
23
23
|
|
|
@@ -46,12 +46,14 @@ Default: `<repo>-pr<n>` (e.g. `muggle-ai-works-pr154`). Override: `--slug=<name>
|
|
|
46
46
|
If `~/.muggle-ai/muggle-do/sessions/<slug>/` exists (including a slot just migrated above):
|
|
47
47
|
|
|
48
48
|
- Without `--resume` → exit with the slot-conflict abort. Both remedies (delete + re-run, or pass `--resume`) are spelled out in the message.
|
|
49
|
-
- With `--resume` → refresh `prs.json[0].head_sha` to the current `headRefOid` from Step 2; leave `last_seen.json`
|
|
49
|
+
- With `--resume` → refresh `prs.json[0].head_sha` to the current `headRefOid` from Step 2; leave `last_seen.json` untouched. If `state.md` already has a `## Pre-flight answers` block, skip to Step 8; if not (older session), run Step 6.5 to backfill it, then skip to Step 8.
|
|
50
50
|
|
|
51
|
-
### Step 6 — Resolve the
|
|
51
|
+
### Step 6 — Resolve the body-only watermark
|
|
52
52
|
|
|
53
|
-
-
|
|
54
|
-
|
|
53
|
+
Line-comment threads need no seeding — the watcher derives them from live thread state on every tick, so existing unresolved threads are picked up on the first tick regardless of this step. This step only sets `lastBodyReviewId`, the narrow watermark for body-only reviews (a submitted review with no line comments).
|
|
54
|
+
|
|
55
|
+
- **Default (no `--forward-only`):** `lastBodyReviewId = 0`. The watcher picks up every existing body-only review on its first tick. Matches the common case — the user opened the PR, left feedback they want addressed, and is now bootstrapping.
|
|
56
|
+
- **With `--forward-only`:** fetch reviews per [`../_shared/github-cli-recipes/submitted-reviews.md`](../_shared/github-cli-recipes/submitted-reviews.md), then take `max(id)`. Body-only reviews at or below that id are treated as already-handled. This no longer hides existing line-comment threads — those are always picked up from thread state.
|
|
55
57
|
|
|
56
58
|
### Step 6.5 — Resolve E2E validation context
|
|
57
59
|
|
|
@@ -67,7 +69,7 @@ Write under `~/.muggle-ai/muggle-do/sessions/<slug>/`:
|
|
|
67
69
|
|
|
68
70
|
**`prs.json`** — see [`state-schemas.md`](state-schemas.md#prsjson). One entry, `state` = `"open"`, `head_sha` from Step 2's `headRefOid`.
|
|
69
71
|
|
|
70
|
-
**`last_seen.json`** — see [`state-schemas.md`](state-schemas.md#last_seenjson). One key (`"<owner>/<repo>#<n>"`), `
|
|
72
|
+
**`last_seen.json`** — see [`state-schemas.md`](state-schemas.md#last_seenjson). One key (`"<owner>/<repo>#<n>"`), `lastBodyReviewId` from Step 6, `last_pushed_sha: null`, `idle_tick_count: 0`, `cycles_completed: 0`, `escalated_review_ids: []`, `pushed_shas: []`.
|
|
71
73
|
|
|
72
74
|
**`state.md`** — see [`state-schemas.md`](state-schemas.md#statemd). `Bootstrapped from URL: yes`. Cache the loop-user login. Append the `## Pre-flight answers` block with the fields resolved in Step 6.5, per [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md#persisted-fields).
|
|
73
75
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Watcher Per-Tick Contract
|
|
2
2
|
|
|
3
|
-
The procedure for the **tick mode** of `muggle-pr-followup` — one polling iteration scoped to one PR. The watcher is a dumb pipe: it polls for
|
|
3
|
+
The procedure for the **tick mode** of `muggle-pr-followup` — one polling iteration scoped to one PR. The watcher is a dumb pipe: it polls for actionable review threads, CI checks, and merge-conflict state, dispatches `/muggle-do` if there's unaddressed review feedback, fixable red CI, or an unmergeable branch, and exits. It does not classify, fix, resolve, amend requirements, post replies, run cycles, or escalate.
|
|
4
4
|
|
|
5
|
-
Routing into this mode is documented in [`SKILL.md`](SKILL.md#routing). The architectural rationale lives in the brain
|
|
5
|
+
Routing into this mode is documented in [`SKILL.md`](SKILL.md#routing). The architectural rationale lives in the brain docs `architecture/2026-05-08-muggle-do-pr-comment-loop-design.md` (the overall loop) and `architecture/2026-06-06-pr-followup-thread-state-baseline-design.md` (the thread-state dispatch trigger).
|
|
6
6
|
|
|
7
7
|
## Turn preamble
|
|
8
8
|
|
|
@@ -48,33 +48,36 @@ If `state` is `MERGED` or `CLOSED`:
|
|
|
48
48
|
3. Exit. The watcher has unscheduled itself; no future ticks fire for this PR.
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
### Step 3 —
|
|
51
|
+
### Step 3 — Compute the actionable set from live thread state
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
The watcher's dispatch trigger is **derived from current GitHub state**, not a stored review-id cursor — see the [thread-state baseline design](../../../../muggle-ai-brain/architecture/2026-06-06-pr-followup-thread-state-baseline-design.md). Two sources, unioned:
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
- **echo reviews** per [`../_shared/pr-followup-helpers/echo-skip.md`](../_shared/pr-followup-helpers/echo-skip.md) — a review whose every comment carries the loop marker is the loop's own reply, surfaced by GitHub as a new review. Advance `last_seen.reviewId` past it and skip; never dispatch, or the watcher replies to itself forever.
|
|
55
|
+
**(a) Actionable threads.** Fetch unresolved review threads per [`../_shared/github-cli-recipes/unresolved-threads.md`](../_shared/github-cli-recipes/unresolved-threads.md). A thread is **actionable** when `isResolved == false` **and** `isOutdated == false` **and** its newest comment lacks the loop marker `<!-- muggle-do:bot -->` — classify by the marker, never `author.login` (see [`../_shared/pr-followup-helpers/loop-signature.md`](../_shared/pr-followup-helpers/loop-signature.md)). The marker rule makes echo intrinsic: once the loop has replied, the thread's newest comment is the loop's own, so the thread is no longer actionable — no cursor to advance, no self-recursion (see [`../_shared/pr-followup-helpers/echo-skip.md`](../_shared/pr-followup-helpers/echo-skip.md)).
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
**(b) Actionable body-only reviews.** A body-only review — a submitted `CHANGES_REQUESTED`/`COMMENTED` review with no line comments — has no thread to derive state from, so it keeps a narrow watermark. Fetch submitted reviews per [`../_shared/github-cli-recipes/submitted-reviews.md`](../_shared/github-cli-recipes/submitted-reviews.md); a body-only review is actionable when `id > last_seen.lastBodyReviewId` **and** `id ∉ last_seen.escalated_review_ids`.
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
Collect the **owning review ids** for dispatch: for each actionable thread, the owning review of its newest comment (`pullRequestReview.databaseId` from the query); plus every actionable body-only review id. The dedup'd union is the dispatch list.
|
|
60
|
+
|
|
61
|
+
### Step 4 — If the actionable set is non-empty → dispatch (reviews preempt CI)
|
|
62
|
+
|
|
63
|
+
The watcher does **not** classify. Classification, batching, replying, escalation, and cycle execution all live in `/muggle-do`. The watcher hands over the owning review ids and exits — `/muggle-do`'s address-reviews re-derives the unresolved threads itself (its authority), so the watcher only needs to decide *that* there is work, not enumerate it exhaustively.
|
|
61
64
|
|
|
62
65
|
1. Reset `last_seen.idle_tick_count` to 0.
|
|
63
66
|
2. **Stop this watcher (single-thread).** Cancel its cron so no tick fires while the dev cycle runs: `CronList`, find the job whose command ends with `/muggle:muggle-pr-followup <slug> <n>` (exact two-arg match), `CronDelete` it. `/muggle-do` respawns the watcher when the cycle finishes — exactly one cron ever, and no tick overlaps a running cycle.
|
|
64
67
|
3. Dispatch `/muggle-do` with an *address-reviews* directive carrying:
|
|
65
68
|
- PR URL (from `prs.json[0].url`)
|
|
66
69
|
- Session slug (from the invocation arguments)
|
|
67
|
-
-
|
|
70
|
+
- The owning review ids from Step 3, as a space-separated list
|
|
68
71
|
|
|
69
72
|
Exact phrasing belongs to `/muggle-do`'s intent-routing. A reasonable shape is:
|
|
70
73
|
```
|
|
71
74
|
/muggle-do address reviews <id1> <id2> ... on <pr-url> slug=<slug>
|
|
72
75
|
```
|
|
73
76
|
4. Append a dispatching line to `followup.log` per [`output-templates/watcher-log.md`](output-templates/watcher-log.md).
|
|
74
|
-
5. Emit a `tick` event with `
|
|
75
|
-
6. Exit. **Reviews preempt CI** — when
|
|
77
|
+
5. Emit a `tick` event with `actionable_threads: <count>`, `dispatched_review_ids: [<id>, ...]`.
|
|
78
|
+
6. Exit. **Reviews preempt CI** — when there is actionable feedback, this tick dispatches address-reviews and never polls CI. The watcher is now stopped; the dev cycle owns the PR and restarts the watcher when it finishes. (The watcher also self-unschedules in Step 2, terminal.)
|
|
76
79
|
|
|
77
|
-
### Step 5 — No
|
|
80
|
+
### Step 5 — No actionable feedback → check mergeability
|
|
78
81
|
|
|
79
82
|
Read `mergeable` / `mergeStateStatus` from the Step 1 metadata. If `mergeable == CONFLICTING` (or `mergeStateStatus == DIRTY`), **and** `conflict_resolve_attempts[head_sha] < 2`, **and** `head_sha` ∉ `conflict_escalated_shas` → dispatch and exit:
|
|
80
83
|
|
|
@@ -89,7 +92,7 @@ Read `mergeable` / `mergeStateStatus` from the Step 1 metadata. If `mergeable ==
|
|
|
89
92
|
|
|
90
93
|
`mergeable == MERGEABLE` / `UNKNOWN` (GitHub still computing — treat as not-conflicting this tick), or budget spent (`conflict_resolve_attempts[head_sha] >= 2` or `head_sha` ∈ `conflict_escalated_shas`) → fall through to CI.
|
|
91
94
|
|
|
92
|
-
### Step 6 — No
|
|
95
|
+
### Step 6 — No actionable feedback, mergeable → poll CI for the head SHA
|
|
93
96
|
|
|
94
97
|
Fetch the check-run rollup for `prs.json[0].head_sha` per [`../_shared/github-cli-recipes/pr-checks.md`](../_shared/github-cli-recipes/pr-checks.md), then:
|
|
95
98
|
|
|
@@ -108,7 +111,7 @@ Fetch the check-run rollup for `prs.json[0].head_sha` per [`../_shared/github-cl
|
|
|
108
111
|
|
|
109
112
|
### Step 7 — Idle
|
|
110
113
|
|
|
111
|
-
Any idle branch (Steps 4–6 that did not dispatch): increment `last_seen.idle_tick_count`, append an idle line to `followup.log` per [`output-templates/watcher-log.md`](output-templates/watcher-log.md), emit a `tick` event with `idle: true`, `
|
|
114
|
+
Any idle branch (Steps 4–6 that did not dispatch): increment `last_seen.idle_tick_count`, append an idle line to `followup.log` per [`output-templates/watcher-log.md`](output-templates/watcher-log.md), emit a `tick` event with `idle: true`, `actionable_threads: 0`, `dispatched_review_ids: []`, `conflicting: <bool>`, `dispatched_resolve_conflicts: false`, `checks_red: <count or 0>`, `dispatched_ci_fix: false`. Exit. The next tick fires in 1 min via `/loop`.
|
|
112
115
|
|
|
113
116
|
## Output
|
|
114
117
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
```
|
|
6
6
|
Bootstrapped PR follow-up for <owner>/<repo>#<n>
|
|
7
7
|
Slug: <slug>
|
|
8
|
-
|
|
8
|
+
Baseline: thread-state (unresolved threads picked up live); lastBodyReviewId=0 | =<id> (forward-only)
|
|
9
9
|
Working tree: <toplevel>
|
|
10
10
|
Dispatching: /loop 1m /muggle:muggle-pr-followup <slug> <n>
|
|
11
11
|
```
|
|
@@ -6,7 +6,7 @@ For `/muggle:muggle-pr-followup help` or `?` (no args runs **auto-track** instea
|
|
|
6
6
|
muggle-pr-followup — watcher loop for PR review follow-ups
|
|
7
7
|
|
|
8
8
|
Active loops:
|
|
9
|
-
<slug> → <owner>/<repo>#<n> (
|
|
9
|
+
<slug> → <owner>/<repo>#<n> (<N> cycles)
|
|
10
10
|
...
|
|
11
11
|
(or "no active loops")
|
|
12
12
|
|
|
@@ -5,13 +5,13 @@ The watcher does **not** print to the user during normal operation. It only appe
|
|
|
5
5
|
## Idle tick
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
<ISO-8601> tick pr=<n>
|
|
8
|
+
<ISO-8601> tick pr=<n> threads=0 idle
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Dispatching tick
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
<ISO-8601> tick pr=<n>
|
|
14
|
+
<ISO-8601> tick pr=<n> threads=<count> dispatched=<id1>,<id2>,...
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Terminal tick
|
|
@@ -34,7 +34,7 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
34
34
|
```json
|
|
35
35
|
{
|
|
36
36
|
"<owner>/<repo>#<n>": {
|
|
37
|
-
"
|
|
37
|
+
"lastBodyReviewId": <int>,
|
|
38
38
|
"last_pushed_sha": "<sha-or-null>",
|
|
39
39
|
"idle_tick_count": <int>,
|
|
40
40
|
"cycles_completed": <int>,
|
|
@@ -48,11 +48,11 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
- `
|
|
51
|
+
- `lastBodyReviewId`: narrow watermark for **body-only** reviews (a submitted review carrying no line comments). The watcher dispatches a body-only review only when `id > lastBodyReviewId`. Line-comment threads do **not** use it — they are dispatched from live thread state (unresolved + not outdated + newest comment unmarked by the loop), so there is no cursor that can pin past them. Bootstrap sets it to the highest existing submitted review id with `--forward-only`, else `0`.
|
|
52
52
|
- `last_pushed_sha`: most recent SHA `/muggle-do` pushed in this PR's life; `null` until the first push.
|
|
53
|
-
- `idle_tick_count`: incremented each tick
|
|
53
|
+
- `idle_tick_count`: incremented each tick whose actionable set is empty. Reset to 0 on any tick that dispatches `/muggle-do`. Diagnostic only — does not gate behavior.
|
|
54
54
|
- `cycles_completed`: incremented each time `/muggle-do` completes an address-reviews invocation (regardless of actionable/ambiguous/mixed).
|
|
55
|
-
- `escalated_review_ids`: review ids classified as ambiguous by `/muggle-do`. The watcher excludes these from
|
|
55
|
+
- `escalated_review_ids`: review ids classified as ambiguous by `/muggle-do`. The watcher excludes these from the actionable set (both body-only reviews and the threads they own) so the same ambiguous review is never re-dispatched.
|
|
56
56
|
- `pushed_shas`: every SHA `/muggle-do` has pushed for this PR. Append-only. Used by the resolve-reminder stage to recognize threads addressed by the loop.
|
|
57
57
|
- `ci_fix_attempts`: per-SHA count of fix-ci cycles `/muggle-do` has run. The watcher stops dispatching fix-ci for a SHA once its count reaches 3. Keyed by head SHA.
|
|
58
58
|
- `ci_escalated_shas`: head SHAs whose CI the fix-ci stage gave up on (attempts exhausted or only out-of-scope checks). The watcher excludes these from CI dispatch so a hopeless SHA is never re-fixed.
|
|
@@ -94,8 +94,8 @@ The watcher does **not** read or write `state.md`. Only bootstrap, `/muggle-do`,
|
|
|
94
94
|
Append-only line-per-tick log. One line per watcher tick, plus one line per `/muggle-do` invocation. Format is loose, but each line starts with an ISO-8601 timestamp:
|
|
95
95
|
|
|
96
96
|
```
|
|
97
|
-
2026-05-20T12:34:56Z tick pr=154
|
|
98
|
-
2026-05-20T12:35:56Z tick pr=154
|
|
97
|
+
2026-05-20T12:34:56Z tick pr=154 threads=0 idle
|
|
98
|
+
2026-05-20T12:35:56Z tick pr=154 threads=1 dispatched=4295962800
|
|
99
99
|
2026-05-20T12:36:14Z muggle-do cycle review_ids=[4295962800] outcome=pushed head_sha=abc1234
|
|
100
100
|
```
|
|
101
101
|
|
|
@@ -116,7 +116,7 @@ Written exactly once when the PR's watcher exits terminally (PR merged or closed
|
|
|
116
116
|
|
|
117
117
|
## Timeline
|
|
118
118
|
|
|
119
|
-
- <ISO-8601> bootstrap (
|
|
119
|
+
- <ISO-8601> bootstrap (lastBodyReviewId <id>; line-comment threads state-derived)
|
|
120
120
|
- <ISO-8601> review <id> from <login> — actionable, pushed <sha>
|
|
121
121
|
- <ISO-8601> review <id> from <login> — ambiguous, escalated
|
|
122
122
|
- ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: muggle-status
|
|
3
|
-
description:
|
|
3
|
+
description: "Check the health of the user's Muggle AI installation and diagnose why it's misbehaving — MCP server connectivity, tool loading, login/auth validity, overall setup. Engage on muggle status and on any diagnostic question about Muggle itself: is muggle working or healthy, why does muggle keep failing or timing out, are the muggle MCP tools loading, is my muggle login still valid. Prefer this over answering from memory whenever the user is unsure Muggle itself is functioning. Boundary: diagnosing is muggle-status; fixing a broken install is muggle-repair. Not for the health of the user's own app, CI, or infra."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Muggle Test Status
|