forgedock 1.54.0 → 1.55.0
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/bin/auth/app-token.mjs +2 -0
- package/bin/auth/app-token.test.mjs +9 -1
- package/bin/engine/events.mjs +1 -0
- package/bin/engine/events.test.mjs +5 -1
- package/bin/engine/outcome-codes.mjs +3 -0
- package/bin/engine-cli.mjs +126 -34
- package/bin/forgedock.mjs +56 -4
- package/bin/gc-schedule.mjs +83 -0
- package/bin/gc.mjs +56 -8
- package/bin/help-text.mjs +1 -1
- package/bin/hooks/pre-tool-use.mjs +1 -0
- package/bin/init-detect.mjs +73 -2
- package/bin/labels.json +5 -0
- package/bin/lean/admission.mjs +21 -1
- package/bin/lean/baselines.mjs +43 -0
- package/bin/lean/baselines.test.mjs +33 -0
- package/bin/lean/batch-health.mjs +43 -6
- package/bin/lean/batch-health.test.mjs +41 -1
- package/bin/lean/batch.mjs +41 -4
- package/bin/lean/batch.test.mjs +106 -3
- package/bin/lean/conformance.mjs +131 -12
- package/bin/lean/conformance.test.mjs +172 -3
- package/bin/lean/depcache.mjs +23 -2
- package/bin/lean/depcache.test.mjs +22 -0
- package/bin/lean/docsgate.mjs +137 -0
- package/bin/lean/docsgate.test.mjs +78 -0
- package/bin/lean/effects.mjs +31 -2
- package/bin/lean/enumerating.mjs +39 -13
- package/bin/lean/enumerating.test.mjs +20 -0
- package/bin/lean/execution.test.mjs +3 -3
- package/bin/lean/fastforward.mjs +93 -0
- package/bin/lean/fastforward.test.mjs +73 -0
- package/bin/lean/guardgate.mjs +38 -7
- package/bin/lean/guardgate.test.mjs +39 -0
- package/bin/lean/issuewatch-install.mjs +92 -0
- package/bin/lean/issuewatch-install.test.mjs +31 -0
- package/bin/lean/issuewatch-parity.mjs +33 -3
- package/bin/lean/issuewatch-parity.test.mjs +30 -5
- package/bin/lean/issuewatch-reconcile.mjs +123 -0
- package/bin/lean/issuewatch-reconcile.test.mjs +30 -0
- package/bin/lean/issuewatch-verify.mjs +51 -9
- package/bin/lean/issuewatch.mjs +153 -33
- package/bin/lean/issuewatch.test.mjs +243 -22
- package/bin/lean/lean.mjs +381 -75
- package/bin/lean/lean.test.mjs +437 -20
- package/bin/lean/light.mjs +11 -3
- package/bin/lean/light.test.mjs +27 -0
- package/bin/lean/lightlane.mjs +8 -3
- package/bin/lean/lightlane.test.mjs +20 -0
- package/bin/lean/mechfix.mjs +35 -4
- package/bin/lean/mechfix.test.mjs +48 -1
- package/bin/lean/orchestrate-children.test.mjs +10 -0
- package/bin/lean/orchestrate-owned.test.mjs +73 -0
- package/bin/lean/orchestrate.mjs +28 -4
- package/bin/lean/overlap.mjs +20 -0
- package/bin/lean/overlap.test.mjs +49 -0
- package/bin/lean/pagegate.mjs +152 -0
- package/bin/lean/pagegate.test.mjs +77 -0
- package/bin/lean/parked-relabel.mjs +32 -0
- package/bin/lean/parked-relabel.test.mjs +45 -0
- package/bin/lean/phaseledger.mjs +17 -2
- package/bin/lean/postdeploy-check.mjs +27 -0
- package/bin/lean/postdeploy-check.test.mjs +13 -1
- package/bin/lean/postrun.mjs +32 -0
- package/bin/lean/postrun.test.mjs +41 -0
- package/bin/lean/preflight.mjs +46 -0
- package/bin/lean/preflight.test.mjs +30 -1
- package/bin/lean/prompts.mjs +36 -6
- package/bin/lean/recovery.test.mjs +16 -0
- package/bin/lean/release.mjs +30 -3
- package/bin/lean/release.test.mjs +36 -0
- package/bin/lean/render.mjs +17 -6
- package/bin/lean/reproquality.mjs +116 -0
- package/bin/lean/reproquality.test.mjs +85 -0
- package/bin/lean/review-trigger.mjs +8 -3
- package/bin/lean/sandbox-budget.test.mjs +27 -0
- package/bin/lean/schedd.mjs +40 -11
- package/bin/lean/schedd.test.mjs +12 -1
- package/bin/lean/testadequacy.mjs +97 -0
- package/bin/lean/testadequacy.test.mjs +92 -0
- package/bin/lean/testsandbox.mjs +202 -0
- package/bin/lean/testsandbox.test.mjs +157 -0
- package/bin/lean/toolplace.mjs +5 -2
- package/bin/lean/toolplace.test.mjs +6 -0
- package/bin/lean/verify.mjs +6 -1
- package/bin/lean/verify.test.mjs +18 -2
- package/bin/lean/warmtree.mjs +77 -0
- package/bin/lean/warmtree.test.mjs +81 -0
- package/bin/runner.mjs +6 -1
- package/bin/stats/conformance-outcomes.mjs +12 -2
- package/bin/stats/depth.mjs +24 -1
- package/bin/stats/depth.test.mjs +21 -1
- package/bin/stats/index.mjs +5 -2
- package/bin/stats/query.mjs +2 -1
- package/commands/cleanup.md +18 -0
- package/commands/fd-introspect.md +19 -0
- package/commands/milestone.md +5 -1
- package/commands/pipeline-health/phase-2-metrics.md +4 -0
- package/commands/recover-orphans.md +31 -1
- package/commands/review-pr-staging.md +9 -0
- package/commands/review-pr.md +2 -0
- package/docs/CI.md +1 -1
- package/docs/CONFIG.md +26 -1
- package/docs/EVENTS.md +1 -0
- package/docs/ISSUE-WATCH.md +12 -3
- package/docs/eval/adversarial-bench.md +1 -1
- package/docs/eval/published/adversarial-2026-11-11.md +58 -0
- package/package.json +1 -1
- package/scripts/bench-lightlane.mjs +3 -2
- package/scripts/hotspots.sh +7 -4
- package/scripts/hotspots.test.sh +12 -0
- package/scripts/recover-orphans-stateless.test.sh +79 -0
- package/scripts/transition-label.sh +2 -0
- package/templates/workflows/forgedock-reopen-clean.yml +33 -0
package/bin/auth/app-token.mjs
CHANGED
|
@@ -16,6 +16,8 @@ import { homedir } from "node:os";
|
|
|
16
16
|
import { PIPELINE_PERMISSIONS, API, mintInstallationToken, findInstallation, buildAppManifest, convertManifestCode, receiveManifestCode } from "./app-manifest.mjs";
|
|
17
17
|
|
|
18
18
|
export const REFRESH_BEFORE_MS = 10 * 60 * 1000;
|
|
19
|
+
// Commands that run long enough to outlive an installation token (1h, adopted with as little as REFRESH_BEFORE_MS left): they start startAuthRefresh.
|
|
20
|
+
export const AUTH_REFRESH_COMMANDS = new Set(["orchestrate", "schedd", "watch", "issue-watch", "prod-watch", "run-issue", "resume-stalled", "run", "bootstrap", "release"]);
|
|
19
21
|
const UA = { "User-Agent": "forgedock", Accept: "application/json", "Content-Type": "application/json" };
|
|
20
22
|
|
|
21
23
|
const homeDir = (env) => env.FORGE_HOME_DIR || join(homedir(), ".forge");
|
|
@@ -5,7 +5,7 @@ import assert from "node:assert/strict";
|
|
|
5
5
|
import { statSync, existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { tmpDir } from "../tests/_tmp.mjs";
|
|
8
|
-
import { resolveAuth, applyAuthEnv, startAuthRefresh, writeState, readState, statePath, deviceFlowLogin, mintViaBroker, assertSecureBroker, authFromCli, doctorAppAuth, clearState } from "./app-token.mjs";
|
|
8
|
+
import { resolveAuth, applyAuthEnv, startAuthRefresh, writeState, readState, statePath, deviceFlowLogin, mintViaBroker, assertSecureBroker, authFromCli, doctorAppAuth, clearState, AUTH_REFRESH_COMMANDS } from "./app-token.mjs";
|
|
9
9
|
|
|
10
10
|
const mkEnv = (extra = {}) => ({ FORGE_HOME_DIR: tmpDir("app-auth-"), ...extra });
|
|
11
11
|
const NOW = Date.parse("2026-01-01T00:00:00Z");
|
|
@@ -230,3 +230,11 @@ test("an inherited App token whose login was removed is dropped with its marker
|
|
|
230
230
|
assert.equal(out.fp, null);
|
|
231
231
|
assert.equal(out.timers, 0);
|
|
232
232
|
});
|
|
233
|
+
|
|
234
|
+
// Long-running lane commands must refresh the App token they adopt, or lanes past expiry 401.
|
|
235
|
+
test("AUTH_REFRESH_COMMANDS covers lane commands and the CLI uses it instead of an inline list", () => {
|
|
236
|
+
for (const c of ["orchestrate", "schedd", "watch", "issue-watch", "prod-watch", "run-issue", "resume-stalled", "run", "bootstrap", "release"]) assert.ok(AUTH_REFRESH_COMMANDS.has(c), c);
|
|
237
|
+
for (const c of ["auth", "gc", "doctor"]) assert.ok(!AUTH_REFRESH_COMMANDS.has(c), c);
|
|
238
|
+
const src = readFileSync(new URL("../forgedock.mjs", import.meta.url), "utf8");
|
|
239
|
+
assert.match(src, /AUTH_REFRESH_COMMANDS\.has\(command\)\) startAuthRefresh\(\)/);
|
|
240
|
+
});
|
package/bin/engine/events.mjs
CHANGED
|
@@ -27,6 +27,7 @@ export const EVENT_TYPES = {
|
|
|
27
27
|
"probe.failed": ["detail", "fix"],
|
|
28
28
|
"regression.detected": ["subject", "metric", "detail"],
|
|
29
29
|
"experiment.verdict": ["experiment", "verdict", "detail"],
|
|
30
|
+
"watch.dead": ["watch", "repo", "reason", "age_s"],
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
const scalar = (v) => (typeof v === "number" ? Number.isFinite(v) : typeof v === "boolean" || (typeof v === "string" && v !== ""));
|
|
@@ -15,7 +15,7 @@ const lines = (dir) => readFileSync(join(dir, "o_r.jsonl"), "utf8").trim().split
|
|
|
15
15
|
|
|
16
16
|
describe("event contract (v1)", () => {
|
|
17
17
|
it("documents exactly the named lifecycle types", () => {
|
|
18
|
-
assert.deepEqual(Object.keys(EVENT_TYPES), ["lane.picked_up", "contract.frozen", "pr.opened", "pr.merged", "release.promoted", "probe.passed", "probe.failed", "regression.detected", "experiment.verdict"]);
|
|
18
|
+
assert.deepEqual(Object.keys(EVENT_TYPES), ["lane.picked_up", "contract.frozen", "pr.opened", "pr.merged", "release.promoted", "probe.passed", "probe.failed", "regression.detected", "experiment.verdict", "watch.dead"]);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it("every envelope has the same top-level keys and only documented data keys", () => {
|
|
@@ -92,6 +92,10 @@ describe("regression, experiment and promoted builders (#4632)", () => {
|
|
|
92
92
|
assert.deepEqual(EVENT_TYPES["regression.detected"], ["subject", "metric", "detail"]);
|
|
93
93
|
assert.deepEqual(EVENT_TYPES["experiment.verdict"], ["experiment", "verdict", "detail"]);
|
|
94
94
|
});
|
|
95
|
+
it("watch.dead carries the watch, repo, reason and age", () => {
|
|
96
|
+
const e = buildEvent("watch.dead", { watch: "w", repo: "o/r", reason: "no heartbeat", age_s: 4000, extra: "x" }, { repo: "o/r" });
|
|
97
|
+
assert.deepEqual(e.data, { watch: "w", repo: "o/r", reason: "no heartbeat", age_s: 4000 });
|
|
98
|
+
});
|
|
95
99
|
it("a regression row is written to the sink", async () => {
|
|
96
100
|
const dir = tmp();
|
|
97
101
|
const p = regressionEvent({ issue: 5, outcome: "fail", regression: 7, detail: "d" });
|
|
@@ -242,6 +242,9 @@ function classifyNeedsHumanBase(row) {
|
|
|
242
242
|
/** forge#4725: mechanical/environment codes recover on their own budget (`recovery.mechanicalMaxAttempts`), apart from conformance failures. */
|
|
243
243
|
export const MECHANICAL_CODES = Object.freeze([OUTCOME_CODES.BASE_CONFLICT, OUTCOME_CODES.CONTRACT_INVALID_COMMAND, OUTCOME_CODES.ENV_TOOL_MISSING, OUTCOME_CODES.ENV_REPRO_UNRUNNABLE, ENV_VALIDATE_TIMEOUT, ENV_VALIDATE_PLACEMENT, OUTCOME_CODES.ENV_CAPABILITY_REMOTE]);
|
|
244
244
|
|
|
245
|
+
/** #5423: environment gaps the engine recovers itself: a first lane ending on one never labels the issue needs-human. */
|
|
246
|
+
export const ENV_ENGINE_OWNED_CODES = Object.freeze([OUTCOME_CODES.ENV_TOOL_MISSING, ENV_VALIDATE_PLACEMENT, ENV_VALIDATE_TIMEOUT, OUTCOME_CODES.ENV_CAPABILITY_REMOTE, OUTCOME_CODES.ENV_REPRO_UNRUNNABLE]);
|
|
247
|
+
|
|
245
248
|
/** `mechanical` | `conformance`: the recovery budget class of a lane result row (a conflicting `ci-pending` is a base conflict). */
|
|
246
249
|
export function recoveryClassOf(row) {
|
|
247
250
|
return MECHANICAL_CODES.includes(recoveryCodeOf(row)) ? "mechanical" : "conformance";
|
package/bin/engine-cli.mjs
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* issues, calls scanStalls, and re-dispatches each stalled issue via run-issue.
|
|
6
6
|
*/
|
|
7
7
|
import { validateForgeYaml, formatFinding } from "./config-schema.mjs";
|
|
8
|
+
import { parseDocsConfig } from "./lean/docsgate.mjs";
|
|
9
|
+
import { parsePagesConfig, PAGE_RE, designHold } from "./lean/pagegate.mjs";
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
8
11
|
import { execFile, spawn } from "node:child_process";
|
|
9
12
|
import { promisify } from "node:util";
|
|
10
13
|
import { readdirSync, statSync, readFileSync } from "node:fs";
|
|
@@ -248,6 +251,13 @@ export function readReproTest(cwd = process.cwd()) {
|
|
|
248
251
|
return ["off", "prefer"].includes(v) ? v : undefined;
|
|
249
252
|
} catch { return undefined; }
|
|
250
253
|
}
|
|
254
|
+
/** forge.yaml `lean.repro_quality` (off|shadow|enforce, #5446); undefined when absent or invalid (the core defaults to shadow). */
|
|
255
|
+
export function readReproQuality(cwd = process.cwd()) {
|
|
256
|
+
try {
|
|
257
|
+
const v = String(parseForgeYaml(readFileSync(join(cwd, "forge.yaml"), "utf8"))?.lean?.repro_quality ?? "").trim();
|
|
258
|
+
return ["off", "shadow", "enforce"].includes(v) ? v : undefined;
|
|
259
|
+
} catch { return undefined; }
|
|
260
|
+
}
|
|
251
261
|
/** forge.yaml `decomposition.close_parent` (#3736, #4337): true closes a decomposed parent at decomposition; anything else keeps it open. */
|
|
252
262
|
export function readCloseParent(cwd = process.cwd()) {
|
|
253
263
|
try { return String(parseForgeYaml(readFileSync(join(cwd, "forge.yaml"), "utf8"))?.decomposition?.close_parent ?? "").trim() === "true"; } catch { return false; }
|
|
@@ -440,10 +450,14 @@ export function readMergeWait(cwd = process.cwd()) {
|
|
|
440
450
|
*/
|
|
441
451
|
export function readVerify(cwd = process.cwd()) {
|
|
442
452
|
try {
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
|
|
453
|
+
const yml = parseForgeYaml(readFileSync(join(cwd, "forge.yaml"), "utf8"));
|
|
454
|
+
// #5480: `lean: enumerating: mechanical: false` turns off the engine's own enumerating-test edits (the one-level reader flattens it to lean.mechanical)
|
|
455
|
+
const enumOff = String(yml?.lean?.enumerating?.mechanical ?? yml?.lean?.mechanical ?? "").trim().toLowerCase() === "false";
|
|
456
|
+
const base = yml?.verify && typeof yml.verify === "object" ? yml.verify : enumOff ? {} : null;
|
|
457
|
+
if (!base) return undefined;
|
|
458
|
+
const sec = enumOff ? { ...base, enumerating_mechanical: "false" } : base;
|
|
459
|
+
const invariants = readInvariants(cwd), flaky = readYamlList(cwd, "verify", "flaky"), guard_command = readYamlMap(cwd, "verify", "guard_command"), baselines = readYamlMap(cwd, "verify", "baselines"), sandboxes = readYamlMap(cwd, "verify", "sandboxes"); // #5448: {when glob: command}
|
|
460
|
+
return coerceCiVerify(parseVerify({ ...sec, ...(invariants ? { invariants } : {}), ...(flaky ? { flaky } : {}), ...(guard_command ? { guard_command } : {}), ...(baselines ? { baselines } : {}), ...(sandboxes ? { sandboxes } : {}) }), { cwd }); // #5278: local-first never pushes for paid CI before review
|
|
447
461
|
} catch { return undefined; }
|
|
448
462
|
}
|
|
449
463
|
/** #4542: forge.yaml `execution.host_capabilities` (+ patterns) for a lane's remote-block mapping; undefined when none are declared. */
|
|
@@ -564,9 +578,13 @@ export function readEnvConfig(cwd = process.cwd()) {
|
|
|
564
578
|
const pp = readYamlMap(cwd, "topology", "prod_parity"); // #5284: {path glob: command | "note: how to verify"} production-only facts
|
|
565
579
|
const s = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
|
|
566
580
|
const rr = s(y?.topology?.route_reachability); // #5087: repo-supplied command: exits non-zero when the ingress does not deliver the added route paths (args) to their service
|
|
581
|
+
const dc = parseDocsConfig(y?.docs); // #5419: forge.yaml docs: (off unless required_for is set)
|
|
582
|
+
let appPages = false; // #5428: default-on trigger: the repo tracks Next app/**/page.* files
|
|
583
|
+
try { appPages = String(execFileSync("git", ["ls-files", "--", "*page.*"], { cwd, encoding: "utf8", timeout: 10000, stdio: ["ignore", "pipe", "ignore"] })).split("\n").some((f) => PAGE_RE.test(f)); } catch { /* not a git checkout: off */ }
|
|
584
|
+
const pg = parsePagesConfig(y?.pages, { hasAppPages: appPages }); // #5428: forge.yaml pages: (off for repos without pages)
|
|
567
585
|
const kb = typeof e.sparse_max_kb === "string" && /^\d+$/.test(e.sparse_max_kb.trim()) ? Number(e.sparse_max_kb) : e.sparse_max_kb;
|
|
568
586
|
return { ...(s(e.toolchain) ? { toolchainOverride: s(e.toolchain) } : {}), ...(s(e.setup) ? { envSetup: s(e.setup) } : {}),
|
|
569
|
-
...(Number.isInteger(kb) && kb >= 0 ? { sparseMaxKb: kb } : {}), ...(Object.keys(runners).length ? { testRunners: runners } : {}), ...(recipes.length ? { validateRecipes: recipes } : {}), ...(cf && Object.keys(cf).length ? { coupledFiles: cf } : {}), ...(rr ? { routeReachability: rr } : {}), ...(pp && Object.keys(pp).length ? { prodParity: pp } : {}) };
|
|
587
|
+
...(Number.isInteger(kb) && kb >= 0 ? { sparseMaxKb: kb } : {}), ...(Object.keys(runners).length ? { testRunners: runners } : {}), ...(recipes.length ? { validateRecipes: recipes } : {}), ...(cf && Object.keys(cf).length ? { coupledFiles: cf } : {}), ...(rr ? { routeReachability: rr } : {}), ...(dc ? { docsConfig: dc } : {}), ...(pg ? { pagesConfig: pg } : {}), ...(pp && Object.keys(pp).length ? { prodParity: pp } : {}) };
|
|
570
588
|
} catch { return {}; }
|
|
571
589
|
}
|
|
572
590
|
export const ENGINE_PATHS = ["core", "full", "lean", "auto"];
|
|
@@ -921,6 +939,7 @@ export async function runFromCli(argv, deps = {}) {
|
|
|
921
939
|
const lane = flag(argv, "--lane");
|
|
922
940
|
if (argv.includes("--lane") && (!lane || lane.startsWith("--"))) throw new Error("--lane requires a value: staging or milestone/<slug>");
|
|
923
941
|
const laneOverride = argv.includes("--lane-override");
|
|
942
|
+
const adopt = argv.includes("--adopt"); // #5469: take over an open PR the pipeline did not author (lean.mjs adoptPr)
|
|
924
943
|
const repo = flag(argv, "--repo");
|
|
925
944
|
const backend = flag(argv, "--backend");
|
|
926
945
|
const model = flag(argv, "--model");
|
|
@@ -1016,11 +1035,11 @@ export async function runFromCli(argv, deps = {}) {
|
|
|
1016
1035
|
const env = deps.env ?? process.env;
|
|
1017
1036
|
let lres;
|
|
1018
1037
|
try {
|
|
1019
|
-
lres = await runCore({ issue, repo: leanRepo, ...(lane ? { lane } : {}), laneOverride, branches: readBranches(), cwd: process.cwd(), dir, io: leanIo, path: enginePath, onProgress,
|
|
1038
|
+
lres = await runCore({ issue, repo: leanRepo, deferPostRun: true, ...(adopt ? { adopt: true } : {}), ...(lane ? { lane } : {}), laneOverride, branches: readBranches(), cwd: process.cwd(), dir, io: leanIo, path: enginePath, onProgress,
|
|
1020
1039
|
...(rotatorKind({ execution: readExecution(process.cwd()), env }) ? { accountRotator: rotatorKind({ execution: readExecution(process.cwd()), env }) } : {}), // #5094, #5205: detected
|
|
1021
1040
|
onTeardown: (fn) => { teardown = fn; }, ...(env.FORGEDOCK_BATCH_ID ? { batchId: env.FORGEDOCK_BATCH_ID } : {}), ...(placement ? { placement } : {}), ...(recover ? { recover } : {}),
|
|
1022
1041
|
emitTelemetry: deps.emitTelemetry ?? composeEmit(makeEmitTelemetry({ repo: leanRepo }), makeEventEmitter({ repo: leanRepo, config: readEvents() }).emit),
|
|
1023
|
-
admission: readAdmission(), heavy: readHeavy(), ...readCoreLimits(), ...readEnvConfig(), ...(readMergeWait() ? { mergeWait: readMergeWait() } : {}), ...(readConformanceMode() ? { conformance: readConformanceMode() } : {}), ...(readConformanceKinds() ? { conformanceKinds: readConformanceKinds() } : {}), ...(readConformanceMutation() ? { conformanceMutation: "report" } : {}), ...(readContextPack() ? { contextPack: readContextPack() } : {}), ...(readSequenceVersioned() ? { sequenceVersioned: readSequenceVersioned() } : {}), ...(readSharedSurfaces() ? { sharedSurfaces: readSharedSurfaces() } : {}), ...(readReviewIncomplete() ? { reviewIncomplete: readReviewIncomplete() } : {}), ...(readLaneInstructions() ? { laneInstructions: readLaneInstructions() } : {}), ...(readReproTest() ? { reproTest: readReproTest() } : {}), ...(readExplore() ? { explore: readExplore() } : {}), ...(readExperiment() ? { experiment: readExperiment() } : {}), light: readLight(), ...(readCloseParent() ? { closeParent: true } : {}), ...(readReviewTrigger() ? { reviewTrigger: readReviewTrigger() } : {}), ...(readVerify() ? { verify: readVerify() } : {}), ...readPrecheckOptions(), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model") ? { reviewerModel: readLeanSetting("reviewer_model") } : {}), ...(readFixModel() ? { fixModel: readFixModel() } : {}), ...(readBuilderRouting() ? { builderRouting: readBuilderRouting() } : {}), ...(readVerifier() ? { verifier: readVerifier() } : {}), ...(readHostCaps() ? { hostCaps: readHostCaps() } : {}), ...readRelayCaps(), ...(readSequenceRegenerate() ? { sequenceRegenerate: readSequenceRegenerate() } : {}), ...(readBaseMerge() ? { baseMerge: readBaseMerge() } : {}), ...(readFollowupsDefaultMilestone() ? { followupsDefaultMilestone: readFollowupsDefaultMilestone() } : {}), ...(readFollowupsRollupLabel() ? { followupsRollupLabel: readFollowupsRollupLabel() } : {}) });
|
|
1042
|
+
admission: readAdmission(), heavy: readHeavy(), ...readCoreLimits(), ...readEnvConfig(), ...(readMergeWait() ? { mergeWait: readMergeWait() } : {}), ...(readConformanceMode() ? { conformance: readConformanceMode() } : {}), ...(readConformanceKinds() ? { conformanceKinds: readConformanceKinds() } : {}), ...(readConformanceMutation() ? { conformanceMutation: "report" } : {}), ...(readContextPack() ? { contextPack: readContextPack() } : {}), ...(readSequenceVersioned() ? { sequenceVersioned: readSequenceVersioned() } : {}), ...(readSharedSurfaces() ? { sharedSurfaces: readSharedSurfaces() } : {}), ...(readReviewIncomplete() ? { reviewIncomplete: readReviewIncomplete() } : {}), ...(readLaneInstructions() ? { laneInstructions: readLaneInstructions() } : {}), ...(readReproTest() ? { reproTest: readReproTest() } : {}), ...(readReproQuality() ? { reproQuality: readReproQuality() } : {}), ...(readExplore() ? { explore: readExplore() } : {}), ...(readExperiment() ? { experiment: readExperiment() } : {}), light: readLight(), ...(readCloseParent() ? { closeParent: true } : {}), ...(readReviewTrigger() ? { reviewTrigger: readReviewTrigger() } : {}), ...(readVerify() ? { verify: readVerify() } : {}), ...readPrecheckOptions(), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model") ? { reviewerModel: readLeanSetting("reviewer_model") } : {}), ...(readFixModel() ? { fixModel: readFixModel() } : {}), ...(readBuilderRouting() ? { builderRouting: readBuilderRouting() } : {}), ...(readVerifier() ? { verifier: readVerifier() } : {}), ...(readHostCaps() ? { hostCaps: readHostCaps() } : {}), ...readRelayCaps(), ...(readSequenceRegenerate() ? { sequenceRegenerate: readSequenceRegenerate() } : {}), ...(readBaseMerge() ? { baseMerge: readBaseMerge() } : {}), ...(readFollowupsDefaultMilestone() ? { followupsDefaultMilestone: readFollowupsDefaultMilestone() } : {}), ...(readFollowupsRollupLabel() ? { followupsRollupLabel: readFollowupsRollupLabel() } : {}) });
|
|
1024
1043
|
} catch (e) { if (!interrupted) report({ terminalReason: "engine-error", detail: String(e?.message ?? e).slice(0, 500) }); throw e; }
|
|
1025
1044
|
finally { if (!interrupted) for (const [sig, f] of Object.entries(handlers)) off(sig, f); }
|
|
1026
1045
|
if (interrupted) return lres; // the signal handler reported and exits
|
|
@@ -1029,6 +1048,7 @@ export async function runFromCli(argv, deps = {}) {
|
|
|
1029
1048
|
if (lres.terminalReason === "lane-refused") { console.log(`issue #${issue} → lane-refused ${lres.code} (${lres.detail})`); return lres; }
|
|
1030
1049
|
console.log(`issue #${issue} → ${lres.terminalReason}`);
|
|
1031
1050
|
if (!["merged", "invalid"].includes(lres.terminalReason)) console.log(lres.detail ?? "");
|
|
1051
|
+
try { await lres.postRun?.(); } catch { /* #5437: recorded as POSTRUN_FAILED, never the outcome */ }
|
|
1032
1052
|
return lres;
|
|
1033
1053
|
}
|
|
1034
1054
|
const res = await runIssueFn({ issue, dir, agentId, lane, io,
|
|
@@ -1225,6 +1245,11 @@ function flag(argv, name) { const i = argv.indexOf(name); return i >= 0 ? argv[i
|
|
|
1225
1245
|
* SIGTERM (their teardown saves the work), remote lanes run to their result and the rest end `held`; `--resume <id>` continues it.
|
|
1226
1246
|
*/
|
|
1227
1247
|
export async function orchestrateFromCli(argv, deps = {}) {
|
|
1248
|
+
if (argv.includes("--adopt")) { // #5469: review, base-sync and merge a hand-built open PR of one issue: the single-issue lane in adopt mode
|
|
1249
|
+
const issue = argv[argv.indexOf("--adopt") + 1];
|
|
1250
|
+
if (!/^#?\d+$/.test(String(issue))) throw new Error(ORCH_USAGE);
|
|
1251
|
+
return runFromCli([String(issue).replace("#", ""), "--adopt", ...argv.filter((a, i) => ["--repo", "--lane"].includes(argv[i - 1]) || ["--repo", "--lane"].includes(a))], deps);
|
|
1252
|
+
}
|
|
1228
1253
|
const inProcess = deps.inProcess || deps.leanModule || deps.laneScript || deps.batchRoot || deps.leanIo
|
|
1229
1254
|
|| argv.includes("--foreground") || process.env.FORGEDOCK_SCHEDD === "0";
|
|
1230
1255
|
if (inProcess) return runBatch({ argv: argv.filter((a) => a !== "--foreground"), cwd: process.cwd(), env: process.env, sink: consoleSink(), deps });
|
|
@@ -1273,8 +1298,8 @@ async function envBatch({ argv, root, print = (l) => console.log(l) }) {
|
|
|
1273
1298
|
return { ok: true, batch: id };
|
|
1274
1299
|
}
|
|
1275
1300
|
|
|
1276
|
-
const ORCH_USAGE = "usage: forgedock orchestrate <issue...> [--parallel K] [--lane L] [--lane-override] [--force <reason>] [--repo owner/repo] [--auto-children off|decomposed|epic|all] [--epic N] | --resume <id> [issue...] | --set-parallel <id> <K> | --set-max-remote <id> <N> | --set-placement <id> remote|hybrid|local | --clear-breaker <id> | --add <id> <issue...> | --requeue <id> <issue...> [--reason <text>] | --cancel <id> [--stop-remote] | --hold <id> <issue...> | --release <id> <issue...> | --show-env <id> | --set-env <id> KEY=VAL | --unset-env <id> KEY";
|
|
1277
|
-
const ORCH_VALUED = ["--parallel", "--lane", "--repo", "--model", "--prefilter-model", "--reason", "--force", "--auto-children", "--epic"];
|
|
1301
|
+
const ORCH_USAGE = "usage: forgedock orchestrate <issue...> [--parallel K] [--lane L] [--lane-override] [--force <reason>] [--repo owner/repo] [--auto-children off|decomposed|epic|all] [--epic N] | --resume <id> [issue...] | --set-parallel <id> <K> | --set-max-remote <id> <N> | --set-placement <id> remote|hybrid|local | --clear-breaker <id> | --add <id> <issue...> | --requeue <id> <issue...> [--reason <text>] | --cancel <id> [--stop-remote] | --hold <id> <issue...> [--for <4h|30m|1d>] [--reason <text>] | --gc-orphans | --adopt <issue> [--repo owner/repo] [--lane L] | --release <id> <issue...> | --show-env <id> | --set-env <id> KEY=VAL | --unset-env <id> KEY";
|
|
1302
|
+
const ORCH_VALUED = ["--parallel", "--lane", "--repo", "--model", "--prefilter-model", "--reason", "--force", "--auto-children", "--epic", "--for"];
|
|
1278
1303
|
const issuesOf = (argv) => {
|
|
1279
1304
|
const issues = [];
|
|
1280
1305
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -1283,6 +1308,8 @@ const issuesOf = (argv) => {
|
|
|
1283
1308
|
}
|
|
1284
1309
|
return issues;
|
|
1285
1310
|
};
|
|
1311
|
+
/** #5471: the reason of `--force <reason>` (null when absent or valueless): lifts the cross-batch ownership skip. */
|
|
1312
|
+
const forceOf = (argv) => { const v = flag(argv, "--force"); return v && !String(v).startsWith("--") ? v : null; };
|
|
1286
1313
|
/** #4469: the operands among `tokens` (`--add`/`--resume` extras): no flags, and no value of a valued flag (`--parallel 5` is not issue #5). */
|
|
1287
1314
|
const operandsOf = (tokens) => {
|
|
1288
1315
|
const out = [];
|
|
@@ -1334,7 +1361,7 @@ const unhostedFailure = (id, res, requireHost, result) => {
|
|
|
1334
1361
|
if (requireHost && !res.hosted && !res.reopened) throw Object.assign(new Error(`batch ${id}: the issues are queued in the batch but NOTHING is scheduled: no schedd hosts it. Start the runner: forgedock orchestrate --resume ${id}`), { code: "batch.not-hosted", result });
|
|
1335
1362
|
};
|
|
1336
1363
|
|
|
1337
|
-
async function addToBatch({ id, tokens, root, io, viaDaemon = null, requireHost = false, print = (l) => console.log(l) }) {
|
|
1364
|
+
async function addToBatch({ id, tokens, root, io, viaDaemon = null, requireHost = false, force = null, print = (l) => console.log(l) }) {
|
|
1338
1365
|
const batchMod = await import("./lean/batch.mjs");
|
|
1339
1366
|
const b = batchMod.openBatch(root, id);
|
|
1340
1367
|
if (!b.exists()) throw new Error(`no batch ${id} in ${root}`);
|
|
@@ -1353,7 +1380,9 @@ async function addToBatch({ id, tokens, root, io, viaDaemon = null, requireHost
|
|
|
1353
1380
|
const open = [];
|
|
1354
1381
|
for (const n of ints) {
|
|
1355
1382
|
const st = state.get(n);
|
|
1356
|
-
|
|
1383
|
+
const owner = st === "OPEN" && !force ? batchMod.ownerOf(root, repo, n, id) : null; // #5471
|
|
1384
|
+
if (owner) { if (!skipped.some((x) => x.issue === n)) skipped.push({ issue: n, reason: `owned by ${owner}` }); }
|
|
1385
|
+
else if (st === "OPEN") open.push(n);
|
|
1357
1386
|
else if (!skipped.some((x) => x.issue === n)) skipped.push({ issue: n, reason: st ? "closed" : "unreadable" });
|
|
1358
1387
|
}
|
|
1359
1388
|
let res = { added: [], skipped: [], requeued: [] };
|
|
@@ -1394,19 +1423,45 @@ function baseWaitOf(waits, { io, leanIo, cwd, now = () => Date.now() }) {
|
|
|
1394
1423
|
};
|
|
1395
1424
|
}
|
|
1396
1425
|
|
|
1426
|
+
/** #5469: `--for 4h` / `30m` / `2d` / `90s` as ms; null when absent. Throws on a malformed value. */
|
|
1427
|
+
function parseHoldFor(v) {
|
|
1428
|
+
if (v === null || v === undefined) return null;
|
|
1429
|
+
const m = /^(\d+(?:\.\d+)?)([smhd])$/.exec(String(v).trim());
|
|
1430
|
+
if (!m || !(Number(m[1]) > 0)) throw new Error(`--for expects a duration like 4h, 30m, 2d or 90s, got "${v}"`);
|
|
1431
|
+
return Math.round(Number(m[1]) * { s: 1000, m: 60000, h: 3600000, d: 86400000 }[m[2]]);
|
|
1432
|
+
}
|
|
1433
|
+
/** #5469: the hold's owner (the operator session: the CLI's parent pid on this host), expiry (`--for`) and `--reason`. */
|
|
1434
|
+
function holdMeta(argv) {
|
|
1435
|
+
const forLabel = flag(argv, "--for"), reason = flag(argv, "--reason");
|
|
1436
|
+
return { owner: process.env.FORGE_HOLD_OWNER || `${process.env.USER || process.env.USERNAME || "operator"}@${hostname()}`, ownerPid: process.ppid, ownerHost: hostname(), forMs: parseHoldFor(forLabel), forLabel, reason: reason && !reason.startsWith("--") ? reason : null };
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/** #5469: `--gc-orphans`: cancel every orphaned batch (unhosted, pending issues, idle for a week) through the daemon or the batch files. */
|
|
1440
|
+
async function gcOrphans({ root, viaDaemon = null, print = (l) => console.log(l) }) {
|
|
1441
|
+
let res = viaDaemon ? await viaDaemon() : null;
|
|
1442
|
+
if (!res) {
|
|
1443
|
+
const schedd = await import("./lean/schedd.mjs"), batchMod = await import("./lean/batch.mjs");
|
|
1444
|
+
const { orphaned } = schedd.findUnhosted(root);
|
|
1445
|
+
for (const o of orphaned) batchMod.openBatch(root, o.id).requestCancel({ reason: "gc-orphans" });
|
|
1446
|
+
res = { cancelled: orphaned.map((o) => o.id) };
|
|
1447
|
+
}
|
|
1448
|
+
print(res.cancelled?.length ? `cancelled ${res.cancelled.length} orphaned batch(es): ${res.cancelled.join(" ")}` : "no orphaned batches");
|
|
1449
|
+
return { ok: true, cancelled: res.cancelled ?? [] };
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1397
1452
|
/**
|
|
1398
1453
|
* `--hold <id> N...` / `--release <id> N...` (#4592): the batch's `hold` file, through the daemon (`viaDaemon(op, issues)`, null
|
|
1399
1454
|
* when none runs) or directly. A held issue is not admitted (a running lane is not stopped); `--release` (or a `--resume` that
|
|
1400
1455
|
* names it) lets it run again. @returns {{ok, batch, changed:number[]}}
|
|
1401
1456
|
*/
|
|
1402
|
-
async function holdBatch({ op, id, tokens, root, viaDaemon = null, takeover = null, print = (l) => console.log(l) }) {
|
|
1457
|
+
async function holdBatch({ op, id, tokens, root, viaDaemon = null, takeover = null, meta = null, print = (l) => console.log(l) }) {
|
|
1403
1458
|
const issues = tokens.filter((t) => /^#?\d+$/.test(String(t))).map((t) => parseInt(String(t).replace("#", ""), 10));
|
|
1404
1459
|
if (!id || String(id).startsWith("--") || !issues.length) throw new Error(ORCH_USAGE);
|
|
1405
|
-
let res = viaDaemon ? await viaDaemon(op, issues) : null;
|
|
1460
|
+
let res = viaDaemon ? await viaDaemon(op, issues, meta) : null;
|
|
1406
1461
|
if (!res) {
|
|
1407
1462
|
const b = (await import("./lean/batch.mjs")).openBatch(root, id);
|
|
1408
1463
|
if (!b.exists()) throw new Error(`no batch ${id} in ${root}`);
|
|
1409
|
-
res = { changed: op === "hold" ? b.holdIssues(issues) : b.releaseIssues(issues) };
|
|
1464
|
+
res = { changed: op === "hold" ? b.holdIssues(issues, meta) : b.releaseIssues(issues) };
|
|
1410
1465
|
}
|
|
1411
1466
|
if (op === "release" && takeover) { // #5241: a released issue deferred on a cancelled batch's lease is requeued at once
|
|
1412
1467
|
const batchMod = await import("./lean/batch.mjs"), b = batchMod.openBatch(root, id), st = b.store.load(), repo = b.readPlan()?.repo ?? null;
|
|
@@ -1414,7 +1469,7 @@ async function holdBatch({ op, id, tokens, root, viaDaemon = null, takeover = nu
|
|
|
1414
1469
|
if (dead.length) await takeover(dead);
|
|
1415
1470
|
}
|
|
1416
1471
|
const list = (res.changed ?? []).map((n) => `#${n}`).join(" ") || "(none)";
|
|
1417
|
-
print(op === "hold" ? `batch ${id}: held ${list}; forgedock orchestrate --release ${id} <issue...> (or --resume ${id} <issue...>) re-admits them`
|
|
1472
|
+
print(op === "hold" ? `batch ${id}: held ${list}${meta?.forMs ? ` for ${meta.forLabel}` : ""}; forgedock orchestrate --release ${id} <issue...> (or --resume ${id} <issue...>) re-admits them`
|
|
1418
1473
|
: `batch ${id}: released ${list}`);
|
|
1419
1474
|
return { ok: true, batch: id, changed: res.changed ?? [] };
|
|
1420
1475
|
}
|
|
@@ -1425,7 +1480,7 @@ async function holdBatch({ op, id, tokens, root, viaDaemon = null, takeover = nu
|
|
|
1425
1480
|
* written. Through the daemon (`viaDaemon`, null when none runs: the batch's `requeue` file, and a finished batch's report is
|
|
1426
1481
|
* cleared so `--resume` runs it again). The runner applies the entries and posts the FORGE:DECISION.
|
|
1427
1482
|
*/
|
|
1428
|
-
async function requeueBatch({ id, tokens, reason, root, io, viaDaemon = null, requireHost = false, print = (l) => console.log(l) }) {
|
|
1483
|
+
async function requeueBatch({ id, tokens, reason, root, io, viaDaemon = null, requireHost = false, force = null, print = (l) => console.log(l) }) {
|
|
1429
1484
|
if (!id || String(id).startsWith("--") || !tokens.length) throw new Error(ORCH_USAGE);
|
|
1430
1485
|
const batchMod = await import("./lean/batch.mjs");
|
|
1431
1486
|
const b = batchMod.openBatch(root, id);
|
|
@@ -1440,6 +1495,7 @@ async function requeueBatch({ id, tokens, reason, root, io, viaDaemon = null, re
|
|
|
1440
1495
|
try { v = JSON.parse(await io.gh(["issue", "view", String(n), ...(repo ? ["-R", repo] : []), "--json", "state,labels"])); } catch { v = null; }
|
|
1441
1496
|
if (!v) refused.push({ issue: n, reason: "unreadable" });
|
|
1442
1497
|
else if (v.state !== "OPEN") refused.push({ issue: n, reason: "closed" });
|
|
1498
|
+
else if (!force && batchMod.ownerOf(root, repo, n, id)) refused.push({ issue: n, reason: `owned by ${batchMod.ownerOf(root, repo, n, id)}` }); // #5471
|
|
1443
1499
|
else if ((v.labels ?? []).some((l) => (l?.name ?? l) === "needs-human")) refused.push({ issue: n, reason: "still labelled needs-human: record the decision and remove the label first" });
|
|
1444
1500
|
else open.push(n);
|
|
1445
1501
|
}
|
|
@@ -1526,10 +1582,10 @@ async function orchestrateClient(argv, deps = {}) {
|
|
|
1526
1582
|
try { sock = await schedd.connectDaemon({ dir, spawnDaemon: null }); } catch { sock = null; }
|
|
1527
1583
|
return sock ? schedd.request(sock, { op: "requeue", id, issues, reason, by }, undefined, { timeoutMs: schedd.REQUEST_MS }) : null;
|
|
1528
1584
|
};
|
|
1529
|
-
const holdVia = (id) => async (op, issues) => {
|
|
1585
|
+
const holdVia = (id) => async (op, issues, meta = null) => {
|
|
1530
1586
|
let sock = null;
|
|
1531
1587
|
try { sock = await schedd.connectDaemon({ dir, spawnDaemon: null }); } catch { sock = null; }
|
|
1532
|
-
return sock ? schedd.request(sock, { op, id, issues }, undefined, { timeoutMs: schedd.REQUEST_MS }) : null;
|
|
1588
|
+
return sock ? schedd.request(sock, { op, id, issues, ...(meta ? { meta } : {}) }, undefined, { timeoutMs: schedd.REQUEST_MS }) : null;
|
|
1533
1589
|
};
|
|
1534
1590
|
const batchRootOf = async () => (await import("./lean/batch.mjs")).batchRoot();
|
|
1535
1591
|
if (["--show-env", "--set-env", "--unset-env"].some((f) => argv.includes(f))) return envBatch({ argv, root: await batchRootOf() });
|
|
@@ -1544,23 +1600,28 @@ async function orchestrateClient(argv, deps = {}) {
|
|
|
1544
1600
|
}
|
|
1545
1601
|
if (argv.includes("--requeue")) {
|
|
1546
1602
|
const i = argv.indexOf("--requeue"), id = argv[i + 1];
|
|
1547
|
-
return requeueBatch({ id, tokens: operandsOf(argv.slice(i + 2)), reason: flag(argv, "--reason"), root: await batchRootOf(), io: deps.io ?? makeIo(), viaDaemon: requeueVia(id), requireHost: true });
|
|
1603
|
+
return requeueBatch({ id, tokens: operandsOf(argv.slice(i + 2)), reason: flag(argv, "--reason"), root: await batchRootOf(), io: deps.io ?? makeIo(), viaDaemon: requeueVia(id), requireHost: true, force: forceOf(argv) });
|
|
1548
1604
|
}
|
|
1605
|
+
if (argv.includes("--gc-orphans")) return gcOrphans({ root: await batchRootOf(), viaDaemon: async () => {
|
|
1606
|
+
let sock = null;
|
|
1607
|
+
try { sock = await schedd.connectDaemon({ dir, spawnDaemon: null }); } catch { sock = null; }
|
|
1608
|
+
return sock ? schedd.request(sock, { op: "gc-orphans" }, undefined, { timeoutMs: schedd.REQUEST_MS }) : null;
|
|
1609
|
+
} });
|
|
1549
1610
|
for (const op of ["hold", "release"]) if (argv.includes(`--${op}`)) {
|
|
1550
1611
|
const id = flag(argv, `--${op}`);
|
|
1551
1612
|
const root = await batchRootOf(), io = deps.io ?? makeIo();
|
|
1552
|
-
return holdBatch({ op, id, tokens: operandsOf(argv.slice(argv.indexOf(`--${op}`) + 2)), root, viaDaemon: holdVia(id),
|
|
1613
|
+
return holdBatch({ op, id, tokens: operandsOf(argv.slice(argv.indexOf(`--${op}`) + 2)), root, viaDaemon: holdVia(id), meta: op === "hold" ? holdMeta(argv) : null,
|
|
1553
1614
|
takeover: (ns) => requeueBatch({ id, tokens: ns, reason: "--release: lease held by a cancelled batch", root, io, viaDaemon: requeueVia(id) }) });
|
|
1554
1615
|
}
|
|
1555
1616
|
if (argv.includes("--add")) {
|
|
1556
1617
|
const i = argv.indexOf("--add"), id = argv[i + 1];
|
|
1557
1618
|
if (!id || i + 2 >= argv.length) throw new Error(ORCH_USAGE);
|
|
1558
|
-
return addToBatch({ id, tokens: operandsOf(argv.slice(i + 2)), root: await batchRootOf(), io: deps.io ?? makeIo(), viaDaemon: addVia(id), requireHost: true });
|
|
1619
|
+
return addToBatch({ id, tokens: operandsOf(argv.slice(i + 2)), root: await batchRootOf(), io: deps.io ?? makeIo(), viaDaemon: addVia(id), requireHost: true, force: forceOf(argv) });
|
|
1559
1620
|
}
|
|
1560
1621
|
const resumeId = flag(argv, "--resume");
|
|
1561
1622
|
const resumeExtra = resumeId ? operandsOf(argv.slice(argv.indexOf("--resume") + 2)) : [];
|
|
1562
1623
|
if (resumeExtra.length) {
|
|
1563
|
-
await addToBatch({ id: resumeId, tokens: resumeExtra, root: await batchRootOf(), io: deps.io ?? makeIo(), viaDaemon: addVia(resumeId) });
|
|
1624
|
+
await addToBatch({ id: resumeId, tokens: resumeExtra, root: await batchRootOf(), io: deps.io ?? makeIo(), viaDaemon: addVia(resumeId), force: forceOf(argv) });
|
|
1564
1625
|
await holdBatch({ op: "release", id: resumeId, tokens: resumeExtra, root: await batchRootOf(), viaDaemon: holdVia(resumeId), print: (l) => onlyReleased(l) }); // #4592: a named, held issue is re-admitted
|
|
1565
1626
|
}
|
|
1566
1627
|
let msg;
|
|
@@ -1650,22 +1711,23 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
1650
1711
|
if (argv.includes("--cancel")) return cancelBatch({ id: flag(argv, "--cancel"), root, stopRemote: argv.includes("--stop-remote"), print: (l) => sink.line(l) });
|
|
1651
1712
|
if (argv.includes("--requeue")) {
|
|
1652
1713
|
const i = argv.indexOf("--requeue");
|
|
1653
|
-
return requeueBatch({ id: argv[i + 1], tokens: operandsOf(argv.slice(i + 2)), reason: flag(argv, "--reason"), root, io: deps.io ?? makeIo(), requireHost: true, print: (l) => sink.line(l) });
|
|
1714
|
+
return requeueBatch({ id: argv[i + 1], tokens: operandsOf(argv.slice(i + 2)), reason: flag(argv, "--reason"), root, io: deps.io ?? makeIo(), requireHost: true, force: forceOf(argv), print: (l) => sink.line(l) });
|
|
1654
1715
|
}
|
|
1716
|
+
if (argv.includes("--gc-orphans")) return gcOrphans({ root, print: (l) => sink.line(l) });
|
|
1655
1717
|
for (const op of ["hold", "release"]) if (argv.includes(`--${op}`)) {
|
|
1656
1718
|
const hid = flag(argv, `--${op}`);
|
|
1657
|
-
return holdBatch({ op, id: hid, tokens: operandsOf(argv.slice(argv.indexOf(`--${op}`) + 2)), root, print: (l) => sink.line(l),
|
|
1719
|
+
return holdBatch({ op, id: hid, tokens: operandsOf(argv.slice(argv.indexOf(`--${op}`) + 2)), root, meta: op === "hold" ? holdMeta(argv) : null, print: (l) => sink.line(l),
|
|
1658
1720
|
takeover: (ns) => requeueBatch({ id: hid, tokens: ns, reason: "--release: lease held by a cancelled batch", root, io: deps.io ?? makeIo(), print: (l) => sink.line(l) }) });
|
|
1659
1721
|
}
|
|
1660
1722
|
if (argv.includes("--add")) {
|
|
1661
1723
|
const i = argv.indexOf("--add");
|
|
1662
1724
|
if (!argv[i + 1] || i + 2 >= argv.length) throw new Error(ORCH_USAGE);
|
|
1663
|
-
return addToBatch({ id: argv[i + 1], tokens: operandsOf(argv.slice(i + 2)), root, io: deps.io ?? makeIo(), requireHost: true, print: (l) => sink.line(l) });
|
|
1725
|
+
return addToBatch({ id: argv[i + 1], tokens: operandsOf(argv.slice(i + 2)), root, io: deps.io ?? makeIo(), requireHost: true, force: forceOf(argv), print: (l) => sink.line(l) });
|
|
1664
1726
|
}
|
|
1665
1727
|
const resumeId = flag(argv, "--resume");
|
|
1666
1728
|
const resumeExtra = resumeId ? operandsOf(argv.slice(argv.indexOf("--resume") + 2)) : [];
|
|
1667
1729
|
if (resumeExtra.length) {
|
|
1668
|
-
await addToBatch({ id: resumeId, tokens: resumeExtra, root, io: deps.io ?? makeIo(), print: (l) => sink.line(l) });
|
|
1730
|
+
await addToBatch({ id: resumeId, tokens: resumeExtra, root, io: deps.io ?? makeIo(), force: forceOf(argv), print: (l) => sink.line(l) });
|
|
1669
1731
|
await holdBatch({ op: "release", id: resumeId, tokens: resumeExtra, root, print: (l) => onlyReleased(l, (t) => sink.line(t)) }); // #4592
|
|
1670
1732
|
}
|
|
1671
1733
|
let batch, plan = null;
|
|
@@ -1701,6 +1763,26 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
1701
1763
|
// #4659: a milestone start is refused unless every dependency of its issues is merged into its lane, or --force <reason>
|
|
1702
1764
|
const force = flag(argv, "--force");
|
|
1703
1765
|
if (argv.includes("--force") && (!force || force.startsWith("--"))) throw new Error("--force requires a reason: --force \"<why the unmet dependencies are acceptable>\"");
|
|
1766
|
+
{ // #5442: page work waits for an approved design: a design:* issue is never dispatched (--force does not lift it)
|
|
1767
|
+
const held = new Map();
|
|
1768
|
+
for (const n of issues) {
|
|
1769
|
+
let v = null;
|
|
1770
|
+
try { v = JSON.parse(await io.gh(["issue", "view", String(n), "-R", repo, "--json", "labels"])); } catch { v = null; }
|
|
1771
|
+
const h = designHold(v?.labels);
|
|
1772
|
+
if (h) held.set(n, h);
|
|
1773
|
+
}
|
|
1774
|
+
for (const [n, h] of held) sink.line(`skipped: #${n} design_pending (${h}); run /design, design:approved lifts the hold`);
|
|
1775
|
+
if (held.size) {
|
|
1776
|
+
if (held.size === issues.length) throw new Error(`every issue is design_pending (${[...held.values()].join(", ")}); run /design first`);
|
|
1777
|
+
const out = [];
|
|
1778
|
+
for (let i = 0; i < argv.length; i++) {
|
|
1779
|
+
if (ORCH_VALUED.includes(argv[i])) { out.push(argv[i], argv[++i]); continue; }
|
|
1780
|
+
if (/^#?\d+$/.test(argv[i]) && held.has(parseInt(argv[i].replace("#", ""), 10))) continue;
|
|
1781
|
+
out.push(argv[i]);
|
|
1782
|
+
}
|
|
1783
|
+
argv = out; issues = issuesOf(argv);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1704
1786
|
if (!force) {
|
|
1705
1787
|
const { unmetDependencies } = await import("../scripts/plan-validate-live.mjs");
|
|
1706
1788
|
const gateBranches = readBranches(cwd);
|
|
@@ -1768,6 +1850,7 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
1768
1850
|
const { formatFirstPassSummary } = await import("./lean/fixround.mjs");
|
|
1769
1851
|
const { formatDecompositionSummary } = await import("./lean/decompose.mjs");
|
|
1770
1852
|
const { formatShadowSummary } = await import("./lean/conformance.mjs");
|
|
1853
|
+
const { formatTestAdequacySummary } = await import("./lean/testadequacy.mjs");
|
|
1771
1854
|
const leanIo = deps.leanIo ?? (await import("./lean/effects.mjs")).makeLeanIo({ repo });
|
|
1772
1855
|
// #4399: declared acceptance probes of closed issues whose fix reached the default branch; never fails the batch
|
|
1773
1856
|
const sweep = deps.sweepProbes !== undefined ? deps.sweepProbes : (await import("./lean/probe.mjs")).sweepProbes;
|
|
@@ -1799,9 +1882,10 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
1799
1882
|
if (deps.leanModule) {
|
|
1800
1883
|
const { runCore } = deps.leanModule;
|
|
1801
1884
|
const emitTelemetry = deps.emitTelemetry ?? makeEmitTelemetry({ repo });
|
|
1802
|
-
lanes = { adopt: null, runOne: (n, ln, ctx = {}) => runCore({ issue: n, repo, lane: ln,
|
|
1885
|
+
lanes = { adopt: null, runOne: (n, ln, ctx = {}) => runCore({ issue: n, repo, lane: ln, deferPostRun: true, // #5437: orchestrate runs result.postRun once the slot is free
|
|
1886
|
+
laneOverride, ...(ctx.placement ? { placement: { ...ctx.placement, mode: execMode() } } : {}), ...(ctx.recover ? { recover: ctx.recover } : {}), branches, cwd, dir, io: leanIo, agentId: `orch_${process.pid}_${n}`, emitTelemetry, batchId: batch.id,
|
|
1803
1887
|
...(rotatorKind({ execution: readExecution(cwd), env }) ? { accountRotator: rotatorKind({ execution: readExecution(cwd), env }) } : {}), // #5094, #5205: detected
|
|
1804
|
-
admission: readAdmission(cwd), heavy: readHeavy(cwd), ...readCoreLimits(cwd), ...readEnvConfig(cwd), ...(readMergeWait(cwd) ? { mergeWait: readMergeWait(cwd) } : {}), ...(readConformanceMode(cwd) ? { conformance: readConformanceMode(cwd) } : {}), ...(readConformanceKinds(cwd) ? { conformanceKinds: readConformanceKinds(cwd) } : {}), ...(readConformanceMutation(cwd) ? { conformanceMutation: "report" } : {}), ...(readContextPack(cwd) ? { contextPack: readContextPack(cwd) } : {}), ...(readSequenceVersioned(cwd) ? { sequenceVersioned: readSequenceVersioned(cwd) } : {}), ...(readSharedSurfaces(cwd) ? { sharedSurfaces: readSharedSurfaces(cwd) } : {}), ...(readReviewIncomplete(cwd) ? { reviewIncomplete: readReviewIncomplete(cwd) } : {}), ...(readLaneInstructions(cwd) ? { laneInstructions: readLaneInstructions(cwd) } : {}), ...(readReproTest(cwd) ? { reproTest: readReproTest(cwd) } : {}), ...(readExplore(cwd) ? { explore: readExplore(cwd) } : {}), ...(readExperiment(cwd) ? { experiment: readExperiment(cwd) } : {}), light: readLight(cwd), ...(readCloseParent(cwd) ? { closeParent: true } : {}), ...(readReviewTrigger(cwd) ? { reviewTrigger: readReviewTrigger(cwd) } : {}), ...(readVerify(cwd) ? { verify: readVerify(cwd) } : {}), ...readPrecheckOptions(cwd), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model", cwd) ? { reviewerModel: readLeanSetting("reviewer_model", cwd) } : {}), ...(readFixModel(cwd) ? { fixModel: readFixModel(cwd) } : {}), ...(readBuilderRouting(cwd) ? { builderRouting: readBuilderRouting(cwd) } : {}), ...(readVerifier(cwd) ? { verifier: readVerifier(cwd) } : {}), ...(readHostCaps(cwd) ? { hostCaps: readHostCaps(cwd) } : {}), ...readRelayCaps(), ...(readSequenceRegenerate(cwd) ? { sequenceRegenerate: readSequenceRegenerate(cwd) } : {}), ...(readBaseMerge(cwd) ? { baseMerge: readBaseMerge(cwd) } : {}), ...(readFollowupsDefaultMilestone(cwd) ? { followupsDefaultMilestone: readFollowupsDefaultMilestone(cwd) } : {}), ...(readFollowupsRollupLabel(cwd) ? { followupsRollupLabel: readFollowupsRollupLabel(cwd) } : {}) }) };
|
|
1888
|
+
admission: readAdmission(cwd), heavy: readHeavy(cwd), ...readCoreLimits(cwd), ...readEnvConfig(cwd), ...(readMergeWait(cwd) ? { mergeWait: readMergeWait(cwd) } : {}), ...(readConformanceMode(cwd) ? { conformance: readConformanceMode(cwd) } : {}), ...(readConformanceKinds(cwd) ? { conformanceKinds: readConformanceKinds(cwd) } : {}), ...(readConformanceMutation(cwd) ? { conformanceMutation: "report" } : {}), ...(readContextPack(cwd) ? { contextPack: readContextPack(cwd) } : {}), ...(readSequenceVersioned(cwd) ? { sequenceVersioned: readSequenceVersioned(cwd) } : {}), ...(readSharedSurfaces(cwd) ? { sharedSurfaces: readSharedSurfaces(cwd) } : {}), ...(readReviewIncomplete(cwd) ? { reviewIncomplete: readReviewIncomplete(cwd) } : {}), ...(readLaneInstructions(cwd) ? { laneInstructions: readLaneInstructions(cwd) } : {}), ...(readReproTest(cwd) ? { reproTest: readReproTest(cwd) } : {}), ...(readReproQuality(cwd) ? { reproQuality: readReproQuality(cwd) } : {}), ...(readExplore(cwd) ? { explore: readExplore(cwd) } : {}), ...(readExperiment(cwd) ? { experiment: readExperiment(cwd) } : {}), light: readLight(cwd), ...(readCloseParent(cwd) ? { closeParent: true } : {}), ...(readReviewTrigger(cwd) ? { reviewTrigger: readReviewTrigger(cwd) } : {}), ...(readVerify(cwd) ? { verify: readVerify(cwd) } : {}), ...readPrecheckOptions(cwd), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model", cwd) ? { reviewerModel: readLeanSetting("reviewer_model", cwd) } : {}), ...(readFixModel(cwd) ? { fixModel: readFixModel(cwd) } : {}), ...(readBuilderRouting(cwd) ? { builderRouting: readBuilderRouting(cwd) } : {}), ...(readVerifier(cwd) ? { verifier: readVerifier(cwd) } : {}), ...(readHostCaps(cwd) ? { hostCaps: readHostCaps(cwd) } : {}), ...readRelayCaps(), ...(readSequenceRegenerate(cwd) ? { sequenceRegenerate: readSequenceRegenerate(cwd) } : {}), ...(readBaseMerge(cwd) ? { baseMerge: readBaseMerge(cwd) } : {}), ...(readFollowupsDefaultMilestone(cwd) ? { followupsDefaultMilestone: readFollowupsDefaultMilestone(cwd) } : {}), ...(readFollowupsRollupLabel(cwd) ? { followupsRollupLabel: readFollowupsRollupLabel(cwd) } : {}) }) };
|
|
1805
1889
|
} else {
|
|
1806
1890
|
const laneScript = deps.laneScript ?? fileURLToPath(new URL("./forgedock.mjs", import.meta.url));
|
|
1807
1891
|
// #4690: lanes learn K (the default MemoryMax is derived from it); one line says so when no scope caps them.
|
|
@@ -2000,7 +2084,7 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
2000
2084
|
try {
|
|
2001
2085
|
const { nearCeiling } = await import("./lean/admission.mjs");
|
|
2002
2086
|
const host = deps.host ?? (await import("./lean/effects.mjs")).makeHostProbe();
|
|
2003
|
-
near = await nearCeiling({ cfg: readAdmission(cwd), host, ratio: hygiene.max_host_load_ratio });
|
|
2087
|
+
near = await nearCeiling({ cfg: readAdmission(cwd), host, ratio: hygiene.max_host_load_ratio, minFreeGb: hygiene.min_free_gb }); // #5421: disk pressure triggers GC too
|
|
2004
2088
|
} catch { near = false; }
|
|
2005
2089
|
if (near || gcPending) await runGcPhase("admission");
|
|
2006
2090
|
};
|
|
@@ -2033,6 +2117,7 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
2033
2117
|
let rows, childFields = null; // #4965: the host gh's accepted `issue list --json` fields, read once from its help
|
|
2034
2118
|
const healthCheck = (checkpoint) => batchHealth.runCheck({ batch, checkpoint, config: healthConf, repo, now: healthNow,
|
|
2035
2119
|
resolve: (cands) => batchHealth.resolvedOnGithub(cands, (a) => leanIo.gh(a), repo),
|
|
2120
|
+
statelessOf: (st) => batchHealth.statelessOnGithub(st, (a) => leanIo.gh(a), repo),
|
|
2036
2121
|
alert: (text, health) => batchHealth.deliverAlert({ text, batchId: batch.id, health, sink, gh: (a) => leanIo.gh(a), repo, config: healthConf, epics: epicsOf(argv), ...(deps.notify ? { notify: deps.notify } : {}) }) });
|
|
2037
2122
|
let healthTimers = { cancel: () => {} };
|
|
2038
2123
|
try { healthTimers = batchHealth.scheduleChecks({ batch, created: healthCreated, config: healthConf, now: healthNow, ...(deps.healthTimer ? { setTimer: deps.healthTimer.set, clearTimer: deps.healthTimer.clear } : {}), check: healthCheck }); } catch { /* health is advisory */ }
|
|
@@ -2045,7 +2130,7 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
2045
2130
|
trusted: (n) => trustedOf.get(n) === true,
|
|
2046
2131
|
autoChildren,
|
|
2047
2132
|
...(autoMod.addsEpicChildren(autoChildren.mode) ? { getChildren: async () => ({ list: await autoMod.readChildList({ gh: (a) => leanIo.gh(a), repo, fields: childFields ??= await autoMod.hostListFields((a) => leanIo.gh(a)) }), elsewhere: autoMod.liveElsewhere({ batchMod, root, self: batch.id, repo }) }) } : {}),
|
|
2048
|
-
issues, parallel, prefilter, resolveLane: laneOf, store: batch.store, getParallel: batch.readParallel, getAdded: batch.readAdded, getRequeued: batch.readRequeued, getCancelled: batch.readCancel, getHeld: batch.readHeld, getGates: batch.readGates, baseWait: baseWaits.size ? baseWaitOf(baseWaits, { io, leanIo, cwd }) : null, ...lanes,
|
|
2133
|
+
issues, parallel, prefilter, resolveLane: laneOf, store: batch.store, getParallel: batch.readParallel, getAdded: batch.readAdded, getRequeued: batch.readRequeued, getCancelled: batch.readCancel, getHeld: batch.readHeld, expireHolds: batch.expireHolds, getHoldInfo: batch.readHoldInfo, getGates: batch.readGates, baseWait: baseWaits.size ? baseWaitOf(baseWaits, { io, leanIo, cwd }) : null, ...lanes,
|
|
2049
2134
|
breaker: orch.breaker, maxDeferrals: orch.maxDeferrals, ...(Number.isInteger(orch.transientRetries) ? { transientRetries: orch.transientRetries } : {}), ...(deps.pollMs ? { pollMs: deps.pollMs } : {}), ...budget, limits, identity, rotator, batchId: batch.id, drift, lifecycle, integration,
|
|
2050
2135
|
...(registry ? { sched: { registry, batch: batch.id, repo, cap: liveLaneCap(orch.globalParallel ?? null, { cfg: readAdmission(cwd) }), exclusive: true }, priorityOf: async (n) => schedMod.priorityFromLabels(await labelNames(n)) } : {}),
|
|
2051
2136
|
// #5174: hold new local admissions while loadavg/cores is above engine.overload_load_per_core (host-wide batches only)
|
|
@@ -2061,7 +2146,7 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
2061
2146
|
// A recovery that ended for good without the lane relabelling it (engine-error, deferred): needs-human back, one comment.
|
|
2062
2147
|
relabelNeedsHuman: deps.relabelNeedsHuman ?? makeRelabelNeedsHuman({ gh: (a) => leanIo.gh(a), repo }),
|
|
2063
2148
|
// #4481: a requeued or resumed issue that was closed or whose lane PR merged meanwhile is not run again
|
|
2064
|
-
dispatchCheck: deps.dispatchCheck !== undefined ? deps.dispatchCheck : makeDispatchCheck({ gh: (a) => leanIo.gh(a), repo }),
|
|
2149
|
+
dispatchCheck: deps.dispatchCheck !== undefined ? deps.dispatchCheck : makeDispatchCheck({ gh: (a) => leanIo.gh(a), repo, owner: plan?.forced ? null : (n) => batchMod.dispatchOwner(root, repo, n, batch.id) }),
|
|
2065
2150
|
// #5204: the engine version is saved with the batch state, so a resume after an upgrade names it on each interrupted lane
|
|
2066
2151
|
version: ENGINE_VERSION,
|
|
2067
2152
|
// #5204: an interrupted, requeued lane runs nothing until it is dispatched again: workflow:building comes off (best effort)
|
|
@@ -2125,6 +2210,8 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
2125
2210
|
report.push(...formatEfficiencyLines(await (deps.efficiency ?? batchEfficiency)({ batchDir: batch.dir, runsDir: dir, repo, gh: (a) => leanIo.gh(a), rows })));
|
|
2126
2211
|
} catch (e) { report.push(`efficiency: n/a (${String(e?.message ?? e).split("\n")[0].slice(0, 160)})`); }
|
|
2127
2212
|
report.push(await budgetReportLine({ cwd, repo, gh: (a) => leanIo.gh(a) })); // #5278: month usage, projection and any auto switch to local-first
|
|
2213
|
+
const adequacyLine = formatTestAdequacySummary(rows); // #5449
|
|
2214
|
+
if (adequacyLine) report.push(adequacyLine);
|
|
2128
2215
|
const shadowLine = formatShadowSummary(rows); // #4398
|
|
2129
2216
|
if (shadowLine) report.push(shadowLine);
|
|
2130
2217
|
const decompLine = formatDecompositionSummary(rows); // #4396
|
|
@@ -2181,7 +2268,7 @@ export async function closedScope({ gh, repo, issue, labels }) {
|
|
|
2181
2268
|
* Release review #4500: an OPEN issue reopened after that PR merged (a failed acceptance probe, #4399, or an operator
|
|
2182
2269
|
* reopening it for rework) is new work, so the lane runs; an unreadable reopen history also runs the lane.
|
|
2183
2270
|
*/
|
|
2184
|
-
export function makeDispatchCheck({ gh, repo }) {
|
|
2271
|
+
export function makeDispatchCheck({ gh, repo, owner: batchOwner = null }) {
|
|
2185
2272
|
const json = async (args) => { try { return JSON.parse(String(await gh(args))); } catch { return null; } };
|
|
2186
2273
|
/** Latest `reopened` event time (ms) on the issue, 0 when never reopened, null when unreadable. */
|
|
2187
2274
|
const lastReopen = async (n) => {
|
|
@@ -2214,6 +2301,9 @@ export function makeDispatchCheck({ gh, repo }) {
|
|
|
2214
2301
|
// #4920: a live lease held by another lane, read from GitHub (any batch, any host, across restarts): no lane, no sandbox.
|
|
2215
2302
|
// Release review #4931: never the open feat/issue-N-lean PR here. That branch is this issue's own lane, which a
|
|
2216
2303
|
// relaunch or recovery lane resumes by design; a lane still running on it holds the lease.
|
|
2304
|
+
// #5471: another live batch of the repo runs / holds the issue: no lane here (--force on the batch lifts it)
|
|
2305
|
+
const other = state === "OPEN" && batchOwner ? batchOwner(n) : null;
|
|
2306
|
+
if (other) return { outcome: "deferred", code: "batch.owned", detail: `owned by ${other}` };
|
|
2217
2307
|
const owner = state === "OPEN" ? await otherLaneOwner({ gh, repo, issue: n, checkPr: false }).catch(() => null) : null;
|
|
2218
2308
|
if (owner) return { outcome: "deferred", code: "lease.held", detail: owner.detail };
|
|
2219
2309
|
return null;
|
|
@@ -2237,8 +2327,8 @@ export function makeRelabelNeedsHuman({ gh, repo, now = () => Date.now() }) {
|
|
|
2237
2327
|
// #4656: a mechanical park carries its code and PR on `parked:<code>` and joins the remediation queue, not the human queue.
|
|
2238
2328
|
if (parked?.code) {
|
|
2239
2329
|
const { parkedLabel, REMEDIATION_QUEUE_LABEL } = await import("./engine/outcome-codes.mjs");
|
|
2240
|
-
|
|
2241
|
-
|
|
2330
|
+
const { parkedRelabel } = await import("./lean/parked-relabel.mjs");
|
|
2331
|
+
if (!(await parkedRelabel({ gh, repo, issue, code: parked.code })).ok) return "failed"; // #5466: needs-human stays unless the replacement labels landed
|
|
2242
2332
|
try {
|
|
2243
2333
|
const { capComment } = await import("./lean/render.mjs");
|
|
2244
2334
|
await gh(["issue", "comment", String(issue), "-R", repo, "--body", capComment(`<!-- FORGE:PARKED code=${parked.code}${parked.pr ? ` pr=${parked.pr}` : ""} -->\n## Parked (\`${parked.code}\`)\nCode: \`${parked.code}\`\nPR: ${parked.pr ? `#${parked.pr}` : "none"}\nQueue: \`${REMEDIATION_QUEUE_LABEL}\` (\`/work-on:remediate\`)\n${evidence}`)]);
|
|
@@ -2322,7 +2412,9 @@ export async function scheddFromCli(argv, deps = {}) {
|
|
|
2322
2412
|
const pend = b.pendingAdds?.length ? `, pending adds: ${b.pendingAdds.map((n) => `#${n}`).join(" ")}` : "";
|
|
2323
2413
|
console.log(` ${b.id}${b.running ? "" : " (not hosted)"}: ${age}${pend}`);
|
|
2324
2414
|
}
|
|
2415
|
+
for (const l of schedd.sharedPendingLines(st.batches)) console.log(l); // #5471
|
|
2325
2416
|
if (st.host) { const h = formatOverload(st.host) ?? formatHostLoad(st.host); if (h) console.log(`schedd: ${st.host.overloaded ? h : `host ${h}`}`); } // #5174
|
|
2417
|
+
if (st.orphaned?.length) console.log(`schedd: ${st.orphaned.length} orphaned batch(es) (not hosted, pending issues, idle over 7 days): ${st.orphaned.slice(0, 3).map((o) => o.id).join(" ")}${st.orphaned.length > 3 ? " …" : ""} (forgedock orchestrate --gc-orphans cancels them)`);
|
|
2326
2418
|
for (const u of st.unhosted ?? []) console.log(`schedd: batch ${u.id} is not hosted but has ${u.pending.length} pending: ${u.pending.map((n) => `#${n}`).join(" ")} (forgedock orchestrate --resume ${u.id})`);
|
|
2327
2419
|
return { running: true, ...st };
|
|
2328
2420
|
}
|