patchrelay 0.35.11 → 0.35.13

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.
Files changed (52) hide show
  1. package/README.md +41 -9
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli/args.js +19 -1
  4. package/dist/cli/commands/issues.js +18 -56
  5. package/dist/cli/commands/watch.js +5 -0
  6. package/dist/cli/data.js +160 -47
  7. package/dist/cli/formatters/text.js +51 -90
  8. package/dist/cli/help.js +15 -8
  9. package/dist/cli/index.js +3 -58
  10. package/dist/cli/operator-client.js +0 -82
  11. package/dist/cli/watch/App.js +21 -12
  12. package/dist/cli/watch/HelpBar.js +3 -3
  13. package/dist/cli/watch/IssueDetailView.js +63 -130
  14. package/dist/cli/watch/IssueRow.js +82 -27
  15. package/dist/cli/watch/StatusBar.js +8 -4
  16. package/dist/cli/watch/detail-rows.js +589 -0
  17. package/dist/cli/watch/render-rich-text.js +226 -0
  18. package/dist/cli/watch/state-visualization.js +48 -23
  19. package/dist/cli/watch/timeline-builder.js +2 -1
  20. package/dist/cli/watch/use-detail-stream.js +10 -104
  21. package/dist/cli/watch/use-watch-stream.js +11 -102
  22. package/dist/cli/watch/watch-state.js +129 -56
  23. package/dist/codex-thread-utils.js +3 -0
  24. package/dist/db/migrations.js +239 -2
  25. package/dist/db.js +628 -39
  26. package/dist/github-app-token.js +7 -0
  27. package/dist/github-failure-context.js +44 -1
  28. package/dist/github-rollup.js +47 -0
  29. package/dist/github-webhook-handler.js +423 -52
  30. package/dist/github-webhooks.js +7 -0
  31. package/dist/http.js +12 -264
  32. package/dist/idle-reconciliation.js +268 -76
  33. package/dist/issue-query-service.js +221 -129
  34. package/dist/issue-session-events.js +151 -0
  35. package/dist/issue-session.js +99 -0
  36. package/dist/linear-client.js +39 -25
  37. package/dist/linear-session-reporting.js +12 -0
  38. package/dist/linear-session-sync.js +253 -24
  39. package/dist/linear-workflow.js +33 -0
  40. package/dist/merge-queue-protocol.js +0 -51
  41. package/dist/preflight.js +1 -4
  42. package/dist/queue-health-monitor.js +11 -7
  43. package/dist/run-orchestrator.js +1364 -147
  44. package/dist/run-reporting.js +5 -3
  45. package/dist/service.js +279 -102
  46. package/dist/status-note.js +56 -0
  47. package/dist/waiting-reason.js +65 -0
  48. package/dist/webhook-handler.js +270 -79
  49. package/package.json +3 -2
  50. package/dist/cli/commands/feed.js +0 -60
  51. package/dist/cli/watch/FeedView.js +0 -28
  52. package/dist/cli/watch/use-feed-stream.js +0 -92
@@ -0,0 +1,65 @@
1
+ export const PATCHRELAY_WAITING_REASONS = {
2
+ activeWork: "PatchRelay is actively working",
3
+ waitingForOperatorInput: "Waiting on operator input",
4
+ waitingForReviewFeedback: "Waiting to address review feedback",
5
+ waitingForRereview: "Waiting on re-review after requested changes",
6
+ waitingForMergeStewardRepair: "Waiting to repair a merge-steward incident",
7
+ waitingForDownstreamAutomation: "Waiting on downstream review/merge automation",
8
+ workComplete: "PatchRelay work is complete",
9
+ waitingForOperatorIntervention: "Waiting on operator intervention",
10
+ waitingForExternalReview: "Waiting on external review",
11
+ };
12
+ export function derivePatchRelayWaitingReason(params) {
13
+ if (params.activeRunType) {
14
+ return `PatchRelay is running ${humanize(params.activeRunType)}`;
15
+ }
16
+ if (params.activeRunId !== undefined) {
17
+ return PATCHRELAY_WAITING_REASONS.activeWork;
18
+ }
19
+ const blockedByKeys = (params.blockedByKeys ?? []).filter((value) => value.trim().length > 0);
20
+ if (blockedByKeys.length > 0) {
21
+ return `Blocked by ${blockedByKeys.join(", ")}`;
22
+ }
23
+ const checkName = params.latestFailureCheckName ?? "CI";
24
+ switch (params.factoryState) {
25
+ case "awaiting_input":
26
+ return PATCHRELAY_WAITING_REASONS.waitingForOperatorInput;
27
+ case "changes_requested":
28
+ return PATCHRELAY_WAITING_REASONS.waitingForReviewFeedback;
29
+ case "repairing_ci":
30
+ return `Waiting to repair ${checkName}`;
31
+ case "repairing_queue":
32
+ return PATCHRELAY_WAITING_REASONS.waitingForMergeStewardRepair;
33
+ case "awaiting_queue":
34
+ return PATCHRELAY_WAITING_REASONS.waitingForDownstreamAutomation;
35
+ case "done":
36
+ return PATCHRELAY_WAITING_REASONS.workComplete;
37
+ case "failed":
38
+ case "escalated":
39
+ return PATCHRELAY_WAITING_REASONS.waitingForOperatorIntervention;
40
+ default:
41
+ break;
42
+ }
43
+ if (params.prCheckStatus === "failed" || params.prCheckStatus === "failure") {
44
+ return `${checkName} failed`;
45
+ }
46
+ if (params.prReviewState === "changes_requested") {
47
+ if (params.prCheckStatus === "passed" || params.prCheckStatus === "success") {
48
+ return PATCHRELAY_WAITING_REASONS.waitingForRereview;
49
+ }
50
+ return PATCHRELAY_WAITING_REASONS.waitingForReviewFeedback;
51
+ }
52
+ if (params.prReviewState === "approved") {
53
+ return PATCHRELAY_WAITING_REASONS.waitingForDownstreamAutomation;
54
+ }
55
+ if (params.prNumber !== undefined) {
56
+ return PATCHRELAY_WAITING_REASONS.waitingForExternalReview;
57
+ }
58
+ if (params.pendingRunType) {
59
+ return `Ready to run ${humanize(params.pendingRunType)}`;
60
+ }
61
+ return undefined;
62
+ }
63
+ function humanize(value) {
64
+ return value.replaceAll("_", " ");
65
+ }