@muggleai/works 5.27.0-staging.228 → 5.27.0-staging.230
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/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 +16 -2
- package/dist/plugin/scripts/pr-watch-loop.sh +6 -1
- package/dist/plugin/scripts/pr-watch-verdict.mjs +4 -2
- package/dist/plugin/skills/muggle-pr-followup/arm-watcher.md +2 -2
- package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +2 -1
- 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/scripts/pr-watch-arm.sh +16 -2
- package/plugin/scripts/pr-watch-loop.sh +6 -1
- package/plugin/scripts/pr-watch-verdict.mjs +4 -2
- package/plugin/skills/muggle-pr-followup/arm-watcher.md +2 -2
- package/plugin/skills/muggle-pr-followup/state-schemas.md +2 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"name": "muggleai",
|
|
10
10
|
"source": "./plugin",
|
|
11
11
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
12
|
-
"version": "5.27.0-staging.
|
|
12
|
+
"version": "5.27.0-staging.230"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
4
|
-
"version": "5.27.0-staging.
|
|
4
|
+
"version": "5.27.0-staging.230",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
|
-
"version": "5.27.0-staging.
|
|
3
|
+
"version": "5.27.0-staging.230",
|
|
4
4
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
5
|
-
"version": "5.27.0-staging.
|
|
5
|
+
"version": "5.27.0-staging.230",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/dist/plugin/.mcp.json
CHANGED
|
@@ -106,12 +106,14 @@ last_seen_file="${slot}/last_seen.json"
|
|
|
106
106
|
rebase_attempted=0
|
|
107
107
|
ci_attempted=0
|
|
108
108
|
blocked_digest_floor=""
|
|
109
|
+
rebase_budget_exhausted=0
|
|
109
110
|
while IFS= read -r evidence_line; do
|
|
110
111
|
evidence_line="${evidence_line%$'\r'}"
|
|
111
112
|
case "$evidence_line" in
|
|
112
113
|
REBASE_ATTEMPTED=*) rebase_attempted="${evidence_line#REBASE_ATTEMPTED=}" ;;
|
|
113
114
|
CI_ATTEMPTED=*) ci_attempted="${evidence_line#CI_ATTEMPTED=}" ;;
|
|
114
115
|
BLOCKED_CIDIGEST=*) blocked_digest_floor="${evidence_line#BLOCKED_CIDIGEST=}" ;;
|
|
116
|
+
REBASE_BUDGET_EXHAUSTED=*) rebase_budget_exhausted="${evidence_line#REBASE_BUDGET_EXHAUSTED=}" ;;
|
|
115
117
|
esac
|
|
116
118
|
done < <(node "${script_dir}/pr-watch-verdict.mjs" arm-floors --pr-key "${repo}#${pr_number}" \
|
|
117
119
|
--head "$head_sha" --rebase-key "$rebase_key" < "$last_seen_file" 2>/dev/null)
|
|
@@ -121,6 +123,15 @@ ci_red_floor=""
|
|
|
121
123
|
rebase_floor=""
|
|
122
124
|
[ -n "$rebase_due_key" ] && [ "$rebase_attempted" = "1" ] && rebase_floor="$rebase_due_key"
|
|
123
125
|
|
|
126
|
+
# A PR that spent its catch-up rebase budget is held for its owner whether or not
|
|
127
|
+
# the branch is stale yet: the tick refuses every rebase until maxCatchUpRebases
|
|
128
|
+
# is raised, so announcing one — here or on the loop's next base move — only asks
|
|
129
|
+
# the session for work the verdict turns down. The next arm reads a raised cap.
|
|
130
|
+
rebase_held=""
|
|
131
|
+
[ "$rebase_budget_exhausted" = "1" ] && rebase_held="1"
|
|
132
|
+
recorded_rebase_due_key="$rebase_due_key"
|
|
133
|
+
[ -n "$rebase_held" ] && recorded_rebase_due_key=""
|
|
134
|
+
|
|
124
135
|
thread_count=0
|
|
125
136
|
[ -n "$unresolved_threads" ] && thread_count=$(printf '%s' "$unresolved_threads" | tr ';' '\n' | grep -c .)
|
|
126
137
|
|
|
@@ -138,7 +149,9 @@ if [ -n "$ci_red_head" ]; then
|
|
|
138
149
|
fi
|
|
139
150
|
fi
|
|
140
151
|
if [ -n "$rebase_due_key" ]; then
|
|
141
|
-
if [ -n "$
|
|
152
|
+
if [ -n "$rebase_held" ]; then
|
|
153
|
+
echo "DRAIN branch stale at arm time — catch-up rebase budget spent (maxCatchUpRebases), held for the owner: no rebase to dispatch"
|
|
154
|
+
elif [ -n "$rebase_floor" ]; then
|
|
142
155
|
echo "DRAIN branch stale at arm time — a rebase already ran for key ${rebase_due_key}, floored"
|
|
143
156
|
else
|
|
144
157
|
echo "DRAIN branch stale at arm time — no rebase attempt recorded for key ${rebase_due_key}, not floored: dispatch rebase"
|
|
@@ -152,9 +165,10 @@ fi
|
|
|
152
165
|
printf 'CIRED="%s"\n' "$ci_red_floor"
|
|
153
166
|
printf 'REBASED="%s"\n' "$rebase_floor"
|
|
154
167
|
printf 'BLOCKED_CIDIGEST="%s"\n' "$blocked_digest_floor"
|
|
168
|
+
printf 'REBASE_HELD="%s"\n' "$rebase_held"
|
|
155
169
|
} > "${slot}/watch-watermark.env"
|
|
156
170
|
|
|
157
|
-
watch_record_due_work "$slot" "$head_sha" "$
|
|
171
|
+
watch_record_due_work "$slot" "$head_sha" "$recorded_rebase_due_key" "$ci_red_head"
|
|
158
172
|
|
|
159
173
|
# Claim the slot for this session. watcher_lease_is_foreign reads an absent
|
|
160
174
|
# owner.json as "not foreign", so a slot armed without one leases itself to a
|
|
@@ -137,6 +137,7 @@ while :; do
|
|
|
137
137
|
watermark_ci_red=$(read_watermark_value CIRED)
|
|
138
138
|
watermark_rebase=$(read_watermark_value REBASED)
|
|
139
139
|
watermark_blocked_digest=$(read_watermark_value BLOCKED_CIDIGEST)
|
|
140
|
+
watermark_rebase_held=$(read_watermark_value REBASE_HELD)
|
|
140
141
|
|
|
141
142
|
state_line=$(watch_fetch_state "$repo" "$pr_number" "$slot" "$state_projection")
|
|
142
143
|
# One quick retry before counting a strike: a single flaky call should not
|
|
@@ -207,7 +208,11 @@ while :; do
|
|
|
207
208
|
fi
|
|
208
209
|
|
|
209
210
|
rebase_key="${head_sha}..${base_tip_sha}"
|
|
210
|
-
if [ "$
|
|
211
|
+
if [ "$watermark_rebase_held" = "1" ]; then
|
|
212
|
+
# The PR spent its catch-up rebase budget: however far the base moves, the
|
|
213
|
+
# tick refuses the rebase a wake would ask for, so nothing is due either.
|
|
214
|
+
due_rebase_key=""
|
|
215
|
+
elif [ "$rebase_key" = "$watermark_rebase" ] || [ "$rebase_key" = "$floor_rebase" ]; then
|
|
211
216
|
# Only a key already found due is ever floored, and the pair's standing
|
|
212
217
|
# cannot change until the head or the base moves, which mints a new key.
|
|
213
218
|
due_rebase_key="$rebase_key"
|
|
@@ -54,11 +54,12 @@ function isRebaseBudgetExhausted(lastSeenEntry, maxCatchUpRebases) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// src/pr-watch/armFloors.ts
|
|
57
|
-
function resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey) {
|
|
57
|
+
function resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey, maxCatchUpRebases) {
|
|
58
58
|
const blockedCiDigest = lastSeenEntry.blocked?.fingerprint?.ci_digest;
|
|
59
59
|
return {
|
|
60
60
|
isRebaseKeyAttempted: rebaseKey !== "" && isRebaseKeyAttempted(lastSeenEntry, rebaseKey),
|
|
61
61
|
isCiHeadAttempted: headSha !== "" && isCiHeadAttempted(lastSeenEntry, headSha),
|
|
62
|
+
isRebaseBudgetExhausted: isRebaseBudgetExhausted(lastSeenEntry, maxCatchUpRebases),
|
|
62
63
|
blockedCiDigest: typeof blockedCiDigest === "string" && !LINE_BREAK.test(blockedCiDigest) ? blockedCiDigest : ""
|
|
63
64
|
};
|
|
64
65
|
}
|
|
@@ -137,11 +138,12 @@ function runPrWatchVerdictCommand(commandLine, lastSeenJson, resolvePreferences)
|
|
|
137
138
|
const headSha = flags[HEAD_FLAG] ?? "";
|
|
138
139
|
const rebaseKey = flags[REBASE_KEY_FLAG] ?? "";
|
|
139
140
|
if (subcommand === "arm-floors" /* ArmFloors */) {
|
|
140
|
-
const evidence = resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey);
|
|
141
|
+
const evidence = resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey, resolvePreferences().maxCatchUpRebases);
|
|
141
142
|
return {
|
|
142
143
|
stdout: `REBASE_ATTEMPTED=${evidence.isRebaseKeyAttempted ? 1 : 0}
|
|
143
144
|
CI_ATTEMPTED=${evidence.isCiHeadAttempted ? 1 : 0}
|
|
144
145
|
BLOCKED_CIDIGEST=${evidence.blockedCiDigest}
|
|
146
|
+
REBASE_BUDGET_EXHAUSTED=${evidence.isRebaseBudgetExhausted ? 1 : 0}
|
|
145
147
|
`,
|
|
146
148
|
stderr: "",
|
|
147
149
|
exitCode: 0
|
|
@@ -10,10 +10,10 @@ bash "<abs>/scripts/pr-watch-arm.sh" --slot "<slot>" --repo "<owner>/<repo>" --p
|
|
|
10
10
|
|
|
11
11
|
The same argument that forbids authoring a per-slot `watch.sh` applies to arming itself. Performed from prose, the middle step — writing `watch-watermark.env` — is the one that gets dropped, and dropping it is silent: the loop gates every wake condition on that file, so it polls nothing, reports nothing and never reaches its terminal check, while still holding its PID lease and touching its heartbeat. Eleven such watchers once ran for hours across one session, missed nine merges and a red CI run between them, and every health signal said they were fine. Running one command cannot half-happen.
|
|
12
12
|
|
|
13
|
-
Read the `DRAIN` lines it prints: they are the outstanding work as of the arm. Review ids and threads the drain read are floored, so the monitor 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. 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.
|
|
13
|
+
Read the `DRAIN` lines it prints: they are the outstanding work as of the arm. Review ids and threads the drain read are floored, so the monitor 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.
|
|
14
14
|
|
|
15
15
|
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.
|
|
16
|
-
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-id 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 monitor's first iteration surfaces it. Seed the CI floor (`CIRED`) from the same drain read: set it to the head SHA 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** `last_seen.json` records a fix-ci attempt for that head — a cycle already ran for that red, so its escalation or retry is not news — and empty otherwise. 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. The script reads all
|
|
16
|
+
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-id 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 monitor's first iteration surfaces it. Seed the CI floor (`CIRED`) from the same drain read: set it to the head SHA 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** `last_seen.json` records a fix-ci attempt for that head — a cycle already ran for that red, so its escalation or retry is not news — and empty otherwise. 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)).
|
|
17
17
|
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 monitor 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.
|
|
18
18
|
|
|
19
19
|
**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 monitor 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.
|
|
@@ -220,8 +220,9 @@ The watch loop's comparison floor — plain `KEY=VALUE` lines, one file per slot
|
|
|
220
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
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.
|
|
222
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.
|
|
223
|
+
- `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 rollover or respawn.
|
|
223
224
|
|
|
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.
|
|
225
|
+
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, `REBASE_HELD` from the rebase budget) 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.
|
|
225
226
|
|
|
226
227
|
**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.
|
|
227
228
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"release": "5.26.0",
|
|
3
|
-
"buildId": "run-
|
|
4
|
-
"commitSha": "
|
|
5
|
-
"buildTime": "2026-10-
|
|
3
|
+
"buildId": "run-230-1",
|
|
4
|
+
"commitSha": "54c8bb1e0fefcdcf964b24052e8de997645d4097",
|
|
5
|
+
"buildTime": "2026-10-27T05:46:20Z",
|
|
6
6
|
"serviceName": "muggle-ai-works-mcp"
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muggleai/works",
|
|
3
3
|
"mcpName": "io.github.multiplex-ai/muggle",
|
|
4
|
-
"version": "5.27.0-staging.
|
|
4
|
+
"version": "5.27.0-staging.230",
|
|
5
5
|
"description": "13 years of Microsoft hyperscale engineering, packaged as a harness for your AI coding agent.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
4
|
-
"version": "5.27.0-staging.
|
|
4
|
+
"version": "5.27.0-staging.230",
|
|
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.27.0-staging.
|
|
3
|
+
"version": "5.27.0-staging.230",
|
|
4
4
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
|
|
5
|
-
"version": "5.27.0-staging.
|
|
5
|
+
"version": "5.27.0-staging.230",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/plugin/.mcp.json
CHANGED
|
@@ -106,12 +106,14 @@ last_seen_file="${slot}/last_seen.json"
|
|
|
106
106
|
rebase_attempted=0
|
|
107
107
|
ci_attempted=0
|
|
108
108
|
blocked_digest_floor=""
|
|
109
|
+
rebase_budget_exhausted=0
|
|
109
110
|
while IFS= read -r evidence_line; do
|
|
110
111
|
evidence_line="${evidence_line%$'\r'}"
|
|
111
112
|
case "$evidence_line" in
|
|
112
113
|
REBASE_ATTEMPTED=*) rebase_attempted="${evidence_line#REBASE_ATTEMPTED=}" ;;
|
|
113
114
|
CI_ATTEMPTED=*) ci_attempted="${evidence_line#CI_ATTEMPTED=}" ;;
|
|
114
115
|
BLOCKED_CIDIGEST=*) blocked_digest_floor="${evidence_line#BLOCKED_CIDIGEST=}" ;;
|
|
116
|
+
REBASE_BUDGET_EXHAUSTED=*) rebase_budget_exhausted="${evidence_line#REBASE_BUDGET_EXHAUSTED=}" ;;
|
|
115
117
|
esac
|
|
116
118
|
done < <(node "${script_dir}/pr-watch-verdict.mjs" arm-floors --pr-key "${repo}#${pr_number}" \
|
|
117
119
|
--head "$head_sha" --rebase-key "$rebase_key" < "$last_seen_file" 2>/dev/null)
|
|
@@ -121,6 +123,15 @@ ci_red_floor=""
|
|
|
121
123
|
rebase_floor=""
|
|
122
124
|
[ -n "$rebase_due_key" ] && [ "$rebase_attempted" = "1" ] && rebase_floor="$rebase_due_key"
|
|
123
125
|
|
|
126
|
+
# A PR that spent its catch-up rebase budget is held for its owner whether or not
|
|
127
|
+
# the branch is stale yet: the tick refuses every rebase until maxCatchUpRebases
|
|
128
|
+
# is raised, so announcing one — here or on the loop's next base move — only asks
|
|
129
|
+
# the session for work the verdict turns down. The next arm reads a raised cap.
|
|
130
|
+
rebase_held=""
|
|
131
|
+
[ "$rebase_budget_exhausted" = "1" ] && rebase_held="1"
|
|
132
|
+
recorded_rebase_due_key="$rebase_due_key"
|
|
133
|
+
[ -n "$rebase_held" ] && recorded_rebase_due_key=""
|
|
134
|
+
|
|
124
135
|
thread_count=0
|
|
125
136
|
[ -n "$unresolved_threads" ] && thread_count=$(printf '%s' "$unresolved_threads" | tr ';' '\n' | grep -c .)
|
|
126
137
|
|
|
@@ -138,7 +149,9 @@ if [ -n "$ci_red_head" ]; then
|
|
|
138
149
|
fi
|
|
139
150
|
fi
|
|
140
151
|
if [ -n "$rebase_due_key" ]; then
|
|
141
|
-
if [ -n "$
|
|
152
|
+
if [ -n "$rebase_held" ]; then
|
|
153
|
+
echo "DRAIN branch stale at arm time — catch-up rebase budget spent (maxCatchUpRebases), held for the owner: no rebase to dispatch"
|
|
154
|
+
elif [ -n "$rebase_floor" ]; then
|
|
142
155
|
echo "DRAIN branch stale at arm time — a rebase already ran for key ${rebase_due_key}, floored"
|
|
143
156
|
else
|
|
144
157
|
echo "DRAIN branch stale at arm time — no rebase attempt recorded for key ${rebase_due_key}, not floored: dispatch rebase"
|
|
@@ -152,9 +165,10 @@ fi
|
|
|
152
165
|
printf 'CIRED="%s"\n' "$ci_red_floor"
|
|
153
166
|
printf 'REBASED="%s"\n' "$rebase_floor"
|
|
154
167
|
printf 'BLOCKED_CIDIGEST="%s"\n' "$blocked_digest_floor"
|
|
168
|
+
printf 'REBASE_HELD="%s"\n' "$rebase_held"
|
|
155
169
|
} > "${slot}/watch-watermark.env"
|
|
156
170
|
|
|
157
|
-
watch_record_due_work "$slot" "$head_sha" "$
|
|
171
|
+
watch_record_due_work "$slot" "$head_sha" "$recorded_rebase_due_key" "$ci_red_head"
|
|
158
172
|
|
|
159
173
|
# Claim the slot for this session. watcher_lease_is_foreign reads an absent
|
|
160
174
|
# owner.json as "not foreign", so a slot armed without one leases itself to a
|
|
@@ -137,6 +137,7 @@ while :; do
|
|
|
137
137
|
watermark_ci_red=$(read_watermark_value CIRED)
|
|
138
138
|
watermark_rebase=$(read_watermark_value REBASED)
|
|
139
139
|
watermark_blocked_digest=$(read_watermark_value BLOCKED_CIDIGEST)
|
|
140
|
+
watermark_rebase_held=$(read_watermark_value REBASE_HELD)
|
|
140
141
|
|
|
141
142
|
state_line=$(watch_fetch_state "$repo" "$pr_number" "$slot" "$state_projection")
|
|
142
143
|
# One quick retry before counting a strike: a single flaky call should not
|
|
@@ -207,7 +208,11 @@ while :; do
|
|
|
207
208
|
fi
|
|
208
209
|
|
|
209
210
|
rebase_key="${head_sha}..${base_tip_sha}"
|
|
210
|
-
if [ "$
|
|
211
|
+
if [ "$watermark_rebase_held" = "1" ]; then
|
|
212
|
+
# The PR spent its catch-up rebase budget: however far the base moves, the
|
|
213
|
+
# tick refuses the rebase a wake would ask for, so nothing is due either.
|
|
214
|
+
due_rebase_key=""
|
|
215
|
+
elif [ "$rebase_key" = "$watermark_rebase" ] || [ "$rebase_key" = "$floor_rebase" ]; then
|
|
211
216
|
# Only a key already found due is ever floored, and the pair's standing
|
|
212
217
|
# cannot change until the head or the base moves, which mints a new key.
|
|
213
218
|
due_rebase_key="$rebase_key"
|
|
@@ -54,11 +54,12 @@ function isRebaseBudgetExhausted(lastSeenEntry, maxCatchUpRebases) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// src/pr-watch/armFloors.ts
|
|
57
|
-
function resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey) {
|
|
57
|
+
function resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey, maxCatchUpRebases) {
|
|
58
58
|
const blockedCiDigest = lastSeenEntry.blocked?.fingerprint?.ci_digest;
|
|
59
59
|
return {
|
|
60
60
|
isRebaseKeyAttempted: rebaseKey !== "" && isRebaseKeyAttempted(lastSeenEntry, rebaseKey),
|
|
61
61
|
isCiHeadAttempted: headSha !== "" && isCiHeadAttempted(lastSeenEntry, headSha),
|
|
62
|
+
isRebaseBudgetExhausted: isRebaseBudgetExhausted(lastSeenEntry, maxCatchUpRebases),
|
|
62
63
|
blockedCiDigest: typeof blockedCiDigest === "string" && !LINE_BREAK.test(blockedCiDigest) ? blockedCiDigest : ""
|
|
63
64
|
};
|
|
64
65
|
}
|
|
@@ -137,11 +138,12 @@ function runPrWatchVerdictCommand(commandLine, lastSeenJson, resolvePreferences)
|
|
|
137
138
|
const headSha = flags[HEAD_FLAG] ?? "";
|
|
138
139
|
const rebaseKey = flags[REBASE_KEY_FLAG] ?? "";
|
|
139
140
|
if (subcommand === "arm-floors" /* ArmFloors */) {
|
|
140
|
-
const evidence = resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey);
|
|
141
|
+
const evidence = resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey, resolvePreferences().maxCatchUpRebases);
|
|
141
142
|
return {
|
|
142
143
|
stdout: `REBASE_ATTEMPTED=${evidence.isRebaseKeyAttempted ? 1 : 0}
|
|
143
144
|
CI_ATTEMPTED=${evidence.isCiHeadAttempted ? 1 : 0}
|
|
144
145
|
BLOCKED_CIDIGEST=${evidence.blockedCiDigest}
|
|
146
|
+
REBASE_BUDGET_EXHAUSTED=${evidence.isRebaseBudgetExhausted ? 1 : 0}
|
|
145
147
|
`,
|
|
146
148
|
stderr: "",
|
|
147
149
|
exitCode: 0
|
|
@@ -10,10 +10,10 @@ bash "<abs>/scripts/pr-watch-arm.sh" --slot "<slot>" --repo "<owner>/<repo>" --p
|
|
|
10
10
|
|
|
11
11
|
The same argument that forbids authoring a per-slot `watch.sh` applies to arming itself. Performed from prose, the middle step — writing `watch-watermark.env` — is the one that gets dropped, and dropping it is silent: the loop gates every wake condition on that file, so it polls nothing, reports nothing and never reaches its terminal check, while still holding its PID lease and touching its heartbeat. Eleven such watchers once ran for hours across one session, missed nine merges and a red CI run between them, and every health signal said they were fine. Running one command cannot half-happen.
|
|
12
12
|
|
|
13
|
-
Read the `DRAIN` lines it prints: they are the outstanding work as of the arm. Review ids and threads the drain read are floored, so the monitor 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. 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.
|
|
13
|
+
Read the `DRAIN` lines it prints: they are the outstanding work as of the arm. Review ids and threads the drain read are floored, so the monitor 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.
|
|
14
14
|
|
|
15
15
|
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.
|
|
16
|
-
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-id 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 monitor's first iteration surfaces it. Seed the CI floor (`CIRED`) from the same drain read: set it to the head SHA 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** `last_seen.json` records a fix-ci attempt for that head — a cycle already ran for that red, so its escalation or retry is not news — and empty otherwise. 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. The script reads all
|
|
16
|
+
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-id 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 monitor's first iteration surfaces it. Seed the CI floor (`CIRED`) from the same drain read: set it to the head SHA 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** `last_seen.json` records a fix-ci attempt for that head — a cycle already ran for that red, so its escalation or retry is not news — and empty otherwise. 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)).
|
|
17
17
|
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 monitor 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.
|
|
18
18
|
|
|
19
19
|
**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 monitor 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.
|
|
@@ -220,8 +220,9 @@ The watch loop's comparison floor — plain `KEY=VALUE` lines, one file per slot
|
|
|
220
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
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.
|
|
222
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.
|
|
223
|
+
- `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 rollover or respawn.
|
|
223
224
|
|
|
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.
|
|
225
|
+
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, `REBASE_HELD` from the rebase budget) 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.
|
|
225
226
|
|
|
226
227
|
**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.
|
|
227
228
|
|