@muggleai/works 5.32.0-staging.283 → 5.32.0-staging.285
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/{chunk-NTEBYUCA.js → chunk-AEJM2CBK.js} +17 -7
- package/dist/{chunk-CGKARU5D.js → chunk-TM6IZEKH.js} +8 -5
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- 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/scripts/pr-watch-arm.sh +10 -2
- package/dist/plugin/scripts/pr-watch-events.sh +14 -1
- package/dist/plugin/scripts/pr-watch-fetch.sh +1 -0
- package/dist/plugin/scripts/pr-watch-floors.sh +21 -8
- package/dist/plugin/scripts/pr-watch-loop.sh +16 -1
- package/dist/plugin/scripts/pr-watch-state.jq +26 -2
- package/dist/plugin/scripts/pr-watch-verdict.mjs +6 -1
- package/dist/plugin/skills/_shared/pr-followup-helpers/classify.md +12 -0
- package/dist/plugin/skills/_shared/pr-followup-helpers/echo-skip.md +1 -0
- package/dist/plugin/skills/_shared/session-state-writes.md +1 -1
- package/dist/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +1 -1
- package/dist/plugin/skills/_shared/vcs/github/conversation-comments.md +22 -0
- package/dist/plugin/skills/_shared/vcs/github/top-level-comment.md +2 -2
- package/dist/plugin/skills/_shared/vcs/github.md +1 -0
- package/dist/plugin/skills/do/address-reviews.md +20 -12
- package/dist/plugin/skills/do/input-routing.md +1 -1
- package/dist/plugin/skills/do/open-prs/forward.md +1 -1
- package/dist/plugin/skills/do/per-comment-replies.md +8 -1
- package/dist/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -5
- package/dist/plugin/skills/muggle-pr-followup/auto-track.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/bootstrap.md +3 -1
- package/dist/plugin/skills/muggle-pr-followup/contract.md +8 -4
- package/dist/plugin/skills/muggle-pr-followup/output-templates/inline-reply.md +12 -0
- package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +7 -2
- package/dist/release-manifest.json +3 -3
- package/dist/{src-LYOBYPFZ.js → src-KNX6CG4Z.js} +1 -1
- 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/scripts/pr-watch-arm.sh +10 -2
- package/plugin/scripts/pr-watch-events.sh +14 -1
- package/plugin/scripts/pr-watch-fetch.sh +1 -0
- package/plugin/scripts/pr-watch-floors.sh +21 -8
- package/plugin/scripts/pr-watch-loop.sh +16 -1
- package/plugin/scripts/pr-watch-state.jq +26 -2
- package/plugin/scripts/pr-watch-verdict.mjs +6 -1
- package/plugin/skills/_shared/pr-followup-helpers/classify.md +12 -0
- package/plugin/skills/_shared/pr-followup-helpers/echo-skip.md +1 -0
- package/plugin/skills/_shared/session-state-writes.md +1 -1
- package/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +1 -1
- package/plugin/skills/_shared/vcs/github/conversation-comments.md +22 -0
- package/plugin/skills/_shared/vcs/github/top-level-comment.md +2 -2
- package/plugin/skills/_shared/vcs/github.md +1 -0
- package/plugin/skills/do/address-reviews.md +20 -12
- package/plugin/skills/do/input-routing.md +1 -1
- package/plugin/skills/do/open-prs/forward.md +1 -1
- package/plugin/skills/do/per-comment-replies.md +8 -1
- package/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
- package/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -5
- package/plugin/skills/muggle-pr-followup/auto-track.md +1 -1
- package/plugin/skills/muggle-pr-followup/bootstrap.md +3 -1
- package/plugin/skills/muggle-pr-followup/contract.md +8 -4
- package/plugin/skills/muggle-pr-followup/output-templates/inline-reply.md +12 -0
- package/plugin/skills/muggle-pr-followup/state-schemas.md +7 -2
|
@@ -6,7 +6,7 @@ mandatoryStages:
|
|
|
6
6
|
|
|
7
7
|
# Address-Reviews Orchestrator
|
|
8
8
|
|
|
9
|
-
The entry procedure for `/muggle-do`'s **address-reviews** mode — invoked by the watcher loop ([`../muggle-pr-followup/contract.md`](../muggle-pr-followup/contract.md)) when new submitted reviews land on a PR. Orchestrates the cycle: read reviews → classify → execute work on actionables → escalate ambiguous → push and refresh PR → reply per comment → resolve-reminder → respawn watcher.
|
|
9
|
+
The entry procedure for `/muggle-do`'s **address-reviews** mode — invoked by the watcher loop ([`../muggle-pr-followup/contract.md`](../muggle-pr-followup/contract.md)) when new submitted reviews or PR conversation comments land on a PR. Orchestrates the cycle: read reviews → classify → execute work on actionables → escalate ambiguous → push and refresh PR → reply per comment → resolve-reminder → respawn watcher.
|
|
10
10
|
|
|
11
11
|
## Turn preamble
|
|
12
12
|
|
|
@@ -19,16 +19,17 @@ The entry procedure for `/muggle-do`'s **address-reviews** mode — invoked by t
|
|
|
19
19
|
`$ARGUMENTS` carries:
|
|
20
20
|
- PR URL: `<owner>/<repo>#<n>` derivable from the URL.
|
|
21
21
|
- Session slug: `<slug>`.
|
|
22
|
-
- Owning review ids:
|
|
22
|
+
- Owning review ids: zero or more integers (the reviews whose actionable threads or body-only feedback the watcher flagged).
|
|
23
|
+
- Conversation comment ids (GitHub only): zero or more integers after the keyword `conversation` — top-level PR comments the watcher flagged. At least one of the two lists is non-empty.
|
|
23
24
|
|
|
24
|
-
Exact phrasing comes from the watcher's dispatch (see [`../muggle-pr-followup/contract.md`](../muggle-pr-followup/contract.md)). Parse all
|
|
25
|
+
Exact phrasing comes from the watcher's dispatch (see [`../muggle-pr-followup/contract.md`](../muggle-pr-followup/contract.md)). Parse all four out of the directive text.
|
|
25
26
|
|
|
26
27
|
## Inputs from disk
|
|
27
28
|
|
|
28
29
|
Read from `~/.muggle-ai/muggle-do/sessions/<slug>/`:
|
|
29
30
|
|
|
30
31
|
- `prs.json` — to locate the PR's local checkout path (the `repo` field maps to a configured local repo) and capture `head_sha_before`.
|
|
31
|
-
- `last_seen.json` — for `pushed_shas[]` (used by the resolve-reminder stage) and to update `lastBodyReviewId`.
|
|
32
|
+
- `last_seen.json` — for `pushed_shas[]` (used by the resolve-reminder stage) and to update `lastBodyReviewId` and `lastConversationCommentId`.
|
|
32
33
|
- `state.md` — for the cached `loop_user` login (used by resolve-reminder thread classification).
|
|
33
34
|
|
|
34
35
|
## Procedure
|
|
@@ -41,7 +42,7 @@ Before assembling work, rebase onto the latest default branch so the cycle addre
|
|
|
41
42
|
|
|
42
43
|
Resolve the provider per [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md), then assemble.
|
|
43
44
|
|
|
44
|
-
**`github`** —
|
|
45
|
+
**`github`** — three sources, combined into one batch (dedupe by comment id within each id space):
|
|
45
46
|
|
|
46
47
|
**(a) The dispatched reviews.** For each review id in the input:
|
|
47
48
|
|
|
@@ -50,7 +51,9 @@ Resolve the provider per [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-
|
|
|
50
51
|
|
|
51
52
|
**(b) Unaddressed comments on every unresolved thread.** Fetch unresolved threads per [`../_shared/vcs/github/unresolved-threads.md`](../_shared/vcs/github/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.
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
**(c) Conversation comments.** Fetch top-level PR comments per [`../_shared/vcs/github/conversation-comments.md`](../_shared/vcs/github/conversation-comments.md) and add every actionable one — past `last_seen.lastConversationCommentId`, not escalated, not muggle's own or a bot's, author in the allow-list. The dispatched conversation ids are a subset; a comment landing after the watcher's read is swept in the same way. Record the highest id this read returned as `conversation_snapshot_id` — the wave's snapshot for Step 5 and the watermark advance, captured before any reply is posted.
|
|
55
|
+
|
|
56
|
+
Group (a), (b) and (c) into one combined batch.
|
|
54
57
|
|
|
55
58
|
**Claim each thread in the batch.** Claiming is what records that this round took the thread as work; the reply gate settles from claims, not from whether a push happened. Release the claims when the round ends. A claim whose holder died is not a claim — the entry reads unprocessed again and the next round re-claims it — so a crashed round leaves nothing to clean up.
|
|
56
59
|
|
|
@@ -65,6 +68,8 @@ Apply the classify rule in [`../_shared/pr-followup-helpers/classify.md`](../_sh
|
|
|
65
68
|
|
|
66
69
|
Build two sets: `actionable_review_ids` and `ambiguous_review_ids`. Their union is the input list.
|
|
67
70
|
|
|
71
|
+
Classify each **conversation comment** on its own, as a body-only review, with one more outcome from [`classify.md`](../_shared/pr-followup-helpers/classify.md#conversation-comments): **informational** — nothing asked of the PR (thanks, approval, a status note, an exchange between other people). Build `actionable_conversation_ids`, `ambiguous_conversation_ids` and `informational_conversation_ids`. An informational comment gets no reply and no escalation; Step 5 folds it into the watermark.
|
|
72
|
+
|
|
68
73
|
### Step 3 — Handle ambiguous (if any)
|
|
69
74
|
|
|
70
75
|
For each id in `ambiguous_review_ids`:
|
|
@@ -72,19 +77,21 @@ For each id in `ambiguous_review_ids`:
|
|
|
72
77
|
1. Append it to `last_seen.escalated_review_ids` so the watcher won't re-dispatch it.
|
|
73
78
|
2. Run `echo "MUGGLE_REPLY_SKIP: <comment-id> deferred to the user"` naming its comment ids (`gitlab`: discussion ids). An escalated thread is deferred, not answered, so the reply gate in [`per-comment-replies.md`](per-comment-replies.md) would otherwise hold the turn open waiting on a reply that is not coming. The deferral is recorded against those comments durably, so it still holds after this session ends; a marker naming no tracked comment falls back to a session-wide skip.
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
For each id in `ambiguous_conversation_ids`, append it to `last_seen.escalated_conversation_comment_ids`. No reply-skip marker is needed: the reply gate tracks review threads, not conversation comments.
|
|
76
81
|
|
|
77
|
-
|
|
82
|
+
Emit **one** terminal escalation message (not one per ambiguous review or comment) per [`../muggle-pr-followup/output-templates/escalation.md`](../muggle-pr-followup/output-templates/escalation.md) (ambiguous template). The message lists every ambiguous review and its comments inline. Emit an event with `kind: "ambiguous-review"` per [`../_shared/telemetry-events/muggle-do-escalation.md`](../_shared/telemetry-events/muggle-do-escalation.md).
|
|
83
|
+
|
|
84
|
+
The user clarifies on GitHub by submitting a new review or a new conversation comment. The next watcher tick picks it up.
|
|
78
85
|
|
|
79
86
|
### Step 4 — Handle actionables (if any)
|
|
80
87
|
|
|
81
|
-
If `actionable_review_ids`
|
|
88
|
+
If `actionable_review_ids` and `actionable_conversation_ids` are both empty, skip the rest of Step 4, apply Step 5's watermark writes, then proceed to Step 5.5 (resolve-reminder) and Step 6. Otherwise:
|
|
82
89
|
|
|
83
90
|
Before any edits, ensure the PR's branch workspace is the working directory. If `state.md` carries a `worktreePath` (forward-mode session), use it. Otherwise materialize the PR branch per [`../_shared/pr-branch-worktree.md`](../_shared/pr-branch-worktree.md) — the single owner of checking out a PR branch in isolation — so a bootstrap or auto-track watcher never edits the user's live checkout. If the resolved tree is dirty with unrelated work, escalate per Step 7 rather than editing it.
|
|
84
91
|
|
|
85
92
|
#### 4a. Flatten the work
|
|
86
93
|
|
|
87
|
-
The actionable reviews together carry a flat list of change items, one per line comment plus any directive in
|
|
94
|
+
The actionable reviews and conversation comments together carry a flat list of change items, one per line comment plus any directive in a review body or conversation comment. Each item is design, code logic, or test in nature; the cycle does **not** treat each item as a separate cycle iteration — it plans them together and runs the work **once** for the whole batch.
|
|
88
95
|
|
|
89
96
|
#### 4b. Apply design + code-logic changes
|
|
90
97
|
|
|
@@ -110,8 +117,7 @@ Invoke [`open-prs/update.md`](open-prs/update.md) (pass the PR URL + slug + exis
|
|
|
110
117
|
|
|
111
118
|
#### 4g. Post per-comment inline replies
|
|
112
119
|
|
|
113
|
-
Invoke [`per-comment-replies.md`](per-comment-replies.md) with the actionable reviews (`gitlab`: discussions) and the new SHA. One reply per comment, in its own thread, describing what was done for it. The reply is the whole of it — neither provider's threads get resolved by the loop.
|
|
114
|
-
|
|
120
|
+
Invoke [`per-comment-replies.md`](per-comment-replies.md) with the actionable reviews (`gitlab`: discussions), the actionable conversation comments, and the new SHA. One reply per comment, in its own thread, describing what was done for it; a conversation comment, which has no thread, gets one signed top-level comment that names it. The reply is the whole of it — neither provider's threads get resolved by the loop.
|
|
115
121
|
(The resolve-reminder runs once per round in Step 5.5 below — not only after a push — so a round that pushed nothing still nudges addressed-but-unresolved threads.)
|
|
116
122
|
|
|
117
123
|
### Step 5 — Update session state
|
|
@@ -121,6 +127,7 @@ Apply each field write below as a whole-file rewrite (Read → change field →
|
|
|
121
127
|
- `last_seen.cycles_completed` += 1
|
|
122
128
|
- `last_seen.last_pushed_sha` = the new head SHA (update.md already wrote this; verify)
|
|
123
129
|
- `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.
|
|
130
|
+
- `last_seen.lastConversationCommentId` = max(`conversation_snapshot_id`, last_seen.lastConversationCommentId) — but never past an actionable conversation comment whose reply failed: stop just below the lowest such id, so the next tick re-dispatches it. Replied, informational and escalated comments are all handled. The slot's `CONV` floor in `watch-watermark.env` advances to the same value ([`../muggle-pr-followup/arm-watcher.md`](../muggle-pr-followup/arm-watcher.md)).
|
|
124
131
|
|
|
125
132
|
### Step 5.5 — Resolve-reminder (runs every round)
|
|
126
133
|
|
|
@@ -156,4 +163,5 @@ Do **not** push, do **not** post replies, do **not** run resolve-reminder. The c
|
|
|
156
163
|
|
|
157
164
|
- One `/muggle-do` invocation = at most one push and one resolve-reminder, regardless of how many reviews are in the batch.
|
|
158
165
|
- 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.
|
|
166
|
+
- Every conversation comment in the batch ends up answered by exactly one loop-marked top-level comment, informational, or in `escalated_conversation_comment_ids` — and below `lastConversationCommentId` only once one of those holds.
|
|
159
167
|
- The watcher is respawned exactly when the PR is still open at the end of the cycle.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
How `/muggle-do` resolves `$ARGUMENTS` to a mode. Modes 1–4 are programmatic — dispatched by the watcher — so never ask on those. A change-URL in modes 1–3 is either a GitHub PR (`github.com/.../pull/<n>`) or a GitLab MR (`<host>/.../-/merge_requests/<iid>`); provider is resolved via [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md). Inspect in order:
|
|
4
4
|
|
|
5
|
-
1. **Address-reviews** — a PR/MR URL **and** an address-reviews directive carrying review/discussion ids → [`address-reviews.md`](address-reviews.md). On GitHub these ids are integers ≥ 100000000; that magnitude is GitHub-specific lore, **not** a portable test. Under GitLab, tell this apart from other directives by the directive keyword plus the presence of discussion ids, never by id size.
|
|
5
|
+
1. **Address-reviews** — a PR/MR URL **and** an address-reviews directive carrying review/discussion ids, conversation comment ids after the keyword `conversation`, or both → [`address-reviews.md`](address-reviews.md). On GitHub these ids are integers ≥ 100000000; that magnitude is GitHub-specific lore, **not** a portable test. Under GitLab, tell this apart from other directives by the directive keyword plus the presence of discussion ids, never by id size.
|
|
6
6
|
2. **Fix-CI** — a PR/MR URL **and** a `fix ci` / `fix-ci` directive with failing check names (no review/discussion ids) → [`fix-ci.md`](fix-ci.md).
|
|
7
7
|
3. **Rebase** — a PR/MR URL **and** a `rebase` directive (or legacy `resolve conflicts` / `resolve-conflicts`; no review/discussion ids, no check names) → [`resolve-conflicts.md`](resolve-conflicts.md). Rebases the branch onto its base whether it's merely behind or actually conflicting.
|
|
8
8
|
4. **Post-merge cleanup** — a `cleanup` token and `slug=<slug>` (no PR URL, no review ids), optionally `state=<merged|closed>` (default `merged`) → [`cleanup.md`](cleanup.md).
|
|
@@ -90,7 +90,7 @@ Write `~/.muggle-ai/muggle-do/sessions/<slug>/prs.json` per [`../../muggle-pr-fo
|
|
|
90
90
|
[{ "repo": "owner/repo", "number": 142, "url": "...", "head_sha": "...", "state": "open" }]
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
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`.
|
|
93
|
+
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` and `lastConversationCommentId: 0`.
|
|
94
94
|
|
|
95
95
|
**Do not** seed `cycle.json` or `requirements.md`. The watcher is a dumb pipe; `/muggle-do` reads reviews off GitHub.
|
|
96
96
|
|
|
@@ -7,6 +7,7 @@ This is **not** a top-level "summary reply on the review." Each comment thread g
|
|
|
7
7
|
## Inputs
|
|
8
8
|
|
|
9
9
|
- `actionable_reviews` — the list of reviews classified actionable in `address-reviews.md` Step 2. On `gitlab`, these are the actionable **discussions** (no review envelope) — read each as a thread of notes.
|
|
10
|
+
- `actionable_conversation_comments` (GitHub only) — the conversation comments classified actionable in `address-reviews.md` Step 2, each with its id, author, body and `html_url`.
|
|
10
11
|
- `new_sha` — the SHA `open-prs/update.md` just pushed.
|
|
11
12
|
- The PR's owner, repo, number. On `gitlab`, the project ref and MR iid.
|
|
12
13
|
|
|
@@ -52,6 +53,12 @@ Re: review #<review_id> — addressed in <short-sha>: <one-line summary>.
|
|
|
52
53
|
|
|
53
54
|
Posted per [`../_shared/vcs/github/top-level-comment.md`](../_shared/vcs/github/top-level-comment.md). Fires at most once per actionable review-with-no-line-comments. Does not fire if the review has line comments — Step 2 covers those.
|
|
54
55
|
|
|
56
|
+
### Step 4 — Answer conversation comments (GitHub only)
|
|
57
|
+
|
|
58
|
+
A top-level PR comment ([`../_shared/vcs/github/conversation-comments.md`](../_shared/vcs/github/conversation-comments.md)) has no thread and no reply endpoint. Post **one** top-level comment per actionable conversation comment — never one comment answering several — using the conversation template in [`../muggle-pr-followup/output-templates/inline-reply.md`](../muggle-pr-followup/output-templates/inline-reply.md), which quotes and links the comment it answers. Sign with `--mode loop` through [`../_shared/vcs/github/top-level-comment.md`](../_shared/vcs/github/top-level-comment.md): the marker is what keeps the watch from waking on the reply. A comment that asked a question the round answered without a change is answered the same way, with no SHA.
|
|
59
|
+
|
|
60
|
+
Record each reply's outcome: a conversation comment whose reply failed is still unanswered, and [`address-reviews.md`](address-reviews.md) Step 5 keeps the watermark below it.
|
|
61
|
+
|
|
55
62
|
## Failure modes
|
|
56
63
|
|
|
57
64
|
- `gh api` returns an error for an individual reply → log to `followup.log`, continue with the remaining comments. Do not abort the whole step over one failure; the push has already happened and other replies still need posting.
|
|
@@ -70,6 +77,6 @@ A thread the round deferred to the user instead of answering (the ambiguous esca
|
|
|
70
77
|
|
|
71
78
|
## Invariants
|
|
72
79
|
|
|
73
|
-
- One reply per line comment (`gitlab`: per discussion). No per-review summary reply anywhere.
|
|
80
|
+
- One reply per line comment (`gitlab`: per discussion), and one top-level reply per actionable conversation comment. No per-review summary reply anywhere.
|
|
74
81
|
- The loop never resolves a review thread, on either provider. A `PreToolUse` guardrail denies both calls.
|
|
75
82
|
- Every reply body contains the new SHA's 7-char prefix (which push addressed it) and ends with the loop signature block — the `<!-- muggle-do:bot -->` marker, not the author login, is what identifies loop-authored comments.
|
|
@@ -55,7 +55,7 @@ Bootstrap accepts three optional trailing flags:
|
|
|
55
55
|
|
|
56
56
|
- `--slug=<name>` — override the default `<repo>-pr<n>` slug
|
|
57
57
|
- `--resume` — opt in to reusing an existing session slot (default is refuse on conflict)
|
|
58
|
-
- `--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.
|
|
58
|
+
- `--forward-only` — pin `lastBodyReviewId` past existing **body-only** reviews and `lastConversationCommentId` past existing conversation comments (skip history on those). Line-comment threads are always picked up from live thread state, regardless of this flag.
|
|
59
59
|
|
|
60
60
|
## Preferences
|
|
61
61
|
|
|
@@ -14,8 +14,8 @@ The same argument that forbids authoring a per-slot `watch.sh` applies to arming
|
|
|
14
14
|
|
|
15
15
|
The `DRAIN` lines it prints, in the watch's output, are the outstanding work as of the arm. Review ids and threads the drain read are floored, so the loop will *not* tell you about those again. A stale branch or a red head is floored only when `last_seen.json` records a rebase or fix-ci cycle already attempted for that key or head ([`state-schemas.md`](state-schemas.md#watch-watermarkenv)); otherwise the drain line says `not floored: dispatch …` and the loop's first poll reports it as an event. A PR that spent its catch-up rebase budget is the exception: its drain line says the rebase is `held for the owner`, and nothing is dispatched — the tick would refuse it — until the owner raises [`maxCatchUpRebases`](../muggle-preferences/preference-gates/maxCatchUpRebases.md). Re-arming is never a way to set work aside — it neither handles nor silences anything. Steps 1-3 below are what the script does, and why.
|
|
16
16
|
|
|
17
|
-
1. **Drain.** Run one tick per [`contract.md`](contract.md). It acts on everything already outstanding — actionable threads (`gitlab`: discussions), body-only reviews past the watermark (GitHub-only — GitLab has no review envelope), a stale branch, red CI — and finalizes a terminal PR. If the tick dispatched a cycle, stop here: the cycle's exit path settles the watch when it finishes.
|
|
18
|
-
2. **Seed the watermark.** *(`pr-watch-arm.sh` does this; the reasoning is kept because the floors are subtle and wrong ones are quiet.)* Resolve the provider once per [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md) — every fetch in this sequence uses that provider's recipes. Write the slot's watch watermark ([`state-schemas.md`](state-schemas.md#watch-watermarkenv)) to the ids the **drain itself read** — the max review-id and comment
|
|
17
|
+
1. **Drain.** Run one tick per [`contract.md`](contract.md). It acts on everything already outstanding — actionable threads (`gitlab`: discussions), body-only reviews past the watermark (GitHub-only — GitLab has no review envelope), conversation comments past theirs (GitHub-only), a stale branch, red CI — and finalizes a terminal PR. If the tick dispatched a cycle, stop here: the cycle's exit path settles the watch when it finishes.
|
|
18
|
+
2. **Seed the watermark.** *(`pr-watch-arm.sh` does this; the reasoning is kept because the floors are subtle and wrong ones are quiet.)* Resolve the provider once per [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md) — every fetch in this sequence uses that provider's recipes. Write the slot's watch watermark ([`state-schemas.md`](state-schemas.md#watch-watermarkenv)) to the ids the **drain itself read** — the max review-id, comment-id and human conversation-comment id (`CONV`) observed at the drain's own fetch (Step 1), snapshotted at that read. Never let the loop capture its own baseline — the arming session writes it; and **never** from a fresh fetch taken after the drain, which would include a comment that arrived after the drain read the wave and mark it seen unread. Seeded to the drain's floor, anything landing after that read stays above the watermark and the loop's first iteration surfaces it. Seed the CI floor (`CIRED`) from the same drain read: set it to the red key (`<head_sha>@<red-check-runs>`) only when the checks have **already settled red** at that read (no check pending, one or more in the `fail` bucket per [`../_shared/vcs/common/ci-rollup.md`](../_shared/vcs/common/ci-rollup.md)) **and** fix-ci is finished with that head — it escalated, or spent the tick's per-head budget — and empty otherwise. A lone attempt does not floor: the count is written before the fix runs, so a cycle that recorded it and changed nothing would otherwise leave the red silent. Seed the rebase floor (`REBASED`) the same way, from the drain's branch-standing read per [`../_shared/vcs/common/branch-standing.md`](../_shared/vcs/common/branch-standing.md): the current `rebase_key` (`<head_sha>..<base_tip_sha>`) only when the drain found the branch behind or conflicting **and** a rebase attempt is recorded for that key, empty otherwise. An escalation entry alone never floors anything: one with no attempt behind it records a decision nobody acted on, and flooring it is how a re-arming session once kept a stale branch and a red head silent for a day ([`state-schemas.md`](state-schemas.md#watch-watermarkenv) names the fields). Seed the blocked-CI floor (`BLOCKED_CIDIGEST`) to the blocked fingerprint's `ci_digest` when arming while `last_seen.blocked` is already set, and empty otherwise — empty is the not-blocked state, in which the loop's blocked-resume probe stays dormant. Seed the rebase hold (`REBASE_HELD`) to `1` when `last_seen.json`'s `catch_up_rebases` has reached `maxCatchUpRebases` — the same check the tick's verdict blocks on — and empty otherwise: while it is set the loop raises no rebase wake on any base move. The script reads all four facts from `last_seen.json` through [`../../scripts/pr-watch-verdict.mjs`](../../scripts/pr-watch-verdict.mjs) `arm-floors`, and records what it found due in `watch-due.env` ([`state-schemas.md`](state-schemas.md#watch-dueenv)).
|
|
19
19
|
3. **Dedup, then watch.** First read `<slot>/watch.pid` ([`state-schemas.md`](state-schemas.md#watchpid)): if it names a live process (`kill -0 "$pid"` succeeds) **and `owner.json` records this session**, a watcher already owns this slot — **skip arming, do not start a second**. This is what stops orphaned watchers from accumulating: the in-session task dying does not stop the OS loop it launched (on Windows a detached Git Bash loop keeps running and polling `gh` forever after the session ends), so checking a live task list is not enough — the PID lease is.
|
|
20
20
|
|
|
21
21
|
**A live lease owned by a different session does not count as owned** — check it with `watcher_lease_is_foreign` from [`../../scripts/pr-watch-guards.sh`](../../scripts/pr-watch-guards.sh). A live PID proves the loop is running, never that anything is listening: an orphan left by a dead session keeps polling and keeps touching its heartbeat while its stdout is that session's closed pipe, so every liveness signal reads healthy and the events reach nobody. Skipping on the PID alone let such a corpse block this session from arming the PR for the whole lifetime cap — seven days, since the default moved off six hours. When the guard reports a foreign lease, kill that PID, delete `watch.pid`, and arm fresh; note it in the slot's `followup.log` so the reclaim is visible.
|
|
@@ -38,7 +38,7 @@ The `DRAIN` lines it prints, in the watch's output, are the outstanding work as
|
|
|
38
38
|
|
|
39
39
|
**Never author a per-slot `watch.sh`.** The loop ships as [`../../scripts/pr-watch-loop.sh`](../../scripts/pr-watch-loop.sh), with its wake conditions in [`../../scripts/pr-watch-events.sh`](../../scripts/pr-watch-events.sh) and its state projection in [`../../scripts/pr-watch-state.jq`](../../scripts/pr-watch-state.jq); arming runs it and passes arguments. Writing the loop from this prose was how it drifted — each arm produced an independent derivation, and a derivation that quietly dropped a wake still ran, still heartbeat, still logged, and simply never fired for the signal it lost. Two slots on one machine ended up without the behind-base wake, which left their PRs unmergeable under watchers that looked healthy. The prose below says *why* each wake exists; the shipped files are the only definition of *what* fires. A slot holding a legacy generated `watch.sh` keeps it until re-armed, at which point the supersede guard retires the old loop.
|
|
40
40
|
|
|
41
|
-
The task's description is `PR #<n> — <title>`. Description and command both matter: some task surfaces show one, some the other, and a slot-bearing command keeps the watch identifiable everywhere a raw script blob would not. One background task per PR at a time: it is the watch's visible handle, showing as a running task while the PR is polled, and replaced by a fresh one after each report. Its loop checks about every 60 seconds, re-reading the watermark and touching the slot's `watch-heartbeat` file each iteration — the liveness beacon that tells [`reconcile.md`](reconcile.md) a quiet watch is still alive; on a newer submitted review, a newer thread comment (`gitlab`: a newer discussion note), a thread newly unresolved (`gitlab`: discussion), **the head SHA's checks settling red** (no check pending and one or more in the `fail` bucket per [`../_shared/vcs/common/ci-rollup.md`](../_shared/vcs/common/ci-rollup.md)), **the branch falling behind or conflicting with its base** (`behind_by > 0` or the conflict signal per [`../_shared/vcs/common/branch-standing.md`](../_shared/vcs/common/branch-standing.md)), or — **only while the watch is blocked** (`BLOCKED_CIDIGEST` non-empty) — **the head's CI digest changing in any way** (not just to red) — it prints one line per finding and **exits**, recording what it reported in `watch-reported.env` ([`state-schemas.md`](state-schemas.md#watch-reportedenv)) so no later loop reports the same occurrence again. The review and thread floors are monotonic ids; the other three are not. The CI-red floor is the **red key** — the head SHA plus each failed check's run id — because the check rollup is non-monotonic: it flips green↔red and resets on every push, so the key fires once per red verdict and a later push re-arms it on the new SHA. The run ids matter because a settled walkthrough comment or a rerun publishes a new run on the same head; when that run is red too, it is the verdict fix-ci is waiting on, and a head-only floor swallowed it. The rebase floor (`REBASED`) is the **`rebase_key`** — `<head_sha>..<base_tip_sha>` — because staleness is a function of both sides: keying on the pair fires once per newly-due pair and re-arms when either the head or the base moves, where a head-only key would wedge permanently the first time the base advances (the head cannot change while nobody pushes). A head whose checks are still **pending** is never a red wake, and a branch with `behind_by == 0` and `mergeable == UNKNOWN` is never a rebase wake: pending checks may yet go green and conflict state is still computing, and the tick would idle on either (Steps 5–6) regardless. The blocked-CI signal is different in kind — a **resume** probe, live only while the watch is blocked: it wakes on any move of the head's CI digest (the same bucket-plus-sorted-name/conclusion signature the blocked fingerprint records — [`blocked-tick.md`](blocked-tick.md)) away from `BLOCKED_CIDIGEST`, so a block waiting on a green pass, a rerun, or an external deploy check resumes as promptly as one waiting on red. Quiet iterations print nothing and cost nothing — no model tokens are spent while the watch is quiet.
|
|
41
|
+
The task's description is `PR #<n> — <title>`. Description and command both matter: some task surfaces show one, some the other, and a slot-bearing command keeps the watch identifiable everywhere a raw script blob would not. One background task per PR at a time: it is the watch's visible handle, showing as a running task while the PR is polled, and replaced by a fresh one after each report. Its loop checks about every 60 seconds, re-reading the watermark and touching the slot's `watch-heartbeat` file each iteration — the liveness beacon that tells [`reconcile.md`](reconcile.md) a quiet watch is still alive; on a newer submitted review, a newer thread comment (`gitlab`: a newer discussion note), a newer human conversation comment (`github`: a top-level PR comment muggle did not post and no bot wrote), a thread newly unresolved (`gitlab`: discussion), **the head SHA's checks settling red** (no check pending and one or more in the `fail` bucket per [`../_shared/vcs/common/ci-rollup.md`](../_shared/vcs/common/ci-rollup.md)), **the branch falling behind or conflicting with its base** (`behind_by > 0` or the conflict signal per [`../_shared/vcs/common/branch-standing.md`](../_shared/vcs/common/branch-standing.md)), or — **only while the watch is blocked** (`BLOCKED_CIDIGEST` non-empty) — **the head's CI digest changing in any way** (not just to red) — it prints one line per finding and **exits**, recording what it reported in `watch-reported.env` ([`state-schemas.md`](state-schemas.md#watch-reportedenv)) so no later loop reports the same occurrence again. The review, comment, conversation and thread floors are monotonic ids; the other three are not. The CI-red floor is the **red key** — the head SHA plus each failed check's run id — because the check rollup is non-monotonic: it flips green↔red and resets on every push, so the key fires once per red verdict and a later push re-arms it on the new SHA. The run ids matter because a settled walkthrough comment or a rerun publishes a new run on the same head; when that run is red too, it is the verdict fix-ci is waiting on, and a head-only floor swallowed it. The rebase floor (`REBASED`) is the **`rebase_key`** — `<head_sha>..<base_tip_sha>` — because staleness is a function of both sides: keying on the pair fires once per newly-due pair and re-arms when either the head or the base moves, where a head-only key would wedge permanently the first time the base advances (the head cannot change while nobody pushes). A head whose checks are still **pending** is never a red wake, and a branch with `behind_by == 0` and `mergeable == UNKNOWN` is never a rebase wake: pending checks may yet go green and conflict state is still computing, and the tick would idle on either (Steps 5–6) regardless. The blocked-CI signal is different in kind — a **resume** probe, live only while the watch is blocked: it wakes on any move of the head's CI digest (the same bucket-plus-sorted-name/conclusion signature the blocked fingerprint records — [`blocked-tick.md`](blocked-tick.md)) away from `BLOCKED_CIDIGEST`, so a block waiting on a green pass, a rerun, or an external deploy check resumes as promptly as one waiting on red. Quiet iterations print nothing and cost nothing — no model tokens are spent while the watch is quiet.
|
|
42
42
|
|
|
43
43
|
Each poll also rewrites the slot's `watch-due.env` whenever the due work changes — the rebase key found due and the head whose checks settled red, or an empty file when neither — so the session's turn-end gate can see work the watch reported without a provider call ([`state-schemas.md`](state-schemas.md#watch-dueenv)).
|
|
44
44
|
|
|
@@ -56,9 +56,9 @@ The `DRAIN` lines it prints, in the watch's output, are the outstanding work as
|
|
|
56
56
|
- No line — a newer arm superseded the loop, and that arm's loop owns the slot. Nothing to do.
|
|
57
57
|
|
|
58
58
|
The wake turn runs the tick with `--wake=<event>` — the flag that tells routing's live-watcher gate this poll was prompted, not idle curiosity ([`SKILL.md`](SKILL.md#routing)) — and whatever cycle the tick produces runs **inline in the owning session** — never in a subagent. The session's full history is part of the cycle's context (decisions, review nuance, owner phrasing); a subagent only knows its briefing plus disk/provider state, and anything the briefing omits is silently missing from the cycle. The token cost of inline cycles is accepted — context beats cost. The tick still derives everything from live provider state; a terminal PR finalizes there while the loop exits on its own.
|
|
59
|
-
**After a cycle** — advance the watermark to the **handled wave's snapshot**, in the same dispatched context that ran the cycle. Capture the max review-id and comment
|
|
59
|
+
**After a cycle** — advance the watermark to the **handled wave's snapshot**, in the same dispatched context that ran the cycle. Capture the max review-id, comment-id and conversation-comment id **at the start of handling** — the ids the cycle actually read when it derived the wave, before any reply is posted — and advance the watermark to exactly those. **Never** re-derive it from a live-max fetched after the replies land: a reviewer comment that arrives during the handling window — between reading the wave and posting the replies — lands below that post-reply max and is marked seen without ever being read. Snapshotting at the start-of-handling read keeps such a comment above the watermark, so the next tick surfaces it. That advance is also what stops the loop from reporting its own reply; a cycle that skips it leaves the watermark stale, and the next event is an echo.
|
|
60
60
|
|
|
61
|
-
**Scan before advancing — a hard invariant.** Before writing the advanced watermark, confirm every unresolved review thread in the handled wave has been addressed: a reply posted, or an explicit deferral recorded. If any unresolved thread is still unaddressed, do **not** advance past it — leave its newest-comment id above the `COM` floor and its thread id out of the known-unresolved `THREADS` set, so the loop's next iteration wakes on it and the next tick re-surfaces it. The watermark only ever moves over threads that were actually handled.
|
|
61
|
+
**Scan before advancing — a hard invariant.** Before writing the advanced watermark, confirm every unresolved review thread in the handled wave has been addressed: a reply posted, or an explicit deferral recorded. If any unresolved thread is still unaddressed, do **not** advance past it — leave its newest-comment id above the `COM` floor and its thread id out of the known-unresolved `THREADS` set, so the loop's next iteration wakes on it and the next tick re-surfaces it. The watermark only ever moves over threads that were actually handled. Conversation comments follow the same rule: `CONV` advances only past a conversation comment the cycle replied to, folded as needing no reply, or escalated — an unaddressed one stays above it.
|
|
62
62
|
|
|
63
63
|
Arm a fresh loop only when none is alive — judged by the `<slot>/watch.pid` lease (a live PID means a watcher already owns the slot), not by the in-session task list, since an orphaned OS loop outlives the session that launched it; the settle path never duplicates a running watch. The one exception is answering the slot's own loop ending (Step 3).
|
|
64
64
|
|
|
@@ -53,7 +53,7 @@ For each PR URL in the track list, run the [`bootstrap.md`](bootstrap.md) proced
|
|
|
53
53
|
- **Existing slot → skip silently** (never the slot-conflict abort); add it to the *skipped* list.
|
|
54
54
|
- **`caller = "auto-track"`** in the bootstrap telemetry event.
|
|
55
55
|
|
|
56
|
-
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`/`cron.json`/`state.md` writes minus the pre-flight block.
|
|
56
|
+
Everything else is unchanged: URL parse, metadata + terminal-PR abort, slug, `lastBodyReviewId` 0 and `lastConversationCommentId` 0 (line-comment threads are picked up live from thread state; body-only reviews and conversation comments from id 0), and the `prs.json`/`last_seen.json`/`cron.json`/`state.md` writes minus the pre-flight block.
|
|
57
57
|
|
|
58
58
|
### Step 5 — Print the summary
|
|
59
59
|
|
|
@@ -57,6 +57,8 @@ Line-comment threads need no seeding — the watcher derives them from live thre
|
|
|
57
57
|
- **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.
|
|
58
58
|
- **With `--forward-only`:** fetch reviews per [`../_shared/vcs/github/submitted-reviews.md`](../_shared/vcs/github/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.
|
|
59
59
|
|
|
60
|
+
`lastConversationCommentId`, the watermark for top-level PR comments (GitHub only), follows the same rule: `0` by default, and under `--forward-only` the highest comment id from [`../_shared/vcs/github/conversation-comments.md`](../_shared/vcs/github/conversation-comments.md).
|
|
61
|
+
|
|
60
62
|
### Step 6.5 — Resolve the validation context (skip when there's nothing to E2E)
|
|
61
63
|
|
|
62
64
|
The only step that may prompt the user, and only when the PR has a testable surface. Run silent detection from [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md) first. If it finds **no dev server / no testable surface** — a docs, config, skill, or library change, or a non-web repo — seed the watcher **poll-only**: no prompt, no `## Pre-flight answers` block, continue to Step 7 (same as [`auto-track`](auto-track.md)).
|
|
@@ -75,7 +77,7 @@ Write under `~/.muggle-ai/muggle-do/sessions/<slug>/`:
|
|
|
75
77
|
|
|
76
78
|
**`prs.json`** — see [`state-schemas.md`](state-schemas.md#prsjson). One entry, `state` = `"open"`, `head_sha` from Step 2's `headRefOid`.
|
|
77
79
|
|
|
78
|
-
**`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: []`. Omit `blocked` — the watcher starts unblocked.
|
|
80
|
+
**`last_seen.json`** — see [`state-schemas.md`](state-schemas.md#last_seenjson). One key (`"<owner>/<repo>#<n>"`), `lastBodyReviewId` and `lastConversationCommentId` from Step 6, `last_pushed_sha: null`, `idle_tick_count: 0`, `cycles_completed: 0`, `escalated_review_ids: []`, `escalated_conversation_comment_ids: []`, `pushed_shas: []`. Omit `blocked` — the watcher starts unblocked.
|
|
79
81
|
|
|
80
82
|
**`cron.json`** — see [`state-schemas.md`](state-schemas.md#cronjson). `cron_id: null` (bootstrap arms no cron; a tick running under one recorded by [`reconcile.md`](reconcile.md) self-records its id per [`record-cron-id.md`](record-cron-id.md)), `command: "/muggle:muggle-pr-followup <slug> <n>"`, `interval: "1m"`, `recorded_at: <now>`.
|
|
81
83
|
|
|
@@ -78,7 +78,7 @@ Run the resume gate per [`blocked-tick.md`](blocked-tick.md): recompute the fing
|
|
|
78
78
|
|
|
79
79
|
### Step 3 — Compute the actionable set from live thread state
|
|
80
80
|
|
|
81
|
-
The watcher's dispatch trigger is **derived from current provider 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). Resolve the provider per [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md), then:
|
|
81
|
+
The watcher's dispatch trigger is **derived from current provider state**, not a stored review-id cursor (body-only reviews and conversation comments, which have no thread state, are the two narrow exceptions below) — see the [thread-state baseline design](../../../../muggle-ai-brain/architecture/2026-06-06-pr-followup-thread-state-baseline-design.md). Resolve the provider per [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md), then:
|
|
82
82
|
|
|
83
83
|
- **`github`** — two sources, unioned:
|
|
84
84
|
|
|
@@ -86,7 +86,9 @@ The watcher's dispatch trigger is **derived from current provider state**, not a
|
|
|
86
86
|
|
|
87
87
|
**(b) Actionable body-only reviews — GitHub only.** 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. GitLab has no review envelope (feedback is always a discussion note), so this sub-branch is GitHub-only and has no GitLab analogue. Fetch submitted reviews per [`../_shared/vcs/github/submitted-reviews.md`](../_shared/vcs/github/submitted-reviews.md); a body-only review is actionable when `id > last_seen.lastBodyReviewId` **and** `id ∉ last_seen.escalated_review_ids`.
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
**(c) Actionable conversation comments — GitHub only.** A top-level PR comment on the Conversation tab belongs to no review and no thread, so it keeps its own narrow watermark, like a body-only review. Fetch them per [`../_shared/vcs/github/conversation-comments.md`](../_shared/vcs/github/conversation-comments.md); one is actionable when `id > last_seen.lastConversationCommentId`, `id ∉ last_seen.escalated_conversation_comment_ids`, and muggle did not post it and no bot wrote it — the same exclusions the watch loop's projection applies. An entry with no `lastConversationCommentId` key predates this source: write the highest actionable id as its value (whole-file rewrite) and dispatch none of them ([`state-schemas.md`](state-schemas.md#last_seenjson)).
|
|
90
|
+
|
|
91
|
+
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. Actionable conversation comment ids travel beside it as a second list: they are issue-comment ids, a different sequence, and never mix with review ids.
|
|
90
92
|
|
|
91
93
|
- **`gitlab`** — single source. Fetch unresolved discussions per [`../_shared/vcs/gitlab/unresolved-discussions.md`](../_shared/vcs/gitlab/unresolved-discussions.md) (drop to [`../_shared/vcs/gitlab/mr-discussions.md`](../_shared/vcs/gitlab/mr-discussions.md) for the raw notes if a thread's classification needs them). A discussion is **actionable** when it is unresolved **and** its newest note lacks the loop marker `<!-- muggle-do:bot -->` — same marker classification, never `author.username`. There is no body-only watermark: discussion state is the sole authority. The dispatch list is the **discussion ids** of the actionable discussions.
|
|
92
94
|
|
|
@@ -100,13 +102,15 @@ The watcher does **not** classify. Classification, batching, replying, escalatio
|
|
|
100
102
|
- PR URL (from `prs.json[0].url`)
|
|
101
103
|
- Session slug (from the invocation arguments)
|
|
102
104
|
- The dispatch ids from Step 3 (GitHub owning review ids / GitLab discussion ids), as a space-separated list
|
|
105
|
+
- GitHub: the actionable conversation comment ids from Step 3(c), after the keyword `conversation`; omitted when there are none
|
|
103
106
|
|
|
104
107
|
Exact phrasing belongs to `/muggle-do`'s intent-routing. A reasonable shape is:
|
|
105
108
|
```
|
|
106
|
-
/muggle-do address reviews <id1> <id2> ... on <pr-url> slug=<slug>
|
|
109
|
+
/muggle-do address reviews <id1> <id2> ... [conversation <cid1> <cid2> ...] on <pr-url> slug=<slug>
|
|
107
110
|
```
|
|
111
|
+
A wave of conversation comments alone dispatches with an empty review list: `address reviews conversation <cid1> on <pr-url> slug=<slug>`.
|
|
108
112
|
4. Append a dispatching line to `followup.log` per [`output-templates/watcher-log.md`](output-templates/watcher-log.md).
|
|
109
|
-
5. Emit a `tick` event with `actionable_threads: <count
|
|
113
|
+
5. Emit a `tick` event with `actionable_threads: <count>` (conversation comments included), `dispatched_review_ids: [<id>, ...]`.
|
|
110
114
|
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.)
|
|
111
115
|
|
|
112
116
|
### Step 5 — No actionable feedback → read the branch's standing against its base
|
|
@@ -15,3 +15,15 @@ When an actionable review has a non-empty body but zero line comments, GitHub ha
|
|
|
15
15
|
```
|
|
16
16
|
Re: review #<review_id> — addressed in <short-sha>: <one-line summary>.
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## Conversation-comment reply
|
|
20
|
+
|
|
21
|
+
A top-level PR comment (Conversation tab) has no reply endpoint. Answer it with its own top-level comment, exactly one per addressed conversation comment, quoting its first line and linking it so a reader can tell which comment it answers:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
> <first line of the comment, trimmed>
|
|
25
|
+
|
|
26
|
+
Re: [comment](<comment html_url>) by @<author> — addressed in <short-sha>: <one-line summary>.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
A question the round answered without a change drops `addressed in <short-sha>:` for the answer itself. Posted per [`../../_shared/vcs/github/top-level-comment.md`](../../_shared/vcs/github/top-level-comment.md) with `--mode loop`, so the watch reads it as the loop's own and never wakes on it.
|
|
@@ -98,10 +98,12 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
98
98
|
{
|
|
99
99
|
"<owner>/<repo>#<n>": {
|
|
100
100
|
"lastBodyReviewId": <int>,
|
|
101
|
+
"lastConversationCommentId": <int>,
|
|
101
102
|
"last_pushed_sha": "<sha-or-null>",
|
|
102
103
|
"idle_tick_count": <int>,
|
|
103
104
|
"cycles_completed": <int>,
|
|
104
105
|
"escalated_review_ids": [<int>, ...],
|
|
106
|
+
"escalated_conversation_comment_ids": [<int>, ...],
|
|
105
107
|
"pushed_shas": ["<sha>", ...],
|
|
106
108
|
"ci_fix_attempts": { "<sha>": <int> },
|
|
107
109
|
"ci_escalated_shas": ["<sha>", ...],
|
|
@@ -124,10 +126,12 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
124
126
|
```
|
|
125
127
|
|
|
126
128
|
- `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`. The cursor keeps its name under GitLab, where it holds the highest note / discussion id.
|
|
129
|
+
- `lastConversationCommentId` (GitHub only): narrow watermark for **conversation comments** — top-level PR comments on the Conversation tab, which belong to no review and no thread. The watcher dispatches one only when `id > lastConversationCommentId` ([`../_shared/vcs/github/conversation-comments.md`](../_shared/vcs/github/conversation-comments.md)). Issue-comment ids are their own sequence, so this never shares `lastBodyReviewId`. Bootstrap, auto-track and forward mode write it beside `lastBodyReviewId` — `0`, or the highest existing conversation comment id under `--forward-only`. An entry **without** the key predates conversation comments being watched: the tick seeds it to the highest actionable id it reads and dispatches none of them, so an upgrade never re-answers a PR's comment history.
|
|
127
130
|
- `last_pushed_sha`: most recent SHA `/muggle-do` pushed in this PR's life; `null` until the first push.
|
|
128
131
|
- `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.
|
|
129
132
|
- `cycles_completed`: incremented each time `/muggle-do` completes an address-reviews invocation (regardless of actionable/ambiguous/mixed).
|
|
130
133
|
- `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.
|
|
134
|
+
- `escalated_conversation_comment_ids`: conversation comment ids `/muggle-do` classified ambiguous. Excluded from the actionable set like `escalated_review_ids`, and either list non-empty blocks the watch with reason `reviews_escalated`.
|
|
131
135
|
- `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.
|
|
132
136
|
- `ci_fix_attempts`: per-SHA count of fix-ci cycles `/muggle-do` has run, incremented when a cycle starts — so a cycle that only re-runs a noisy check, or escalates without a push, still counts. The watcher stops dispatching fix-ci for a SHA once its count reaches 3. Keyed by head SHA. A count of 1 or more is the only evidence that floors a red head at arm time or releases the turn-end gate.
|
|
133
137
|
- `ci_escalated_shas`: head SHAs whose CI the fix-ci stage gave up on (attempts exhausted, only out-of-scope checks, or a noisy check red again after its re-run). Suppresses CI dispatch **only while `ci_fix_attempts[sha] >= 1`**; an entry with no attempt behind it is ignored and fix-ci dispatches anyway.
|
|
@@ -226,13 +230,14 @@ The watch loop's comparison floor — plain `KEY=VALUE` lines, one file per slot
|
|
|
226
230
|
|
|
227
231
|
- `REV` — highest submitted-review id already handled
|
|
228
232
|
- `COM` — highest thread-comment id already handled
|
|
233
|
+
- `CONV` — highest human conversation-comment id (top-level PR comment, Conversation tab) already handled. The loop's projection drops muggle's own posts and bot authors before taking the max, so the loop's signed reply never lifts it. A watermark without the key predates the floor: arming seeds it from the drain's read, and a loop running over such a watermark floors at its own first read until then.
|
|
229
234
|
- `THREADS` — semicolon-joined ids of threads already known unresolved
|
|
230
235
|
- `CIRED` — the red key `<head_sha>@<red-check-runs>` (each failed check's `name#run-id`, sorted — the last field of [`../../scripts/pr-watch-state.jq`](../../scripts/pr-watch-state.jq)) of a red verdict fix-ci is finished with: `head_sha` ∈ `ci_escalated_shas` with an attempt behind it, or `ci_fix_attempts[sha] >= 3`. Empty when the checks are green, still pending, unseen, or red with fix-ci not finished — the last so the loop reports it. A lone attempt never floors: the count is written before the fix runs, so it proves a cycle started, not that anything on the PR changed. The floor is a red key rather than a monotonic id because the rollup flips green↔red and resets on each push, and it carries run ids because a settled walkthrough comment or a rerun publishes a new run on the **same** head — a red verdict from that run is what fix-ci waits on, so it wakes the loop again ([`arm-watcher.md`](arm-watcher.md)).
|
|
231
236
|
- `REBASED` — the `rebase_key` (`<head_sha>..<base_tip_sha>`) whose behind/conflicting state a rebase cycle already attempted (`conflict_resolve_attempts[key] >= 1`); empty when the branch is current with its base, unseen, or stale with no attempt. Keyed on the pair, not a monotonic id, because staleness depends on both sides — the loop fires once per newly-due pair and re-arms when the head or the base moves. Same key [`contract.md`](contract.md) Steps 5–6 dedup rebase dispatch on; the loop only signals a due rebase, the tick's verdict applies the budgets.
|
|
232
237
|
- `BLOCKED_CIDIGEST` — the head's `ci_digest` at the moment a block was flagged (the same signature `blocked.fingerprint.ci_digest` carries); empty whenever the watch is not blocked. Non-empty arms the loop's blocked-resume probe: while set, the loop wakes on any move of the live digest away from this value, so a block resumes on a green pass, a rerun, or an external deploy check — not only on red. Written by [`blocked-tick.md`](blocked-tick.md) when a block is flagged and cleared to empty when it resumes.
|
|
233
238
|
- `REBASE_HELD` — `1` when the PR has spent its catch-up rebase budget (`catch_up_rebases` has reached [`maxCatchUpRebases`](../muggle-preferences/preference-gates/maxCatchUpRebases.md)), empty otherwise. While set, the loop raises no rebase wake and records no rebase as due however far the base moves: the tick's verdict refuses every rebase until the owner raises the cap, so a wake would only ask for work it turns down. Every arm recomputes it, so a raised cap lifts the hold at the next re-arm.
|
|
234
239
|
|
|
235
|
-
Written whole-file by the orchestrating session — the review/comment/CI/rebase floors seeded at arm time (`REV`/`COM`/`THREADS` to the **drain's own observed max** on a first arm, and carried forward from this file on a re-arm, dropping threads since resolved, so a review that landed after the session's last read stays above them; `CIRED`/`REBASED` to the red head and stale key a cycle already attempted, `REBASE_HELD` from the rebase budget) and advanced after every cycle to the **handled wave's snapshot** (the max review-id and comment
|
|
240
|
+
Written whole-file by the orchestrating session — the review/comment/CI/rebase floors seeded at arm time (`REV`/`COM`/`CONV`/`THREADS` to the **drain's own observed max** on a first arm, and carried forward from this file on a re-arm, dropping threads since resolved, so a review that landed after the session's last read stays above them; `CIRED`/`REBASED` to the red head and stale key a cycle already attempted, `REBASE_HELD` from the rebase budget) and advanced after every cycle to the **handled wave's snapshot** (the max review-id, comment-id and conversation-comment id the cycle read at the start of handling, captured before replies were posted); `BLOCKED_CIDIGEST` is set and cleared by the blocked-tick flag/resume path, and every arm re-seeds it from `last_seen.blocked.fingerprint.ci_digest` so a re-arm keeps the resume probe live. **Never** derived from a fresh fetch taken after the drain or after replies land: a later fetch includes ids that arrived in the handling window and were never read, and marking them seen swallows them ([`arm-watcher.md`](arm-watcher.md)). The advance also never moves any floor past an unresolved thread the cycle left unaddressed. Read by the watch loop each iteration; the loop never writes it. A stale watermark makes the next reported event the loop's own reply.
|
|
236
241
|
|
|
237
242
|
**Never `source` this file, and quote or extract values.** `THREADS` holds bare semicolons: sourced unquoted, the shell splits the line at the first `;` and silently drops every id after it — the loop then re-reports known threads as new. The watch loop must extract values verbatim (e.g. `grep '^THREADS=' | cut -d= -f2- | tr -d '"\r'`), tolerating quotes and CRLF; writers should quote the value anyway.
|
|
238
243
|
|
|
@@ -250,7 +255,7 @@ The file is **empty** when nothing is due. Written by [`../../scripts/pr-watch-a
|
|
|
250
255
|
|
|
251
256
|
What the slot's loops already reported to the session — `KEY="value"` lines like the watermark's, written only by the loop, and only on the poll that ends it with a report:
|
|
252
257
|
|
|
253
|
-
- `REV` / `COM` — the newest review and comment ids that poll saw; each one at or below them was reported or already floored.
|
|
258
|
+
- `REV` / `COM` / `CONV` — the newest review, thread-comment and human conversation-comment ids that poll saw; each one at or below them was reported or already floored.
|
|
254
259
|
- `THREADS` — the threads unresolved at that poll.
|
|
255
260
|
- `CIRED` / `REBASED` — the red key and the rebase key a loop reported.
|
|
256
261
|
- `BLOCKED_CIDIGEST` / `BLOCKED_FOR` — the CI digest a blocked-resume wake reported, and the watermark's `BLOCKED_CIDIGEST` it was reported under. It quiets only that block, so the same digest can resume a later one.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"release": "5.26.0",
|
|
3
|
-
"buildId": "run-
|
|
4
|
-
"commitSha": "
|
|
5
|
-
"buildTime": "2026-11-
|
|
3
|
+
"buildId": "run-285-1",
|
|
4
|
+
"commitSha": "250f5bb129270f99e8d9e87afc011b783f7777d8",
|
|
5
|
+
"buildTime": "2026-11-03T21:27:56Z",
|
|
6
6
|
"serviceName": "muggle-ai-works-mcp"
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CLAUDE_CODE_AUTH_STATUS_ARGS, CLAUDE_CODE_CHECK_TIMEOUT_MS, CLAUDE_CODE_EXECUTABLE, CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE, CLAUDE_CODE_SESSION_LINK_ENV_VARS, CLAUDE_CODE_VERSION_ARGS, CheckoutFreshnessVerdict, ClaudeCodeReadiness, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, LLM_CREDENTIALS_FILE_MODE, LLM_CREDENTIALS_FILE_NAME, LLM_SOURCE_HEADER, LLM_SOURCE_OPTIONS, LLM_SOURCE_OWNED_ENV_NAMES, LLM_SOURCE_PROMPT, LLM_SOURCE_SCOPE_NOTE, LlmSource, MASKED_API_KEY_PREFIX, MASKED_API_KEY_VISIBLE_CHARS, MAX_LISTED_INHERITED_COMMITS, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, StackCheckVerdict, StackClaimVerdict, StackLeaseEndReason, StackMismatchKind, StackPortAction, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyLlmSourceSelection, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildLlmSourcePlan, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, compareQueuePlaces, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackReap, decideStackRelease, decideStackRunEnd, decideStackRunStart, deleteApiKeyData, deleteCredentials, describeLlmSourceStatus, describeStackMismatch, e2e_exports as e2e, evaluateCheckoutFreshness, findVacatedNeeds, finishStackRun, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports as localQa, lookUpCheckoutPullRequest, markOnboardingCompleted, maskLlmApiKey, mcp_exports as mcp, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, e2e_exports as qa, readPreferencesMetadata, readRunView, readServiceStackStatus, reapServiceStack, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveLlmSourceStatus, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, startStackRun, stopVacatedServices, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-
|
|
1
|
+
export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CLAUDE_CODE_AUTH_STATUS_ARGS, CLAUDE_CODE_CHECK_TIMEOUT_MS, CLAUDE_CODE_EXECUTABLE, CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE, CLAUDE_CODE_SESSION_LINK_ENV_VARS, CLAUDE_CODE_VERSION_ARGS, CheckoutFreshnessVerdict, ClaudeCodeReadiness, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, LLM_CREDENTIALS_FILE_MODE, LLM_CREDENTIALS_FILE_NAME, LLM_SOURCE_HEADER, LLM_SOURCE_OPTIONS, LLM_SOURCE_OWNED_ENV_NAMES, LLM_SOURCE_PROMPT, LLM_SOURCE_SCOPE_NOTE, LlmSource, MASKED_API_KEY_PREFIX, MASKED_API_KEY_VISIBLE_CHARS, MAX_LISTED_INHERITED_COMMITS, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, StackCheckVerdict, StackClaimVerdict, StackLeaseEndReason, StackMismatchKind, StackPortAction, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyLlmSourceSelection, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildLlmSourcePlan, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, compareQueuePlaces, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackReap, decideStackRelease, decideStackRunEnd, decideStackRunStart, deleteApiKeyData, deleteCredentials, describeLlmSourceStatus, describeStackMismatch, e2e_exports as e2e, evaluateCheckoutFreshness, findVacatedNeeds, finishStackRun, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports as localQa, lookUpCheckoutPullRequest, markOnboardingCompleted, maskLlmApiKey, mcp_exports as mcp, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, e2e_exports as qa, readPreferencesMetadata, readRunView, readServiceStackStatus, reapServiceStack, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveLlmSourceStatus, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, startStackRun, stopVacatedServices, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-AEJM2CBK.js';
|
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.32.0-staging.
|
|
4
|
+
"version": "5.32.0-staging.285",
|
|
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.32.0-staging.
|
|
4
|
+
"version": "5.32.0-staging.285",
|
|
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.32.0-staging.
|
|
3
|
+
"version": "5.32.0-staging.285",
|
|
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.32.0-staging.
|
|
5
|
+
"version": "5.32.0-staging.285",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/plugin/.mcp.json
CHANGED
|
@@ -80,6 +80,7 @@ unresolved_threads="${STATE_FIELDS[6]-}"
|
|
|
80
80
|
pending_checks="${STATE_FIELDS[7]-}"
|
|
81
81
|
failed_checks="${STATE_FIELDS[8]-}"
|
|
82
82
|
ci_red_key="$(watch_ci_red_key "$head_sha" "${STATE_FIELDS[10]-}")"
|
|
83
|
+
latest_conversation="${STATE_FIELDS[11]-}"
|
|
83
84
|
|
|
84
85
|
if [ "$pr_state" = "MERGED" ] || [ "$pr_state" = "CLOSED" ]; then
|
|
85
86
|
echo "TERMINAL pr=$pr_number state=$pr_state — nothing to arm"
|
|
@@ -145,7 +146,7 @@ thread_count=0
|
|
|
145
146
|
# Unattempted work is left unfloored, so the loop's first poll reports it and
|
|
146
147
|
# exits — that report is the wake.
|
|
147
148
|
echo "DRAIN pr=$pr_number state=$pr_state head=${head_sha:0:8}"
|
|
148
|
-
echo "DRAIN unresolved-threads=$thread_count latest-review=${latest_review:-0} latest-comment=${latest_comment:-0}"
|
|
149
|
+
echo "DRAIN unresolved-threads=$thread_count latest-review=${latest_review:-0} latest-comment=${latest_comment:-0} latest-conversation-comment=${latest_conversation:-0}"
|
|
149
150
|
echo "DRAIN checks pending=${pending_checks:-0} failed=${failed_checks:-0} behind-base=${behind_count:-unknown} mergeable=${mergeable:-UNKNOWN}"
|
|
150
151
|
if [ -n "$ci_red_head" ]; then
|
|
151
152
|
if [ -n "$ci_red_floor" ]; then
|
|
@@ -164,17 +165,23 @@ if [ -n "$rebase_due_key" ]; then
|
|
|
164
165
|
fi
|
|
165
166
|
fi
|
|
166
167
|
|
|
167
|
-
# A re-arm carries the review, comment and thread floors forward. The session
|
|
168
|
+
# A re-arm carries the review, comment, conversation and thread floors forward. The session
|
|
168
169
|
# advanced them past what it handled, so anything newer — a review landing
|
|
169
170
|
# between its last tick's read and this one — is above them, and the loop's
|
|
170
171
|
# first poll reports it. Seeding them from this read would floor that review
|
|
171
172
|
# unseen. Only a first arm, with nothing handled yet, takes them from its read.
|
|
172
173
|
review_floor="${latest_review:-0}"
|
|
173
174
|
comment_floor="${latest_comment:-0}"
|
|
175
|
+
conversation_floor="${latest_conversation:-0}"
|
|
174
176
|
threads_floor="$unresolved_threads"
|
|
175
177
|
if [ -f "${slot}/watch-watermark.env" ]; then
|
|
176
178
|
review_floor="$(watch_read_slot_value "$slot" watch-watermark.env REV)"
|
|
177
179
|
comment_floor="$(watch_read_slot_value "$slot" watch-watermark.env COM)"
|
|
180
|
+
# A watermark from before conversation comments were watched has no floor
|
|
181
|
+
# to carry, so this drain's read is the first one it gets.
|
|
182
|
+
if watch_slot_has_key "$slot" watch-watermark.env CONV; then
|
|
183
|
+
conversation_floor="$(watch_read_slot_value "$slot" watch-watermark.env CONV)"
|
|
184
|
+
fi
|
|
178
185
|
threads_floor="$(watch_threads_still_unresolved \
|
|
179
186
|
"$(watch_read_slot_value "$slot" watch-watermark.env THREADS)" "$unresolved_threads")"
|
|
180
187
|
fi
|
|
@@ -182,6 +189,7 @@ fi
|
|
|
182
189
|
{
|
|
183
190
|
printf 'REV=%s\n' "${review_floor:-0}"
|
|
184
191
|
printf 'COM=%s\n' "${comment_floor:-0}"
|
|
192
|
+
printf 'CONV=%s\n' "${conversation_floor:-0}"
|
|
185
193
|
printf 'THREADS="%s"\n' "$threads_floor"
|
|
186
194
|
printf 'CIRED="%s"\n' "$ci_red_floor"
|
|
187
195
|
printf 'REBASED="%s"\n' "$rebase_floor"
|
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
# unresolved_threads and fires a thread wake for a PR with no threads, while the
|
|
28
28
|
# check digest lands in failed_checks and leaves red-CI detection reading a
|
|
29
29
|
# string where it expects a count. awk with an explicit FS does not collapse.
|
|
30
|
+
#
|
|
31
|
+
# A CRLF-terminated projection (jq on Windows) would leave a carriage return on
|
|
32
|
+
# the last field, which is numeric and would then fail every comparison.
|
|
30
33
|
watch_split_state() {
|
|
31
|
-
printf '%s\n' "$1" | awk -F'\t' '{for (i = 1; i <= NF; i++) print $i}'
|
|
34
|
+
printf '%s\n' "$1" | awk -F'\t' '{sub(/\r$/, ""); for (i = 1; i <= NF; i++) print $i}'
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
# Loads a state line's fields into the array STATE_FIELDS, empty fields kept.
|
|
@@ -59,6 +62,16 @@ watch_wake_comment() {
|
|
|
59
62
|
echo "EVENT pr=$pr new thread comment id=$latest"
|
|
60
63
|
}
|
|
61
64
|
|
|
65
|
+
# A top-level PR comment (the Conversation tab) newer than the floor. The
|
|
66
|
+
# projection already dropped muggle's own posts and bot authors, so whatever is
|
|
67
|
+
# left is a human's. Issue-comment ids are monotonic like the two above, but a
|
|
68
|
+
# sequence of their own, hence a floor of their own.
|
|
69
|
+
watch_wake_conversation_comment() {
|
|
70
|
+
local pr="$1" latest="$2" floor="$3"
|
|
71
|
+
[ "${latest:-0}" -gt "${floor:-0}" ] 2>/dev/null || return 1
|
|
72
|
+
echo "EVENT pr=$pr new conversation comment id=$latest"
|
|
73
|
+
}
|
|
74
|
+
|
|
62
75
|
# A thread that is unresolved and not already known to be. `known` is the
|
|
63
76
|
# semicolon-joined THREADS floor; membership is the test, not ordering, because
|
|
64
77
|
# thread ids are opaque strings rather than a monotonic sequence.
|
|
@@ -42,6 +42,7 @@ query($owner: String!, $name: String!, $number: Int!) {
|
|
|
42
42
|
comments(last: 1) { nodes { databaseId body pullRequestReview { databaseId state } } }
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
comments(last: 50) { nodes { databaseId body createdAt author { __typename login } } }
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}' --jq "$state_projection" 2>>"${slot}/watch-fetch.log"
|