patchrelay 0.20.5 → 0.20.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.
- package/dist/build-info.json +3 -3
- package/dist/http.js +2 -2
- package/dist/run-orchestrator.js +10 -0
- package/dist/service.js +17 -2
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
package/dist/http.js
CHANGED
|
@@ -243,6 +243,8 @@ export async function buildHttpServer(config, service, logger) {
|
|
|
243
243
|
return reply.code(401).send({ ok: false, reason: "operator_auth_required" });
|
|
244
244
|
}
|
|
245
245
|
});
|
|
246
|
+
}
|
|
247
|
+
if (managementRoutesEnabled) {
|
|
246
248
|
app.get("/api/issues/:issueKey", async (request, reply) => {
|
|
247
249
|
const issueKey = request.params.issueKey;
|
|
248
250
|
const result = await service.getIssueOverview(issueKey);
|
|
@@ -296,8 +298,6 @@ export async function buildHttpServer(config, service, logger) {
|
|
|
296
298
|
}
|
|
297
299
|
return reply.send({ ok: true, ...link });
|
|
298
300
|
});
|
|
299
|
-
}
|
|
300
|
-
if (managementRoutesEnabled) {
|
|
301
301
|
app.post("/api/issues/:issueKey/retry", async (request, reply) => {
|
|
302
302
|
const issueKey = request.params.issueKey;
|
|
303
303
|
const result = service.retryIssue(issueKey);
|
package/dist/run-orchestrator.js
CHANGED
|
@@ -546,6 +546,16 @@ export class RunOrchestrator {
|
|
|
546
546
|
// Reactive loops (CI repair, review fix) will handle follow-up if needed.
|
|
547
547
|
if (latestTurn?.status === "interrupted") {
|
|
548
548
|
this.logger.warn({ issueKey: issue.issueKey, runType: run.runType, threadId: run.threadId }, "Run has interrupted turn — marking as failed");
|
|
549
|
+
// Interrupted runs are not real failures — undo the budget increment.
|
|
550
|
+
if (run.runType === "ci_repair" && issue.ciRepairAttempts > 0) {
|
|
551
|
+
this.db.upsertIssue({ projectId: issue.projectId, linearIssueId: issue.linearIssueId, ciRepairAttempts: issue.ciRepairAttempts - 1 });
|
|
552
|
+
}
|
|
553
|
+
else if (run.runType === "queue_repair" && issue.queueRepairAttempts > 0) {
|
|
554
|
+
this.db.upsertIssue({ projectId: issue.projectId, linearIssueId: issue.linearIssueId, queueRepairAttempts: issue.queueRepairAttempts - 1 });
|
|
555
|
+
}
|
|
556
|
+
else if (run.runType === "review_fix" && issue.reviewFixAttempts > 0) {
|
|
557
|
+
this.db.upsertIssue({ projectId: issue.projectId, linearIssueId: issue.linearIssueId, reviewFixAttempts: issue.reviewFixAttempts - 1 });
|
|
558
|
+
}
|
|
549
559
|
this.failRunAndClear(run, "Codex turn was interrupted");
|
|
550
560
|
const failedIssue = this.db.getIssue(run.projectId, run.linearIssueId) ?? issue;
|
|
551
561
|
void this.emitLinearActivity(failedIssue, buildRunFailureActivity(run.runType, "The Codex turn was interrupted."));
|
package/dist/service.js
CHANGED
|
@@ -278,12 +278,27 @@ export class PatchRelayService {
|
|
|
278
278
|
return undefined;
|
|
279
279
|
if (issue.activeRunId)
|
|
280
280
|
return { error: "Issue already has an active run" };
|
|
281
|
-
|
|
281
|
+
// Infer run type from current state instead of always resetting to implementation
|
|
282
|
+
let runType = "implementation";
|
|
283
|
+
let factoryState = "delegated";
|
|
284
|
+
if (issue.prNumber && issue.prCheckStatus === "failed") {
|
|
285
|
+
runType = "ci_repair";
|
|
286
|
+
factoryState = "repairing_ci";
|
|
287
|
+
}
|
|
288
|
+
else if (issue.prNumber && issue.prReviewState === "changes_requested") {
|
|
289
|
+
runType = "review_fix";
|
|
290
|
+
factoryState = "changes_requested";
|
|
291
|
+
}
|
|
292
|
+
else if (issue.prNumber) {
|
|
293
|
+
// PR exists but no specific failure — re-run implementation
|
|
294
|
+
runType = "implementation";
|
|
295
|
+
factoryState = "implementing";
|
|
296
|
+
}
|
|
282
297
|
this.db.upsertIssue({
|
|
283
298
|
projectId: issue.projectId,
|
|
284
299
|
linearIssueId: issue.linearIssueId,
|
|
285
300
|
pendingRunType: runType,
|
|
286
|
-
factoryState:
|
|
301
|
+
factoryState: factoryState,
|
|
287
302
|
});
|
|
288
303
|
this.runtime.enqueueIssue(issue.projectId, issue.linearIssueId);
|
|
289
304
|
return { issueKey, runType };
|