patchrelay 0.37.1 → 0.38.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.
- package/README.md +47 -9
- package/dist/awaiting-input-reason.js +9 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/cluster-health.js +59 -3
- package/dist/cli/help.js +1 -1
- package/dist/cli/output.js +2 -0
- package/dist/db/issue-session-store.js +0 -14
- package/dist/db/issue-store.js +8 -16
- package/dist/db/migrations.js +6 -13
- package/dist/db.js +1 -3
- package/dist/github-linear-session-sync.js +57 -0
- package/dist/github-pr-comment-handler.js +74 -0
- package/dist/github-webhook-failure-context.js +70 -0
- package/dist/github-webhook-handler.js +49 -965
- package/dist/github-webhook-issue-resolution.js +46 -0
- package/dist/github-webhook-policy.js +105 -0
- package/dist/github-webhook-reactive-run.js +302 -0
- package/dist/github-webhook-state-projector.js +231 -0
- package/dist/github-webhook-terminal-handler.js +111 -0
- package/dist/github-webhooks.js +4 -0
- package/dist/idle-reconciliation.js +22 -23
- package/dist/issue-overview-query.js +11 -57
- package/dist/issue-session-projector.js +1 -0
- package/dist/issue-session.js +8 -0
- package/dist/legacy-issue-overview.js +58 -0
- package/dist/linear-session-reporting.js +30 -1
- package/dist/linear-session-sync.js +9 -1
- package/dist/linear-status-comment-sync.js +34 -1
- package/dist/linear-workflow-state-sync.js +2 -2
- package/dist/operator-retry-event.js +15 -12
- package/dist/paused-issue-state.js +24 -0
- package/dist/reactive-pr-state.js +65 -0
- package/dist/reactive-run-policy.js +35 -118
- package/dist/remote-pr-state.js +11 -0
- package/dist/run-launcher.js +0 -1
- package/dist/run-orchestrator.js +22 -11
- package/dist/run-reconciler.js +10 -0
- package/dist/run-recovery-service.js +1 -10
- package/dist/service-issue-actions.js +5 -0
- package/dist/service-startup-recovery.js +9 -6
- package/dist/service.js +0 -1
- package/dist/tracked-issue-list-query.js +3 -1
- package/dist/tracked-issue-projector.js +3 -0
- package/dist/waiting-reason.js +10 -0
- package/dist/webhooks/agent-session-handler.js +9 -1
- package/dist/webhooks/comment-wake-handler.js +12 -0
- package/dist/webhooks/decision-helpers.js +44 -3
- package/dist/webhooks/dependency-readiness-handler.js +1 -0
- package/dist/webhooks/desired-stage-recorder.js +40 -10
- package/package.json +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function getRelevantGitHubCiSnapshot(db, issue, event) {
|
|
2
|
+
const snapshot = db.issues.getLatestGitHubCiSnapshot(issue.projectId, issue.linearIssueId);
|
|
3
|
+
if (!snapshot)
|
|
4
|
+
return undefined;
|
|
5
|
+
if (snapshot.headSha !== event.headSha)
|
|
6
|
+
return undefined;
|
|
7
|
+
return snapshot;
|
|
8
|
+
}
|
|
9
|
+
export function pickPrimaryFailedCheck(snapshot) {
|
|
10
|
+
const gateName = snapshot.gateCheckName?.trim().toLowerCase();
|
|
11
|
+
return snapshot.failedChecks.find((entry) => entry.name.trim().toLowerCase() !== gateName)
|
|
12
|
+
?? snapshot.failedChecks[0];
|
|
13
|
+
}
|
|
14
|
+
export async function resolveGitHubBranchFailureContext(params) {
|
|
15
|
+
const repoFullName = params.project?.github?.repoFullName ?? params.event.repoFullName;
|
|
16
|
+
const snapshot = getRelevantGitHubCiSnapshot(params.db, params.issue, params.event);
|
|
17
|
+
const primaryFailedCheck = snapshot ? pickPrimaryFailedCheck(snapshot) : undefined;
|
|
18
|
+
const context = await params.failureContextResolver.resolve({
|
|
19
|
+
source: "branch_ci",
|
|
20
|
+
repoFullName,
|
|
21
|
+
event: primaryFailedCheck
|
|
22
|
+
? {
|
|
23
|
+
...params.event,
|
|
24
|
+
checkName: primaryFailedCheck.name,
|
|
25
|
+
checkUrl: primaryFailedCheck.detailsUrl ?? params.event.checkUrl,
|
|
26
|
+
checkDetailsUrl: primaryFailedCheck.detailsUrl ?? params.event.checkDetailsUrl,
|
|
27
|
+
}
|
|
28
|
+
: params.event,
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
...(context ? context : {}),
|
|
32
|
+
...(context?.headSha || params.event.headSha ? { failureHeadSha: context?.headSha ?? params.event.headSha } : {}),
|
|
33
|
+
...(context?.failureSignature ? { failureSignature: context.failureSignature } : {}),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function buildGitHubQueueFailureContext(event, project, queueRepairContext) {
|
|
37
|
+
const repoFullName = event.repoFullName || project?.github?.repoFullName || "";
|
|
38
|
+
const incident = queueRepairContext && typeof queueRepairContext === "object"
|
|
39
|
+
? queueRepairContext
|
|
40
|
+
: undefined;
|
|
41
|
+
const summary = typeof incident?.incidentSummary === "string"
|
|
42
|
+
? incident.incidentSummary
|
|
43
|
+
: event.checkOutputSummary ?? event.checkOutputTitle;
|
|
44
|
+
const failureHeadSha = event.headSha;
|
|
45
|
+
const failureSignature = [
|
|
46
|
+
"queue_eviction",
|
|
47
|
+
failureHeadSha ?? "unknown-sha",
|
|
48
|
+
event.checkName ?? "merge-steward/queue",
|
|
49
|
+
].join("::");
|
|
50
|
+
return {
|
|
51
|
+
source: "queue_eviction",
|
|
52
|
+
repoFullName,
|
|
53
|
+
capturedAt: new Date().toISOString(),
|
|
54
|
+
...(failureHeadSha ? { headSha: failureHeadSha, failureHeadSha } : {}),
|
|
55
|
+
...(event.checkName ? { checkName: event.checkName } : {}),
|
|
56
|
+
...(event.checkUrl ? { checkUrl: event.checkUrl } : {}),
|
|
57
|
+
...(event.checkDetailsUrl ? { checkDetailsUrl: event.checkDetailsUrl } : {}),
|
|
58
|
+
...(summary ? { summary } : {}),
|
|
59
|
+
failureSignature,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function resolveGitHubCheckClass(checkName, project) {
|
|
63
|
+
if (!checkName || !project)
|
|
64
|
+
return "code";
|
|
65
|
+
if ((project.reviewChecks ?? []).some((name) => checkName.includes(name)))
|
|
66
|
+
return "review";
|
|
67
|
+
if ((project.gateChecks ?? []).some((name) => checkName.includes(name)))
|
|
68
|
+
return "gate";
|
|
69
|
+
return "code";
|
|
70
|
+
}
|