patchrelay 0.51.5 → 0.52.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "service": "patchrelay",
3
- "version": "0.51.5",
4
- "commit": "fa598553f4b9",
5
- "builtAt": "2026-04-22T13:58:38.906Z"
3
+ "version": "0.52.1",
4
+ "commit": "ce226d1e6424",
5
+ "builtAt": "2026-04-22T15:51:04.485Z"
6
6
  }
@@ -18,29 +18,33 @@ function deriveProgressFactFromCompletedItem(rawItem, issue) {
18
18
  if (item.type !== "agentMessage" || typeof item.text !== "string") {
19
19
  return undefined;
20
20
  }
21
- const body = compactOperatorSentence(item.text);
22
- if (!body) {
21
+ const fullBody = sanitizeOperatorFacingText(item.text)?.replace(/\s+/g, " ").trim();
22
+ if (!fullBody) {
23
23
  return undefined;
24
24
  }
25
- if (looksLikeVerification(body)) {
25
+ const ephemeralBody = compactOperatorSentence(fullBody) ?? fullBody;
26
+ if (looksLikeVerification(fullBody)) {
26
27
  return {
27
28
  kind: "verification_started",
28
- meaningKey: `verification:${normalizeMeaningKey(body)}`,
29
- content: { type: "thought", body },
29
+ meaningKey: `verification:${normalizeMeaningKey(fullBody)}`,
30
+ ephemeralContent: { type: "thought", body: ephemeralBody },
31
+ historyContent: { type: "thought", body: fullBody },
30
32
  };
31
33
  }
32
- if (looksLikePublishing(body)) {
34
+ if (looksLikePublishing(fullBody)) {
33
35
  return {
34
36
  kind: "publishing_started",
35
- meaningKey: `publishing:${normalizeMeaningKey(body)}`,
36
- content: { type: "thought", body },
37
+ meaningKey: `publishing:${normalizeMeaningKey(fullBody)}`,
38
+ ephemeralContent: { type: "thought", body: ephemeralBody },
39
+ historyContent: { type: "thought", body: fullBody },
37
40
  };
38
41
  }
39
- if (looksLikeRootCause(body)) {
42
+ if (looksLikeRootCause(fullBody)) {
40
43
  return {
41
44
  kind: "root_cause_found",
42
- meaningKey: `finding:${normalizeMeaningKey(body)}`,
43
- content: { type: "thought", body },
45
+ meaningKey: `finding:${normalizeMeaningKey(fullBody)}`,
46
+ ephemeralContent: { type: "thought", body: ephemeralBody },
47
+ historyContent: { type: "thought", body: fullBody },
44
48
  };
45
49
  }
46
50
  return undefined;
@@ -59,7 +63,12 @@ function deriveProgressFactFromPlan(rawPlan, issue) {
59
63
  return {
60
64
  kind: "verification_started",
61
65
  meaningKey: `verification:${normalizeMeaningKey(activeStep.step)}`,
62
- content: {
66
+ ephemeralContent: {
67
+ type: "action",
68
+ action: "Verifying",
69
+ parameter: summarizePlanStep(activeStep.step, "latest changes before publishing"),
70
+ },
71
+ historyContent: {
63
72
  type: "action",
64
73
  action: "Verifying",
65
74
  parameter: summarizePlanStep(activeStep.step, "latest changes before publishing"),
@@ -71,7 +80,12 @@ function deriveProgressFactFromPlan(rawPlan, issue) {
71
80
  return {
72
81
  kind: "publishing_started",
73
82
  meaningKey: `publishing:${normalizeMeaningKey(activeStep.step)}`,
74
- content: {
83
+ ephemeralContent: {
84
+ type: "action",
85
+ action: "Publishing",
86
+ parameter,
87
+ },
88
+ historyContent: {
75
89
  type: "action",
76
90
  action: "Publishing",
77
91
  parameter,
@@ -17,22 +17,79 @@ export class LinearProgressReporter {
17
17
  return;
18
18
  }
19
19
  const previous = this.publicationsByRun.get(run.id);
20
- if (previous?.meaningKey === fact.meaningKey) {
20
+ const shouldEmitEphemeral = previous?.ephemeralMeaningKey !== fact.meaningKey;
21
+ const shouldEmitHistory = previous?.historyMeaningKey !== fact.meaningKey;
22
+ if (!shouldEmitEphemeral && !shouldEmitHistory) {
21
23
  return;
22
24
  }
25
+ const now = Date.now();
23
26
  const publication = {
24
- meaningKey: fact.meaningKey,
25
- publishedAtMs: Date.now(),
27
+ ...previous,
28
+ ...(shouldEmitEphemeral
29
+ ? {
30
+ ephemeralMeaningKey: fact.meaningKey,
31
+ ephemeralPublishedAtMs: now,
32
+ }
33
+ : {}),
34
+ ...(shouldEmitHistory
35
+ ? {
36
+ historyMeaningKey: fact.meaningKey,
37
+ historyPublishedAtMs: now,
38
+ }
39
+ : {}),
26
40
  };
27
41
  this.publicationsByRun.set(run.id, publication);
28
- void this.emitActivity(issue, fact.content, { ephemeral: true }).catch(() => {
29
- const current = this.publicationsByRun.get(run.id);
30
- if (current?.publishedAtMs === publication.publishedAtMs && current.meaningKey === publication.meaningKey) {
31
- this.publicationsByRun.delete(run.id);
32
- }
33
- });
42
+ if (shouldEmitEphemeral) {
43
+ void this.emitActivity(issue, fact.ephemeralContent, { ephemeral: true }).catch(() => {
44
+ this.clearFailedPublication(run.id, "ephemeral", fact.meaningKey, now);
45
+ });
46
+ }
47
+ if (shouldEmitHistory) {
48
+ void this.emitActivity(issue, fact.historyContent).catch(() => {
49
+ this.clearFailedPublication(run.id, "history", fact.meaningKey, now);
50
+ });
51
+ }
34
52
  }
35
53
  clearProgress(runId) {
36
54
  this.publicationsByRun.delete(runId);
37
55
  }
56
+ clearFailedPublication(runId, channel, meaningKey, publishedAtMs) {
57
+ const current = this.publicationsByRun.get(runId);
58
+ if (!current) {
59
+ return;
60
+ }
61
+ if (channel === "ephemeral") {
62
+ if (current.ephemeralMeaningKey !== meaningKey || current.ephemeralPublishedAtMs !== publishedAtMs) {
63
+ return;
64
+ }
65
+ const next = {};
66
+ if (current.historyMeaningKey !== undefined) {
67
+ next.historyMeaningKey = current.historyMeaningKey;
68
+ }
69
+ if (current.historyPublishedAtMs !== undefined) {
70
+ next.historyPublishedAtMs = current.historyPublishedAtMs;
71
+ }
72
+ if (!next.historyMeaningKey) {
73
+ this.publicationsByRun.delete(runId);
74
+ return;
75
+ }
76
+ this.publicationsByRun.set(runId, next);
77
+ return;
78
+ }
79
+ if (current.historyMeaningKey !== meaningKey || current.historyPublishedAtMs !== publishedAtMs) {
80
+ return;
81
+ }
82
+ const next = {};
83
+ if (current.ephemeralMeaningKey !== undefined) {
84
+ next.ephemeralMeaningKey = current.ephemeralMeaningKey;
85
+ }
86
+ if (current.ephemeralPublishedAtMs !== undefined) {
87
+ next.ephemeralPublishedAtMs = current.ephemeralPublishedAtMs;
88
+ }
89
+ if (!next.ephemeralMeaningKey) {
90
+ this.publicationsByRun.delete(runId);
91
+ return;
92
+ }
93
+ this.publicationsByRun.set(runId, next);
94
+ }
38
95
  }
@@ -77,20 +77,35 @@ export function buildRunCompletedActivity(params) {
77
77
  }
78
78
  return undefined;
79
79
  case "review_fix":
80
- return {
81
- type: "response",
82
- body: `Updated ${prLabel} to address review feedback.${detail}`,
83
- };
80
+ return summary
81
+ ? {
82
+ type: "response",
83
+ body: summary,
84
+ }
85
+ : {
86
+ type: "response",
87
+ body: `Updated ${prLabel} to address review feedback.`,
88
+ };
84
89
  case "ci_repair":
85
- return {
86
- type: "response",
87
- body: `Updated ${prLabel} after CI repair.${detail}`,
88
- };
90
+ return summary
91
+ ? {
92
+ type: "response",
93
+ body: summary,
94
+ }
95
+ : {
96
+ type: "response",
97
+ body: `Updated ${prLabel} after CI repair.`,
98
+ };
89
99
  case "queue_repair":
90
- return {
91
- type: "response",
92
- body: `Updated ${prLabel} after merge-queue repair.${detail}`,
93
- };
100
+ return summary
101
+ ? {
102
+ type: "response",
103
+ body: summary,
104
+ }
105
+ : {
106
+ type: "response",
107
+ body: `Updated ${prLabel} after merge-queue repair.`,
108
+ };
94
109
  case "branch_upkeep":
95
110
  return undefined;
96
111
  default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchrelay",
3
- "version": "0.51.5",
3
+ "version": "0.52.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {