patchrelay 0.52.4 → 0.52.6

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.52.4",
4
- "commit": "5fd50d353ab4",
5
- "builtAt": "2026-04-22T20:52:16.943Z"
3
+ "version": "0.52.6",
4
+ "commit": "cc8a389260f0",
5
+ "builtAt": "2026-04-22T23:52:25.456Z"
6
6
  }
package/dist/cli/data.js CHANGED
@@ -272,6 +272,7 @@ export class CliDataAccess extends CliOperatorApiClient {
272
272
  this.db.issueSessions.upsertIssueRespectingActiveLease(issue.projectId, issue.linearIssueId, {
273
273
  projectId: issue.projectId,
274
274
  linearIssueId: issue.linearIssueId,
275
+ delegatedToPatchRelay: false,
275
276
  factoryState: terminalState,
276
277
  activeRunId: null,
277
278
  pendingRunType: null,
package/dist/config.js CHANGED
@@ -23,6 +23,8 @@ const DEFAULT_PATCHRELAY_DEVELOPER_INSTRUCTIONS = [
23
23
  "- A requested-changes repair is only complete after a newer PR head is pushed, unless a genuine external blocker prevents correct publication.",
24
24
  "- If you change schema, enums, shared vocabulary, normalization helpers, or compatibility mappings, inspect the main read/write paths that can bypass the new abstraction and fix or cover any mismatch before publishing.",
25
25
  "- For CI repair, do not change code or config until you either reproduce the failure on the exact failing head or can point to a concrete log signature that justifies the fix. If you cannot reproduce it, prefer a rerun-only repair over speculative changes.",
26
+ "- For main repair, first verify that the incident still persists on the exact failing main SHA. If a rerun clears transient runner issues such as disk pressure or network lag, treat that as the repair instead of inventing branch changes.",
27
+ "- Do not propose or implement moving CI, deploy, or tests to different nodes or runner pools unless a human explicitly asked for that infrastructure migration.",
26
28
  "- If a broader inconsistency is not required to make this task correct, mention it briefly instead of expanding scope.",
27
29
  "- Before publishing, do one brief reviewer-minded pass on the current head and fix likely in-scope blockers.",
28
30
  ].join("\n");
@@ -63,7 +63,7 @@ export class MergedLinearCompletionReconciler {
63
63
  this.settleIssue(issue, now);
64
64
  continue;
65
65
  }
66
- if (issue.factoryState === "done" && !isCompletedLinearState(liveIssue.stateType, liveIssue.stateName)) {
66
+ if (issue.factoryState === "done" && !isTerminalLinearState(liveIssue.stateType, liveIssue.stateName)) {
67
67
  this.reopenStaleLocalDoneIssue(issue, liveIssue);
68
68
  }
69
69
  else {
@@ -182,6 +182,14 @@ function isRateLimitedError(error) {
182
182
  const message = error instanceof Error ? error.message : String(error);
183
183
  return /ratelimit|rate limit/i.test(message);
184
184
  }
185
+ function isTerminalLinearState(currentLinearStateType, currentLinearState) {
186
+ const normalizedType = currentLinearStateType?.trim().toLowerCase();
187
+ if (normalizedType === "completed" || normalizedType === "canceled" || normalizedType === "cancelled") {
188
+ return true;
189
+ }
190
+ const normalizedName = currentLinearState?.trim().toLowerCase();
191
+ return normalizedName === "done" || normalizedName === "completed" || normalizedName === "canceled" || normalizedName === "cancelled";
192
+ }
185
193
  function resolveOpenWorkflowState(issue) {
186
194
  const reactiveIntent = deriveIssueSessionReactiveIntent({
187
195
  delegatedToPatchRelay: issue.delegatedToPatchRelay,
@@ -323,6 +323,23 @@ function buildCiRepairContext(context) {
323
323
  : "",
324
324
  ].filter(Boolean).join("\n");
325
325
  }
326
+ function buildMainRepairContext(context) {
327
+ const failingCheckNames = Array.isArray(context?.failingChecks)
328
+ ? context.failingChecks
329
+ .filter((entry) => Boolean(entry) && typeof entry === "object")
330
+ .map((entry) => String(entry.name ?? "").trim())
331
+ .filter((name) => name.length > 0)
332
+ : [];
333
+ return [
334
+ "Base-branch repair on the red mainline.",
335
+ "Goal: restore main by fixing the real persistent failure, not by papering over a transient runner incident.",
336
+ "Before changing code or workflow config, verify that the original incident still persists on the exact failing main SHA or identify a concrete log signature that justifies the fix.",
337
+ "For transient infrastructure symptoms such as disk pressure, runner exhaustion, or network flakiness, prefer a rerun-only repair if the rerun clears the branch.",
338
+ "Do not propose or implement moving CI, deploy, or tests onto different nodes or runner pools unless a human explicitly asked for that infrastructure migration.",
339
+ context?.baseSha ? `Failing main SHA: ${String(context.baseSha)}` : "",
340
+ failingCheckNames.length > 0 ? `Failing checks: ${failingCheckNames.join(", ")}` : "",
341
+ ].filter(Boolean).join("\n");
342
+ }
326
343
  function appendQueueRepairContext(lines, context) {
327
344
  const queueContext = context?.mergeQueueContext;
328
345
  if (!queueContext || typeof queueContext !== "object") {
@@ -433,6 +450,9 @@ function buildCurrentContext(runType, issue, context, followUp = false) {
433
450
  }
434
451
  lines.push(...buildHumanContextLines(context));
435
452
  switch (runType) {
453
+ case "main_repair":
454
+ lines.push(buildMainRepairContext(context));
455
+ break;
436
456
  case "ci_repair":
437
457
  lines.push(buildCiRepairContext(context));
438
458
  break;
@@ -181,6 +181,7 @@ export class ServiceIssueActions {
181
181
  this.db.issueSessions.upsertIssueRespectingActiveLease(issue.projectId, issue.linearIssueId, {
182
182
  projectId: issue.projectId,
183
183
  linearIssueId: issue.linearIssueId,
184
+ delegatedToPatchRelay: false,
184
185
  factoryState: terminalState,
185
186
  activeRunId: null,
186
187
  pendingRunType: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchrelay",
3
- "version": "0.52.4",
3
+ "version": "0.52.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {