@muggleai/works 5.36.0-staging.335 → 5.36.0-staging.337
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/AGENTS.md +1 -0
- package/README.md +2 -1
- package/dist/{chunk-KGTP3CED.js → chunk-HTCBHSL6.js} +132 -40
- package/dist/{chunk-5E46QHM6.js → chunk-OIFLV2QN.js} +499 -157
- 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/README.md +1 -0
- package/dist/plugin/commands/mbugreport.md +7 -0
- package/dist/plugin/hooks/README.md +1 -1
- package/dist/plugin/scripts/guardrail-watch-follow-through-gate.sh +22 -7
- package/dist/plugin/scripts/guardrails.mjs +21 -3
- package/dist/plugin/scripts/pr-watch-arm.sh +11 -6
- package/dist/plugin/scripts/pr-watch-loop.sh +3 -2
- package/dist/plugin/scripts/pr-watch-verdict.mjs +1 -0
- package/dist/plugin/skills/CLAUDE.md +1 -1
- package/dist/plugin/skills/_aliases.json +2 -1
- package/dist/plugin/skills/do/audit-trail.md +1 -1
- package/dist/plugin/skills/do/e2e-repair.md +1 -1
- package/dist/plugin/skills/do/open-prs/forward.md +17 -15
- package/dist/plugin/skills/do/open-prs.md +1 -1
- package/dist/plugin/skills/mbugreport/SKILL.md +9 -0
- package/dist/plugin/skills/mbugreport/agents/openai.yaml +7 -0
- package/dist/plugin/skills/muggle/SKILL.md +1 -0
- package/dist/plugin/skills/muggle-bug-report/SKILL.md +37 -0
- package/dist/plugin/skills/muggle-bug-report/ops/file.md +68 -0
- package/dist/plugin/skills/muggle-bug-report/ops/list.md +30 -0
- package/dist/plugin/skills/muggle-bug-report/ops/reply.md +38 -0
- package/dist/plugin/skills/muggle-bug-report/ops/status.md +45 -0
- package/dist/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/arm-watcher.md +2 -2
- package/dist/plugin/skills/muggle-pr-followup/contract.md +6 -0
- package/dist/plugin/skills/muggle-pr-followup/reconcile.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +8 -2
- package/dist/release-manifest.json +4 -4
- package/dist/{src-2OO6JDTQ.js → src-5Z6EIGHT.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/README.md +1 -0
- package/plugin/commands/mbugreport.md +7 -0
- package/plugin/hooks/README.md +1 -1
- package/plugin/scripts/guardrail-watch-follow-through-gate.sh +22 -7
- package/plugin/scripts/guardrails.mjs +21 -3
- package/plugin/scripts/pr-watch-arm.sh +11 -6
- package/plugin/scripts/pr-watch-loop.sh +3 -2
- package/plugin/scripts/pr-watch-verdict.mjs +1 -0
- package/plugin/skills/CLAUDE.md +1 -1
- package/plugin/skills/_aliases.json +2 -1
- package/plugin/skills/do/audit-trail.md +1 -1
- package/plugin/skills/do/e2e-repair.md +1 -1
- package/plugin/skills/do/open-prs/forward.md +17 -15
- package/plugin/skills/do/open-prs.md +1 -1
- package/plugin/skills/mbugreport/SKILL.md +9 -0
- package/plugin/skills/mbugreport/agents/openai.yaml +7 -0
- package/plugin/skills/muggle/SKILL.md +1 -0
- package/plugin/skills/muggle-bug-report/SKILL.md +37 -0
- package/plugin/skills/muggle-bug-report/ops/file.md +68 -0
- package/plugin/skills/muggle-bug-report/ops/list.md +30 -0
- package/plugin/skills/muggle-bug-report/ops/reply.md +38 -0
- package/plugin/skills/muggle-bug-report/ops/status.md +45 -0
- package/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
- package/plugin/skills/muggle-pr-followup/arm-watcher.md +2 -2
- package/plugin/skills/muggle-pr-followup/contract.md +6 -0
- package/plugin/skills/muggle-pr-followup/reconcile.md +1 -1
- package/plugin/skills/muggle-pr-followup/state-schemas.md +8 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Audit trail
|
|
2
2
|
|
|
3
|
-
**Arm first.** If this cycle leaves a PR open and its watch is not armed yet, stop reading and arm it now ([`respawn-watcher.md`](respawn-watcher.md), or Stage
|
|
3
|
+
**Arm first.** If this cycle leaves a PR open and its watch is not armed yet, stop reading and arm it now ([`respawn-watcher.md`](respawn-watcher.md), or Stage 5.5 on a forward cycle, whose Stage 8 then lifts the hold). The block is written after the arm, never instead of it.
|
|
4
4
|
|
|
5
5
|
What a cycle shows the user before it ends: the tests the change involved, their results, and links to the proof. It reports and gates nothing. Anything missing is stated in the block, never a reason to stop, retry, or ask.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# E2E Repair Loop (Stage 7.5)
|
|
2
2
|
|
|
3
|
-
Runs between Stage 7's posted walkthrough and Stage 8's watcher dispatch, and again whenever the watcher finds the PR's `muggle-walkthrough` check red on failed cases ([`fix-ci.md`](fix-ci.md) Step 2.5). A failing acceptance run means the change is not ready for a reviewer, so this stage root-causes every failure and either repairs it in-pipeline or puts one decision in front of the user. The
|
|
3
|
+
Runs between Stage 7's posted walkthrough and Stage 8's watcher dispatch, and again whenever the watcher finds the PR's `muggle-walkthrough` check red on failed cases ([`fix-ci.md`](fix-ci.md) Step 2.5). A failing acceptance run means the change is not ready for a reviewer, so this stage root-causes every failure and either repairs it in-pipeline or puts one decision in front of the user. The PR's watch is armed at Stage 5.5 but holds every cycle until this stage clears and Stage 8 lifts the hold.
|
|
4
4
|
|
|
5
5
|
## Turn preamble
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Open PR — forward mode
|
|
2
2
|
|
|
3
|
-
The forward pipeline's PR stages, which run on either side of Stage 6. **Stage 5.5** opens the change — a PR on GitHub (`gh pr create`) or an MR on GitLab (`glab mr create`), provider resolved in Step 5 — as soon as unit tests pass, before any browser run. **Stage 7** settles that run's result on it,
|
|
3
|
+
The forward pipeline's PR stages, which run on either side of Stage 6. **Stage 5.5** opens the change — a PR on GitHub (`gh pr create`) or an MR on GitLab (`glab mr create`), provider resolved in Step 5 — as soon as unit tests pass, before any browser run, and arms its watch with every cycle held. **Stage 7** settles that run's result on it, and **Stage 8** lifts the hold.
|
|
4
4
|
|
|
5
5
|
The PR goes up first because opening it needs nothing from the run: CI and reviewers start on the diff while E2E runs, and the run's [PR progress](../../_shared/dev-loop/run.md#pr-progress) fills the PR's walkthrough comment case by case. The walkthrough check stays red until Stage 7 settles that comment, so an open PR never passes as tested before its run lands.
|
|
6
6
|
|
|
@@ -62,6 +62,16 @@ Per repo:
|
|
|
62
62
|
|
|
63
63
|
A create that fails ends the cycle for that repo: report it under **Errors** and run no E2E for it, since the run would have no PR to settle.
|
|
64
64
|
|
|
65
|
+
6. **Seed and arm the watch, held.** Write `~/.muggle-ai/muggle-do/sessions/<slug>/prs.json` per [`../../muggle-pr-followup/state-schemas.md`](../../muggle-pr-followup/state-schemas.md#prsjson), one entry per PR this stage opened:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
[{ "repo": "owner/repo", "number": 142, "url": "...", "head_sha": "...", "state": "open" }]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Seed `last_seen.json` per [`../../muggle-pr-followup/state-schemas.md`](../../muggle-pr-followup/state-schemas.md#last_seenjson): the empty-watermark shape with `pushed_shas: []`, `lastBodyReviewId: 0` and `lastConversationCommentId: 0` (forward mode has no prior reviews to skip), and `"forward_stages_in_flight": true`. **Do not** seed `cycle.json` or `requirements.md`. Then arm each PR's watch per [`../../muggle-pr-followup/arm-watcher.md`](../../muggle-pr-followup/arm-watcher.md). The arm writes `owner.json` and `watch-registration.json`, so from here on the PR is watched, owned by this session, and visible to the muggle watch service and to reconcile, however Stage 6 ends.
|
|
72
|
+
|
|
73
|
+
The flag is the hold. While it is set the watch still reports, but the tick dispatches nothing — no address-reviews, rebase, or fix-ci — and logs a `deferred` line instead (the verdict is `hold-forward-stages`), because Stage 6 is testing the head any such cycle would push over. A watch wake that arrives during Stages 6–7.5 runs that tick between steps of this cycle and goes back to the stage in flight; it never pre-empts it. Reviews, CI and branch drift wait in the watermarks, undispatched, for Stage 8.
|
|
74
|
+
|
|
65
75
|
## Stage 7 — report on the PR
|
|
66
76
|
|
|
67
77
|
Runs once Stage 6 has recorded this change's verdict; a Stage 6 readiness halt never reaches it. Per repo, using the provider resolved in Stage 5.5:
|
|
@@ -86,25 +96,17 @@ The E2E repair loop ([`../e2e-repair.md`](../e2e-repair.md)) runs once Stage 7 h
|
|
|
86
96
|
|
|
87
97
|
## Stage 8 handoff
|
|
88
98
|
|
|
89
|
-
After every repo is processed and Stage 7.5 has cleared,
|
|
90
|
-
|
|
91
|
-
Write `~/.muggle-ai/muggle-do/sessions/<slug>/prs.json` per [`../../muggle-pr-followup/state-schemas.md`](../../muggle-pr-followup/state-schemas.md#prsjson):
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
[{ "repo": "owner/repo", "number": 142, "url": "...", "head_sha": "...", "state": "open" }]
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
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`.
|
|
99
|
+
After every repo is processed and Stage 7.5 has cleared, lift the hold Stage 5.5 set and hand each PR to its watch. The handoff ticks are the LAST action this stage takes.
|
|
98
100
|
|
|
99
|
-
|
|
101
|
+
Per PR: rewrite `last_seen.json` without `forward_stages_in_flight` (whole-file rewrite), then run its tick, `/muggle:muggle-pr-followup <slug> <n> --wake=stage-handoff`. The tick refreshes `prs.json` from the provider (Stage 7 may have force-pushed the tested head), dispatches whatever the hold kept back — reviews first, then a rebase or fix-ci — or idles, and leaves one loop polling per [`../../muggle-pr-followup/arm-watcher.md`](../../muggle-pr-followup/arm-watcher.md), the same procedure [`../respawn-watcher.md`](../respawn-watcher.md) settles every later watch with. A loop that died during Stage 6 is re-armed there. Never a recurring `/loop` cron — every cron fire is a model turn, while the loop polls token-free. The PR counts as watched only while that loop is running; a seeded slot alone is not a watch.
|
|
100
102
|
|
|
101
|
-
|
|
103
|
+
Stage 7.5 keeps its meaning: it is still the gate in front of every cycle the watch dispatches, because nothing dispatches until this handoff lifts the hold. A cycle that exits before Stage 8 — a Stage 6 readiness halt, a stalled run — leaves the hold set and says so on the **Stage 8** line: the PR stays watched and its reports still reach this session, but no cycle runs on it until the forward cycle resumes or the user asks for the hold to be lifted.
|
|
102
104
|
|
|
103
|
-
If
|
|
105
|
+
If Stage 5.5 opened no PR, there is no slot and nothing to hand off — record the reason in `result.md` and exit.
|
|
104
106
|
|
|
105
107
|
## Invariants
|
|
106
108
|
|
|
107
|
-
- Branch synced with its base before the push, never after; PR opened per non-skipped repo before Stage 6 starts, ready for review — never a draft; the tested head is the PR's head before its walkthrough settles; designated walkthrough comment settled via Mode A, or its skip reason stated; `prs.json`+`last_seen.json` seeded (no `cycle.json`, no `requirements.md`); Stage 7.5 cleared before
|
|
109
|
+
- Branch synced with its base before the push, never after; PR opened per non-skipped repo before Stage 6 starts, ready for review — never a draft; the tested head is the PR's head before its walkthrough settles; designated walkthrough comment settled via Mode A, or its skip reason stated; `prs.json`+`last_seen.json` seeded and the watch armed, held, when the PR opens (no `cycle.json`, no `requirements.md`); Stage 7.5 cleared before the hold lifts; the handoff tick is the last action.
|
|
108
110
|
|
|
109
111
|
## Output
|
|
110
112
|
|
|
@@ -117,7 +119,7 @@ The cycle's closing message opens with the [audit trail](../audit-trail.md), on
|
|
|
117
119
|
**Overflow comments posted:** repo → PR #
|
|
118
120
|
**Recurring run:** `already scheduled` | `<recommended options>` (bug fixes only)
|
|
119
121
|
**Stage 7.5:** `green` | `waived — <reason>` | `decision-pending`
|
|
120
|
-
**Stage 8:** `Watching <N> PR(s) — one watch loop per PR,
|
|
122
|
+
**Stage 8:** `Watching <N> PR(s) — hold lifted, one watch loop per PR` | `Held — <reason>; watched since Stage 5.5, cycles wait for the hold to lift` | `No PRs to watch — no slot seeded`
|
|
121
123
|
**Errors:** repo → message
|
|
122
124
|
|
|
123
125
|
## Post-merge cleanup
|
|
@@ -4,5 +4,5 @@ Two modes, set by the `/muggle-do` invocation. Each consumer loads only its mode
|
|
|
4
4
|
|
|
5
5
|
| Mode | When | Procedure |
|
|
6
6
|
| :--- | :--- | :-------- |
|
|
7
|
-
| Forward | A fresh feature, called by `/muggle-do`'s forward pipeline. Opens the PR after Stage 5 (Stage 5.5), settles its walkthrough after Stage 6 (Stage 7),
|
|
7
|
+
| Forward | A fresh feature, called by `/muggle-do`'s forward pipeline. Opens the PR after Stage 5 (Stage 5.5) and arms its watch with cycles held, settles its walkthrough after Stage 6 (Stage 7), lifts the hold at Stage 8. | [`open-prs/forward.md`](open-prs/forward.md) |
|
|
8
8
|
| Update | The PR already exists; the address-reviews orchestrator called this stage to push + refresh title/description/walkthrough. | [`open-prs/update.md`](open-prs/update.md) |
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mbugreport
|
|
3
|
+
description: Explicit short alias for the `muggle-bug-report` skill. ONLY invoke when the user explicitly types `mbugreport` or `/mbugreport` — never auto-trigger from any other phrasing.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# mbugreport — alias for muggle-bug-report
|
|
8
|
+
|
|
9
|
+
Invoke the `muggle-bug-report` skill via the Skill tool. Forward any user-provided arguments unchanged. In a host with no Skill tool (Codex), open `../muggle-bug-report/SKILL.md` and follow it with those arguments.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Codex reads this beside SKILL.md. An alias is for the user to type, never for
|
|
2
|
+
# the model to pick on its own: Codex's equivalent of disable-model-invocation.
|
|
3
|
+
interface:
|
|
4
|
+
display_name: "mbugreport"
|
|
5
|
+
short_description: "Short alias for the muggle-bug-report skill"
|
|
6
|
+
policy:
|
|
7
|
+
allow_implicit_invocation: false
|
|
@@ -49,5 +49,6 @@ If the user intent clearly matches one command, route directly — no menu neede
|
|
|
49
49
|
- post results to PR/attach walkthrough/visual evidence on PR → `muggle-pr-visual-walkthrough`
|
|
50
50
|
- watch my PR for reviews/follow up on PR reviews/babysit PR review thread → `muggle-pr-followup`
|
|
51
51
|
- give feedback on a run/the test was wrong/step N didn't work/show my feedback/delete feedback → `muggle-feedback`
|
|
52
|
+
- report a bug in muggle/muggle itself is broken/my bug reports/status of BUG-NNNN → `muggle-bug-report`
|
|
52
53
|
|
|
53
54
|
If intent is ambiguous, use `AskUserQuestion` with the most likely options rather than asking the user to type a clarification.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: muggle-bug-report
|
|
3
|
+
model: haiku
|
|
4
|
+
description: "Use when the user wants to report a bug in Muggle AI itself (a muggle command or tool erroring, a run hanging, a dashboard or billing problem), or to list, check (BUG-4821) or reply to their bug reports. Not for bugs in the user's own app, nor a generated test script step that misbehaved (muggle-feedback). Triggers on /muggle-bug-report, report a muggle bug."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Muggle Bug Report
|
|
8
|
+
|
|
9
|
+
> Telemetry first step: see [`_shared/telemetry-emit.md`](../_shared/telemetry-emit.md). Use `skillName: "muggle-bug-report"`.
|
|
10
|
+
|
|
11
|
+
> Running outside Claude Code (in Codex, for one)? Read [`../_shared/host-tool-equivalents.md`](../_shared/host-tool-equivalents.md) first — it maps the tools and paths this skill names to your host's.
|
|
12
|
+
|
|
13
|
+
Files a bug about Muggle AI to the Muggle team and follows it: every report gets a short id (`BUG-4821`), a ticket page on the dashboard, and in-app updates as the team works it.
|
|
14
|
+
|
|
15
|
+
## Routing
|
|
16
|
+
|
|
17
|
+
| Intent | Op file |
|
|
18
|
+
|---|---|
|
|
19
|
+
| "report a bug" / "muggle is broken" / "file this" / no arguments | [`ops/file.md`](ops/file.md) |
|
|
20
|
+
| "my bug reports" / "list my tickets" | [`ops/list.md`](ops/list.md) |
|
|
21
|
+
| "status BUG-4821" / "what happened to my report" | [`ops/status.md`](ops/status.md) |
|
|
22
|
+
| "reply to BUG-4821" / "answer their question" | [`ops/reply.md`](ops/reply.md) |
|
|
23
|
+
|
|
24
|
+
If intent is ambiguous, use `AskUserQuestion` once with **File a bug / List my reports / Check one / Reply** — never ask the user to type a clarification.
|
|
25
|
+
|
|
26
|
+
## Constraints (all ops)
|
|
27
|
+
|
|
28
|
+
- **Every tool takes the `bugReportId`, never the short id.** Turn a `BUG-NNNN` the user names into its `bugReportId` with `muggle-remote-bug-report-list`: page with `pageSize: 50`, passing `nextCursor` back as `cursor`, until an item's `shortId` matches. No match on any page → say so and show the list.
|
|
29
|
+
- **Screenshots are paths on this machine**: images only (png, jpg, gif, webp), at most 5, 5 MB each. Pass absolute paths in `screenshotPaths`; the tool reads and uploads them.
|
|
30
|
+
- **Not signed in** (`UNAUTHORIZED`): hand off to the `muggle-login` skill, then resume the op.
|
|
31
|
+
- **`dashboardUrl`** in each response is the ticket's page; print it with the short id.
|
|
32
|
+
|
|
33
|
+
## Non-negotiables (all ops)
|
|
34
|
+
|
|
35
|
+
- Never file or reply without showing the user exactly what will be sent and getting a confirm.
|
|
36
|
+
- Never add context the context tool did not return, and never put a secret, token or password in a title, description, steps or reply. If the user's text contains one, point it out and ask them to remove it before filing.
|
|
37
|
+
- Show only what the response holds; never guess a ticket's status or what the team will do.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# File a bug
|
|
2
|
+
|
|
3
|
+
## 1. Ask what went wrong
|
|
4
|
+
|
|
5
|
+
Take what the user already said from the prompt or arguments; ask only for what is missing.
|
|
6
|
+
|
|
7
|
+
- **Title** — one line. Draft it from their description and let them edit.
|
|
8
|
+
- **What happened** — the description, in their words.
|
|
9
|
+
- **Severity** — `AskUserQuestion`: **Blocker** (can't continue) / **Major** (works around it with effort) / **Minor** (cosmetic or small). Wire values: `blocker`, `major`, `minor`.
|
|
10
|
+
- **Steps / expected / actual** — `AskUserQuestion`: **Add steps, expected and actual** / **Skip**. When added, collect each as free text.
|
|
11
|
+
- **Screenshots** — `AskUserQuestion`: **Attach screenshots** / **No screenshots**. When attaching, collect absolute file paths.
|
|
12
|
+
|
|
13
|
+
## 2. Route a script-step report to feedback
|
|
14
|
+
|
|
15
|
+
If the report is about one generated test script or one of its steps doing the wrong thing (clicked the wrong element, step N failed, wrong text typed), `AskUserQuestion`:
|
|
16
|
+
|
|
17
|
+
> "This sounds like script feedback, which regenerates the script. Which do you want?"
|
|
18
|
+
> - **Script feedback** — invoke the `muggle-feedback` skill via the Skill tool with the user's description as `args`, then stop.
|
|
19
|
+
> - **Bug report anyway**
|
|
20
|
+
|
|
21
|
+
Anything else — a command or tool error, a hang, a crash, a dashboard or billing problem — continues here.
|
|
22
|
+
|
|
23
|
+
## 3. Gather and show context
|
|
24
|
+
|
|
25
|
+
Call `muggle-local-bug-report-context-get` with `cwd` set to the current working directory. It returns the CLI and Studio versions, operating system, last-used project and newest local run, with secret-looking values already left out.
|
|
26
|
+
|
|
27
|
+
Print the report as it will be sent:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Title: <title>
|
|
31
|
+
Severity: <Blocker | Major | Minor>
|
|
32
|
+
What happened:
|
|
33
|
+
<description>
|
|
34
|
+
Steps / expected / actual: <each, or "none">
|
|
35
|
+
Screenshots: <file names, or "none">
|
|
36
|
+
|
|
37
|
+
Included with your report:
|
|
38
|
+
<each context line from the tool, plus any "left out" line>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 4. Confirm
|
|
42
|
+
|
|
43
|
+
`AskUserQuestion`:
|
|
44
|
+
|
|
45
|
+
> "File this bug report?"
|
|
46
|
+
> - **File it**
|
|
47
|
+
> - **Edit** — ask which part, collect the change, then print §3 again
|
|
48
|
+
> - **Cancel** — print "Cancelled — nothing was sent." and stop
|
|
49
|
+
|
|
50
|
+
## 5. File
|
|
51
|
+
|
|
52
|
+
Call `muggle-remote-bug-report-create` with `title`, `description`, `severity`, the optional `stepsToReproduce` / `expectedBehavior` / `actualBehavior`, `screenshotPaths`, and `clientContext` set to the tool's `clientContext` JSON block unchanged.
|
|
53
|
+
|
|
54
|
+
| Error | Response |
|
|
55
|
+
|---|---|
|
|
56
|
+
| A screenshot refused (`INVALID_ARGUMENT`) | Print the message; `AskUserQuestion`: **Fix the path** / **File without it** |
|
|
57
|
+
| `bug_report_rate_limited` (429) | "You have filed 10 reports in the last hour. Try again later." Stop. |
|
|
58
|
+
| `UNAUTHORIZED` | Hand off to `muggle-login`, then retry once |
|
|
59
|
+
| Anything else | Print it verbatim; nothing was filed |
|
|
60
|
+
|
|
61
|
+
## 6. Report
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
Filed <shortId>: <title>
|
|
65
|
+
Track it: <dashboardUrl>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Updates arrive in the dashboard inbox. Check later with "status <shortId>".
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# List bug reports
|
|
2
|
+
|
|
3
|
+
## 1. Fetch
|
|
4
|
+
|
|
5
|
+
`muggle-remote-bug-report-list` with `pageSize: 20`. No items → print "You have not filed any bug reports." and offer `AskUserQuestion`: **File a bug** ([`file.md`](file.md)) / **Done**.
|
|
6
|
+
|
|
7
|
+
## 2. Render
|
|
8
|
+
|
|
9
|
+
Newest activity first, as the response orders it:
|
|
10
|
+
|
|
11
|
+
| Short id | Title | Status | Severity | Last update |
|
|
12
|
+
|---|---|---|---|---|
|
|
13
|
+
|
|
14
|
+
- **Status** — the wire value in words: `new` → New, `triaged` → Triaged, `in_progress` → In progress, `needs_info` → Needs info, `fixed` → Fixed, `closed` → Closed.
|
|
15
|
+
- **Last update** — `lastActivityAtMs`, human-readable (e.g. `2 days ago`).
|
|
16
|
+
- Mark a **Needs info** row "waiting on you".
|
|
17
|
+
|
|
18
|
+
When `nextCursor` is set, add "More reports exist" and offer **Show more** in §3.
|
|
19
|
+
|
|
20
|
+
Print the response's `dashboardUrl` as the link to all reports.
|
|
21
|
+
|
|
22
|
+
## 3. Offer next action
|
|
23
|
+
|
|
24
|
+
`AskUserQuestion`:
|
|
25
|
+
|
|
26
|
+
> "What next?"
|
|
27
|
+
> - **Open one** — pick a row, then [`status.md`](status.md)
|
|
28
|
+
> - **Reply to one** — pick a row, then [`reply.md`](reply.md)
|
|
29
|
+
> - **Show more** — only when `nextCursor` is set; fetch with `cursor: nextCursor` and append
|
|
30
|
+
> - **Done**
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Reply on a bug report
|
|
2
|
+
|
|
3
|
+
## 1. Identify the report
|
|
4
|
+
|
|
5
|
+
As in [`status.md`](status.md) §1. Fetch it with `muggle-remote-bug-report-get` and print its short id, title, status and the newest timeline entry, so the user answers what was asked.
|
|
6
|
+
|
|
7
|
+
## 2. Collect the reply
|
|
8
|
+
|
|
9
|
+
- **Message** — free text; re-ask when blank.
|
|
10
|
+
- **Screenshots** — `AskUserQuestion`: **Attach screenshots** / **No screenshots**. When attaching, collect absolute file paths.
|
|
11
|
+
|
|
12
|
+
## 3. Confirm
|
|
13
|
+
|
|
14
|
+
Print the message and screenshot file names, then `AskUserQuestion`:
|
|
15
|
+
|
|
16
|
+
> "Post this reply on <shortId>?"
|
|
17
|
+
> - **Post it**
|
|
18
|
+
> - **Edit**
|
|
19
|
+
> - **Cancel** — print "Cancelled — nothing was sent." and stop
|
|
20
|
+
|
|
21
|
+
## 4. Post
|
|
22
|
+
|
|
23
|
+
`muggle-remote-bug-report-reply` with `bugReportId`, `message` and `screenshotPaths`.
|
|
24
|
+
|
|
25
|
+
| Error | Response |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `bug_report_reopen_window_elapsed` (409) | "This ticket closed more than 14 days ago and can't be reopened." Offer to file a new report ([`file.md`](file.md)) whose description starts with "Follow-up to <shortId>". |
|
|
28
|
+
| A screenshot refused (`INVALID_ARGUMENT`) | Print the message; `AskUserQuestion`: **Fix the path** / **Post without it** |
|
|
29
|
+
| Anything else | Print it verbatim; nothing was posted |
|
|
30
|
+
|
|
31
|
+
## 5. Report
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Replied on <shortId>.
|
|
35
|
+
Track it: <dashboardUrl>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
A reply on a **Needs info**, **Fixed** or **Closed** ticket sends it back to the team as **Triaged**.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Bug report status
|
|
2
|
+
|
|
3
|
+
## 1. Identify the report
|
|
4
|
+
|
|
5
|
+
- A `BUG-NNNN` or `bugReportId` in the prompt → resolve it per SKILL.md's short-id constraint.
|
|
6
|
+
- A row from a list shown earlier → use its `bugReportId`.
|
|
7
|
+
- Nothing named → run [`list.md`](list.md) and let the user pick.
|
|
8
|
+
|
|
9
|
+
## 2. Fetch
|
|
10
|
+
|
|
11
|
+
`muggle-remote-bug-report-get` with the `bugReportId`.
|
|
12
|
+
|
|
13
|
+
## 3. Render
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
<shortId>: <title>
|
|
17
|
+
Status: <status in words> (<closeReason in words, and duplicateOfShortId, when closed>)
|
|
18
|
+
Severity: <severity> Priority: <priority, or "not set yet">
|
|
19
|
+
Filed: <createdAtMs, human-readable>
|
|
20
|
+
Track it: <dashboardUrl>
|
|
21
|
+
|
|
22
|
+
What you reported:
|
|
23
|
+
<description>
|
|
24
|
+
<steps / expected / actual when present>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then the timeline, oldest first, one entry per activity:
|
|
28
|
+
|
|
29
|
+
- `filed` → "Filed"
|
|
30
|
+
- `status_change` → "<actorDisplayName>: <fromStatus> → <toStatus>" plus the message when present
|
|
31
|
+
- `priority_change` → "<actorDisplayName>: priority <fromPriority> → <toPriority>"
|
|
32
|
+
- `note` → "<actorDisplayName>: <message>"
|
|
33
|
+
- `filer_reply` → "You: <message>"
|
|
34
|
+
|
|
35
|
+
Add "(N screenshots)" to an entry that has them.
|
|
36
|
+
|
|
37
|
+
## 4. Offer next action
|
|
38
|
+
|
|
39
|
+
When the status is **Needs info**, say the team is waiting on the user's answer.
|
|
40
|
+
|
|
41
|
+
`AskUserQuestion`:
|
|
42
|
+
|
|
43
|
+
> "What next?"
|
|
44
|
+
> - **Reply** — [`reply.md`](reply.md) with this `bugReportId`
|
|
45
|
+
> - **Done**
|
|
@@ -45,7 +45,7 @@ The skill recognizes its mode by inspecting `$ARGUMENTS` and falling back to on-
|
|
|
45
45
|
| `reconcile` / `sweep` (optional `<slug>`) | — | **reconcile** → [`reconcile.md`](reconcile.md) |
|
|
46
46
|
| `adopt` (optional `<slug>`) | — | **adopt** → [`adopt.md`](adopt.md) — take over a slot owned by a dead session; no slug lists the adoptable ones |
|
|
47
47
|
|
|
48
|
-
**`--wake=<event>`** is passed only by an event wake's dispatch ([`arm-watcher.md`](arm-watcher.md) step 5),
|
|
48
|
+
**`--wake=<event>`** is passed only by an event wake's dispatch ([`arm-watcher.md`](arm-watcher.md) step 5), by the follow-through Stop gate's instruction (`--wake=follow-through`) when the watch recorded due work nothing attempted or holds a report that never reached the session, or by the pipeline that opened the PR when it hands the PR over (`--wake=stage-handoff`) — each asserts something is waiting, so the tick's poll is justified. A service wake may carry `--also=<slug>:<n>:<kind>,…`: the owner's other slots whose watch reports also wait. After this tick, run `/muggle:muggle-pr-followup <slug> <n> --wake=<kind>` for each listed slot, one at a time, so no owned PR's report is left unread. Manual invocations never pass it; with a live watcher they get watch-status, because a poll that nothing prompted is a main-session poll wasted. Recovery fires need no flag — a recoverable slot's watcher is dead by definition, so the gate falls through to tick. A stale cron firing against a re-armed slot hits the live-`watch.pid` branch and is absorbed as a status line, no provider calls.
|
|
49
49
|
|
|
50
50
|
Auto-track runs **reconcile** first, so a no-arg invocation also finalizes any slot whose PR merged or closed while its watcher was down (expired cron, ended session) and re-arms this session's own open slots whose watcher stopped silently (a dropped respawn). Reconcile recovers a watcher that was already running; it never seeds a first watcher for a PR — that is auto-track's / bootstrap's job — and never re-arms one this session does not own. A no-arg invocation is a request to track *your* PRs, so it can only ever end with the session watching PRs it pushed plus watchers it already had.
|
|
51
51
|
|
|
@@ -16,13 +16,13 @@ The `DRAIN` lines it prints, in the watch's output, are the outstanding work as
|
|
|
16
16
|
|
|
17
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
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
|
-
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)
|
|
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), **`owner.json` records this session**, and the slot has no [`watch-listener`](state-schemas.md#watch-listener) file, a watcher already owns this slot — **skip arming, do not start a second**. A live loop whose `watch-listener` names `muggle-watch` was started by the muggle watch service and reports to the service, not to this session: arm over it. The new loop supersedes it, takes the slot back, and deletes the service's undelivered reports, which this arm's drain covers. 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.
|
|
22
22
|
|
|
23
23
|
This is narrow on purpose. It reclaims only a lease held on behalf of *another* session, which is decidable from `owner.json` alone. A loop orphaned by its **own** session still reads as owned, and nothing on disk distinguishes it — so the signal comes from the reader instead. **When this arm answers the slot's own loop ending — its `EXPIRED` or `ROLLOVER` line, or a monitor's expiry notice — skip this dedup and arm.** Each means the previous loop is gone or no longer heard. The new loop writes its PID to `watch.pid`, and `watcher_superseded` retires any survivor at its next iteration. Treat an armed watcher as evidence a poller exists, never as proof a review will be seen.
|
|
24
24
|
|
|
25
|
-
Otherwise **claim the slot for this session** before starting anything: write `owner.json` ([`state-schemas.md`](state-schemas.md#ownerjson)) with `session_id` from `$CLAUDE_CODE_SESSION_ID` and `claimed_at` now. Arming is what establishes ownership, so every arming point records it here rather than each caller remembering to. If `$CLAUDE_CODE_SESSION_ID` is unset, write no `owner.json` — an unidentifiable owner is worse than none, since [`reconcile.md`](reconcile.md) would read a bogus id as some other session's claim and could never recover the slot.
|
|
25
|
+
Otherwise **claim the slot for this session** before starting anything: write `owner.json` ([`state-schemas.md`](state-schemas.md#ownerjson)) with `session_id` from `$CLAUDE_CODE_SESSION_ID` and `claimed_at` now. `pr-watch-arm.sh --owner <session-id>` claims for that session instead; the muggle watch service passes the id `owner.json` already records, so the loops it restarts stay owned. Arming is what establishes ownership, so every arming point records it here rather than each caller remembering to. If `$CLAUDE_CODE_SESSION_ID` is unset, write no `owner.json` — an unidentifiable owner is worse than none, since [`reconcile.md`](reconcile.md) would read a bogus id as some other session's claim and could never recover the slot.
|
|
26
26
|
|
|
27
27
|
The same claim **registers the slot with the muggle watch service**: `pr-watch-arm.sh` writes [`watch-registration.json`](state-schemas.md#watch-registrationjson) beside `owner.json`. The service is a per-user scheduled job that runs outside every session. When a registered slot's loop is gone, it starts the loop itself as a detached program, so no session spends a turn on it. When that loop reports, the service wakes the owner session with that one PR's tick, and only between turns. It never sends a session a reconcile or anything about another PR. A slot armed any other way is registered with `muggle watch register --slot <slot>`. `muggle watch unregister --slot <slot>` keeps a slot session-scoped. The service still reports on it, but never starts its loop or wakes its owner.
|
|
28
28
|
|
|
@@ -92,6 +92,10 @@ The watcher's dispatch trigger is **derived from current provider state**, not a
|
|
|
92
92
|
|
|
93
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.
|
|
94
94
|
|
|
95
|
+
### Step 3.5 — Forward-stage hold
|
|
96
|
+
|
|
97
|
+
When `last_seen[<pr>].forward_stages_in_flight` is `true` ([`state-schemas.md`](state-schemas.md#last_seenjson)), the pipeline that opened this PR still owns it: it set the flag when it opened the PR and armed this watch, and clears it at its handoff, which then runs this tick with `--wake=stage-handoff`. Dispatch nothing, reviews included: that pipeline is still testing the head a cycle would push over, and it alone decides when the watch may act. Append a `deferred` line to `followup.log` naming what the tick would have dispatched (review ids, conversation comment ids), skip Steps 4–6 and exit as transient idle through Step 7.5, so the loop keeps watching. Nothing is lost: the review and conversation watermarks are not advanced, so the handoff's tick finds the same actionable set. A terminal PR still finalizes in Step 2.
|
|
98
|
+
|
|
95
99
|
### Step 4 — If the actionable set is non-empty → dispatch (reviews preempt CI)
|
|
96
100
|
|
|
97
101
|
The watcher does **not** classify. Classification, batching, replying, escalation, and cycle execution all live in `/muggle-do`. The watcher hands over the dispatch ids from Step 3 (GitHub: owning review ids; GitLab: discussion 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.
|
|
@@ -143,6 +147,7 @@ node "<abs>/scripts/pr-watch-verdict.mjs" tick --pr-key "<owner>/<repo>#<n>" --h
|
|
|
143
147
|
|
|
144
148
|
It prints one line, `VERDICT=<verdict>`. A non-zero exit is a broken install: report it and stop, never improvise a verdict. What it applies, in order:
|
|
145
149
|
|
|
150
|
+
0. `forward_stages_in_flight` is `true` → `hold-forward-stages`, whatever the branch and CI say (Step 3.5).
|
|
146
151
|
1. A rebase is due and `catch_up_rebases >= maxCatchUpRebases` (the cap from the user's preferences; the `rebase_budget_exhausted` flag is not consulted) → `block-rebase-budget-exhausted`.
|
|
147
152
|
2. A rebase is due, `conflict_resolve_attempts[rebase_key] < 2`, and `rebase_key` ∉ `conflict_escalated_keys` → `dispatch-rebase`. With the per-key budget spent — `conflict_resolve_attempts[rebase_key] >= 2` or `rebase_key` ∈ `conflict_escalated_keys` — it falls through to CI.
|
|
148
153
|
3. CI is `red`, `ci_fix_attempts[head_sha] < 3`, and `head_sha` ∉ `ci_escalated_shas` → `dispatch-fix-ci`. Red with `ci_fix_attempts[head_sha] >= 3` or `head_sha` ∈ `ci_escalated_shas` dispatches nothing — the fix budget is spent and the watcher does not re-dispatch; it holds as `block-ci-escalated` (Step 4) even when fix-ci never wrote the escalation, because idling there leaves a red PR with nobody told. A check still pending (`bucket == "pending"`) never dispatches: the tick idles until CI settles, and a green head idles too.
|
|
@@ -176,6 +181,7 @@ Act on the verdict:
|
|
|
176
181
|
4. Append a dispatching line to `followup.log`; emit a `tick` event with `checks_red: <count>`, `dispatched_ci_fix: true`.
|
|
177
182
|
5. Exit. The dev cycle owns the PR; its respawn restarts the watcher, whose next tick re-checks CI on the new head SHA — CI itself is the verify loop.
|
|
178
183
|
- `block-conflict-escalated`, `block-ci-escalated`, `block-reviews-escalated` → blocked pending a human (Step 7).
|
|
184
|
+
- `hold-forward-stages` → transient idle (Step 7), with a `deferred` line in `followup.log` naming the rebase or fix-ci the hold kept back (Step 3.5).
|
|
179
185
|
- `idle` → transient idle (Step 7).
|
|
180
186
|
|
|
181
187
|
### Step 7 — Idle (remind when blocked pending a human)
|
|
@@ -18,7 +18,7 @@ Two invariants hold on every trigger, however the sweep was reached: it never se
|
|
|
18
18
|
|
|
19
19
|
A watcher reports to its session: a loop armed in a session prints into it, so a session that ends or hits its usage limit stops hearing its watches. No poller acts on a PR out of session. This is deliberate: a review is addressed only inside a session that carries the context to address it, never by a headless process that would reply without that context.
|
|
20
20
|
|
|
21
|
-
What does run out of session is the muggle watch service (`muggle watch`, a per-user scheduled job). It addresses nothing on any PR, and it never sends a session this sweep. For a slot registered in [`watch-registration.json`](state-schemas.md#watch-registrationjson) whose loop is gone, it restarts the loop itself as a detached program, which costs no session a turn. When that loop reports, it wakes the **owning** session with that one PR's tick, `/muggle:muggle-pr-followup <slug> <n> --wake=<event
|
|
21
|
+
What does run out of session is the muggle watch service (`muggle watch`, a per-user scheduled job). It addresses nothing on any PR, and it never sends a session this sweep. For a slot registered in [`watch-registration.json`](state-schemas.md#watch-registrationjson) whose loop is gone, it restarts the loop itself as a detached program, which costs no session a turn. When that loop reports, it wakes the **owning** session with that one PR's tick, `/muggle:muggle-pr-followup <slug> <n> --wake=<event>`, naming the owner's other waiting reports in `--also`. It does so only between turns, never while the session works or waits on its user. A report waiting on a busy owner never leaves the PR unwatched: the service queues it and restarts the loop, claimed for the owner `owner.json` records. A plugin reload leaves a session that owns open watches running. A slot whose PR went terminal while neither its loop nor its owner is running it finalizes itself, as Step 3 would, leaving the post-merge cleanup unrun. Everything else it finds (red CI, a stale branch, a report its owner cannot take yet) it only reports.
|
|
22
22
|
|
|
23
23
|
**Ownership is session-scoped too, and that is what bounds recovery.** Each slot records the session that armed it in [`owner.json`](state-schemas.md#ownerjson). Step 3.6 re-arms only slots the running session owns — watchers it armed itself, whose poller died under it. A slot owned by another session, or by none, is **never** re-armed here however dead its poller looks. The same argument that forbids a headless daemon forbids a fresh session inheriting a stranger's PR: it would be picking up review work it has no context for, on a branch it never built, and every push it made would be as context-blind as the daemon the design already rejected. Adoption exists precisely so that step is a deliberate act by the owner ([`adopt.md`](adopt.md)) rather than a side effect of starting a session.
|
|
24
24
|
|
|
@@ -59,9 +59,9 @@ The slot's opt-in to recovery by the muggle watch service (`muggle watch`, a per
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
Recovery requires all of: the slot is registered, the PR is open on GitHub, no loop is heard (no loop process carries the slot's `--slot` path, or the one that does prints into a session that has ended), the heartbeat is older than the re-arm hand-off, `polling.disabled` is absent, `owner.json` names an owner, and that owner is not mid-turn. The service then runs `pr-watch-arm.sh` itself, detached, with `MUGGLE_PR_WATCH_LISTENER=muggle-watch
|
|
62
|
+
Recovery requires all of: the slot is registered, the PR is open on GitHub, no loop is heard (no loop process carries the slot's `--slot` path, or the one that does prints into a session that has ended), the heartbeat is older than the re-arm hand-off, `polling.disabled` is absent, `owner.json` names an owner, and that owner is not mid-turn. A report the owner has not been woken for never holds the PR unwatched: the service sets it aside in [`watch-service.queued.out`](#watch-servicequeuedout) and starts the fresh loop, mid-turn owner or not. The service then runs `pr-watch-arm.sh` itself, detached, with `MUGGLE_PR_WATCH_LISTENER=muggle-watch` and `--owner <session_id>` from `owner.json`, so the arm claims the slot for its recorded owner rather than leaving it unowned. The loop records [`watch-listener`](#watch-listener) and writes its output to [`watch-service.out`](#watch-serviceout), and no session spends a turn on it.
|
|
63
63
|
|
|
64
|
-
When that loop exits on an `EVENT` or `TERMINAL` line, the service wakes the owner with `/muggle:muggle-pr-followup <slug> <n> --wake=<event|terminal>`, naming that slot and PR
|
|
64
|
+
When that loop exits on an `EVENT` or `TERMINAL` line, or a queued report waits, the service wakes the owner with `/muggle:muggle-pr-followup <slug> <n> --wake=<event|terminal>`, naming that slot and PR. Every other slot of the same owner with a report waiting rides along as `--also=<slug>:<n>:<kind>,…`, so one wake tells the session about all of them. It resumes the owner in the background from the project dir its transcript records. A running owner is woken only as a background session idle between turns: it is stopped first, and only after a throwaway background launch confirms Claude will resume it in that workspace. The resume runs only once neither `claude agents` nor Claude's own session registry shows a process for the owner. If Claude still answers with a copy under a new id, the service stops and removes that copy and counts the wake as failed, so the agent view never gains a duplicate. An owner that is mid-turn, waiting on its user, or open in a terminal keeps the report, the service alerts once the report is overdue, and the follow-through Stop gate names the report's tick at the owner's next turn end. The service never wakes the ended owner of a merged or closed PR; it closes that slot out instead. An `EXPIRED` loop is restarted without waking anyone. The service caps loop starts and wakes per pass, caps failed wakes per owner, and holds every wake while the account sits at a usage limit.
|
|
65
65
|
|
|
66
66
|
**Absent ⇒ observed only.** The service still reports on the slot's watcher, CI and branch standing, but never starts its loop or wakes its owner. Slots armed before this file existed stay that way until their next arm. The file lives in the slot, so a `.stopped` rename or a `result.md` retires it with the slot.
|
|
67
67
|
|
|
@@ -73,6 +73,10 @@ Who hears the leased loop's exit. A loop started with `MUGGLE_PR_WATCH_LISTENER`
|
|
|
73
73
|
|
|
74
74
|
The output of the last loop the muggle watch service started for the slot. Its `EVENT`, `TERMINAL`, `EXPIRED`, `WATCH-FAIL` or `ARM-FAIL` line says why the loop ended. Once the owner is woken for an `EVENT` or `TERMINAL` report, the file is renamed `watch-service.delivered.out`, so no later pass wakes the owner for it again. A loop a session arms deletes the file, because that arm's drain covers whatever it held.
|
|
75
75
|
|
|
76
|
+
## `watch-service.queued.out`
|
|
77
|
+
|
|
78
|
+
Service loop reports the owner has not been woken for, set aside when the service starts a fresh loop over them, so the PR stays watched while the report waits. Each report is appended; the file's time is when the first one was reported. The owner's wake renames it, with any `watch-service.out` report, into `watch-service.delivered.out`, and a loop a session arms deletes it, as it does `watch-service.out`. While it is non-empty in a slot this session owns, the follow-through Stop gate blocks the turn end naming `/muggle:muggle-pr-followup <slug> <n> --wake=follow-through`.
|
|
79
|
+
|
|
76
80
|
## `cron.json`
|
|
77
81
|
|
|
78
82
|
A durable, on-disk handle to this slot's watcher cron. Its whole reason to exist: `CronList` goes **blind to crons that outlive a session continue / compaction** (the watcher's `/loop` cron survives, but the tool can no longer enumerate it), so a teardown that can only find crons through `CronList` can never delete the orphan — it re-fires until the 7-day `/loop` expiry. A cron id recorded to disk **while the cron was still visible** stays a valid `CronDelete` target afterward. See [`record-cron-id.md`](record-cron-id.md) (who writes it) and [`cancel-cron.md`](cancel-cron.md) (who deletes by it).
|
|
@@ -112,6 +116,7 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
112
116
|
"conflict_escalated_keys": ["<head-sha>..<base-tip-sha>", ...],
|
|
113
117
|
"catch_up_rebases": <int>,
|
|
114
118
|
"rebase_budget_exhausted": <bool>,
|
|
119
|
+
"forward_stages_in_flight": <bool>,
|
|
115
120
|
"e2e_decision": {
|
|
116
121
|
"head_sha": "<sha>",
|
|
117
122
|
"cases": [{ "name": "<test case>", "testCaseId": "<id>", "bucket": "<bucket>", "failedStep": <int>, "waived": <bool> }]
|
|
@@ -132,6 +137,7 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
132
137
|
|
|
133
138
|
- `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.
|
|
134
139
|
- `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.
|
|
140
|
+
- `forward_stages_in_flight`: `true` while the pipeline that opened the PR still owns it. That pipeline opens the PR, seeds the slot with the flag set and arms the watch in one step, so the PR is watched and registered with the muggle watch service from the moment it exists. While it is set the tick dispatches nothing ([`contract.md`](contract.md) Step 3.5), the verdict script answers `hold-forward-stages`, and the follow-through Stop gate owes nothing for the PR. The pipeline removes the key at its handoff and runs the tick with `--wake=stage-handoff`, which dispatches whatever the hold kept back. Absent means `false`.
|
|
135
141
|
- `last_pushed_sha`: most recent SHA `/muggle-do` pushed in this PR's life; `null` until the first push.
|
|
136
142
|
- `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.
|
|
137
143
|
- `cycles_completed`: incremented each time `/muggle-do` completes an address-reviews invocation (regardless of actionable/ambiguous/mixed).
|