patchrelay 0.51.2 → 0.51.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build-info.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shouldSyncVisibleIssueComment, syncVisibleStatusComment, } from "./linear-status-comment-sync.js";
|
|
1
|
+
import { collapseVisibleStatusComment, shouldSyncVisibleIssueComment, syncVisibleStatusComment, } from "./linear-status-comment-sync.js";
|
|
2
2
|
import { LinearAgentSessionClient } from "./linear-agent-session-client.js";
|
|
3
3
|
import { LinearProgressReporter } from "./linear-progress-reporter.js";
|
|
4
4
|
import { syncActiveWorkflowState } from "./linear-workflow-state-sync.js";
|
|
@@ -49,6 +49,13 @@ export class LinearSessionSync {
|
|
|
49
49
|
...(options ? { options } : {}),
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
+
else if (syncedIssue.statusCommentId) {
|
|
53
|
+
await collapseVisibleStatusComment({
|
|
54
|
+
issue: syncedIssue,
|
|
55
|
+
linear,
|
|
56
|
+
logger: this.logger,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
52
59
|
}
|
|
53
60
|
catch (error) {
|
|
54
61
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -25,8 +25,40 @@ export async function syncVisibleStatusComment(params) {
|
|
|
25
25
|
logger.warn({ issueKey: issue.issueKey, error: msg }, "Failed to sync Linear status comment");
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
export function shouldSyncVisibleIssueComment(
|
|
29
|
-
|
|
28
|
+
export function shouldSyncVisibleIssueComment(issue, hasAgentSession) {
|
|
29
|
+
if (!hasAgentSession) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
if (!issue.delegatedToPatchRelay) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if (issue.sessionState === "waiting_input" || issue.factoryState === "awaiting_input") {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (issue.sessionState === "failed" || issue.factoryState === "failed" || issue.factoryState === "escalated") {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
if (issue.factoryState === "done") {
|
|
42
|
+
return issue.prState !== "merged";
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
export async function collapseVisibleStatusComment(params) {
|
|
47
|
+
const { issue, linear, logger } = params;
|
|
48
|
+
if (!issue.statusCommentId) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
await linear.upsertIssueComment({
|
|
53
|
+
issueId: issue.linearIssueId,
|
|
54
|
+
commentId: issue.statusCommentId,
|
|
55
|
+
body: renderCollapsedStatusComment(),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
60
|
+
logger.warn({ issueId: issue.linearIssueId, error: msg }, "Failed to collapse Linear status comment");
|
|
61
|
+
}
|
|
30
62
|
}
|
|
31
63
|
function renderStatusComment(db, issue, trackedIssue, options) {
|
|
32
64
|
const activeRun = issue.activeRunId ? db.runs.getRunById(issue.activeRunId) : undefined;
|
|
@@ -97,21 +129,18 @@ function renderStatusComment(db, issue, trackedIssue, options) {
|
|
|
97
129
|
: `PR: ${linkedLabel}`;
|
|
98
130
|
lines.push("", prLine);
|
|
99
131
|
}
|
|
100
|
-
if (latestRun) {
|
|
101
|
-
lines.push("", `Latest run: ${formatLatestRun(latestRun)}`);
|
|
102
|
-
if (latestRun.failureReason) {
|
|
103
|
-
lines.push("", `Failure: ${latestRun.failureReason}`);
|
|
104
|
-
}
|
|
105
|
-
if (completionCheck && completionCheck.outcome !== "needs_input" && completionCheck.summary !== statusNote) {
|
|
106
|
-
lines.push("", `Completion check: ${completionCheck.summary}`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
132
|
if (issue.lastGitHubFailureCheckName && (issue.factoryState === "repairing_ci" || issue.prCheckStatus === "failed" || issue.prCheckStatus === "failure")) {
|
|
110
133
|
lines.push("", `Latest failing check: ${issue.lastGitHubFailureCheckName}`);
|
|
111
134
|
}
|
|
112
|
-
lines.push("", "_PatchRelay updates this comment as it works. Review and merge remain downstream._");
|
|
113
135
|
return lines.join("\n");
|
|
114
136
|
}
|
|
137
|
+
function renderCollapsedStatusComment() {
|
|
138
|
+
return [
|
|
139
|
+
"## PatchRelay status",
|
|
140
|
+
"",
|
|
141
|
+
"Live status is in the agent session and activity feed. This comment is reused only when PatchRelay needs human input or intervention.",
|
|
142
|
+
].join("\n");
|
|
143
|
+
}
|
|
115
144
|
function statusHeadline(issue, activeRunType) {
|
|
116
145
|
const prContext = derivePrDisplayContext(issue);
|
|
117
146
|
if (activeRunType) {
|
|
@@ -193,10 +222,6 @@ function statusHeadline(issue, activeRunType) {
|
|
|
193
222
|
return humanize(issue.factoryState);
|
|
194
223
|
}
|
|
195
224
|
}
|
|
196
|
-
function formatLatestRun(run) {
|
|
197
|
-
const at = run.endedAt ?? run.startedAt;
|
|
198
|
-
return `${humanize(run.runType)} ${run.status} at ${at}`;
|
|
199
|
-
}
|
|
200
225
|
function humanize(value) {
|
|
201
226
|
return value.replaceAll("_", " ");
|
|
202
227
|
}
|
package/dist/status-note.js
CHANGED
|
@@ -36,6 +36,7 @@ export function deriveIssueStatusNote(params) {
|
|
|
36
36
|
? completionCheck.question ?? completionCheck.summary
|
|
37
37
|
: completionCheck?.summary);
|
|
38
38
|
const latestRunNote = clean(extractLatestAssistantSummary(params.latestRun));
|
|
39
|
+
const latestFailureReason = clean(params.latestRun?.failureReason);
|
|
39
40
|
const latestEventNote = clean(eventStatusNote(params.latestEvent));
|
|
40
41
|
const failureSummary = clean(params.failureSummary);
|
|
41
42
|
const waitingReason = clean(params.waitingReason);
|
|
@@ -50,7 +51,7 @@ export function deriveIssueStatusNote(params) {
|
|
|
50
51
|
break;
|
|
51
52
|
case "failed":
|
|
52
53
|
case "escalated":
|
|
53
|
-
note = latestEventNote ?? completionCheckNote ?? failureSummary ?? latestRunNote ?? sessionSummary;
|
|
54
|
+
note = latestEventNote ?? completionCheckNote ?? failureSummary ?? latestFailureReason ?? latestRunNote ?? sessionSummary;
|
|
54
55
|
break;
|
|
55
56
|
case "done":
|
|
56
57
|
note = completionCheckNote ?? sessionSummary ?? latestRunNote ?? failureSummary;
|
|
@@ -2,8 +2,7 @@ export function isInertPatchRelayComment(issue, commentId, body, actorType) {
|
|
|
2
2
|
if (commentId === issue.statusCommentId) {
|
|
3
3
|
return true;
|
|
4
4
|
}
|
|
5
|
-
if (body.startsWith("## PatchRelay status")
|
|
6
|
-
&& body.includes("_PatchRelay updates this comment as it works. Review and merge remain downstream._")) {
|
|
5
|
+
if (body.startsWith("## PatchRelay status")) {
|
|
7
6
|
return true;
|
|
8
7
|
}
|
|
9
8
|
const normalizedActorType = actorType?.trim().toLowerCase();
|