@muggleai/works 5.32.0-staging.284 → 5.32.0-staging.286

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 (68) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-4RAKCQ6C.js → chunk-AEJM2CBK.js} +14 -6
  3. package/dist/{chunk-6R5MFNNH.js → chunk-TM6IZEKH.js} +8 -5
  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-mcp.json +1 -1
  8. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  9. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  10. package/dist/plugin/.mcp.json +1 -1
  11. package/dist/plugin/scripts/pr-watch-arm.sh +10 -2
  12. package/dist/plugin/scripts/pr-watch-events.sh +14 -1
  13. package/dist/plugin/scripts/pr-watch-fetch.sh +1 -0
  14. package/dist/plugin/scripts/pr-watch-floors.sh +21 -8
  15. package/dist/plugin/scripts/pr-watch-loop.sh +16 -1
  16. package/dist/plugin/scripts/pr-watch-state.jq +26 -2
  17. package/dist/plugin/scripts/pr-watch-verdict.mjs +6 -1
  18. package/dist/plugin/skills/_shared/pr-followup-helpers/classify.md +12 -0
  19. package/dist/plugin/skills/_shared/pr-followup-helpers/echo-skip.md +1 -0
  20. package/dist/plugin/skills/_shared/session-state-writes.md +1 -1
  21. package/dist/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +1 -1
  22. package/dist/plugin/skills/_shared/vcs/github/conversation-comments.md +22 -0
  23. package/dist/plugin/skills/_shared/vcs/github/top-level-comment.md +2 -2
  24. package/dist/plugin/skills/_shared/vcs/github.md +1 -0
  25. package/dist/plugin/skills/do/address-reviews.md +20 -12
  26. package/dist/plugin/skills/do/input-routing.md +1 -1
  27. package/dist/plugin/skills/do/open-prs/forward.md +1 -1
  28. package/dist/plugin/skills/do/per-comment-replies.md +8 -1
  29. package/dist/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
  30. package/dist/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -5
  31. package/dist/plugin/skills/muggle-pr-followup/auto-track.md +1 -1
  32. package/dist/plugin/skills/muggle-pr-followup/bootstrap.md +3 -1
  33. package/dist/plugin/skills/muggle-pr-followup/contract.md +8 -4
  34. package/dist/plugin/skills/muggle-pr-followup/output-templates/inline-reply.md +12 -0
  35. package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +7 -2
  36. package/dist/release-manifest.json +3 -3
  37. package/dist/{src-XH2JOAWO.js → src-KNX6CG4Z.js} +1 -1
  38. package/package.json +1 -1
  39. package/plugin/.claude-plugin/plugin.json +1 -1
  40. package/plugin/.codex-mcp.json +1 -1
  41. package/plugin/.codex-plugin/plugin.json +1 -1
  42. package/plugin/.cursor-plugin/plugin.json +1 -1
  43. package/plugin/.mcp.json +1 -1
  44. package/plugin/scripts/pr-watch-arm.sh +10 -2
  45. package/plugin/scripts/pr-watch-events.sh +14 -1
  46. package/plugin/scripts/pr-watch-fetch.sh +1 -0
  47. package/plugin/scripts/pr-watch-floors.sh +21 -8
  48. package/plugin/scripts/pr-watch-loop.sh +16 -1
  49. package/plugin/scripts/pr-watch-state.jq +26 -2
  50. package/plugin/scripts/pr-watch-verdict.mjs +6 -1
  51. package/plugin/skills/_shared/pr-followup-helpers/classify.md +12 -0
  52. package/plugin/skills/_shared/pr-followup-helpers/echo-skip.md +1 -0
  53. package/plugin/skills/_shared/session-state-writes.md +1 -1
  54. package/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +1 -1
  55. package/plugin/skills/_shared/vcs/github/conversation-comments.md +22 -0
  56. package/plugin/skills/_shared/vcs/github/top-level-comment.md +2 -2
  57. package/plugin/skills/_shared/vcs/github.md +1 -0
  58. package/plugin/skills/do/address-reviews.md +20 -12
  59. package/plugin/skills/do/input-routing.md +1 -1
  60. package/plugin/skills/do/open-prs/forward.md +1 -1
  61. package/plugin/skills/do/per-comment-replies.md +8 -1
  62. package/plugin/skills/muggle-pr-followup/SKILL.md +1 -1
  63. package/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -5
  64. package/plugin/skills/muggle-pr-followup/auto-track.md +1 -1
  65. package/plugin/skills/muggle-pr-followup/bootstrap.md +3 -1
  66. package/plugin/skills/muggle-pr-followup/contract.md +8 -4
  67. package/plugin/skills/muggle-pr-followup/output-templates/inline-reply.md +12 -0
  68. package/plugin/skills/muggle-pr-followup/state-schemas.md +7 -2
@@ -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.32.0-staging.284"
12
+ "version": "5.32.0-staging.286"
13
13
  }
14
14
  ]
15
15
  }
@@ -6994,12 +6994,19 @@ var ProjectTestRunsSummaryInputSchema = z.object({
6994
6994
  var ReportStatsSummaryInputSchema = z.object({
6995
6995
  projectId: IdSchema.describe("Project ID (UUID) to get report stats for")
6996
6996
  });
6997
+ var UtcDateKeySchema = z.string().regex(/^\d{2}-\d{2}-\d{4}$/, "Date key must be MM-DD-YYYY");
6997
6998
  var ReportCostQueryInputSchema = z.object({
6998
6999
  projectId: IdSchema.describe("Project ID (UUID)"),
6999
- startDateKey: z.string().optional().describe("Start date key (YYYYMMDD)"),
7000
- endDateKey: z.string().optional().describe("End date key (YYYYMMDD)"),
7001
- filterType: TokenUsageFilterTypeSchema.optional().describe("Aggregation dimension for cost breakdown"),
7002
- filterIds: z.array(IdSchema).optional().describe("Entity UUIDs matching filterType (project / use case / test case / test script / action script)")
7000
+ startDateKey: UtcDateKeySchema.optional().describe(
7001
+ "Inclusive start day, UTC, MM-DD-YYYY. Provide with endDateKey, or omit both for all time."
7002
+ ),
7003
+ endDateKey: UtcDateKeySchema.optional().describe(
7004
+ "Inclusive end day, UTC, MM-DD-YYYY. Provide with startDateKey, or omit both for all time."
7005
+ ),
7006
+ filterType: TokenUsageFilterTypeSchema.describe("Aggregation dimension for cost breakdown"),
7007
+ filterIds: z.array(IdSchema).min(1).describe(
7008
+ "Entity UUIDs matching filterType (project / use case / test case / test script / action script). For the whole project, pass filterType 'project' and the project ID."
7009
+ )
7003
7010
  });
7004
7011
  var ReportPreferencesUpsertInputSchema = z.object({
7005
7012
  projectId: IdSchema.describe("Project ID (UUID)"),
@@ -8965,7 +8972,7 @@ var reportTools = [
8965
8972
  },
8966
8973
  {
8967
8974
  name: "muggle-remote-report-stats-summary-get",
8968
- description: "Get report statistics summary for a project.",
8975
+ description: "Get report statistics summary for a project: key metrics, completeness, complexity, and costAnalysis \u2014 all-time token spend in USD with a breakdown by testing stage, by model (input/output/cache tokens), and by highest-cost test case. costAnalysis is absent when the project has no token spend.",
8969
8976
  inputSchema: ReportStatsSummaryInputSchema,
8970
8977
  mapToUpstream: (input) => {
8971
8978
  const toolInput = input;
@@ -8978,7 +8985,7 @@ var reportTools = [
8978
8985
  },
8979
8986
  {
8980
8987
  name: "muggle-remote-report-cost-query",
8981
- description: "Query cost/usage data for a project over a date range.",
8988
+ description: "Query token cost for entities of a project, optionally over a UTC date range. Returns totalsById (tokens and USD per filter ID) and breakdownById (per filter ID: spend by testing stage, by model with input/output/cache tokens, and by test case).",
8982
8989
  inputSchema: ReportCostQueryInputSchema,
8983
8990
  mapToUpstream: (input) => {
8984
8991
  const toolInput = input;
@@ -11126,6 +11133,7 @@ __export(e2e_exports2, {
11126
11133
  UserFeedbackListInputSchema: () => UserFeedbackListInputSchema,
11127
11134
  UserFeedbackTargetSchema: () => UserFeedbackTargetSchema,
11128
11135
  UserFeedbackTargetTypeSchema: () => UserFeedbackTargetTypeSchema,
11136
+ UtcDateKeySchema: () => UtcDateKeySchema,
11129
11137
  WalletAutoTopUpSetPaymentMethodInputSchema: () => WalletAutoTopUpSetPaymentMethodInputSchema,
11130
11138
  WalletAutoTopUpUpdateInputSchema: () => WalletAutoTopUpUpdateInputSchema,
11131
11139
  WalletPaymentMethodCreateSetupSessionInputSchema: () => WalletPaymentMethodCreateSetupSessionInputSchema,
@@ -1,4 +1,4 @@
1
- import { __export, getLogger, TelemetryEnvironment, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, LlmSource, applyLlmSourceSelection, describeStackMismatch, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl, local_exports } from './chunk-4RAKCQ6C.js';
1
+ import { __export, getLogger, TelemetryEnvironment, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, LlmSource, applyLlmSourceSelection, describeStackMismatch, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl, local_exports } from './chunk-AEJM2CBK.js';
2
2
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js';
4
4
  import { v4 } from 'uuid';
@@ -1165,7 +1165,7 @@ async function resolveGsScreenshotUrls(report, opts) {
1165
1165
  if (gsUrls.length === 0) {
1166
1166
  return report;
1167
1167
  }
1168
- const mcps = await import('./src-XH2JOAWO.js');
1168
+ const mcps = await import('./src-KNX6CG4Z.js');
1169
1169
  const credentials = await mcps.getCallerCredentialsAsync();
1170
1170
  if (!credentials.bearerToken && !credentials.apiKey) {
1171
1171
  stderrWrite(
@@ -5314,6 +5314,11 @@ function isRebaseKeyEscalated(lastSeenEntry, rebaseKey) {
5314
5314
  function isCiHeadEscalated(lastSeenEntry, headSha) {
5315
5315
  return (lastSeenEntry.ci_escalated_shas ?? []).includes(headSha) && isCiHeadAttempted(lastSeenEntry, headSha);
5316
5316
  }
5317
+ function hasEscalatedReviewFeedback(lastSeenEntry) {
5318
+ return [lastSeenEntry.escalated_review_ids, lastSeenEntry.escalated_conversation_comment_ids].some(
5319
+ (escalatedIds) => Array.isArray(escalatedIds) && escalatedIds.length > 0
5320
+ );
5321
+ }
5317
5322
  function readSlotText(filePath) {
5318
5323
  try {
5319
5324
  return readFileSync(filePath, "utf-8");
@@ -5361,9 +5366,7 @@ function resolveOwnerEscalation(lastSeenJson, followupLogLines, pr, headSha) {
5361
5366
  );
5362
5367
  if (isConflictEscalated) kinds.push("conflict" /* Conflict */);
5363
5368
  }
5364
- if (Array.isArray(lastSeenEntry.escalated_review_ids) && lastSeenEntry.escalated_review_ids.length > 0) {
5365
- kinds.push("reviews" /* Reviews */);
5366
- }
5369
+ if (hasEscalatedReviewFeedback(lastSeenEntry)) kinds.push("reviews" /* Reviews */);
5367
5370
  if (kinds.length === 0) return void 0;
5368
5371
  const note = latestEscalationNote(followupLogLines, pr.number);
5369
5372
  return note === void 0 ? { kinds } : { kinds, note };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-6R5MFNNH.js';
3
- import './chunk-4RAKCQ6C.js';
2
+ import { runCli } from './chunk-TM6IZEKH.js';
3
+ import './chunk-AEJM2CBK.js';
4
4
 
5
5
  // src/cli/main.ts
6
6
  runCli().catch((error) => {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-6R5MFNNH.js';
2
- export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-4RAKCQ6C.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-TM6IZEKH.js';
2
+ export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-AEJM2CBK.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.32.0-staging.284",
4
+ "version": "5.32.0-staging.286",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.32.0-staging.284",
7
+ "@muggleai/works@5.32.0-staging.286",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.32.0-staging.284",
3
+ "version": "5.32.0-staging.286",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.32.0-staging.284",
5
+ "version": "5.32.0-staging.286",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.32.0-staging.284",
7
+ "@muggleai/works@5.32.0-staging.286",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -80,6 +80,7 @@ unresolved_threads="${STATE_FIELDS[6]-}"
80
80
  pending_checks="${STATE_FIELDS[7]-}"
81
81
  failed_checks="${STATE_FIELDS[8]-}"
82
82
  ci_red_key="$(watch_ci_red_key "$head_sha" "${STATE_FIELDS[10]-}")"
83
+ latest_conversation="${STATE_FIELDS[11]-}"
83
84
 
84
85
  if [ "$pr_state" = "MERGED" ] || [ "$pr_state" = "CLOSED" ]; then
85
86
  echo "TERMINAL pr=$pr_number state=$pr_state — nothing to arm"
@@ -145,7 +146,7 @@ thread_count=0
145
146
  # Unattempted work is left unfloored, so the loop's first poll reports it and
146
147
  # exits — that report is the wake.
147
148
  echo "DRAIN pr=$pr_number state=$pr_state head=${head_sha:0:8}"
148
- echo "DRAIN unresolved-threads=$thread_count latest-review=${latest_review:-0} latest-comment=${latest_comment:-0}"
149
+ echo "DRAIN unresolved-threads=$thread_count latest-review=${latest_review:-0} latest-comment=${latest_comment:-0} latest-conversation-comment=${latest_conversation:-0}"
149
150
  echo "DRAIN checks pending=${pending_checks:-0} failed=${failed_checks:-0} behind-base=${behind_count:-unknown} mergeable=${mergeable:-UNKNOWN}"
150
151
  if [ -n "$ci_red_head" ]; then
151
152
  if [ -n "$ci_red_floor" ]; then
@@ -164,17 +165,23 @@ if [ -n "$rebase_due_key" ]; then
164
165
  fi
165
166
  fi
166
167
 
167
- # A re-arm carries the review, comment and thread floors forward. The session
168
+ # A re-arm carries the review, comment, conversation and thread floors forward. The session
168
169
  # advanced them past what it handled, so anything newer — a review landing
169
170
  # between its last tick's read and this one — is above them, and the loop's
170
171
  # first poll reports it. Seeding them from this read would floor that review
171
172
  # unseen. Only a first arm, with nothing handled yet, takes them from its read.
172
173
  review_floor="${latest_review:-0}"
173
174
  comment_floor="${latest_comment:-0}"
175
+ conversation_floor="${latest_conversation:-0}"
174
176
  threads_floor="$unresolved_threads"
175
177
  if [ -f "${slot}/watch-watermark.env" ]; then
176
178
  review_floor="$(watch_read_slot_value "$slot" watch-watermark.env REV)"
177
179
  comment_floor="$(watch_read_slot_value "$slot" watch-watermark.env COM)"
180
+ # A watermark from before conversation comments were watched has no floor
181
+ # to carry, so this drain's read is the first one it gets.
182
+ if watch_slot_has_key "$slot" watch-watermark.env CONV; then
183
+ conversation_floor="$(watch_read_slot_value "$slot" watch-watermark.env CONV)"
184
+ fi
178
185
  threads_floor="$(watch_threads_still_unresolved \
179
186
  "$(watch_read_slot_value "$slot" watch-watermark.env THREADS)" "$unresolved_threads")"
180
187
  fi
@@ -182,6 +189,7 @@ fi
182
189
  {
183
190
  printf 'REV=%s\n' "${review_floor:-0}"
184
191
  printf 'COM=%s\n' "${comment_floor:-0}"
192
+ printf 'CONV=%s\n' "${conversation_floor:-0}"
185
193
  printf 'THREADS="%s"\n' "$threads_floor"
186
194
  printf 'CIRED="%s"\n' "$ci_red_floor"
187
195
  printf 'REBASED="%s"\n' "$rebase_floor"
@@ -27,8 +27,11 @@
27
27
  # unresolved_threads and fires a thread wake for a PR with no threads, while the
28
28
  # check digest lands in failed_checks and leaves red-CI detection reading a
29
29
  # string where it expects a count. awk with an explicit FS does not collapse.
30
+ #
31
+ # A CRLF-terminated projection (jq on Windows) would leave a carriage return on
32
+ # the last field, which is numeric and would then fail every comparison.
30
33
  watch_split_state() {
31
- printf '%s\n' "$1" | awk -F'\t' '{for (i = 1; i <= NF; i++) print $i}'
34
+ printf '%s\n' "$1" | awk -F'\t' '{sub(/\r$/, ""); for (i = 1; i <= NF; i++) print $i}'
32
35
  }
33
36
 
34
37
  # Loads a state line's fields into the array STATE_FIELDS, empty fields kept.
@@ -59,6 +62,16 @@ watch_wake_comment() {
59
62
  echo "EVENT pr=$pr new thread comment id=$latest"
60
63
  }
61
64
 
65
+ # A top-level PR comment (the Conversation tab) newer than the floor. The
66
+ # projection already dropped muggle's own posts and bot authors, so whatever is
67
+ # left is a human's. Issue-comment ids are monotonic like the two above, but a
68
+ # sequence of their own, hence a floor of their own.
69
+ watch_wake_conversation_comment() {
70
+ local pr="$1" latest="$2" floor="$3"
71
+ [ "${latest:-0}" -gt "${floor:-0}" ] 2>/dev/null || return 1
72
+ echo "EVENT pr=$pr new conversation comment id=$latest"
73
+ }
74
+
62
75
  # A thread that is unresolved and not already known to be. `known` is the
63
76
  # semicolon-joined THREADS floor; membership is the test, not ordering, because
64
77
  # thread ids are opaque strings rather than a monotonic sequence.
@@ -42,6 +42,7 @@ query($owner: String!, $name: String!, $number: Int!) {
42
42
  comments(last: 1) { nodes { databaseId body pullRequestReview { databaseId state } } }
43
43
  }
44
44
  }
45
+ comments(last: 50) { nodes { databaseId body createdAt author { __typename login } } }
45
46
  }
46
47
  }
47
48
  }' --jq "$state_projection" 2>>"${slot}/watch-fetch.log"
@@ -33,15 +33,28 @@ watch_read_slot_value() {
33
33
  printf '%s' "$value"
34
34
  }
35
35
 
36
- # Writes <slot>/watch-reported.env: the newest review and comment ids and the
37
- # unresolved threads a loop's last poll saw — every one of them either reported
38
- # or already floored — and the red head, rebase key and blocked digest it
39
- # reported, with the block (`blocked_for`, that block's watermark digest) the
40
- # digest was reported under.
36
+ # True when the slot file carries `key` at all, empty or not. Tells a floor
37
+ # written as zero from one a watch armed before that floor existed never wrote.
38
+ watch_slot_has_key() {
39
+ local slot="$1" file_name="$2" key="$3" line
40
+ [ -f "${slot}/${file_name}" ] || return 1
41
+ while IFS= read -r line || [ -n "$line" ]; do
42
+ case "$line" in
43
+ "${key}="*) return 0 ;;
44
+ esac
45
+ done < "${slot}/${file_name}"
46
+ return 1
47
+ }
48
+
49
+ # Writes <slot>/watch-reported.env: the newest review, thread-comment and
50
+ # conversation-comment ids and the unresolved threads a loop's last poll saw —
51
+ # every one of them either reported or already floored — and the red head,
52
+ # rebase key and blocked digest it reported, with the block (`blocked_for`, that
53
+ # block's watermark digest) the digest was reported under.
41
54
  watch_record_reported() {
42
- local slot="$1" review="$2" comment="$3" threads="$4" ci_red="$5" rebase="$6" blocked_digest="$7" blocked_for="$8"
43
- printf 'REV=%s\nCOM=%s\nTHREADS="%s"\nCIRED="%s"\nREBASED="%s"\nBLOCKED_CIDIGEST="%s"\nBLOCKED_FOR="%s"\n' \
44
- "$review" "$comment" "$threads" "$ci_red" "$rebase" "$blocked_digest" "$blocked_for" \
55
+ local slot="$1" review="$2" comment="$3" conversation="$4" threads="$5" ci_red="$6" rebase="$7" blocked_digest="$8" blocked_for="$9"
56
+ printf 'REV=%s\nCOM=%s\nCONV=%s\nTHREADS="%s"\nCIRED="%s"\nREBASED="%s"\nBLOCKED_CIDIGEST="%s"\nBLOCKED_FOR="%s"\n' \
57
+ "$review" "$comment" "$conversation" "$threads" "$ci_red" "$rebase" "$blocked_digest" "$blocked_for" \
45
58
  > "${slot}/${MUGGLE_PR_WATCH_REPORTED_FILE}"
46
59
  }
47
60
 
@@ -95,6 +95,7 @@ read_reported() {
95
95
  }
96
96
  reported_review=$(read_reported REV)
97
97
  reported_comment=$(read_reported COM)
98
+ reported_conversation=$(read_reported CONV)
98
99
  reported_threads=$(read_reported THREADS)
99
100
  floor_ci_red=$(read_reported CIRED)
100
101
  floor_rebase=$(read_reported REBASED)
@@ -154,6 +155,7 @@ while :; do
154
155
 
155
156
  watermark_review=$(read_watermark REV)
156
157
  watermark_comment=$(read_watermark COM)
158
+ watermark_conversation=$(read_watermark CONV)
157
159
  watermark_threads=$(read_watermark THREADS)
158
160
  watermark_ci_red=$(read_watermark CIRED)
159
161
  watermark_rebase=$(read_watermark REBASED)
@@ -188,6 +190,7 @@ while :; do
188
190
  failed_checks="${STATE_FIELDS[8]-}"
189
191
  ci_digest="${STATE_FIELDS[9]-}"
190
192
  ci_red_key="$(watch_ci_red_key "$head_sha" "${STATE_FIELDS[10]-}")"
193
+ latest_conversation="${STATE_FIELDS[11]-}"
191
194
 
192
195
  if [ "$pr_state" = "MERGED" ] || [ "$pr_state" = "CLOSED" ]; then
193
196
  echo "TERMINAL pr=$pr_number state=$pr_state"
@@ -209,6 +212,17 @@ while :; do
209
212
  watch_wake_review "$pr_number" "$latest_review" "$(higher_id "$watermark_review" "$reported_review")" && has_reported=1
210
213
  watch_wake_comment "$pr_number" "$latest_comment" "$(higher_id "$watermark_comment" "$reported_comment")" && has_reported=1
211
214
 
215
+ # A watermark armed before conversation comments were watched has no CONV
216
+ # floor, and reading that as zero would report every human comment the PR
217
+ # ever had. Such a slot floors at this loop's first read until a re-arm
218
+ # seeds the key from its drain.
219
+ if ! watch_slot_has_key "$slot" watch-watermark.env CONV; then
220
+ legacy_conversation_floor="${legacy_conversation_floor:-${latest_conversation:-0}}"
221
+ watermark_conversation="$legacy_conversation_floor"
222
+ fi
223
+ watch_wake_conversation_comment "$pr_number" "$latest_conversation" \
224
+ "$(higher_id "$watermark_conversation" "$reported_conversation")" && has_reported=1
225
+
212
226
  if [ -n "$unresolved_threads" ]; then
213
227
  IFS=';' read -ra thread_ids <<< "$unresolved_threads"
214
228
  for thread_id in "${thread_ids[@]}"; do
@@ -265,7 +279,8 @@ while :; do
265
279
 
266
280
  if [ -n "$has_reported" ]; then
267
281
  watch_record_reported "$slot" "$(higher_id "$latest_review" "$reported_review")" \
268
- "$(higher_id "$latest_comment" "$reported_comment")" "$unresolved_threads" \
282
+ "$(higher_id "$latest_comment" "$reported_comment")" \
283
+ "$(higher_id "$latest_conversation" "$reported_conversation")" "$unresolved_threads" \
269
284
  "$floor_ci_red" "$floor_rebase" "$floor_blocked_digest" "$floor_blocked_for"
270
285
  exit 0
271
286
  fi
@@ -6,7 +6,7 @@
6
6
  # Field order is the contract pr-watch-loop.sh reads positionally:
7
7
  # state, headRefOid, base-tip, mergeable, latest-review, latest-comment,
8
8
  # unresolved-thread-ids, pending-checks, failed-checks, check-digest,
9
- # red-check-runs
9
+ # red-check-runs, latest-conversation-comment
10
10
  #
11
11
  # red-check-runs names each failed check with its run id (`name#id`, sorted).
12
12
  # A settle, a rerun or a comment-triggered re-check publishes a new run on the
@@ -19,9 +19,32 @@
19
19
  # from it stays equal to an escalated or floored key however far the base
20
20
  # advances, and the branch never wakes again. A deleted base branch projects as
21
21
  # an empty field rather than a missing one, so no later field shifts.
22
+ #
23
+ # latest-conversation-comment is the newest top-level PR comment (the
24
+ # Conversation tab) a human wrote. Last, so every earlier reader keeps its index.
22
25
 
23
26
  def loop_marked: ((.body // "") | contains("<!-- muggle-do:bot -->"));
24
27
 
28
+ # A body without its `>` quote lines. GitHub's quote-reply copies the quoted
29
+ # text's markdown, so a human answering one of muggle's posts carries muggle's
30
+ # visible signature inside the quote.
31
+ def unquoted_body: (.body // "") | split("\n") | map(select(test("^ *>") | not)) | join("\n");
32
+
33
+ # Anything muggle posts on the Conversation tab: loop replies and reminders,
34
+ # walkthrough and PR sections (each opens with a `<!-- muggle-` marker), and
35
+ # plain-signed notices, which carry only the visible signature link.
36
+ def muggle_posted:
37
+ loop_marked
38
+ or (unquoted_body | contains("<!-- muggle-"))
39
+ or (unquoted_body | contains("[Muggle Works](https://github.com/multiplex-ai/muggle-ai-works)"));
40
+
41
+ # GraphQL names a GitHub App by its bare login (`github-actions`) and types it
42
+ # Bot; the `[bot]` suffix is the REST spelling, kept for any author that has it.
43
+ def bot_authored:
44
+ (.author.__typename // "") == "Bot"
45
+ or ((.author.login // "") | endswith("[bot]"))
46
+ or (.author.login // "") == "github-actions";
47
+
25
48
  .data.repository.pullRequest as $pr
26
49
  | (($pr.commits.nodes[0].commit.statusCheckRollup.contexts.nodes) // []) as $contexts
27
50
  | ($contexts | map(
@@ -64,5 +87,6 @@ def loop_marked: ((.body // "") | contains("<!-- muggle-do:bot -->"));
64
87
  ($checks | map(select(.verdict == "PENDING")) | length),
65
88
  ($failedChecks | length),
66
89
  ($checks | sort_by(.name) | map(.name + ":" + .verdict) | join(",")),
67
- ($failedChecks | map(.name + "#" + (.runId | tostring)) | sort | join(","))
90
+ ($failedChecks | map(.name + "#" + (.runId | tostring)) | sort | join(",")),
91
+ ((($pr.comments.nodes // []) | map(select((muggle_posted | not) and (bot_authored | not)) | .databaseId) | max) // 0)
68
92
  ] | @tsv
@@ -60,6 +60,11 @@ function isRebaseBudgetExhausted(lastSeenEntry, maxCatchUpRebases) {
60
60
  const catchUpRebases = lastSeenEntry.catch_up_rebases;
61
61
  return maxCatchUpRebases !== null && typeof catchUpRebases === "number" && catchUpRebases >= maxCatchUpRebases;
62
62
  }
63
+ function hasEscalatedReviewFeedback(lastSeenEntry) {
64
+ return [lastSeenEntry.escalated_review_ids, lastSeenEntry.escalated_conversation_comment_ids].some(
65
+ (escalatedIds) => Array.isArray(escalatedIds) && escalatedIds.length > 0
66
+ );
67
+ }
63
68
 
64
69
  // src/pr-watch/armFloors.ts
65
70
  function resolveArmFloorEvidence(lastSeenEntry, headSha, rebaseKey, maxCatchUpRebases) {
@@ -114,7 +119,7 @@ function resolveWatchTickVerdict(lastSeenEntry, observation, preferences) {
114
119
  if (isRebaseKeyEscalated(lastSeenEntry, rebaseKey)) return "block-conflict-escalated" /* BlockConflictEscalated */;
115
120
  const isRedHeadOutOfAttempts = observation.ciBucket === "red" /* Red */ && isCiHeadBudgetSpent(lastSeenEntry, headSha);
116
121
  if (isCiHeadEscalated(lastSeenEntry, headSha) || isRedHeadOutOfAttempts) return "block-ci-escalated" /* BlockCiEscalated */;
117
- if ((lastSeenEntry.escalated_review_ids ?? []).length > 0) return "block-reviews-escalated" /* BlockReviewsEscalated */;
122
+ if (hasEscalatedReviewFeedback(lastSeenEntry)) return "block-reviews-escalated" /* BlockReviewsEscalated */;
118
123
  return "idle" /* Idle */;
119
124
  }
120
125
 
@@ -55,6 +55,18 @@ Reply shape (all replies for one review reference the same SHA):
55
55
 
56
56
  Escalate per the caller's procedure (add the review id to `escalated_review_ids`, emit one terminal message, pause the PR).
57
57
 
58
+ ## Conversation comments
59
+
60
+ A top-level PR comment (Conversation tab) is classified on its own, as a body-only review is, with one extra class. The Conversation tab carries talk that asks nothing of the PR, and escalating it would pause the PR over a "thanks".
61
+
62
+ | Class | Signal | Action |
63
+ | :---- | :----- | :----- |
64
+ | **actionable** | Same as a review: a concrete change or an answerable question about the PR. | Address in the round; reply with one top-level comment that quotes and links it. |
65
+ | **informational** | Asks nothing: thanks, LGTM, a status or merge-timing note, an exchange between other people. | No reply, no escalation; folded into `lastConversationCommentId`. |
66
+ | **ambiguous** | Addresses the PR but carries no actionable signal (the ambiguous table above). | Escalate: add the id to `escalated_conversation_comment_ids`. |
67
+
68
+ The self-loop pre-check does not apply: the watcher already drops every comment muggle posted, so none reaches classification.
69
+
58
70
  ## Borderline rule
59
71
 
60
72
  If you can paraphrase the review's intent as **"do X"** (X concrete) → actionable. Pick the best interpretation; dispatch.
@@ -6,5 +6,6 @@ Under the thread-state dispatch trigger this is **intrinsic** — there is no "a
6
6
 
7
7
  - **Line-comment threads.** A thread is actionable only when its newest comment lacks the loop marker `<!-- muggle-do:bot -->` (see [`loop-signature.md`](loop-signature.md)). After the loop replies, the newest comment is the loop's own and carries the marker, so the thread drops out of the actionable set on its own.
8
8
  - **Body-only reviews.** A loop reply always carries a line comment, so it is never body-only; the body-only check (no line comments, `id > lastBodyReviewId` — see [`../vcs/github/submitted-reviews.md`](../vcs/github/submitted-reviews.md)) excludes echoes structurally.
9
+ - **Conversation comments.** The loop answers a top-level PR comment with a top-level comment of its own, signed `--mode loop`. The watch's projection ([`../../../scripts/pr-watch-state.jq`](../../../scripts/pr-watch-state.jq)) drops every comment muggle posted — the loop marker, any other `<!-- muggle-` marker, or the visible signature outside a quote — and every bot author before taking the newest id, so the reply never lifts the conversation floor.
9
10
 
10
11
  Classify by the marker, never by `author.login` — under a shared account the loop posts as the PR author, so the login cannot tell echo from human.
@@ -18,5 +18,5 @@ If you script the rewrite instead of using the Write tool, any tool that replace
18
18
 
19
19
  ## Field map
20
20
 
21
- - `last_seen.json` — one object keyed by `"<owner>/<repo>#<n>"`. Mutate fields under that key: `idle_tick_count`, `cycles_completed` (counters), `last_pushed_sha`, `lastBodyReviewId` (scalars), `pushed_shas`, `escalated_review_ids`, `ci_escalated_shas`, `conflict_escalated_keys` (arrays), `ci_fix_attempts[<sha>]` (keyed by head SHA), `conflict_resolve_attempts[<head-sha>..<base-tip-sha>]` (keyed by the head/base-tip pair).
21
+ - `last_seen.json` — one object keyed by `"<owner>/<repo>#<n>"`. Mutate fields under that key: `idle_tick_count`, `cycles_completed` (counters), `last_pushed_sha`, `lastBodyReviewId`, `lastConversationCommentId` (scalars), `pushed_shas`, `escalated_review_ids`, `escalated_conversation_comment_ids`, `ci_escalated_shas`, `conflict_escalated_keys` (arrays), `ci_fix_attempts[<sha>]` (keyed by head SHA), `conflict_resolve_attempts[<head-sha>..<base-tip-sha>]` (keyed by the head/base-tip pair).
22
22
  - `prs.json` — a one-element array. Mutate `[0]`: `head_sha`, `state`.
@@ -24,7 +24,7 @@ One per watcher iteration (idle or not).
24
24
  }
25
25
  ```
26
26
 
27
- - `actionable_threads`: count of actionable items this tick — unresolved, non-outdated threads whose newest comment is unmarked, plus body-only reviews past `lastBodyReviewId` — **after** filtering by the escalated set.
27
+ - `actionable_threads`: count of actionable items this tick — unresolved, non-outdated threads whose newest comment is unmarked, plus body-only reviews past `lastBodyReviewId`, plus conversation comments past `lastConversationCommentId` — **after** filtering by the escalated sets.
28
28
  - `dispatched_review_ids`: owning review ids handed to `/muggle-do`. Empty when idle.
29
29
  - `rebase_needed`: true when the branch is behind its base (`behind_by > 0`) or conflicting (`mergeable == CONFLICTING`). `false` when reviews were dispatched (reviews preempt the mergeability check).
30
30
  - `dispatched_rebase`: true when this tick dispatched `/muggle-do` with a rebase directive.
@@ -0,0 +1,22 @@
1
+ # PR conversation comments
2
+
3
+ Top-level comments on the PR's Conversation tab — GitHub's issue comments, outside any review or thread. For the watcher's dispatch trigger and the address-reviews work set.
4
+
5
+ ```bash
6
+ gh api repos/<owner>/<repo>/issues/<n>/comments --paginate \
7
+ --jq '.[] | {id: .id, body: .body, author: .user.login, authorType: .user.type, createdAt: .created_at, url: .html_url}'
8
+ ```
9
+
10
+ A comment is **actionable** when all hold:
11
+
12
+ - `id > last_seen.lastConversationCommentId`
13
+ - `id` not in `last_seen.escalated_conversation_comment_ids`
14
+ - not posted by muggle: the body carries no `<!-- muggle-` marker (the loop marker `<!-- muggle-do:bot -->`, `<!-- muggle-works:signature -->`, the walkthrough and PR-section markers) and, outside its `>` quote lines, no visible Muggle Works signature link — see [`../../pr-followup-helpers/loop-signature.md`](../../pr-followup-helpers/loop-signature.md). A human quote-reply copies the quoted post's signature, so quoted lines never count.
15
+ - not a bot: `authorType` is not `Bot`, the login does not end in `[bot]`, and it is not `github-actions`
16
+ - `author` is in the resolved reviewer allow-list
17
+
18
+ The watch loop applies the same muggle and bot exclusions in `scripts/pr-watch-state.jq` (`muggle_posted`, `bot_authored`); that file is the definition, this list mirrors it.
19
+
20
+ Issue comments have no threading: GitHub offers no reply endpoint, and the loop never edits a human's comment. Each one is answered with its own loop-signed top-level PR comment that quotes and links it.
21
+
22
+ Issue-comment ids are a sequence of their own, separate from review and review-comment ids, which is why they keep their own watermark rather than sharing `lastBodyReviewId`.
@@ -1,10 +1,10 @@
1
1
  # Top-level PR comment
2
2
 
3
- For the resolve-reminder stage and any non-threaded notice.
3
+ For the resolve-reminder stage, replies to PR conversation comments, and any non-threaded notice.
4
4
 
5
5
  ```bash
6
6
  body="$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/sign-body.sh" --command <command> --mode <mode> < <draft-file>)"
7
7
  gh pr comment <pr-number> --repo <owner>/<repo> --body "$body"
8
8
  ```
9
9
 
10
- Sign per [`../post-signature.md`](../post-signature.md). A resolve-reminder takes `--mode loop`, so the loop recognises the reminder as its own on a later tick; a one-shot notice nothing needs to detect takes `--mode plain`.
10
+ Sign per [`../post-signature.md`](../post-signature.md). A resolve-reminder and a conversation-comment reply take `--mode loop`, so the loop recognises the reminder as its own on a later tick; a one-shot notice nothing needs to detect takes `--mode plain`.
@@ -15,6 +15,7 @@ Skills assume a working `gh auth status`. Auth errors surface verbatim from `gh`
15
15
  | [`branch-standing`](common/branch-standing.md) | Tool-agnostic conflict + out-of-date detection — dispatches to `pr-metadata` / `mr-metadata`. |
16
16
  | [`line-comments-for-review`](github/line-comments-for-review.md) | Pull a review's line comments — `/muggle-do` per-comment routing. |
17
17
  | [`unresolved-threads`](github/unresolved-threads.md) | GraphQL unresolved-thread state — watcher's dispatch trigger + resolve-reminder. |
18
+ | [`conversation-comments`](github/conversation-comments.md) | Top-level PR comments (Conversation tab) — watcher's dispatch trigger + address-reviews work set. |
18
19
  | [`reply-line-comment`](github/reply-line-comment.md) | POST a threaded reply on a line comment. |
19
20
  | [`top-level-comment`](github/top-level-comment.md) | POST a top-level PR comment — resolve-reminder + overflow. |
20
21
  | [`push-to-branch`](common/push-to-branch.md) | Signing-gated push + capture new SHA after address-reviews work. |