@mestreyoda/fabrica 0.2.33 → 0.2.34
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/index.js +80 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -113905,8 +113905,8 @@ import fsSync from "node:fs";
|
|
|
113905
113905
|
import path5 from "node:path";
|
|
113906
113906
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
113907
113907
|
function getCurrentVersion() {
|
|
113908
|
-
if ("0.2.
|
|
113909
|
-
return "0.2.
|
|
113908
|
+
if ("0.2.34") {
|
|
113909
|
+
return "0.2.34";
|
|
113910
113910
|
}
|
|
113911
113911
|
try {
|
|
113912
113912
|
const pkgPath = path5.join(THIS_DIR, "..", "..", "package.json");
|
|
@@ -132618,15 +132618,17 @@ async function checkWorkerHealth(opts) {
|
|
|
132618
132618
|
const startedAtMs = new Date(slot.startTime).getTime();
|
|
132619
132619
|
const minutesActive = (Date.now() - startedAtMs) / 6e4;
|
|
132620
132620
|
const hours = minutesActive / 60;
|
|
132621
|
+
let reviewablePrStatus = null;
|
|
132621
132622
|
let hasReviewableArtifact = Boolean(
|
|
132622
132623
|
issueRuntime?.currentPrNumber || issueRuntime?.currentPrUrl || issueRuntime?.artifactOfRecord?.prNumber
|
|
132623
132624
|
);
|
|
132624
|
-
if (
|
|
132625
|
+
if (issueIdNum) {
|
|
132625
132626
|
try {
|
|
132626
132627
|
const prStatus = await provider.getPrStatus(issueIdNum);
|
|
132627
|
-
|
|
132628
|
-
|
|
132629
|
-
|
|
132628
|
+
if (prStatus.url && prStatus.state !== PrState.MERGED && prStatus.state !== PrState.CLOSED && prStatus.currentIssueMatch !== false) {
|
|
132629
|
+
reviewablePrStatus = prStatus;
|
|
132630
|
+
hasReviewableArtifact = true;
|
|
132631
|
+
}
|
|
132630
132632
|
} catch {
|
|
132631
132633
|
}
|
|
132632
132634
|
}
|
|
@@ -132729,6 +132731,78 @@ async function checkWorkerHealth(opts) {
|
|
|
132729
132731
|
fixes.push(fix);
|
|
132730
132732
|
continue;
|
|
132731
132733
|
}
|
|
132734
|
+
const quietMinutes = (() => {
|
|
132735
|
+
const lastObservableAt = sessionKey ? getLastObservableSessionActivityAt(sessionKey, sessions) : null;
|
|
132736
|
+
const referenceAt = lastObservableAt ?? agentAcceptedAt ?? dispatchRequestedAt ?? startedAtMs;
|
|
132737
|
+
if (!referenceAt || Number.isNaN(referenceAt)) return minutesActive;
|
|
132738
|
+
return (Date.now() - referenceAt) / 6e4;
|
|
132739
|
+
})();
|
|
132740
|
+
if (role === "developer" && issue2 && issueIdNum && hasReviewableArtifact && reviewablePrStatus?.url && minutesActive >= stallTimeoutMinutes && quietMinutes >= Math.max(8, Math.floor(stallTimeoutMinutes / 2))) {
|
|
132741
|
+
const fix = {
|
|
132742
|
+
issue: {
|
|
132743
|
+
type: "stalled_with_artifact",
|
|
132744
|
+
severity: "critical",
|
|
132745
|
+
project: project.name,
|
|
132746
|
+
projectSlug,
|
|
132747
|
+
role,
|
|
132748
|
+
level,
|
|
132749
|
+
sessionKey,
|
|
132750
|
+
issueId: slot.issueId,
|
|
132751
|
+
slotIndex,
|
|
132752
|
+
message: `${role.toUpperCase()} ${level}[${slotIndex}] has an open PR but stayed idle for ${Math.round(quietMinutes)}m without converging`
|
|
132753
|
+
},
|
|
132754
|
+
fixed: false
|
|
132755
|
+
};
|
|
132756
|
+
if (autoFix) {
|
|
132757
|
+
const channel = project.channels?.[0];
|
|
132758
|
+
await notify(
|
|
132759
|
+
{
|
|
132760
|
+
type: "workerRecoveryExhausted",
|
|
132761
|
+
project: project.name,
|
|
132762
|
+
issueId: issueIdNum,
|
|
132763
|
+
issueUrl: issue2.web_url,
|
|
132764
|
+
issueTitle: issue2.title,
|
|
132765
|
+
role,
|
|
132766
|
+
detail: `Open PR ${reviewablePrStatus.url} has stalled for ${Math.round(quietMinutes)} minutes without a trustworthy completion. Re-queueing to ${slotQueueLabel}.`,
|
|
132767
|
+
nextState: slotQueueLabel,
|
|
132768
|
+
dispatchCycleId: slot.dispatchCycleId ?? issueRuntime?.lastDispatchCycleId ?? null,
|
|
132769
|
+
dispatchRunId: slot.dispatchRunId ?? issueRuntime?.dispatchRunId ?? null
|
|
132770
|
+
},
|
|
132771
|
+
{
|
|
132772
|
+
workspaceDir,
|
|
132773
|
+
config: notificationConfig,
|
|
132774
|
+
target: channel ? {
|
|
132775
|
+
channelId: channel.channelId,
|
|
132776
|
+
channel: channel.channel,
|
|
132777
|
+
accountId: channel.accountId,
|
|
132778
|
+
messageThreadId: channel.messageThreadId
|
|
132779
|
+
} : void 0,
|
|
132780
|
+
runCommand
|
|
132781
|
+
}
|
|
132782
|
+
).catch(() => {
|
|
132783
|
+
});
|
|
132784
|
+
await revertLabel(fix, expectedLabel, slotQueueLabel);
|
|
132785
|
+
if (!fix.labelRevertFailed) {
|
|
132786
|
+
await deactivateSlot();
|
|
132787
|
+
await updateIssueRuntime(workspaceDir, projectSlug, issueIdNum, {
|
|
132788
|
+
inconclusiveCompletionAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
132789
|
+
inconclusiveCompletionReason: "stalled_with_artifact",
|
|
132790
|
+
progressNotifiedAt: null
|
|
132791
|
+
}).catch(() => {
|
|
132792
|
+
});
|
|
132793
|
+
fix.fixed = true;
|
|
132794
|
+
await auditHealthFixApplied(workspaceDir, fix, {
|
|
132795
|
+
action: "requeue_issue",
|
|
132796
|
+
fromLabel: expectedLabel,
|
|
132797
|
+
toLabel: slotQueueLabel,
|
|
132798
|
+
idleMinutes: Math.round(quietMinutes),
|
|
132799
|
+
deliveryState
|
|
132800
|
+
});
|
|
132801
|
+
}
|
|
132802
|
+
}
|
|
132803
|
+
fixes.push(fix);
|
|
132804
|
+
continue;
|
|
132805
|
+
}
|
|
132732
132806
|
if (hours > staleWorkerHours) {
|
|
132733
132807
|
const fix = {
|
|
132734
132808
|
issue: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mestreyoda/fabrica",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "Autonomous software engineering pipeline for OpenClaw. Turns ideas into deployed code via intake, dispatch, review, test, and merge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|