@muggleai/works 5.24.0-staging.165 → 5.24.0-staging.166

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.
Files changed (44) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-YVR2MCR2.js → chunk-CUL7GQDB.js} +47 -10
  3. package/dist/{chunk-6AAGQQDL.js → chunk-OPJUT6PX.js} +34 -45
  4. package/dist/cli.js +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  7. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  8. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  9. package/dist/plugin/scripts/guardrails.mjs +132 -6
  10. package/dist/plugin/scripts/pr-watch-arm.sh +3 -3
  11. package/dist/plugin/scripts/pr-watch-fetch.sh +2 -2
  12. package/dist/plugin/scripts/pr-watch-loop.sh +2 -2
  13. package/dist/plugin/scripts/pr-watch-state.jq +8 -2
  14. package/dist/plugin/skills/_shared/pr-followup-helpers/classify.md +2 -0
  15. package/dist/plugin/skills/do/address-reviews.md +12 -8
  16. package/dist/plugin/skills/do/cycle-size.md +33 -0
  17. package/dist/plugin/skills/do/e2e-acceptance.md +3 -1
  18. package/dist/plugin/skills/do/fix-ci.md +3 -3
  19. package/dist/plugin/skills/do/impact-analysis.md +11 -0
  20. package/dist/plugin/skills/do/open-prs/update.md +7 -4
  21. package/dist/plugin/skills/do/resolve-conflicts.md +2 -2
  22. package/dist/plugin/skills/do/wave-e2e.md +3 -2
  23. package/dist/plugin/skills/muggle-do/SKILL.md +2 -2
  24. package/dist/release-manifest.json +3 -3
  25. package/dist/{src-OHWBRW4X.js → src-3I5BNAZ7.js} +1 -1
  26. package/package.json +1 -1
  27. package/plugin/.claude-plugin/plugin.json +1 -1
  28. package/plugin/.codex-plugin/plugin.json +1 -1
  29. package/plugin/.cursor-plugin/plugin.json +1 -1
  30. package/plugin/scripts/guardrails.mjs +132 -6
  31. package/plugin/scripts/pr-watch-arm.sh +3 -3
  32. package/plugin/scripts/pr-watch-fetch.sh +2 -2
  33. package/plugin/scripts/pr-watch-loop.sh +2 -2
  34. package/plugin/scripts/pr-watch-state.jq +8 -2
  35. package/plugin/skills/_shared/pr-followup-helpers/classify.md +2 -0
  36. package/plugin/skills/do/address-reviews.md +12 -8
  37. package/plugin/skills/do/cycle-size.md +33 -0
  38. package/plugin/skills/do/e2e-acceptance.md +3 -1
  39. package/plugin/skills/do/fix-ci.md +3 -3
  40. package/plugin/skills/do/impact-analysis.md +11 -0
  41. package/plugin/skills/do/open-prs/update.md +7 -4
  42. package/plugin/skills/do/resolve-conflicts.md +2 -2
  43. package/plugin/skills/do/wave-e2e.md +3 -2
  44. package/plugin/skills/muggle-do/SKILL.md +2 -2
@@ -193,6 +193,7 @@ var GuardrailBackgroundJob = /* @__PURE__ */ ((GuardrailBackgroundJob2) => {
193
193
  GuardrailBackgroundJob2["ReserveWalkthroughComment"] = "reserve-walkthrough-comment";
194
194
  GuardrailBackgroundJob2["SettleWalkthroughSkipped"] = "settle-walkthrough-skipped";
195
195
  GuardrailBackgroundJob2["SettleWalkthroughUnreasoned"] = "settle-walkthrough-unreasoned";
196
+ GuardrailBackgroundJob2["SettleWalkthroughNoAppLogicChange"] = "settle-walkthrough-no-app-logic-change";
196
197
  return GuardrailBackgroundJob2;
197
198
  })(GuardrailBackgroundJob || {});
198
199
 
@@ -703,12 +704,14 @@ function applyRecordedRun(state, run) {
703
704
  let next = state;
704
705
  if (run.unitTestPassed) {
705
706
  next = { ...next, unitTestsGreen: true, e2eRun: false };
707
+ if (next.e2eSkipCycleScoped === true) next = { ...next, e2eSkipped: false, e2eSkipCycleScoped: false };
706
708
  }
707
709
  if (run.e2eRan) {
708
710
  next = { ...next, e2eRun: true, e2eBlockCount: 0 };
709
711
  }
710
712
  if (run.e2eSkipped) {
711
- next = { ...next, e2eSkipped: true };
713
+ const isEnvironmentSkipHeld = next.e2eSkipped === true && next.e2eSkipCycleScoped !== true;
714
+ next = { ...next, e2eSkipped: true, e2eSkipCycleScoped: !isEnvironmentSkipHeld && run.e2eSkipCycleScoped === true };
712
715
  }
713
716
  return next;
714
717
  }
@@ -785,6 +788,9 @@ var REPORT_SENTINEL = "muggle-pr-section";
785
788
  var WALKTHROUGH_SLOT_MARKER = "<!-- muggle-pr-walkthrough:v1 -->";
786
789
  var WALKTHROUGH_SKIPPED_MARKER = "<!-- muggle-pr-walkthrough-status:skipped -->";
787
790
  var WALKTHROUGH_COMMENT_HEADING = "### Muggle AI \u2014 PR visual walkthrough";
791
+ var REPORT_SENTINEL_TAG = new RegExp(`<!--\\s*${REPORT_SENTINEL}[^>]*-->\\s*`, "g");
792
+ var LAST_FULL_RUN_OPENING = "<details><summary>Last full E2E run on this PR</summary>";
793
+ var SHORT_SHA_LENGTH = 7;
788
794
  var GH_COMMENT_TIMEOUT_MS = 1e4;
789
795
 
790
796
  // src/guardrails/prReportPost.ts
@@ -933,6 +939,7 @@ var E2eSkipCode = /* @__PURE__ */ ((E2eSkipCode3) => {
933
939
  E2eSkipCode3["MuggleAuthDown"] = "MUGGLE_AUTH_DOWN";
934
940
  E2eSkipCode3["NoPr"] = "NO_PR";
935
941
  E2eSkipCode3["UserWaived"] = "USER_WAIVED";
942
+ E2eSkipCode3["NoAppLogicChange"] = "NO_APP_LOGIC_CHANGE";
936
943
  return E2eSkipCode3;
937
944
  })(E2eSkipCode || {});
938
945
 
