patchrelay 0.36.16 → 0.36.18

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,3 +1,4 @@
1
+ import { extractCompletionCheck } from "./completion-check.js";
1
2
  import { extractLatestAssistantSummary } from "./issue-session-events.js";
2
3
  import { sanitizeOperatorFacingText } from "./presentation-text.js";
3
4
  function clean(value) {
@@ -27,26 +28,41 @@ export function deriveIssueStatusNote(params) {
27
28
  return `Blocked by ${blockedByKeys.join(", ")}`;
28
29
  }
29
30
  const sessionSummary = clean(params.sessionSummary);
31
+ const completionCheckActive = Boolean(params.latestRun?.status === "running"
32
+ && params.latestRun.completionCheckThreadId
33
+ && !params.latestRun.completionCheckOutcome);
34
+ const completionCheck = extractCompletionCheck(params.latestRun);
35
+ const completionCheckNote = clean(completionCheck?.outcome === "needs_input"
36
+ ? completionCheck.question ?? completionCheck.summary
37
+ : completionCheck?.summary);
30
38
  const latestRunNote = clean(extractLatestAssistantSummary(params.latestRun));
31
39
  const latestEventNote = clean(eventStatusNote(params.latestEvent));
32
40
  const failureSummary = clean(params.failureSummary);
33
41
  const waitingReason = clean(params.waitingReason);
34
42
  let note;
35
- switch (params.issue.factoryState) {
36
- case "awaiting_input":
37
- note = latestRunNote ?? latestEventNote ?? sessionSummary;
38
- break;
39
- case "failed":
40
- case "escalated":
41
- note = latestEventNote ?? failureSummary ?? latestRunNote ?? sessionSummary;
42
- break;
43
- case "repairing_ci":
44
- case "repairing_queue":
45
- note = failureSummary ?? sessionSummary ?? latestRunNote;
46
- break;
47
- default:
48
- note = sessionSummary ?? latestRunNote ?? failureSummary;
49
- break;
43
+ if (completionCheckActive) {
44
+ note = "No PR found; checking next step";
45
+ }
46
+ else {
47
+ switch (params.issue.factoryState) {
48
+ case "awaiting_input":
49
+ note = completionCheckNote ?? latestRunNote ?? latestEventNote ?? sessionSummary;
50
+ break;
51
+ case "failed":
52
+ case "escalated":
53
+ note = latestEventNote ?? completionCheckNote ?? failureSummary ?? latestRunNote ?? sessionSummary;
54
+ break;
55
+ case "done":
56
+ note = completionCheckNote ?? sessionSummary ?? latestRunNote ?? failureSummary;
57
+ break;
58
+ case "repairing_ci":
59
+ case "repairing_queue":
60
+ note = failureSummary ?? sessionSummary ?? latestRunNote;
61
+ break;
62
+ default:
63
+ note = sessionSummary ?? latestRunNote ?? failureSummary;
64
+ break;
65
+ }
50
66
  }
51
67
  if (!note)
52
68
  return undefined;
@@ -30,6 +30,11 @@ export function buildTrackedIssueRecord(params) {
30
30
  blockedByKeys,
31
31
  waitingReason,
32
32
  });
33
+ const completionCheckActive = Boolean(params.issue.activeRunId !== undefined
34
+ && params.latestRun?.id === params.issue.activeRunId
35
+ && params.latestRun.status === "running"
36
+ && params.latestRun.completionCheckThreadId
37
+ && !params.latestRun.completionCheckOutcome);
33
38
  return {
34
39
  id: params.issue.id,
35
40
  projectId: params.issue.projectId,
@@ -62,6 +67,7 @@ export function buildTrackedIssueRecord(params) {
62
67
  ...(failureContext?.stepName ? { latestFailureStepName: failureContext.stepName } : {}),
63
68
  ...(failureContext?.summary ? { latestFailureSummary: failureContext.summary } : {}),
64
69
  ...(waitingReason ? { waitingReason } : {}),
70
+ ...(completionCheckActive ? { completionCheckActive } : {}),
65
71
  ...(params.issue.activeRunId !== undefined ? { activeRunId: params.issue.activeRunId } : {}),
66
72
  ...(params.issue.agentSessionId ? { activeAgentSessionId: params.issue.agentSessionId } : {}),
67
73
  updatedAt: params.issue.updatedAt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchrelay",
3
- "version": "0.36.16",
3
+ "version": "0.36.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {