@nodii/dev 0.6.77 → 0.6.79
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/cli.js +35 -3
- package/dist/closeout.js +238 -0
- package/dist/core.js +2 -2
- package/dist/devops-openapi.json +1 -1
- package/dist/figma-scope.js +71 -2
- package/dist/figma.js +32 -0
- package/dist/flags.js +8 -3
- package/dist/governor.js +15 -6
- package/dist/lanes.js +172 -10
- package/dist/review.js +20 -13
- package/dist/safety.js +28 -1
- package/dist/surface.js +34 -5
- package/dist/watchdog.js +15 -1
- package/package.json +1 -1
package/dist/watchdog.js
CHANGED
|
@@ -5,6 +5,7 @@ import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
import { CliError, configPath, devRequest, encode, readConfig } from "./core.js";
|
|
7
7
|
import { USAGE_REFRESH_MS, listAccounts, reportUsage } from "./accounts.js";
|
|
8
|
+
import { laneCloseout } from "./lanes.js";
|
|
8
9
|
|
|
9
10
|
const execFile = promisify(execFileCallback);
|
|
10
11
|
export const WATCHDOG_LABEL = "com.nodii.watchdog";
|
|
@@ -245,6 +246,7 @@ export async function sweepWatchdog({
|
|
|
245
246
|
machineId,
|
|
246
247
|
now = () => new Date(),
|
|
247
248
|
refreshUsage = refreshMachineUsage,
|
|
249
|
+
closeout = laneCloseout,
|
|
248
250
|
saveReminder = saveLaneCapReminder,
|
|
249
251
|
} = {}) {
|
|
250
252
|
const loaded = records ? { records, errors: [] } : await loadRecords();
|
|
@@ -252,6 +254,7 @@ export async function sweepWatchdog({
|
|
|
252
254
|
const byId = new Map(loaded.records.map((record) => [record.runId, record]));
|
|
253
255
|
const effectiveMachineId = machineId ?? (await coordinatorMachine({ request })).machineId;
|
|
254
256
|
const orphanedRuns = [];
|
|
257
|
+
const finalOrphanCloseouts = [];
|
|
255
258
|
// Dev's live runs are the authority, not the local flags (NODII-DEV-CLI-42):
|
|
256
259
|
// a run Dev still holds as running gets its dead process reported again, and
|
|
257
260
|
// a run with no local record is one this sweep cannot see. Without Dev's list
|
|
@@ -325,6 +328,17 @@ export async function sweepWatchdog({
|
|
|
325
328
|
if (response?.data?.run?.livenessState === "orphan") {
|
|
326
329
|
record.orphanReportedAt = observedAt;
|
|
327
330
|
orphanedRuns.push({ runId: record.runId, pid: record.pid, reportedAt: record.orphanReportedAt });
|
|
331
|
+
// hub-244: an Orphan that turned final (no automatic relaunch)
|
|
332
|
+
// closes out here; Dev released its holds in the same report.
|
|
333
|
+
const run = response.data.run;
|
|
334
|
+
if (run.kind === "lane" && run.laneId && run.autoRelaunchAllowed === false) {
|
|
335
|
+
try {
|
|
336
|
+
const result = await closeout(run.laneId, run.failureReason ?? "final Orphan: the same death twice", { request });
|
|
337
|
+
finalOrphanCloseouts.push({ runId: record.runId, laneId: run.laneId, repositories: result.repositories });
|
|
338
|
+
} catch (error) {
|
|
339
|
+
facts.errors.push({ kind: "closeout", runId: record.runId, code: error?.code ?? "LANE_CLOSEOUT_FAILED" });
|
|
340
|
+
}
|
|
341
|
+
}
|
|
328
342
|
} else if (["done", "handed_off", "failed", "blocked"].includes(response?.data?.run?.status)) {
|
|
329
343
|
record.terminalSeenAt = observedAt;
|
|
330
344
|
} else {
|
|
@@ -353,7 +367,7 @@ export async function sweepWatchdog({
|
|
|
353
367
|
} catch (error) {
|
|
354
368
|
facts.errors.push({ kind: "lane_cap", code: error?.code ?? "LANE_CAP_READ_FAILED" });
|
|
355
369
|
}
|
|
356
|
-
const report = { ...facts, orphanedRuns, unwatchedRuns, accounts, laneCap };
|
|
370
|
+
const report = { ...facts, orphanedRuns, finalOrphanCloseouts, unwatchedRuns, accounts, laneCap };
|
|
357
371
|
return report;
|
|
358
372
|
}
|
|
359
373
|
|