@muggleai/works 5.26.0-staging.207 → 5.26.0-staging.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-mcp.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/.mcp.json +1 -1
- package/dist/plugin/hooks/README.md +2 -1
- package/dist/plugin/hooks/codex-hooks.json +2 -2
- package/dist/plugin/hooks/hooks.json +1 -1
- package/dist/plugin/scripts/guardrail-watch-follow-through-gate.sh +48 -0
- package/dist/plugin/scripts/guardrails.mjs +282 -32
- package/dist/plugin/scripts/pr-watch-arm.sh +64 -37
- package/dist/plugin/scripts/pr-watch-due.sh +31 -0
- package/dist/plugin/scripts/pr-watch-events.sh +20 -6
- package/dist/plugin/scripts/pr-watch-loop.sh +21 -2
- package/dist/plugin/scripts/pr-watch-verdict.mjs +197 -0
- package/dist/plugin/skills/_shared/ci-check-to-command.md +2 -1
- package/dist/plugin/skills/do/fix-ci.md +24 -8
- package/dist/plugin/skills/do/resolve-conflicts.md +7 -3
- package/dist/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
- package/dist/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -3
- package/dist/plugin/skills/muggle-pr-followup/blocked-tick.md +2 -0
- package/dist/plugin/skills/muggle-pr-followup/contract.md +40 -25
- package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +22 -8
- package/dist/release-manifest.json +3 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-mcp.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/hooks/README.md +2 -1
- package/plugin/hooks/codex-hooks.json +2 -2
- package/plugin/hooks/hooks.json +1 -1
- package/plugin/scripts/guardrail-watch-follow-through-gate.sh +48 -0
- package/plugin/scripts/guardrails.mjs +282 -32
- package/plugin/scripts/pr-watch-arm.sh +64 -37
- package/plugin/scripts/pr-watch-due.sh +31 -0
- package/plugin/scripts/pr-watch-events.sh +20 -6
- package/plugin/scripts/pr-watch-loop.sh +21 -2
- package/plugin/scripts/pr-watch-verdict.mjs +197 -0
- package/plugin/skills/_shared/ci-check-to-command.md +2 -1
- package/plugin/skills/do/fix-ci.md +24 -8
- package/plugin/skills/do/resolve-conflicts.md +7 -3
- package/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
- package/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -3
- package/plugin/skills/muggle-pr-followup/blocked-tick.md +2 -0
- package/plugin/skills/muggle-pr-followup/contract.md +40 -25
- package/plugin/skills/muggle-pr-followup/state-schemas.md +22 -8
- /package/dist/{chunk-HGN35NEP.js → chunk-HOKMW4AL.js} +0 -0
|
@@ -95,6 +95,7 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
95
95
|
"pushed_shas": ["<sha>", ...],
|
|
96
96
|
"ci_fix_attempts": { "<sha>": <int> },
|
|
97
97
|
"ci_escalated_shas": ["<sha>", ...],
|
|
98
|
+
"ci_rerun_shas": ["<sha>", ...],
|
|
98
99
|
"conflict_resolve_attempts": { "<head-sha>..<base-tip-sha>": <int> },
|
|
99
100
|
"conflict_escalated_keys": ["<head-sha>..<base-tip-sha>", ...],
|
|
100
101
|
"catch_up_rebases": <int>,
|
|
@@ -118,12 +119,15 @@ Keyed by `"<owner>/<repo>#<n>"`. One key per PR in the slot.
|
|
|
118
119
|
- `cycles_completed`: incremented each time `/muggle-do` completes an address-reviews invocation (regardless of actionable/ambiguous/mixed).
|
|
119
120
|
- `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.
|
|
120
121
|
- `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.
|
|
121
|
-
- `ci_fix_attempts`: per-SHA count of fix-ci cycles `/muggle-do` has run. The watcher stops dispatching fix-ci for a SHA once its count reaches 3. Keyed by head SHA.
|
|
122
|
-
- `ci_escalated_shas`: head SHAs whose CI the fix-ci stage gave up on (attempts exhausted
|
|
123
|
-
- `
|
|
124
|
-
- `
|
|
122
|
+
- `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.
|
|
123
|
+
- `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.
|
|
124
|
+
- `ci_rerun_shas`: heads on which fix-ci already re-ran its non-deterministic checks once. A noisy check red again on a listed head escalates instead of re-running a second time.
|
|
125
|
+
- `conflict_resolve_attempts`: count of rebase cycles `/muggle-do` has run (behind-only or conflicting — both rebase onto the base), incremented when a cycle starts. The watcher stops dispatching once a key's count reaches 2. Keyed by `rebase_key` — `"<head_sha>..<base_tip_sha>"`, the head paired with the base branch tip it was measured against. A count of 1 or more is the only evidence that floors a stale branch at arm time or releases the turn-end gate.
|
|
126
|
+
- `conflict_escalated_keys`: `rebase_key`s whose rebase `/muggle-do` gave up on (attempts exhausted, or a conflict under `autoResolveConflicts=never`). Suppresses rebase dispatch **only while `conflict_resolve_attempts[key] >= 1`**; an entry with no attempt behind it is ignored and the rebase dispatches anyway.
|
|
125
127
|
- `catch_up_rebases`: how many rebases this PR has been dispatched for across its whole life. A plain counter, deliberately unkeyed: the two fields above key on `rebase_key`, which changes on every base advance and so hands an active base an unlimited supply of fresh budgets. Nothing resets this one, which makes it the only cap that binds. Capped by [`../muggle-preferences/preference-gates/maxCatchUpRebases.md`](../muggle-preferences/preference-gates/maxCatchUpRebases.md) — 20 by default, `never` for unbounded. Incremented by the rebase cycle on every push, whatever the outcome.
|
|
126
|
-
- `rebase_budget_exhausted`: set once `catch_up_rebases` reaches the cap
|
|
128
|
+
- `rebase_budget_exhausted`: set by the tick once `catch_up_rebases` reaches the cap, recording why the watch blocks with reason `rebase_budget_exhausted`. The verdict judges exhaustion from the counter and the cap, never from this flag, so raising the preference resumes rebases at once.
|
|
129
|
+
|
|
130
|
+
The escalation sets and attempt counters are written by the `/muggle-do` cycles that ran, and only by them. The dispatch decision that reads them lives in [`../../scripts/pr-watch-verdict.mjs`](../../scripts/pr-watch-verdict.mjs) ([`contract.md`](contract.md) Step 6), not in prose.
|
|
127
131
|
|
|
128
132
|
Both are keyed on the pair, not the head alone, because whether a branch conflicts depends on both sides. Under a head-only key, a base that moves produces a genuinely new conflict against an unchanged head — and the stale entry suppresses it permanently, because nothing can change the head while the branch sits blocked. Pairing re-arms the budget whenever either side moves. Legacy entries written before this change are bare SHAs with no `..`; readers ignore them, which un-wedges any slot they had blocked.
|
|
129
133
|
|
|
@@ -213,14 +217,24 @@ The watch loop's comparison floor — plain `KEY=VALUE` lines, one file per slot
|
|
|
213
217
|
- `REV` — highest submitted-review id already handled
|
|
214
218
|
- `COM` — highest thread-comment id already handled
|
|
215
219
|
- `THREADS` — semicolon-joined ids of threads already known unresolved
|
|
216
|
-
- `CIRED` — head SHA whose settled-red CI
|
|
217
|
-
- `REBASED` — the `rebase_key` (`<head_sha>..<base_tip_sha>`) whose behind/conflicting state
|
|
220
|
+
- `CIRED` — head SHA whose settled-red CI a fix-ci cycle already attempted (`ci_fix_attempts[sha] >= 1`); empty when the checks are green, still pending, unseen, or red with no attempt — the last so the loop reports it. The CI floor is a SHA rather than a monotonic id because the check rollup flips green↔red and resets on each push — keying on the head SHA fires the loop once per red head and re-arms on the next push ([`arm-watcher.md`](arm-watcher.md)).
|
|
221
|
+
- `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 monitor only signals a due rebase, the tick's verdict applies the budgets.
|
|
218
222
|
- `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.
|
|
219
223
|
|
|
220
|
-
Written whole-file by the orchestrating session — the review/comment/CI/rebase floors seeded at arm time (`REV`/`COM` to the **drain's own observed max**, `CIRED`/`REBASED` to
|
|
224
|
+
Written whole-file by the orchestrating session — the review/comment/CI/rebase floors seeded at arm time (`REV`/`COM` to the **drain's own observed max**, `CIRED`/`REBASED` to the red head and stale key a cycle already attempted) and advanced after every cycle to the **handled wave's snapshot** (the max review-id and 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 rollover or respawn 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.
|
|
221
225
|
|
|
222
226
|
**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.
|
|
223
227
|
|
|
228
|
+
## `watch-due.env`
|
|
229
|
+
|
|
230
|
+
The work the watch last saw due on its PR, for the owning session's turn-end gate — plain `KEY="value"` lines, one file per slot:
|
|
231
|
+
|
|
232
|
+
- `HEAD` — the head SHA the observation was made on.
|
|
233
|
+
- `REBASE_DUE` — the `rebase_key` found behind or conflicting with the base; empty when the branch is current.
|
|
234
|
+
- `CI_RED_HEAD` — the head whose checks settled red; empty when CI is green or still pending.
|
|
235
|
+
|
|
236
|
+
The file is **empty** when nothing is due. Written by [`../../scripts/pr-watch-arm.sh`](../../scripts/pr-watch-arm.sh) from the drain's read and rewritten by the loop whenever what is due changes; the session never writes it. The follow-through Stop gate ([`../../hooks/README.md`](../../hooks/README.md)) blocks the turn end while a non-empty record in a slot this session owns names work with no matching attempt in `last_seen.json`: a `REBASE_DUE` key with no `conflict_resolve_attempts` entry (under `autoRebase=always`, budget left), or a `CI_RED_HEAD` with no `ci_fix_attempts` entry. A later tick's `prs.json` naming another head supersedes the record.
|
|
237
|
+
|
|
224
238
|
## `watch.pid`
|
|
225
239
|
|
|
226
240
|
A single line: the process id of the watch loop that currently owns this slot. Written once by the loop itself on start (`echo "$$" > watch.pid`); read by two parties, never rewritten in place:
|
|
File without changes
|