@@ -940,14 +947,34 @@ var E2eSkipCode = /* @__PURE__ */ ((E2eSkipCode3) => {
940
947
  var E2E_SKIP_DECLARATION = /^\s*echo\s+["']?MUGGLE_E2E_SKIP:(.*)$/;
941
948
  var SKIP_CODE_TOKEN = /^[\s:]*([A-Za-z_]+)/;
942
949
  var E2E_SKIP_CODES = Object.values(E2eSkipCode);
950
+ var NON_APP_PATH_SUMMARY = "docs, tests, lint/format config, or CI config";
943
951
  var E2E_SKIP_CODE_CLAIMS = {
944
952
  ["NO_WEB_SURFACE" /* NoWebSurface */]: "the repo ships no web surface to drive",
945
953
  ["DEV_SERVER_UNREACHABLE" /* DevServerUnreachable */]: "the named dev server does not answer",
946
954
  ["EMPTY_DIFF" /* EmptyDiff */]: "the branch carries no diff against its base",
947
955
  ["MUGGLE_AUTH_DOWN" /* MuggleAuthDown */]: "the stored Muggle session is missing or expired",
948
956
  ["NO_PR" /* NoPr */]: "no pull request was handled this session",
949
- ["USER_WAIVED" /* UserWaived */]: "the user waived E2E in their own words"
957
+ ["USER_WAIVED" /* UserWaived */]: "the user waived E2E in their own words",
958
+ ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */]: `every path changed since the named commit is ${NON_APP_PATH_SUMMARY}`
950
959
  };
960
+ var CYCLE_SCOPED_SKIP_CODES = ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */];
961
+ var PRE_CYCLE_SHA_TOKEN = /^([0-9a-f]{7,40})(?![0-9a-z_])/i;
962
+ var NON_APP_PATH_PATTERNS = [
963
+ /\.(md|markdown|rst)$/i,
964
+ /(^|\/)[^/]+\.(test|spec)\.[^/]+$/,
965
+ /(^|\/)(__tests__|__snapshots__|__mocks__)\//,
966
+ /(^|\/)test_[^/]+\.py$/,
967
+ /(^|\/)[^/]+_test\.(py|go)$/,
968
+ /^tests?\//,
969
+ /(^|\/)\.(eslintrc|prettierrc|stylelintrc)(\.[a-z]+)?$/,
970
+ /(^|\/)(eslint|prettier|stylelint)\.config\.[cm]?[jt]s$/,
971
+ /(^|\/)\.(eslint|prettier|stylelint)ignore$/,
972
+ /(^|\/)\.markdownlint[^/]*$/,
973
+ /(^|\/)(biome\.jsonc?|\.editorconfig)$/,
974
+ /^\.github\/workflows\//,
975
+ /^\.gitlab-ci\.yml$/
976
+ ];
977
+ var MAX_NAMED_APP_LOGIC_PATHS = 5;
951
978
  var USER_WAIVE_PHRASE = "SKIP E2E";
952
979
  var DEV_SERVER_PROBE_TIMEOUT_MS = 2e3;
953
980
  var GIT_PROBE_TIMEOUT_MS = 5e3;
@@ -976,6 +1003,18 @@ var WEB_SURFACE_CONFIG_FILES = [
976
1003
  var OAUTH_SESSION_FILE = /^oauth-session[\w.-]*\.json$/;
977
1004
  var MUGGLE_HOME_DIR_NAME = ".muggle-ai";
978
1005
 
1006
+ // src/e2e-skip/noAppLogicChange.ts
1007
+ function parseNoAppLogicChangeDetail(detail) {
1008
+ const stated = detail.trim();
1009
+ const preCycleSha = stated.match(PRE_CYCLE_SHA_TOKEN)?.[1];
1010
+ if (!preCycleSha) return null;
1011
+ const reason = stated.slice(preCycleSha.length).replace(/^[\s:,;.-]+/, "").trim();
1012
+ return { preCycleSha, reason };
1013
+ }
1014
+ function isNonAppPath(repoRelativePath) {
1015
+ return NON_APP_PATH_PATTERNS.some((pattern) => pattern.test(repoRelativePath));
1016
+ }
1017
+
979
1018
  // src/pr-walkthrough/comment.ts
980
1019
  function renderReservedComment() {
981
1020
  return `${WALKTHROUGH_SLOT_MARKER}
@@ -999,6 +1038,34 @@ ${WALKTHROUGH_COMMENT_HEADING}
999
1038
 
1000
1039
  **No E2E run, and no verified reason given.** The session ended still owing an acceptance run and cited no skip code that Muggle could verify. Treat this PR as unvalidated by E2E.`;
1001
1040
  }
1041
+ var shortSha = (sha) => sha.slice(0, SHORT_SHA_LENGTH);
1042
+ function renderNoAppLogicChangeComment(declared, headSha, lastFullRun) {
1043
+ const cycleStart = declared.preCycleSha.toLowerCase();
1044
+ const head = headSha?.toLowerCase() ?? null;
1045
+ const isHeadPastCycleStart = head !== null && !head.startsWith(cycleStart) && !cycleStart.startsWith(head);
1046
+ const headline = isHeadPastCycleStart ? `**E2E skipped \u2014 no app-logic change in \`${shortSha(head)}\`.**` : `**E2E skipped \u2014 no app-logic change since \`${shortSha(cycleStart)}\`.**`;
1047
+ const qualifier = declared.reason ? ` \u2014 ${declared.reason}` : "";
1048
+ const evidence = lastFullRun ? `${LAST_FULL_RUN_OPENING}
1049
+
1050
+ ${lastFullRun}
1051
+
1052
+ </details>` : "_No full E2E run is on record for this PR._";
1053
+ return `${WALKTHROUGH_SLOT_MARKER}
1054
+ ${WALKTHROUGH_SKIPPED_MARKER}
1055
+ ${WALKTHROUGH_COMMENT_HEADING}
1056
+
1057
+ ${headline} Muggle verified \`${"NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */}\` \u2014 every path changed since \`${shortSha(cycleStart)}\` is ${NON_APP_PATH_SUMMARY}${qualifier}.
1058
+
1059
+ ` + evidence;
1060
+ }
1061
+ function lastFullRunOf(body) {
1062
+ const status = classifyComment(body);
1063
+ if (status === "reported" /* Reported */) return body.replace(REPORT_SENTINEL_TAG, "").trim();
1064
+ if (status !== "skipped" /* Skipped */) return null;
1065
+ const start = body.indexOf(LAST_FULL_RUN_OPENING);
1066
+ if (start === -1) return null;
1067
+ return body.slice(start + LAST_FULL_RUN_OPENING.length).replace(/\s*<\/details>\s*$/, "").trim();
1068
+ }
1002
1069
  function classifyComment(body) {
1003
1070
  if (body.includes(REPORT_SENTINEL)) return "reported" /* Reported */;
1004
1071
  if (!body.includes(WALKTHROUGH_SLOT_MARKER)) return "not-designated" /* NotDesignated */;
@@ -1043,6 +1110,13 @@ function listPrComments(pr, run) {
1043
1110
  return null;
1044
1111
  }
1045
1112
  }
1113
+ function readPrHeadSha(pr, run) {
1114
+ try {
1115
+ return run(["api", `repos/${pr.repo}/pulls/${pr.prNumber}`, "--jq", ".head.sha"])?.trim() || null;
1116
+ } catch {
1117
+ return null;
1118
+ }
1119
+ }
1046
1120
  function writeJson(args, payload, run) {
1047
1121
  try {
1048
1122
  return run(args, JSON.stringify(payload)) !== null;
@@ -1096,6 +1170,19 @@ function settleWith(prUrl, body, run) {
1096
1170
  function settleWalkthroughCommentAsSkipped(prUrl, code, detail, run = defaultGhRunner) {
1097
1171
  return settleWith(prUrl, renderSkippedComment(code, detail), run);
1098
1172
  }
1173
+ function settleWalkthroughCommentForNoAppLogicChange(prUrl, detail, run = defaultGhRunner) {
1174
+ const pr = parsePrUrl(prUrl);
1175
+ const declared = parseNoAppLogicChangeDetail(detail);
1176
+ if (!pr || !declared) return false;
1177
+ const comments = listPrComments(pr, run);
1178
+ if (comments === null) return false;
1179
+ const designated = comments.find(
1180
+ (comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */
1181
+ );
1182
+ const lastFullRun = designated ? lastFullRunOf(designated.body) : null;
1183
+ const body = renderNoAppLogicChangeComment(declared, readPrHeadSha(pr, run), lastFullRun);
1184
+ return designated ? patchPrComment(pr, designated.id, body, run) : postPrComment(pr, body, run);
1185
+ }
1099
1186
  function settleWalkthroughCommentAsUnreasoned(prUrl, run = defaultGhRunner) {
1100
1187
  return settleWith(prUrl, renderUnreasonedSkipComment(), run);
1101
1188
  }
@@ -1203,13 +1290,39 @@ var verifyUserWaived = (context) => {
1203
1290
  if (waived) return verified;
1204
1291
  return refuted(`no user turn in the transcript contains "${USER_WAIVE_PHRASE}"`);
1205
1292
  };
1293
+ var namePaths = (paths) => {
1294
+ const named = paths.slice(0, MAX_NAMED_APP_LOGIC_PATHS).join(", ");
1295
+ const unnamed = paths.length - MAX_NAMED_APP_LOGIC_PATHS;
1296
+ return unnamed > 0 ? `${named} and ${unnamed} more` : named;
1297
+ };
1298
+ var verifyNoAppLogicChange = (context, detail) => {
1299
+ if (!context.cwd) return refuted("no working directory was available to inspect");
1300
+ const declared = parseNoAppLogicChangeDetail(detail);
1301
+ if (!declared) {
1302
+ return refuted("the detail names no pre-cycle commit \u2014 cite it as NO_APP_LOGIC_CHANGE: <sha> <what changed>");
1303
+ }
1304
+ const sha = declared.preCycleSha;
1305
+ const diff = context.probe.runGit(
1306
+ ["diff", "--name-only", "--no-renames", "-z", `${sha}^{commit}`, "HEAD"],
1307
+ context.cwd
1308
+ );
1309
+ if (diff === null) return refuted(`${sha} does not resolve to a commit here, or its diff to HEAD could not be read`);
1310
+ const changedPaths = diff.split("\0").filter(Boolean);
1311
+ if (changedPaths.length === 0) {
1312
+ return refuted(`HEAD carries no change since ${sha} \u2014 declare the skip once the cycle's commits are on HEAD`);
1313
+ }
1314
+ const appLogicPaths = changedPaths.filter((path) => !isNonAppPath(path));
1315
+ if (appLogicPaths.length > 0) return refuted(`app-logic paths changed since ${sha}: ${namePaths(appLogicPaths)}`);
1316
+ return verified;
1317
+ };
1206
1318
  var VERIFIERS = {
1207
1319
  ["NO_WEB_SURFACE" /* NoWebSurface */]: verifyNoWebSurface,
1208
1320
  ["DEV_SERVER_UNREACHABLE" /* DevServerUnreachable */]: verifyDevServerUnreachable,
1209
1321
  ["EMPTY_DIFF" /* EmptyDiff */]: verifyEmptyDiff,
1210
1322
  ["MUGGLE_AUTH_DOWN" /* MuggleAuthDown */]: verifyMuggleAuthDown,
1211
1323
  ["NO_PR" /* NoPr */]: verifyNoPr,
1212
- ["USER_WAIVED" /* UserWaived */]: verifyUserWaived
1324
+ ["USER_WAIVED" /* UserWaived */]: verifyUserWaived,
1325
+ ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */]: verifyNoAppLogicChange
1213
1326
  };
1214
1327
  function verifyDeclaredSkip(skip, context) {
1215
1328
  return VERIFIERS[skip.code](context, skip.detail);
@@ -1760,10 +1873,12 @@ function recordTests() {
1760
1873
  const cmd = input.tool_input?.command ?? "";
1761
1874
  const stateBefore = readState(sessionId);
1762
1875
  const judgedSkip = judgeE2eSkip(input, stateBefore);
1876
+ const acceptedSkip = judgedSkip?.accepted ? judgedSkip.skip : null;
1763
1877
  const run = {
1764
1878
  unitTestPassed: isTestCommand(cmd) && testsPassed(input),
1765
1879
  e2eRan: isE2ERun(input),
1766
- e2eSkipped: judgedSkip?.accepted === true
1880
+ e2eSkipped: acceptedSkip !== null,
1881
+ e2eSkipCycleScoped: acceptedSkip !== null && CYCLE_SCOPED_SKIP_CODES.includes(acceptedSkip.code)
1767
1882
  };
1768
1883
  const walkthroughPosted = detectWalkthroughPost(input);
1769
1884
  const failedRunId = detectFailedRunId(input);
@@ -1779,13 +1894,17 @@ function recordTests() {
1779
1894
  if (isWalkthroughGateArmed(next) && !isWalkthroughGateArmed(stateBefore)) {
1780
1895
  startBackgroundJob("scan-walkthroughs" /* ScanWalkthroughs */, [sessionId], input.cwd);
1781
1896
  }
1782
- if (judgedSkip?.accepted) recordSkipReasonOnPrs(next, judgedSkip.skip);
1897
+ if (acceptedSkip) recordSkipReasonOnPrs(next, acceptedSkip);
1783
1898
  if (judgedSkip && !judgedSkip.accepted) {
1784
1899
  return envelope("PostToolUse", explainRejection(judgedSkip), host);
1785
1900
  }
1786
1901
  return "{}";
1787
1902
  }
1788
1903
  function recordSkipReasonOnPrs(state, skip) {
1904
+ if (skip.code === "NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */) {
1905
+ startBackgroundJob("settle-walkthrough-no-app-logic-change" /* SettleWalkthroughNoAppLogicChange */, [skip.detail], input.cwd);
1906
+ return;
1907
+ }
1789
1908
  for (const prUrl of state.prsHandled) {
1790
1909
  startBackgroundJob("settle-walkthrough-skipped" /* SettleWalkthroughSkipped */, [prUrl, skip.code, skip.detail]);
1791
1910
  }
@@ -2074,11 +2193,18 @@ function settleWalkthroughUnreasonedJob() {
2074
2193
  if (prUrl) settleWalkthroughCommentAsUnreasoned(prUrl);
2075
2194
  return "{}";
2076
2195
  }
2196
+ function settleWalkthroughNoAppLogicChangeJob() {
2197
+ const [detail] = jobArgs;
2198
+ const prUrl = defaultPrWalkthroughLookup.branchPrUrl();
2199
+ if (prUrl && detail) settleWalkthroughCommentForNoAppLogicChange(prUrl, detail);
2200
+ return "{}";
2201
+ }
2077
2202
  var backgroundJobs = {
2078
2203
  ["scan-walkthroughs" /* ScanWalkthroughs */]: scanWalkthroughsJob,
2079
2204
  ["reserve-walkthrough-comment" /* ReserveWalkthroughComment */]: reserveWalkthroughCommentJob,
2080
2205
  ["settle-walkthrough-skipped" /* SettleWalkthroughSkipped */]: settleWalkthroughSkippedJob,
2081
- ["settle-walkthrough-unreasoned" /* SettleWalkthroughUnreasoned */]: settleWalkthroughUnreasonedJob
2206
+ ["settle-walkthrough-unreasoned" /* SettleWalkthroughUnreasoned */]: settleWalkthroughUnreasonedJob,
2207
+ ["settle-walkthrough-no-app-logic-change" /* SettleWalkthroughNoAppLogicChange */]: settleWalkthroughNoAppLogicChangeJob
2082
2208
  };
2083
2209
  var runSubcommand = isBackgroundJob(sub) ? backgroundJobs[sub] : handlers[sub] ?? (() => "{}");
2084
2210
  process.stdout.write(runSubcommand());
@@ -62,7 +62,7 @@ fi
62
62
  watch_read_state_fields "$state_line"
63
63
  pr_state="${STATE_FIELDS[0]-}"
64
64
  head_sha="${STATE_FIELDS[1]-}"
65
- base_sha="${STATE_FIELDS[2]-}"
65
+ base_tip_sha="${STATE_FIELDS[2]-}"
66
66
  mergeable="${STATE_FIELDS[3]-}"
67
67
  latest_review="${STATE_FIELDS[4]-}"
68
68
  latest_comment="${STATE_FIELDS[5]-}"
@@ -82,11 +82,11 @@ if [ "${pending_checks:-0}" -eq 0 ] 2>/dev/null && [ "${failed_checks:-0}" -gt 0
82
82
  ci_red_floor="$head_sha"
83
83
  fi
84
84
 
85
- # Same for staleness: keyed on the head/base pair, so it re-arms when either moves.
85
+ # Same for staleness: keyed on the head/base-tip pair, so it re-arms when either moves.
86
86
  rebase_floor=""
87
87
  behind_count="$(watch_fetch_behind_count "$repo" "$base_branch" "$head_sha" "$slot")"
88
88
  if [ "$mergeable" = "CONFLICTING" ] || { [ -n "$behind_count" ] && [ "$behind_count" -gt 0 ] 2>/dev/null; }; then
89
- rebase_floor="${head_sha}..${base_sha}"
89
+ rebase_floor="${head_sha}..${base_tip_sha}"
90
90
  fi
91
91
 
92
92
  thread_count=0
@@ -16,7 +16,7 @@ query($owner: String!, $name: String!, $number: Int!) {
16
16
  pullRequest(number: $number) {
17
17
  state
18
18
  headRefOid
19
- baseRefOid
19
+ baseRef { target { oid } }
20
20
  mergeable
21
21
  commits(last: 1) {
22
22
  nodes {
@@ -48,7 +48,7 @@ query($owner: String!, $name: String!, $number: Int!) {
48
48
  }
49
49
 
50
50
  # behind_by needs its own call — see watch_wake_rebase for why no field on the
51
- # PR carries it. The loop makes it only when the head/base pair moved, so the
51
+ # PR carries it. The loop makes it only when the head/base-tip pair moved, so the
52
52
  # steady state stays one request per iteration.
53
53
  watch_fetch_behind_count() {
54
54
  local repo="$1" base_branch="$2" head_sha="$3" slot="$4"
@@ -152,7 +152,7 @@ while :; do
152
152
  watch_read_state_fields "$state_line"
153
153
  pr_state="${STATE_FIELDS[0]-}"
154
154
  head_sha="${STATE_FIELDS[1]-}"
155
- base_sha="${STATE_FIELDS[2]-}"
155
+ base_tip_sha="${STATE_FIELDS[2]-}"
156
156
  mergeable="${STATE_FIELDS[3]-}"
157
157
  latest_review="${STATE_FIELDS[4]-}"
158
158
  latest_comment="${STATE_FIELDS[5]-}"
@@ -201,7 +201,7 @@ while :; do
201
201
  floor_ci_red="$head_sha"
202
202
  fi
203
203
 
204
- rebase_key="${head_sha}..${base_sha}"
204
+ rebase_key="${head_sha}..${base_tip_sha}"
205
205
  if [ "$rebase_key" != "$watermark_rebase" ] && [ "$rebase_key" != "$floor_rebase" ]; then
206
206
  behind_count=$(watch_fetch_behind_count "$repo" "$base_branch" "$head_sha" "$slot")
207
207
  if watch_wake_rebase "$pr_number" "$mergeable" "$behind_count" "$rebase_key" ""; then
@@ -4,8 +4,14 @@
4
4
  # which is how the echo wake below survived unnoticed.
5
5
  #
6
6
  # Field order is the contract pr-watch-loop.sh reads positionally:
7
- # state, headRefOid, baseRefOid, mergeable, latest-review, latest-comment,
7
+ # state, headRefOid, base-tip, mergeable, latest-review, latest-comment,
8
8
  # unresolved-thread-ids, pending-checks, failed-checks, check-digest
9
+ #
10
+ # base-tip is where the base branch points now, the base half of the rebase key.
11
+ # Not baseRefOid: GitHub moves that only when the head is pushed, so a key built
12
+ # from it stays equal to an escalated or floored key however far the base
13
+ # advances, and the branch never wakes again. A deleted base branch projects as
14
+ # an empty field rather than a missing one, so no later field shifts.
9
15
 
10
16
  def loop_marked: ((.body // "") | contains("<!-- muggle-do:bot -->"));
11
17
 
@@ -40,7 +46,7 @@ def loop_marked: ((.body // "") | contains("<!-- muggle-do:bot -->"));
40
46
  [
41
47
  $pr.state,
42
48
  $pr.headRefOid,
43
- $pr.baseRefOid,
49
+ ($pr.baseRef.target.oid // ""),
44
50
  $pr.mergeable,
45
51
  (([$pr.reviews.nodes[] | select(is_echo_review | not) | .databaseId] | max) // 0),
46
52
  (($liveComments | map(select(loop_marked | not) | .databaseId) | max) // 0),
@@ -23,6 +23,8 @@ Only reviews that survive the self-loop check proceed to classify below.
23
23
 
24
24
  Default to **actionable**. CI catches wrong attempts; reviewers correct on the next round. Escalation is a round-trip with an absent user — reserve it.
25
25
 
26
+ Classification decides only whether to act. How much of the cycle runs is decided later, by the caller, from the diff the work produced — never from how the review was worded or how many comments it carried.
27
+
26
28
  Reply shape (all replies for one review reference the same SHA):
27
29
 
28
30
  - **threaded** (default): `Done in <sha> — <attribution>. (Review #<review_id>, cycle <status>.)`
@@ -82,23 +82,27 @@ The actionable reviews together carry a flat list of change items, one per line
82
82
 
83
83
  #### 4b. Apply design + code-logic changes
84
84
 
85
- Invoke [`build.md`](build.md) with the review-derived requirements: for each comment, what to change and where. `build.md` makes the edits in the working tree but does not commit.
85
+ Record `pre_cycle_sha` per [`cycle-size.md`](cycle-size.md) before the first edit. Invoke [`build.md`](build.md) with the review-derived requirements: for each comment, what to change and where. `build.md` makes the edits in the working tree but does not commit.
86
86
 
87
87
  If `build.md` reports that the requested work requires rethinking the design (e.g. the requested change conflicts with a load-bearing invariant), exit early per Step 7 (design-adjustment escalation).
88
88
 
89
- #### 4c. Create or update unit tests
89
+ #### 4c. Size the cycle
90
+
91
+ Invoke [`impact-analysis.md`](impact-analysis.md) with `pre_cycle_sha` — the forward pipeline's Stage 4, plus the cycle's own diff. Its `cycleSize` picks the tail per [`cycle-size.md`](cycle-size.md): **minor** runs 4d → 4f → 4g, **full** runs 4d → 4e → 4f → 4g, and an empty `cycleFiles` goes straight to 4g. The Step 2 classification never sizes the cycle — a one-line comment can need the full tail and a long review the minor one.
92
+
93
+ #### 4d. Create or update unit tests
90
94
 
91
95
  Invoke [`unit-tests.md`](unit-tests.md). Cover the surface that just changed; respect existing test conventions.
92
96
 
93
- #### 4d. Run ONE E2E acceptance pass
97
+ #### 4e. Run ONE E2E acceptance pass (full cycle only)
94
98
 
95
- Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass covering all related test cases for this PR, not one per comment. When `state.md` records `Wave: on`, the pass runs against the wave stack — siblings started from their PRs' current heads — and the refreshed walkthrough goes to every sibling too, per [`wave-e2e.md`](wave-e2e.md#later-cycles-on-one-wave-pr). The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md).
99
+ Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass covering all related test cases for this PR, not one per comment. When `state.md` records `Wave: on`, the pass runs against the wave stack — siblings started from their PRs' current heads — and the refreshed walkthrough goes to every sibling too, per [`wave-e2e.md`](wave-e2e.md#later-cycles-on-one-wave-pr). The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md). A minor cycle skips this step, wave or not.
96
100
 
97
- #### 4e. Create or update the PR
101
+ #### 4f. Create or update the PR
98
102
 
99
- Invoke [`open-prs/update.md`](open-prs/update.md) (pass the PR URL + slug + existing PR number). It pushes, refreshes title/description on state change, posts a fresh walkthrough comment, and appends the new SHA to `last_seen.pushed_shas[]`. Capture the new `head_sha`.
103
+ Invoke [`open-prs/update.md`](open-prs/update.md) (pass the PR URL + slug + existing PR number, the cycle size, and `pre_cycle_sha`). It pushes, refreshes title/description on state change, settles the walkthrough comment — a fresh walkthrough for a full cycle, the `NO_APP_LOGIC_CHANGE` skip for a minor one — and appends the new SHA to `last_seen.pushed_shas[]`. Capture the new `head_sha`.
100
104
 
101
- #### 4f. Post per-comment inline replies
105
+ #### 4g. Post per-comment inline replies
102
106
 
103
107
  Invoke [`per-comment-replies.md`](per-comment-replies.md) with the actionable reviews (`gitlab`: discussions) and the new SHA. One reply per comment, in its own thread, describing what was done for it. The reply is the whole of it — neither provider's threads get resolved by the loop.
104
108
 
@@ -129,7 +133,7 @@ Emit one event per [`../_shared/telemetry-events/muggle-do-cycle.md`](../_shared
129
133
  - `"mixed"` — both branches ran.
130
134
  - `"no-op"` — every input id was already in `escalated_review_ids` (the watcher shouldn't have dispatched, but defensive coverage).
131
135
 
132
- Emit additional events as Steps fired them (escalation event in Step 3; resolve-reminder event in Step 4g).
136
+ Emit additional events as Steps fired them (escalation event in Step 3; resolve-reminder event in Step 5.5).
133
137
 
134
138
  ## Design-adjustment escalation (Step 4b early exit)
135
139
 
@@ -0,0 +1,33 @@
1
+ # Cycle size (watcher-dispatched cycles)
2
+
3
+ Address-reviews, fix-ci, and rebase cycles each run a **minor** or a **full** tail. The diff the cycle produced picks it — never how a review was worded, how many comments asked, or which check was red.
4
+
5
+ ## Starting commit
6
+
7
+ `pre_cycle_sha` is the PR head the cycle started from, read with `git rev-parse HEAD` in the PR's working tree before the cycle's first change: address-reviews right after its Step 0 sync, fix-ci's `red_sha`, rebase's `rebase_sha`.
8
+
9
+ ## Size
10
+
11
+ Once the cycle's edits are in the working tree — or the rebase has replayed — run [`impact-analysis.md`](impact-analysis.md) with `pre_cycle_sha`. Its `cycleSize` is:
12
+
13
+ - **minor** — every path the cycle changed is docs, tests, lint/format config, or CI config, exactly as the `NO_APP_LOGIC_CHANGE` rule in [`e2e-acceptance.md`](e2e-acceptance.md) defines them.
14
+ - **full** — anything else, a comment-only or formatting-only edit in a source file included. The rule reads paths, not content, because a path rule is what the guardrail can verify.
15
+
16
+ A rebase compares trees, so app logic the base brought in makes the rebase full. An empty `cycleFiles` is neither size: the cycle changed nothing (every review was an answerable question), so it runs no tail — no unit run, no push, no declaration — and goes straight to the mode's replies.
17
+
18
+ ## Full tail
19
+
20
+ Unit tests → E2E per [`e2e-acceptance.md`](e2e-acceptance.md) → push → walkthrough repost: fire [`postPRVisualWalkthrough`](../muggle-preferences/preference-gates/postPRVisualWalkthrough.md), then [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A → the mode's remaining steps.
21
+
22
+ ## Minor tail
23
+
24
+ Unit tests → push → declare the skip → the mode's remaining steps. No E2E run, no walkthrough render.
25
+
26
+ Declare after the push, as one Bash call from the PR's working tree. Only then is local HEAD the head the PR carries: server-signed commits reach the local branch when the push syncs it, and a base sync during the push can rewrite the head.
27
+
28
+ ```bash
29
+ echo "MUGGLE_E2E_SKIP: NO_APP_LOGIC_CHANGE: <pre_cycle_sha> <what changed, e.g. README typo, test rename>"
30
+ ```
31
+
32
+ - **Accepted** — Muggle rewrites the PR's designated walkthrough comment to "E2E skipped — no app-logic change in `<short-sha>`" with the stated reason, and keeps the last full run's walkthrough collapsed beneath it. The walkthrough check passes on the new head when that run passed. When it failed, the check stays red: commits that changed no app logic cannot have repaired a failing case, so that red is fix-ci's walkthrough repair, never a minor cycle's.
33
+ - **Rejected** — the reply names the paths that refuted it. The cycle is full after all: run E2E on the pushed head, repost the walkthrough, then continue.
@@ -23,7 +23,9 @@ This stage is **mode-driven by pre-flight**:
23
23
 
24
24
  **Every SKIPPED exit from this stage** (Step 0 poll-only, Step 1 `unit-only`/`skip`, Step 1.5 placeholder branch) also runs `echo "MUGGLE_E2E_SKIP: <CODE>: <detail>"` as a single Bash call before exiting — it records the skip in guardrail session state so the Stop-hook E2E gate releases instead of blocking the turn.
25
25
 
26
- `<CODE>` is one of `NO_WEB_SURFACE`, `DEV_SERVER_UNREACHABLE`, `EMPTY_DIFF`, `MUGGLE_AUTH_DOWN`, `NO_PR`, `USER_WAIVED`, and the guardrail verifies it against the environment before the gate releases. Every code names a fact about the environment; none names a judgment about the change, so "static page", "layout only", "unit tests cover it" and "verified with another tool" have no way through — cite a code that holds, or run the tests. `USER_WAIVED` needs the user's own literal `SKIP E2E` in the transcript, never an inferred go-ahead. A rejected declaration is answered with the check that failed, and the turn stays blocked.
26
+ `<CODE>` is one of `NO_WEB_SURFACE`, `DEV_SERVER_UNREACHABLE`, `EMPTY_DIFF`, `MUGGLE_AUTH_DOWN`, `NO_PR`, `USER_WAIVED`, `NO_APP_LOGIC_CHANGE` — the one list of verified skip codes, which other files reference rather than restate — and the guardrail verifies it before the gate releases. Every code names a fact the guardrail checks for itself, about the environment or about which paths a commit range touched; none names a judgment about the change, so "static page", "layout only", "unit tests cover it" and "verified with another tool" have no way through — cite a code that holds, or run the tests. `USER_WAIVED` needs the user's own literal `SKIP E2E` in the transcript, never an inferred go-ahead. A rejected declaration is answered with the check that failed, and the turn stays blocked.
27
+
28
+ `NO_APP_LOGIC_CHANGE` belongs to a watcher cycle's minor tail ([`cycle-size.md`](cycle-size.md)), never to a Stage 6 exit. Its detail opens with the cycle's starting commit. Muggle diffs that commit against HEAD and accepts only when every changed path is docs (`*.md`, `*.markdown`, `*.rst`), tests (`*.test.*`, `*.spec.*`, `__tests__/`, `__snapshots__/`, `__mocks__/`, `test_*.py`, `*_test.py`, `*_test.go`, a root-level `test/` or `tests/`), lint/format config (ESLint, Prettier, Stylelint and markdownlint config or ignore files, `biome.json`, `.editorconfig`), or CI config (`.github/workflows/`, `.gitlab-ci.yml`). A commit it cannot resolve, an empty diff, or any other path — a comment-only edit in a source file included — fails.
27
29
  - `staging-replay` is not executed in this stage path and should be surfaced as `INCONCLUSIVE` unless the caller has already routed to a dedicated staging runner.
28
30
 
29
31
  For local runs, the tool boundaries are:
@@ -20,7 +20,7 @@ From `~/.muggle-ai/muggle-do/sessions/<slug>/`: `prs.json` (PR + local checkout
20
20
 
21
21
  ### Step 1 — Re-attach
22
22
 
23
- Check out the PR branch in the session's working tree (per `state.md`). Capture `red_sha = prs.json[0].head_sha`.
23
+ Check out the PR branch in the session's working tree (per `state.md`). Capture `red_sha = prs.json[0].head_sha` — this cycle's `pre_cycle_sha` ([`cycle-size.md`](cycle-size.md)).
24
24
 
25
25
  ### Step 2 — Map each failing check to a local command
26
26
 
@@ -39,13 +39,13 @@ An empty-comment failure (no run ever posted) skips items 1–2: run the suite a
39
39
  ### Step 3 — Verify before push
40
40
 
41
41
  - Build (typecheck + lint on the changed surface) + unit suite must pass.
42
- - Run E2E (per [`../muggle-preferences/preference-gates/autoE2ETest.md`](../muggle-preferences/preference-gates/autoE2ETest.md)) only if the fix touched app logic; lint/format-only fixes skip E2E. A Step 2.5 repair always runs the full suite.
42
+ - Size the fix per [`cycle-size.md`](cycle-size.md) with `pre_cycle_sha = red_sha`. A full fix runs E2E before the push; a minor one skips it and declares `NO_APP_LOGIC_CHANGE` after Step 4's push. A lint or format fix that edits a source file is full. A Step 2.5 repair always runs the full suite.
43
43
 
44
44
  A fix that can't be made green locally is not pushed → Step 6.
45
45
 
46
46
  ### Step 4 — Commit + push
47
47
 
48
- Commit per the `fix(ci): <check> — <what>` convention ([`../_shared/pr-followup-helpers/reply-routing.md`](../_shared/pr-followup-helpers/reply-routing.md)). Push. Append the new SHA to `last_seen.pushed_shas`. **No PR replies** — the fix commit is the response.
48
+ Commit per the `fix(ci): <check> — <what>` convention ([`../_shared/pr-followup-helpers/reply-routing.md`](../_shared/pr-followup-helpers/reply-routing.md)). Push. Append the new SHA to `last_seen.pushed_shas`. Then finish the tail [`cycle-size.md`](cycle-size.md) picked: a full fix reposts the walkthrough (a Step 2.5 repair settles it there instead), a minor one declares the skip. **No PR replies** — the fix commit is the response.
49
49
 
50
50
  ### Step 5 — Update state + respawn
51
51
 
@@ -80,3 +80,14 @@ recommendation: SKIPPED — placeholder branch, no code under test
80
80
  ```
81
81
 
82
82
  `do/e2e-acceptance.md` Step 1.5 reads this and exits the stage cleanly with a SKIPPED verdict — do not silently run tests against master.
83
+
84
+ ## Output state — cycleSize (watcher-dispatched cycles)
85
+
86
+ When the caller passes `pre_cycle_sha` ([`cycle-size.md`](cycle-size.md)), also list the paths this cycle changed, committed or not: `git diff --name-only --no-renames <pre_cycle_sha>` for tracked files, plus `git ls-files --others --exclude-standard` for new ones. Emit:
87
+
88
+ ```
89
+ cycleFiles: [<path>, ...]
90
+ cycleSize: <minor | full>
91
+ ```
92
+
93
+ `minor` only when every path in `cycleFiles` is in the `NO_APP_LOGIC_CHANGE` path set defined in [`e2e-acceptance.md`](e2e-acceptance.md); otherwise `full`. The rest of this stage still runs against the default branch, so a full cycle's E2E routes from `pathClassification` as in a forward run.
@@ -1,6 +1,6 @@
1
1
  # Update PR — address-reviews mode
2
2
 
3
- Invoked by `/muggle-do`'s address-reviews orchestrator after stages 3–6 ran on the existing PR. The PR already exists; this stage pushes the branch, refreshes title/description if state changed, and posts a fresh walkthrough.
3
+ Invoked by `/muggle-do`'s address-reviews orchestrator after build, impact analysis, unit tests, and — for a full cycle — E2E ran on the existing PR. The PR already exists; this stage pushes the branch, refreshes title/description if state changed, and settles the walkthrough comment.
4
4
 
5
5
  Does **not** create a PR, seed session state, or dispatch a watcher (`/muggle-do` respawns the watcher at the end of its address-reviews cycle).
6
6
 
@@ -15,6 +15,7 @@ Does **not** create a PR, seed session state, or dispatch a watcher (`/muggle-do
15
15
  - Per-repo: path, branch (head ref name).
16
16
  - The existing PR URL + number from `~/.muggle-ai/muggle-do/sessions/<slug>/prs.json`.
17
17
  - **Optional** E2E acceptance report from stage 6. Produced by [`../e2e-acceptance.md`](../e2e-acceptance.md); schema in [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md).
18
+ - The cycle size and `pre_cycle_sha` per [`../cycle-size.md`](../cycle-size.md).
18
19
 
19
20
  ## Procedure
20
21
 
@@ -40,7 +41,9 @@ Resolve the provider once per [`../../_shared/vcs/detect-vcs.md`](../../_shared/
40
41
 
41
42
  4. **Refresh body when validation outcome changed** — only when the `## Validation` section's content differs from what's in the body. Use the `--body-file` form in [`../../_shared/vcs/github/pr-edit.md`](../../_shared/vcs/github/pr-edit.md). Preserve `## Goal` and `## Acceptance Criteria` verbatim. Re-stamp the signature: delete the existing block from the `<!-- muggle-works:signature -->` marker to the end, then append the editable-body signature (command `/muggle-do`) as the last thing in the body per [`../../_shared/vcs/post-signature.md`](../../_shared/vcs/post-signature.md) — this keeps exactly one signature across refreshes.
42
43
 
43
- 5. **Visual walkthrough comment** — only when an E2E report exists. Fire [`postPRVisualWalkthrough`](../../muggle-preferences/preference-gates/postPRVisualWalkthrough.md) (PR number from `prs.json`); on skip, record `skipped (gate)` and continue. Otherwise invoke [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) Mode A, which settles the PR's designated walkthrough comment in place — one walkthrough per PR, always reflecting the latest run.
44
+ 5. **Visual walkthrough comment.**
45
+ - **An E2E report exists** (a full cycle, or Step 0's verify gate ran E2E) — fire [`postPRVisualWalkthrough`](../../muggle-preferences/preference-gates/postPRVisualWalkthrough.md) (PR number from `prs.json`); on skip, record `skipped (gate)` and continue. Otherwise invoke [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) Mode A, which settles the PR's designated walkthrough comment in place — one walkthrough per PR, always reflecting the latest run.
46
+ - **No report, minor cycle** — declare the `NO_APP_LOGIC_CHANGE` skip per [`../cycle-size.md`](../cycle-size.md) Minor tail. Step 1's push has landed, so HEAD is what the PR carries; the accepted declaration settles the designated comment. A rejected one makes the cycle full: run [`../e2e-acceptance.md`](../e2e-acceptance.md) on the pushed head, then take the branch above.
44
47
 
45
48
  6. **Overflow comment** — same rule as forward mode: post when the walkthrough skill returns non-null `comment`, via [`../../_shared/vcs/github/top-level-comment.md`](../../_shared/vcs/github/top-level-comment.md). End the posted body with the signature line (command `/muggle-do`) per [`../../_shared/vcs/post-signature.md`](../../_shared/vcs/post-signature.md).
46
49
 
@@ -50,7 +53,7 @@ Return control to `/muggle-do`'s address-reviews orchestrator. The orchestrator
50
53
 
51
54
  ## Invariants
52
55
 
53
- - Branch synced with its base before the push, never after; push; new SHA appended to `pushed_shas`; title/body refreshed only on state change; walkthrough comment via Mode A.
56
+ - Branch synced with its base before the push, never after; push; new SHA appended to `pushed_shas`; title/body refreshed only on state change; walkthrough comment via Mode A, or via the `NO_APP_LOGIC_CHANGE` skip after the push for a minor cycle.
54
57
  - No `gh pr create`, no `/loop` dispatch.
55
58
 
56
59
  ## Output
@@ -59,5 +62,5 @@ Return control to `/muggle-do`'s address-reviews orchestrator. The orchestrator
59
62
  **PR updated:** URL (new SHA: `<short-sha>`)
60
63
  **Title refreshed:** yes | no
61
64
  **Body refreshed:** yes | no
62
- **Walkthrough comment:** posted | skipped (no report) | skipped (gate)
65
+ **Walkthrough comment:** posted | settled as skipped (`NO_APP_LOGIC_CHANGE`) | skipped (no report) | skipped (gate)
63
66
  **Overflow comment:** posted | skipped
@@ -33,11 +33,11 @@ Run the rebase from [`../_shared/sync-branch-with-base.md`](../_shared/sync-bran
33
33
 
34
34
  ### Step 3 — Verify the resolution
35
35
 
36
- Build (typecheck + lint on the changed surface) + unit suite must pass. Run E2E per [`e2e-acceptance.md`](e2e-acceptance.md) when app logic changed and the session carries validation context. A rebase that does not verify is rolled back → escalate per Step 5. **Never push an unverified rebase.**
36
+ Build (typecheck + lint on the changed surface) + unit suite must pass. Size the rebase per [`cycle-size.md`](cycle-size.md) with `pre_cycle_sha = rebase_sha` — the comparison spans everything the base brought in. A full rebase runs E2E per [`e2e-acceptance.md`](e2e-acceptance.md) before the push; a minor one skips it and declares `NO_APP_LOGIC_CHANGE` after Step 4's force-push. A rebase that does not verify is rolled back → escalate per Step 5. **Never push an unverified rebase.**
37
37
 
38
38
  ### Step 4 — Force-push + respawn
39
39
 
40
- Force-push per [`../_shared/vcs/common/push-to-branch.md`](../_shared/vcs/common/push-to-branch.md) (tool-agnostic instruction; handles the signing gate for rebased commits and directs to provider-specific force-push paths). Use `git push --force-with-lease` for the force operation. Append the new SHA to `last_seen.pushed_shas`; increment `last_seen.conflict_resolve_attempts[rebase_key]` **and** `last_seen.catch_up_rebases` — all whole-file rewrites (Read → change field → Write) per [`../_shared/session-state-writes.md`](../_shared/session-state-writes.md), never the Edit tool. The second counter is unkeyed on purpose: `rebase_key` carries the base tip, so it mints a fresh budget every time the base moves and cannot bound a PR on an active base. Increment it on every push here, including one that later escalates, or a branch that fails the same way twenty times reads as having spent nothing. Respawn the watcher per [`respawn-watcher.md`](respawn-watcher.md). Its next tick re-checks the branch against its base on the new head — the rebase is its own verify loop, bounded by the per-SHA attempt budget.
40
+ Force-push per [`../_shared/vcs/common/push-to-branch.md`](../_shared/vcs/common/push-to-branch.md) (tool-agnostic instruction; handles the signing gate for rebased commits and directs to provider-specific force-push paths). Use `git push --force-with-lease` for the force operation. Append the new SHA to `last_seen.pushed_shas`; increment `last_seen.conflict_resolve_attempts[rebase_key]` **and** `last_seen.catch_up_rebases` — all whole-file rewrites (Read → change field → Write) per [`../_shared/session-state-writes.md`](../_shared/session-state-writes.md), never the Edit tool. The second counter is unkeyed on purpose: `rebase_key` carries the base tip, so it mints a fresh budget every time the base moves and cannot bound a PR on an active base. Increment it on every push here, including one that later escalates, or a branch that fails the same way twenty times reads as having spent nothing. Finish the tail [`cycle-size.md`](cycle-size.md) picked — a full rebase reposts the walkthrough, a minor one declares the skip — then respawn the watcher per [`respawn-watcher.md`](respawn-watcher.md). Its next tick re-checks the branch against its base on the new head — the rebase is its own verify loop, bounded by the per-SHA attempt budget.
41
41
 
42
42
  ### Step 5 — Escalate (can't resolve / budget spent)
43
43
 
@@ -72,13 +72,14 @@ The SHAs are what the run tested. A result is only valid for the PRs at those SH
72
72
 
73
73
  When the watcher dispatches an address-reviews or fix-ci cycle on one PR whose `state.md` records `Wave: on`:
74
74
 
75
- - Stage 6 re-runs the wave E2E, with every sibling's service started from its PR's current head — not from the default branch. Fetch each sibling's head into its recorded worktree first.
75
+ - A full cycle ([`cycle-size.md`](cycle-size.md)) re-runs the wave E2E in Stage 6, with every sibling's service started from its PR's current head — not from the default branch. Fetch each sibling's head into its recorded worktree first.
76
76
  - Post the new result to the PR under review and refresh each sibling's walkthrough too, since the run tested them together and the earlier result on the siblings is now stale.
77
+ - A minor cycle runs no E2E. Its `NO_APP_LOGIC_CHANGE` skip settles only the PR under review, with the wave's last run kept beneath it, and the siblings' walkthroughs stay as they are: no app logic changed, so that run still describes the whole wave.
77
78
  - A sibling already merged or closed leaves the wave: test against the base branch for that repo, and drop it from the `## Wave` section on the next refresh.
78
79
 
79
80
  ## Invariants
80
81
 
81
- - One E2E run per wave cycle; never one per repo.
82
+ - One E2E run per full wave cycle, none for a minor one; never one per repo.
82
83
  - Every wave service starts from its member's worktree, verified by process cwd — a listening port proves nothing about the branch.
83
84
  - Every wave PR carries the same walkthrough, the same E2E title prefix, and a `## Wave` section naming its siblings.
84
85
  - Not a wave → each PR runs Stage 6 alone, with the reason recorded.
@@ -49,14 +49,14 @@ Do not create or update a PR until each line holds, or is waived by a one-line r
49
49
  - Build clean — typecheck + lint on changed files
50
50
  - New/changed logic carries unit tests (authored in Stage 3; Stage 5 only runs the suite)
51
51
  - Unit suite run, PASS recorded
52
- - E2E verdict recorded with `runId` per `autoE2ETest` — or `[E2E FAILING]`, or `SKIPPED` citing one of the verified skip codes (`NO_WEB_SURFACE`, `DEV_SERVER_UNREACHABLE`, `EMPTY_DIFF`, `MUGGLE_AUTH_DOWN`, `NO_PR`, `USER_WAIVED`). Free-text reasons are rejected by the gate
52
+ - E2E verdict recorded with `runId` per `autoE2ETest` — or `[E2E FAILING]`, or `SKIPPED` citing a verified skip code from [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md), where each code's verification rule lives. Free-text reasons are rejected by the gate
53
53
  - UI changes verified in a real browser with evidence (screenshot path or muggle `runId`); `curl` + `grep` is not verification
54
54
 
55
55
  Opening a PR with an unchecked, unwaived line is a cycle failure.
56
56
 
57
57
  ## Address-reviews flow
58
58
 
59
- When invoked with the directive (PR URL + slug + review ids), routes to [`../do/address-reviews.md`](../do/address-reviews.md). Shares stages 3–6 + walkthrough with the forward pipeline; skips pre-flight, requirements, and PR creation. See the orchestrator for the cycle's exact step order, classification rules, and respawn logic.
59
+ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/address-reviews.md`](../do/address-reviews.md). Shares stages 3–5 with the forward pipeline, then sizes the cycle from its diff per [`../do/cycle-size.md`](../do/cycle-size.md): a full cycle adds stage 6 and a fresh walkthrough, a minor one skips E2E under a verified `NO_APP_LOGIC_CHANGE`. Skips pre-flight, requirements, and PR creation. See the orchestrator for the cycle's exact step order, classification rules, and respawn logic.
60
60
 
61
61
  ## Input routing
62
62
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-165-1",
4
- "commitSha": "fa635b5527d06b43ea581bd86ad96d940a6a2304",
5
- "buildTime": "2026-10-22T19:39:00Z",
3
+ "buildId": "run-166-1",
4
+ "commitSha": "1b8c88d9616829f6271384d1e46d7b84ed59ec56",
5
+ "buildTime": "2026-10-22T20:10:32Z",
6
6
  "serviceName": "muggle-ai-works-mcp"
7
7
  }
@@ -1 +1 @@
1
- export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-YVR2MCR2.js';
1
+ export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-CUL7GQDB.js';