forgedock 1.59.2 → 1.60.1

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 (97) hide show
  1. package/bin/engine/outcome-codes.mjs +3 -3
  2. package/bin/engine-cli.mjs +50 -10
  3. package/bin/labels.json +5 -0
  4. package/bin/lean/batch.mjs +21 -2
  5. package/bin/lean/batch.test.mjs +116 -1
  6. package/bin/lean/conformance.mjs +19 -6
  7. package/bin/lean/conformance.test.mjs +37 -3
  8. package/bin/lean/depcache.mjs +34 -15
  9. package/bin/lean/depcache.test.mjs +100 -1
  10. package/bin/lean/design-gate.mjs +15 -10
  11. package/bin/lean/design-gate.test.mjs +21 -0
  12. package/bin/lean/effects.mjs +18 -2
  13. package/bin/lean/execution.mjs +23 -5
  14. package/bin/lean/execution.test.mjs +81 -1
  15. package/bin/lean/gatewatch.test.mjs +5 -5
  16. package/bin/lean/issuewatch-triage.mjs +68 -0
  17. package/bin/lean/issuewatch-triage.test.mjs +98 -0
  18. package/bin/lean/issuewatch.mjs +34 -6
  19. package/bin/lean/issuewatch.test.mjs +11 -0
  20. package/bin/lean/lanelock.mjs +5 -4
  21. package/bin/lean/lean.mjs +144 -21
  22. package/bin/lean/lean.test.mjs +180 -6
  23. package/bin/lean/orchestrate-cancel.test.mjs +33 -0
  24. package/bin/lean/orchestrate-hostfallback.test.mjs +41 -0
  25. package/bin/lean/orchestrate-recovering.test.mjs +42 -0
  26. package/bin/lean/orchestrate.mjs +23 -10
  27. package/bin/lean/pagegate.mjs +50 -12
  28. package/bin/lean/pagegate.test.mjs +38 -1
  29. package/bin/lean/phaseledger.mjs +65 -2
  30. package/bin/lean/phaseledger.test.mjs +70 -2
  31. package/bin/lean/preflight.mjs +67 -3
  32. package/bin/lean/preflight.test.mjs +37 -1
  33. package/bin/lean/prompts.mjs +2 -1
  34. package/bin/lean/recovery.test.mjs +11 -6
  35. package/bin/lean/release-classify.mjs +143 -0
  36. package/bin/lean/release-classify.test.mjs +130 -0
  37. package/bin/lean/release-conductor.mjs +163 -0
  38. package/bin/lean/release-conductor.test.mjs +194 -0
  39. package/bin/lean/release-config.mjs +60 -8
  40. package/bin/lean/release-config.test.mjs +43 -1
  41. package/bin/lean/release-control.mjs +22 -5
  42. package/bin/lean/release-control.test.mjs +22 -0
  43. package/bin/lean/release-credentials.mjs +40 -0
  44. package/bin/lean/release-credentials.test.mjs +42 -0
  45. package/bin/lean/release-deploy.mjs +3 -3
  46. package/bin/lean/release-deploy.test.mjs +8 -0
  47. package/bin/lean/release-docs.test.mjs +93 -0
  48. package/bin/lean/release-fence.mjs +2 -0
  49. package/bin/lean/release-gate.mjs +88 -0
  50. package/bin/lean/release-gate.test.mjs +116 -0
  51. package/bin/lean/release-gates.mjs +5 -1
  52. package/bin/lean/release-ledger.mjs +47 -1
  53. package/bin/lean/release-ledger.test.mjs +33 -1
  54. package/bin/lean/release-mergeback.mjs +148 -0
  55. package/bin/lean/release-mergeback.test.mjs +129 -0
  56. package/bin/lean/release-p0.mjs +193 -0
  57. package/bin/lean/release-p0.test.mjs +127 -0
  58. package/bin/lean/release-plan.mjs +267 -0
  59. package/bin/lean/release-plan.test.mjs +202 -0
  60. package/bin/lean/release-preflight.mjs +16 -0
  61. package/bin/lean/release-regate.mjs +141 -0
  62. package/bin/lean/release-regate.test.mjs +149 -0
  63. package/bin/lean/release-review.mjs +5 -3
  64. package/bin/lean/release-rollback.mjs +277 -0
  65. package/bin/lean/release-rollback.test.mjs +245 -0
  66. package/bin/lean/release-snapshot.mjs +48 -9
  67. package/bin/lean/release-snapshot.test.mjs +43 -1
  68. package/bin/lean/release-start.mjs +164 -0
  69. package/bin/lean/release-start.test.mjs +171 -0
  70. package/bin/lean/release-status.mjs +6 -2
  71. package/bin/lean/release-train.mjs +159 -0
  72. package/bin/lean/release-train.test.mjs +139 -0
  73. package/bin/lean/release.mjs +127 -5
  74. package/bin/lean/release.test.mjs +80 -0
  75. package/bin/lean/sandbox-remote.mjs +2 -0
  76. package/bin/lean/schedd-load.test.mjs +82 -0
  77. package/bin/lean/schedd.mjs +67 -31
  78. package/bin/lean/schedd.test.mjs +80 -1
  79. package/bin/lean/validate-catalog.mjs +110 -0
  80. package/bin/lean/validate-catalog.test.mjs +55 -0
  81. package/bin/pool/agent.mjs +12 -1
  82. package/bin/pool/lane-tools.mjs +146 -0
  83. package/bin/pool/lane-tools.test.mjs +26 -0
  84. package/bin/pool/router.mjs +3 -1
  85. package/bin/pool/warm.mjs +14 -3
  86. package/docs/CONFIG.md +225 -1
  87. package/docs/ISSUE-WATCH.md +1 -0
  88. package/docs/design/visual-gate.md +10 -0
  89. package/docs/eval/adversarial-bench.md +1 -0
  90. package/package.json +1 -1
  91. package/pool/README.md +2 -0
  92. package/scripts/acceptance-red-green.sh +5 -2
  93. package/scripts/acceptance-red-green.test.sh +11 -0
  94. package/scripts/bench-adversarial.mjs +4 -0
  95. package/scripts/bench-lightlane.mjs +2 -1
  96. package/templates/github-actions/forge-conductor.scopes.json +7 -0
  97. package/templates/github-actions/forge-conductor.yml +57 -0
@@ -1,6 +1,8 @@
1
1
  // SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  import { createServer } from "node:http";
4
+ /** Retry-After for a launch whose lane_tools image is still building: lanes cap capacity deferrals at 3, so 3 × 5 min covers a cold build. */
5
+ const LANE_BUILD_RETRY_AFTER_S = 300;
4
6
  import { randomBytes } from "node:crypto";
5
7
  import { execFile, spawn } from "node:child_process";
6
8
  import { promisify } from "node:util";
@@ -11,6 +13,7 @@ import { bearerOk, call, readJson, route, sameSecret, send } from "./http.mjs";
11
13
  import { repoRoot, versionOf, laneImageTag, laneBuildArgs } from "./version.mjs";
12
14
  import { jsonStore } from "./store.mjs";
13
15
  import { makeWarm } from "./warm.mjs";
16
+ import { resolveLaneImage, laneImageNow } from "./lane-tools.mjs";
14
17
 
15
18
  const LABEL = "computeshare=1";
16
19
  const LOG_CHUNK = 256 * 1024;
@@ -120,6 +123,12 @@ export function createAgent(cfg, { docker, now = () => Date.now(), log = console
120
123
  // Burst model: reservations are small, so also refuse when the VM is genuinely short of memory or overloaded right now.
121
124
  const h = live(cfg);
122
125
  if (!h.ok) return { status: 503, body: { error: `host busy: ${h.reason}`, live: h }, retryAfter: 60 };
126
+ if (spec.lane_tools?.length) { // #5650 follow-up: never build inside the launch request (router timeout); 503 + retry while it builds
127
+ let st;
128
+ try { st = await laneImageNow({ tools: spec.lane_tools, baseImage: spec.image ?? image, docker }); } catch (e) { return { status: 422, body: { error: e.message, code: e.code ?? "lane_tools.invalid" } }; }
129
+ if (st.building) return { status: 503, body: { error: `lane image ${st.tag} building`, code: "lane_tools.building" }, retryAfter: LANE_BUILD_RETRY_AFTER_S };
130
+ if (st.failed) return { status: 422, body: { error: st.failed, code: "lane_tools.build_failed" } };
131
+ }
123
132
  const name = safeName(spec.id);
124
133
  const dir = join(stateDir, "sandboxes", name);
125
134
  mkdirSync(join(dir, "result"), { recursive: true });
@@ -138,6 +147,8 @@ export function createAgent(cfg, { docker, now = () => Date.now(), log = console
138
147
  const netArgs = ["--add-host", "host.docker.internal:host-gateway", ...(cfg.dns ?? ["1.1.1.1", "8.8.8.8"]).flatMap((d) => ["--dns", String(d)])];
139
148
  let laneCpus = cpus, laneMem = mem_gb, laneNet = netArgs, work = [];
140
149
  try {
150
+ // #5650: a repo's lane_tools select a derived image (built once per tool list); none keeps spec.image ?? image.
151
+ const laneImage = spec.lane_tools?.length ? await resolveLaneImage({ tools: spec.lane_tools, baseImage: spec.image ?? image, docker }) : (spec.image ?? image);
141
152
  if (withDocker) {
142
153
  // Private Docker daemon per sandbox (never the host socket). The lane joins its network namespace, so ports the
143
154
  // project's compose stack publishes are on the lane's localhost, and the API listens on loopback only. Both share
@@ -166,7 +177,7 @@ export function createAgent(cfg, { docker, now = () => Date.now(), log = console
166
177
  "--env-file", envFile, ...laneNet, ...work,
167
178
  ...(spec.claim_dir ? ["-v", `${join(dir, "claim")}:/claim`] : []), // #4912: warm sandboxes receive their lane here
168
179
  "-v", `cs-cache-${cacheKey}:/cache`, "-v", `${join(dir, "result")}:/result`, "-v", `${join(dir, "out")}:/csout`,
169
- spec.image ?? image, ...spec.command.map(String),
180
+ laneImage, ...spec.command.map(String),
170
181
  ]);
171
182
  rec.state = "running";
172
183
  } catch (e) {
@@ -0,0 +1,146 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
2
+ // SPDX-License-Identifier: AGPL-3.0-or-later
3
+ import { createHash } from "node:crypto";
4
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import { join } from "node:path";
7
+
8
+ /**
9
+ * Per-repo lane images (#5650): forge.yaml `execution.lane_tools` lists the tools a repo's lanes need (`name` or
10
+ * `name@version`). The pool derives an image `FROM` the base lane image applying one recipe per tool. RECIPES is the only
11
+ * place tool names appear. To add a tool, add an entry: `versioned` (accepts `@version`) and `steps(version)`, the
12
+ * Dockerfile instructions (Debian/Ubuntu base, building as root) that install it.
13
+ */
14
+ const apt = (...pkgs) => `RUN apt-get update && apt-get install -y --no-install-recommends ${pkgs.join(" ")} && rm -rf /var/lib/apt/lists/*`;
15
+ export const RECIPES = {
16
+ "postgresql-client": { versioned: true, steps: (v) => [apt(v ? `postgresql-client-${v}` : "postgresql-client")] },
17
+ python: { versioned: true, steps: (v) => [apt(v ? `python${v} python${v}-venv` : "python3 python3-venv")] },
18
+ playwright: { versioned: true, steps: (v) => [`RUN npx --yes playwright${v ? `@${v}` : ""} install --with-deps chromium`] },
19
+ // Example of a release-tarball tool; the version is required.
20
+ promtool: { versioned: true, steps: (v) => [`RUN curl -fsSL https://github.com/prometheus/prometheus/releases/download/v${v ?? "2.54.1"}/prometheus-${v ?? "2.54.1"}.linux-amd64.tar.gz | tar -xz --strip-components=1 -C /usr/local/bin --wildcards '*/promtool'`] },
21
+ };
22
+
23
+ const ENTRY_RE = /^([a-z0-9][a-z0-9.+_-]*)(?:@([A-Za-z0-9][A-Za-z0-9.+_-]*))?$/;
24
+ const typed = (code, message) => Object.assign(new Error(message), { code });
25
+
26
+ /** One entry -> {name, version}; throws a message naming the entry when it is empty or has shell metacharacters. */
27
+ export function parseLaneTool(entry) {
28
+ const t = entry === undefined || entry === null ? "" : String(entry).trim();
29
+ const m = ENTRY_RE.exec(t);
30
+ if (!m) throw typed("lane_tools.invalid", `invalid execution.lane_tools entry ${JSON.stringify(t)}: expected name or name@version ([a-z0-9.+_-])`);
31
+ return { name: m[1], version: m[2] ?? null };
32
+ }
33
+
34
+ /** A list (or comma string) -> {tools: sorted, deduped canonical entries, errors: messages naming each bad entry}. */
35
+ export function validateLaneTools(raw) {
36
+ const list = Array.isArray(raw) ? raw : raw === undefined || raw === null || String(raw).trim() === "" ? [] : String(raw).split(",");
37
+ const tools = new Set(), errors = [];
38
+ for (const e of list) {
39
+ try { const p = parseLaneTool(e); tools.add(p.version ? `${p.name}@${p.version}` : p.name); } catch (err) { errors.push(err.message); }
40
+ }
41
+ return { tools: [...tools].sort(), errors };
42
+ }
43
+
44
+ /** True when `name` has a lane_tools recipe (#5652). */
45
+ export function hasRecipe(name) { return Object.hasOwn(RECIPES, String(name)); }
46
+
47
+ /**
48
+ * In-sandbox install commands (#5652) for one tool: the recipe's Dockerfile `RUN` steps as shell commands, `sudo` prefixed
49
+ * when the sandbox user is not root. Empty for a tool with no recipe. Pure; the image build keeps using `steps`.
50
+ */
51
+ export function installCommands(entry, { root = true } = {}) {
52
+ const { name, version } = parseLaneTool(entry);
53
+ if (!hasRecipe(name)) return [];
54
+ const sh = (s) => s.replace(/^RUN\s+/, "");
55
+ return RECIPES[name].steps(version).map((s) => (root ? sh(s) : `sudo sh -c ${JSON.stringify(sh(s))}`));
56
+ }
57
+
58
+ /**
59
+ * Installs `tools` in the running sandbox through the injected `run({command, timeoutMs})` -> {rc, stdout, stderr}.
60
+ * Never throws: {ok:true} or {ok:false, tool, stderrTail}.
61
+ */
62
+ export async function installLaneTools(tools, { run, root = true, timeoutMs = 600000 }) {
63
+ for (const t of tools) {
64
+ for (const command of installCommands(t, { root })) {
65
+ let r;
66
+ try { r = await run({ command, timeoutMs }); } catch (e) { r = { rc: 1, stderr: String(e?.message ?? e) }; }
67
+ if ((r?.rc ?? 0) !== 0) return { ok: false, tool: t, stderrTail: String(r?.stderr || r?.stdout || "").trim().split("\n").slice(-8).join("\n").slice(-600) };
68
+ }
69
+ }
70
+ return { ok: true };
71
+ }
72
+
73
+ /** Fails fast (before any docker call) for a tool with no recipe or an unsupported version. */
74
+ export function checkRecipes(tools) {
75
+ for (const e of tools) {
76
+ const { name, version } = parseLaneTool(e);
77
+ const r = Object.hasOwn(RECIPES, name) ? RECIPES[name] : null;
78
+ if (!r) throw typed("lane_tools.unknown_recipe", `no lane_tools recipe for ${JSON.stringify(name)} (known: ${Object.keys(RECIPES).join(", ")})`);
79
+ if (version && !r.versioned) throw typed("lane_tools.unknown_recipe", `lane_tools recipe ${JSON.stringify(name)} takes no version (got ${version})`);
80
+ }
81
+ }
82
+
83
+ /** Per-repo image tag: base tag plus a hash of the sorted tool list; the same list gives the same tag. */
84
+ export function laneToolsTag(baseImage, tools) {
85
+ const h = createHash("sha256").update([...tools].sort().join("\n")).digest("hex").slice(0, 12);
86
+ return `${baseImage}-t${h}`;
87
+ }
88
+
89
+ /** The generated Dockerfile: FROM the base lane image, then each recipe's steps in sorted order. */
90
+ export function laneToolsDockerfile(baseImage, tools) {
91
+ const steps = [...tools].sort().flatMap((e) => { const { name, version } = parseLaneTool(e); return RECIPES[name].steps(version); });
92
+ return [`FROM ${baseImage}`, "USER root", ...steps, ""].join("\n");
93
+ }
94
+
95
+ /** One in-flight build per tag (shared by every launch and the warm pool), and the last failure per tag. */
96
+ const BUILDS = new Map();
97
+ const FAILED = new Map();
98
+ /** How long a failed build is reported instead of retried. */
99
+ export const LANE_BUILD_RETRY_MS = 10 * 60000;
100
+
101
+ /**
102
+ * The image a launch runs: `baseImage` when no tools; else the per-repo tag, reused when present, built from the base
103
+ * otherwise. `docker.hasImage` and `docker.build(dir, tag, args)` are injected. Throws typed lane_tools.unknown_recipe
104
+ * (nothing built) or lane_tools.build_failed (build error or timeout, never a hang).
105
+ */
106
+ export async function resolveLaneImage({ tools = [], baseImage, docker, buildTimeoutMs = 45 * 60000 }) {
107
+ if (!tools.length) return baseImage;
108
+ checkRecipes(tools);
109
+ const tag = laneToolsTag(baseImage, tools);
110
+ if (await docker.hasImage?.(tag)) return tag;
111
+ if (!BUILDS.has(tag)) BUILDS.set(tag, buildLaneImage({ tag, baseImage, tools, docker, buildTimeoutMs }).finally(() => BUILDS.delete(tag)));
112
+ return BUILDS.get(tag); // concurrent callers share one build of a tag
113
+ }
114
+
115
+ /**
116
+ * Non-blocking form for a launch (the router waits ~120 s, a build can take many minutes): {image} when the tag exists,
117
+ * {building: true} after starting (or joining) a background build, {failed: message} for a build that failed in the last
118
+ * LANE_BUILD_RETRY_MS. Throws typed lane_tools.unknown_recipe.
119
+ */
120
+ export async function laneImageNow({ tools = [], baseImage, docker, buildTimeoutMs = 45 * 60000, now = Date.now }) {
121
+ if (!tools.length) return { image: baseImage };
122
+ checkRecipes(tools);
123
+ const tag = laneToolsTag(baseImage, tools);
124
+ if (await docker.hasImage?.(tag)) return { image: tag };
125
+ const f = FAILED.get(tag);
126
+ if (f && now() - f.at < LANE_BUILD_RETRY_MS) return { failed: f.message };
127
+ if (!BUILDS.has(tag)) {
128
+ FAILED.delete(tag);
129
+ const p = buildLaneImage({ tag, baseImage, tools, docker, buildTimeoutMs }).catch((e) => { FAILED.set(tag, { at: now(), message: e.message }); }).finally(() => BUILDS.delete(tag));
130
+ BUILDS.set(tag, p);
131
+ }
132
+ return { building: true, tag };
133
+ }
134
+
135
+ async function buildLaneImage({ tag, baseImage, tools, docker, buildTimeoutMs }) {
136
+ const dir = mkdtempSync(join(tmpdir(), "lane-tools-"));
137
+ let timer;
138
+ try {
139
+ writeFileSync(join(dir, "Dockerfile"), laneToolsDockerfile(baseImage, tools));
140
+ const timeout = new Promise((_, rej) => { timer = setTimeout(() => rej(new Error(`build timed out after ${buildTimeoutMs}ms`)), buildTimeoutMs); });
141
+ await Promise.race([docker.build(dir, tag, {}), timeout]);
142
+ } catch (e) {
143
+ throw typed("lane_tools.build_failed", `lane_tools image ${tag} build failed: ${String(e.stderr || e.message).slice(0, 300)}`);
144
+ } finally { clearTimeout(timer); rmSync(dir, { recursive: true, force: true }); }
145
+ return tag;
146
+ }
@@ -0,0 +1,26 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
2
+ // SPDX-License-Identifier: AGPL-3.0-or-later
3
+ import { describe, it } from "node:test";
4
+ import assert from "node:assert/strict";
5
+ import { hasRecipe, installCommands, installLaneTools, laneToolsDockerfile } from "./lane-tools.mjs";
6
+
7
+ describe("#5652 in-sandbox lane tool install", () => {
8
+ it("installCommands strips RUN, prefixes sudo when not root, and is empty without a recipe", () => {
9
+ assert.ok(hasRecipe("promtool") && !hasRecipe("nope"));
10
+ assert.match(installCommands("postgresql-client")[0], /^apt-get update/);
11
+ assert.match(installCommands("postgresql-client", { root: false })[0], /^sudo sh -c /);
12
+ assert.deepEqual(installCommands("nope"), []);
13
+ });
14
+ it("installLaneTools runs every step, and returns the stderr tail of the first failure", async () => {
15
+ const seen = [];
16
+ assert.deepEqual(await installLaneTools(["postgresql-client"], { run: async (a) => { seen.push(a.command); return { rc: 0 }; } }), { ok: true });
17
+ assert.equal(seen.length, 1);
18
+ const bad = await installLaneTools(["promtool@2.54.1"], { run: async () => ({ rc: 3, stderr: "a\nb\n404" }) });
19
+ assert.equal(bad.ok, false);
20
+ assert.equal(bad.tool, "promtool@2.54.1");
21
+ assert.match(bad.stderrTail, /404$/);
22
+ });
23
+ it("the image Dockerfile still uses the RUN steps", () => {
24
+ assert.match(laneToolsDockerfile("base:1", ["postgresql-client"]), /\nRUN apt-get update/);
25
+ });
26
+ });
@@ -190,12 +190,14 @@ export function createRouter(cfg, { fetchFn = globalThis.fetch, now = () => Date
190
190
  const size = sizeFor(spec);
191
191
  const fits = (await capacities()).filter((c) => c.ok && !c.paused && c.cpus_free >= size.cpus && c.mem_free_gb >= size.mem_gb)
192
192
  .sort((a, b) => b.cpus_free - a.cpus_free || b.mem_free_gb - a.mem_free_gb);
193
+ let busy = null; // the last agent 503 (e.g. lane_tools image building): its body and Retry-After are passed back
193
194
  for (const c of fits) {
194
195
  const r = await agentCall(own(agents(), c.name), "POST", "/sandboxes", { spec: withForgeYaml(spec), ...size }, 120000);
195
- if (r.status === 503) continue; // raced with another launch; try the next host
196
+ if (r.status === 503) { busy = { r, name: c.name }; continue; } // raced with another launch, or still building; try the next host
196
197
  if (r.ok) { sbx()[spec.id] = { agent: c.name, issue: spec.issue ?? null, batch: spec.batch ?? null, createdAt: now(), touched: now() }; store.save(); }
197
198
  return { status: r.status, body: { ...agentBody(r, c.name), agent: c.name } };
198
199
  }
200
+ if (busy) return { status: 503, body: { ...agentBody(busy.r, busy.name), agent: busy.name }, retryAfter: busy.r.retryAfter ?? cfg.retry_after_s ?? 60 };
199
201
  return { status: 503, body: { error: "no host has a free reservation", lane: size }, retryAfter: cfg.retry_after_s ?? 60 };
200
202
  }
201
203
 
package/bin/pool/warm.mjs CHANGED
@@ -23,13 +23,24 @@ export function makeWarm({ store, sb, own, now, launch, destroy, view, log = con
23
23
  function configure({ spec, cpus, mem_gb, limit = null, n }) {
24
24
  const key = keyOf(spec), want = Math.min(MAX_WARM, Number.isInteger(n) ? n : 0);
25
25
  if (want <= 0) { delete wanted()[key]; store.save(); return { key, n: 0 }; }
26
- wanted()[key] = { n: want, cpus, mem_gb, limit, spec: { image: spec.image ?? null, repo: spec.repo ?? null, cache: spec.cache ?? null, docker: Boolean(spec.docker) } };
26
+ wanted()[key] = { n: want, cpus, mem_gb, limit, spec: { image: spec.image ?? null, repo: spec.repo ?? null, cache: spec.cache ?? null, docker: Boolean(spec.docker), ...(spec.lane_tools?.length ? { lane_tools: spec.lane_tools } : {}) } };
27
27
  store.save();
28
28
  return { key, n: want };
29
29
  }
30
30
  const list = () => recs().map((r) => ({ id: r.id, key: r.warm, state: r.state, ready: isReady(r), cpus: r.cpus, mem_gb: r.mem_gb }));
31
- /** Start sandboxes until each repo has its n (ready or still preparing). Refused launches (capacity) are retried on the next call. */
32
- async function replenish() {
31
+ /**
32
+ * Start sandboxes until each repo has its n (ready or still preparing). Refused launches (capacity) are retried on the next call.
33
+ * Single-flight: a sandbox counts as warm only once its launch returns, so concurrent passes (every lane launch, claim and
34
+ * reaper tick calls this) each saw 0 and over-filled the pool (11 for n=1 when launches were slow). A call during a pass
35
+ * joins it and schedules one more pass for config that changed meanwhile.
36
+ */
37
+ let inflight = null, again = false;
38
+ function replenish() {
39
+ if (inflight) { again = true; return inflight; }
40
+ inflight = (async () => { do { again = false; await replenishPass(); } while (again); })().finally(() => { inflight = null; });
41
+ return inflight;
42
+ }
43
+ async function replenishPass() {
33
44
  for (const [key, w] of Object.entries(wanted())) {
34
45
  for (let have = recs(key).length; have < w.n; have++) {
35
46
  const id = `warm-${key}-${randomBytes(3).toString("hex")}`;
package/docs/CONFIG.md CHANGED
@@ -758,7 +758,7 @@ gate:
758
758
 
759
759
  ## `release` (OPTIONAL)
760
760
 
761
- Settings for `forgedock release [--repo owner/repo] [--merge] [--watch] [--resume <id>]` (#5208), which runs the `branches.staging` → `branches.default` release as one resumable job. State is kept in `~/.forge/releases/<id>/` (or `FORGEDOCK_RELEASE_DIR`); `--resume <id>` continues from the last completed step (preflight, release-pr, review, fixes, promotion, post-merge). Preflight refuses while lanes of the repo run or PRs to the staging branch are open, and sets the repo's batches to K=1 until the job ends. Review and fixes are not automated yet: the job stops there and tells you to use the manual path (`commands/review-pr-staging.md`). Post-merge is automated (#5213): it confirms a publish run for the merge commit (dispatching one when none appears), waits for `artifact_check`, then opens and merges the version-sync PR; a bound that runs out stops the job as blocked and `--resume <id>` retries. `forgedock release status [<id>] [--watch] [--interval s] [--json]` (bare `forgedock release --watch` runs the same loop) and `forgedock release explain <id | #issue | PR> [--json]` (#5554) are read-only: status reads the ledger (when `release.managed`) or the local cache plus the release PR's gate; `--watch` polls until the release is done, refused or blocked. `explain #N` prints the ordered rule trace (skip labels, priority, theme_map, `Depends on`, recorded release set, each with its config key), the lane and what would change it; `explain <PR>` prints the gate decision. `--json` output has schema `forgedock.release.status/v1` or `forgedock.release.explain/v1` and `next_actions[]`, the exact commands an agent may run; output carries no host name, so another host prints the same text. `status --watch [--interval s]` prints only when the output changes and stops at a terminal state; `forgedock release --watch` runs the same loop. Status prints `unknown` for any field the ledger does not hold. `explain #N` also reads the `FORGE:CLASSIFY` record (else `classification: absent`), `plan.skip_labels`, `classify.min_confidence`, `risk.rules[i]`, `forces[i]`, prints `planner: not installed` until the planner registers, and takes the lane from the latest `lane` entry in `controls.jsonl`; `explain <PR>` lists each required check with its outcome and any demotion (actor, expiry, reason, issue). `next_actions[]` carries `hold|resume|cancel` and `lane #N --force <lane>` commands (the `release-control.mjs` verbs) with `--reason <reason>` placeholders; there is no `rollback` verb yet, so none is emitted. `explain <PR>` reads the live `_active.exemptions` records (`release exempt`), `explain #N` the `_active.lanes` records.
761
+ Settings for `forgedock release [--repo owner/repo] [--merge] [--watch] [--resume <id>]` (#5208), which runs the `branches.staging` → `branches.default` release as one resumable job. State is kept in `~/.forge/releases/<id>/` (or `FORGEDOCK_RELEASE_DIR`); `--resume <id>` continues from the last completed step (preflight, release-pr, review, fixes, promotion, post-merge). Preflight refuses while lanes of the repo run or PRs to the staging branch are open, and sets the repo's batches to K=1 until the job ends. Post-merge is automated (#5213): it confirms a publish run for the merge commit (dispatching one when none appears), waits for `artifact_check`, then opens and merges the version-sync PR; a bound that runs out stops the job as blocked and `--resume <id>` retries. `forgedock release status [<id>] [--watch] [--interval s] [--json]` (bare `forgedock release --watch` runs the same loop) and `forgedock release explain <id | #issue | PR> [--json]` (#5554) are read-only: status reads the ledger (when `release.managed`) or the local cache plus the release PR's gate; `--watch` polls until the release is done, refused or blocked. `explain #N` prints the ordered rule trace (skip labels, priority, theme_map, `Depends on`, recorded release set, each with its config key), the lane and what would change it; `explain <PR>` prints the gate decision. `--json` output has schema `forgedock.release.status/v1` or `forgedock.release.explain/v1` and `next_actions[]`, the exact commands an agent may run; output carries no host name, so another host prints the same text. `status --watch [--interval s]` prints only when the output changes and stops at a terminal state; `forgedock release --watch` runs the same loop. Status prints `unknown` for any field the ledger does not hold. `explain #N` also reads the `FORGE:CLASSIFY` record (else `classification: absent`), `plan.skip_labels`, `classify.min_confidence`, `risk.rules[i]`, `forces[i]`, prints `planner: not installed` until the planner registers, and takes the lane from the latest `lane` entry in `controls.jsonl`; `explain <PR>` lists each required check with its outcome and any demotion (actor, expiry, reason, issue). `next_actions[]` carries `hold|resume|cancel` and `lane #N --force <lane>` commands (the `release-control.mjs` verbs) with `--reason <reason>` placeholders; `rollback` and the other control verbs exist (see the CLI reference) but `next_actions[]` does not emit them. `explain <PR>` reads the live `_active.exemptions` records (`release exempt`), `explain #N` the `_active.lanes` records.
762
762
 
763
763
  ```yaml
764
764
  release:
@@ -866,6 +866,227 @@ jobs:
866
866
 
867
867
  **Commands that use this section**: `forgedock release`
868
868
 
869
+ ### Gate-only fix lane: `release control regate` (#5584)
870
+
871
+ `forgedock release control regate <release id> --ref <fix branch|sha> --reason "..." [--gate-fix-ref <hotfix branch>]` re-evaluates the gates of the same release sha (same image digests, no rebuild, no migration rerun) with the gate code of `--ref`, so a fix limited to gate artifacts does not need a new merge cycle. Nothing runs unless the verb is called. The fix still goes through CI and review once; it never skips the merge cycle for code that ships in images.
872
+
873
+ - **Classifier**: the diff between the release's merged sha and `--ref` is gate-only only when every path matches `gates.paths` (default `scripts/deploy/**`, `scripts/lib/**`, `scripts/prod-smoke-test.sh`, `**/gate-fixtures/**`, `tests/gates/**`). A `.github/workflows/*.yml` file qualifies only when every changed hunk lies in a step named in `gates.workflow_steps` (default none). A migration path (`**/migrations/**`, `**/migrate/**`, `*.sql`), an image path (`Dockerfile*`, `docker-compose*.yml`) or any other app path sends the fix to the normal lane.
874
+ - **Dispatch**: one `gh workflow run` of `verify.workflow` at `--ref` through the epoch fence, inputs `sha` (the release sha), `regate=true`, `gate_sha` and `forge_epoch`. The engine never sets `override_freeze` (I26); LIVE_CHECK (I28) still applies to the result.
875
+ - **`gate_fix_ref`** (hotfix same-release gate fix): with `--gate-fix-ref`, the dispatch also carries `gate_fix_ref=<branch>`, which lets a hotfix-branch gate fix replace the default-branch preflight copy. It is recorded in the audit line and in `state.regates`.
876
+ - **Refusals** (nothing is written or dispatched): no recorded live record/rollback target (`state.deploy.target`); `deploy.freeze_variable` set by the run (not set before the deploy) while migration files lie between the rollback target and the release sha; a fix that is not gate-only; a ref already re-evaluated.
877
+ - **Audit**: every use appends a `controls.jsonl` line (`verb: regate`) with the actor, the fix sha, the release sha and `gate_sha` (sha1 over the changed gate paths and their blobs at `--ref`); the release state keeps `regates[]`, and gate telemetry recorded afterwards carries that `gate_sha`.
878
+
879
+ ### Policy reference (`.forge/release.yaml`, #5572)
880
+
881
+ One row per key path of `POLICY_SCHEMA` (`bin/lean/release-config.mjs`). `<name>` is a map key you choose and `[]` a list item. A default of "none" means the key is unset and its feature is off. `bin/lean/release-docs.test.mjs` fails when a schema key is missing here or a key listed here is not in the schema, so a phase that adds a key documents it in the same change.
882
+
883
+ | Key | Type | Default | Meaning |
884
+ |-----|------|---------|---------|
885
+ | `schema` | 1 | required | Policy file version; must be `1`. |
886
+ | `branches` | object | - | Branch names the release lanes use. |
887
+ | `branches.default` | string | `main` (init profile) | The branch releases land on; the policy file is read only from here (I13). |
888
+ | `branches.integration` | string | null | Integration branch for lanes with `base: integration`; unset makes such a lane unreachable. |
889
+ | `branches.train` | string | none | Branch prefix or name for train waves. |
890
+ | `branches.release` | string | none | Branch prefix or name for release waves. |
891
+ | `branches.hotfix` | string | none | Branch prefix or name for hotfix (P0) branches. |
892
+ | `trust` | object | - | Who the pipeline believes. |
893
+ | `trust.actors` | array | none | Logins whose control comments and commits are trusted. |
894
+ | `trust.require_verified_commits` | boolean | off | Refuse release commits that are not verified. |
895
+ | `state` | object | - | Where release state lives and how leases behave. |
896
+ | `state.ledger_prefix` | string | built-in prefix | Name prefix of the ledger entries kept on GitHub. |
897
+ | `state.lease_ttl_s` | number | built-in | Seconds a run lease stays valid without a heartbeat. |
898
+ | `state.heartbeat_s` | number | built-in | Seconds between lease heartbeats. |
899
+ | `units` | map | none | Deployable units, keyed by name; each is mapped to code paths. |
900
+ | `units.<name>.paths` | array | none | Globs of files that belong to the unit. |
901
+ | `units.<name>.image` | string | null | Image name the unit ships as, when it has one. |
902
+ | `units.<name>.criticality` | low\|medium\|high | none | `low`, `medium` or `high`; feeds risk. |
903
+ | `units.<name>.tests` | array | none | Test commands or names that cover the unit. |
904
+ | `units.<name>.verify` | array | none | Post-deploy checks that cover the unit. |
905
+ | `units.<name>.service_pipeline` | boolean | off | The unit deploys through its own service pipeline. |
906
+ | `units.<name>.single_host_ok` | boolean | off | The unit may run on one host. |
907
+ | `units.<name>.dockerfile` | string | null | Dockerfile checked by `release check-config --coverage`. |
908
+ | `units.<name>.surface` | service\|web\|edge | none | `service`, `web` or `edge`. |
909
+ | `couplings` | array | none | Paths that force other units to roll when they change. |
910
+ | `couplings[].paths` | array | none | Globs whose change couples units. |
911
+ | `couplings[].affects` | array | none | Unit names rolled by that change; each must exist in `units`. |
912
+ | `contracts` | array | none | Producer/consumer interfaces between units. |
913
+ | `contracts[].producer` | string | none | Unit that owns the contract. |
914
+ | `contracts[].consumers` | array | none | Units that depend on it. |
915
+ | `contracts[].paths` | array | none | Globs of the contract files. |
916
+ | `contracts[].additive_only` | boolean | off | Only additive changes are allowed. |
917
+ | `contracts[].regenerate` | string | null | Command that regenerates generated contract files. |
918
+ | `forces` | array | none | Rules that force a pipeline for matching paths. |
919
+ | `forces[].paths` | array | none | Globs the rule matches. |
920
+ | `forces[].pipeline` | full\|service\|hotfix | none | `full`, `service` or `hotfix`. |
921
+ | `forces[].reason` | string | none | Text shown in `release explain`. |
922
+ | `classify` | object | - | Issue classification (the `FORGE:CLASSIFY` record). |
923
+ | `classify.min_confidence` | number | none | Records below this confidence are not trusted for lane choice. |
924
+ | `classify.text_only_cap` | number | 0.5 | Confidence cap for a record built from issue text alone. |
925
+ | `classify.triage_max_per_hour` | number | 10 | Triage classify calls per rolling hour. |
926
+ | `classify.exists_in_evidence` | mechanical\|llm | none | `mechanical` or `llm`: how cited evidence paths are checked. |
927
+ | `risk` | object | - | Risk rules. |
928
+ | `risk.rules` | array | none | Ordered rules; the matching rule sets risk and may force a pipeline. |
929
+ | `risk.rules[].when` | object | none | Conditions, all of which must hold. |
930
+ | `risk.rules[].when.migration` | boolean | none | The change touches migrations. |
931
+ | `risk.rules[].when.paths` | array | none | Globs the change touches. |
932
+ | `risk.rules[].when.contract` | boolean | none | The change touches a contract. |
933
+ | `risk.rules[].when.rolled_units_gt` | number | none | More than this many units roll. |
934
+ | `risk.rules[].when.diff_lines_gt` | number | none | More than this many changed lines. |
935
+ | `risk.rules[].when.requires` | string | none | Named requirement that must hold. |
936
+ | `risk.rules[].risk` | low\|medium\|high | none | `low`, `medium` or `high`. |
937
+ | `risk.rules[].forces` | string | none | Pipeline the rule forces. |
938
+ | `features` | object | - | Feature wave policy (#5571). |
939
+ | `features.flag_policy` | require\|warn\|off | none | `require` refuses a feature wave that adds no rollout key, `warn` warns, `off` does nothing; `lanes.<name>.flag_policy` wins. |
940
+ | `plan` | object | - | The release plan. |
941
+ | `plan.approval` | wait\|auto\|auto-if | `wait` (init profile) | `wait`, `auto` or `auto-if`; `auto-if` is rejected until its phase. |
942
+ | `plan.skip_labels` | array | built-in labels | Issue labels kept out of a plan. |
943
+ | `plan.require_design_gate` | boolean | off | Plan needs the design gate to pass. |
944
+ | `plan.max_issues` | number | none | Issue cap for one plan. |
945
+ | `plan.stale_snapshot_s` | number | none | Seconds after which a plan snapshot is stale. |
946
+ | `lanes` | map | none | Named lanes (for example `release`, `train`, `p0`). |
947
+ | `lanes.<name>.pipeline` | string | `existing` (init profile) | Deploy pipeline the lane runs; `existing` keeps the repo's own. |
948
+ | `lanes.<name>.ci_tier` | string | none | CI tier; must exist in `ci.tiers` when tiers are set. |
949
+ | `lanes.<name>.approval` | string | none | Approval mode for the lane. |
950
+ | `lanes.<name>.budget` | string | none | Budget class for the lane. |
951
+ | `lanes.<name>.base` | live\|integration\|default | none | `live`, `integration` or `default`. |
952
+ | `lanes.<name>.units_max` | number | none | Maximum units per wave. |
953
+ | `lanes.<name>.max_risk` | low\|medium\|high | none | Highest risk the lane accepts. |
954
+ | `lanes.<name>.train_max_issues` | number | none | Issue cap per train wave. |
955
+ | `lanes.<name>.train_max_units` | number | none | Unit cap per train wave. |
956
+ | `lanes.<name>.soak_min` | any | none | Soak time, in minutes, before the next wave. |
957
+ | `lanes.<name>.flag_policy` | require\|warn\|off | none | `require`, `warn` or `off`; overrides `features.flag_policy`. |
958
+ | `lanes.<name>.requires` | array | none | Lanes or checks that must pass first. |
959
+ | `credentials` | object | - | Credentials the gates use. |
960
+ | `credentials.gate_app` | string | null | App identity that posts gate results. |
961
+ | `credentials.lane_env_strip` | array | none | Environment variables removed from lane processes. |
962
+ | `merge` | object | - | How the release PR merges. |
963
+ | `merge.approval` | confirm\|with-plan\|auto | `confirm` (init profile) | `confirm`, `with-plan` or `auto`. |
964
+ | `merge.method` | merge-commit\|squash\|rebase | none | `merge-commit`, `squash` or `rebase`. |
965
+ | `merge.trailers` | array | none | Commit trailers added to the merge. |
966
+ | `ci` | object | - | CI policy for releases. |
967
+ | `ci.provider` | github-actions\|command | `github-actions` | `github-actions`; `command` is rejected until its phase. |
968
+ | `ci.required_checks` | any | none | Checks required on the release PR. |
969
+ | `ci.selection` | any | none | How CI jobs are chosen for a diff. |
970
+ | `ci.rerun_budget_min` | number | none | Minutes of reruns the flake classifier may spend. |
971
+ | `ci.fix` | object | - | Gate-failure fix loop. |
972
+ | `ci.fix.max_rounds` | integer | none | Fix rounds before the release stops. |
973
+ | `ci.fix.co_start` | boolean | none | Start the fix lane while checks still run. |
974
+ | `ci.fix.full_run_workflow` | string | none | Workflow that runs the full suite on a fix. |
975
+ | `ci.flake` | object | - | Flake handling (#5568). |
976
+ | `ci.flake.quarantine_after` | number | none | Flakes of one test before it is quarantined. |
977
+ | `ci.flake.window_days` | number | none | Days over which flakes are counted. |
978
+ | `ci.unskippable` | array | none | Job-name substrings that can never be skipped or waived. |
979
+ | `ci.tiers` | map | none | Named CI tiers, each a job list. |
980
+ | `ci.tiers.<name>.jobs` | array | none | Job names in the tier. |
981
+ | `ci.nightly` | any | none | Nightly block (#5569): `workflow`, `branch`, `block_release`, `t0_t2_hours`, `t3_t4_hours`, `t3_jobs`, `t4_jobs`, `unskippable`; see Managed release: nightly and budget. |
982
+ | `ci.budget` | any | none | Budget block (#5569): `on_exceed` (`local-first`, `hold`, `proceed`), `ignore`, `model_release_minutes`; see Managed release: nightly and budget. |
983
+ | `preflight` | object | - | Checks run before release. |
984
+ | `preflight.commands` | array | none | Commands run on the host. |
985
+ | `preflight.timeout_s` | number | none | Seconds before a command is killed. |
986
+ | `preflight.blocking` | boolean | none | A failure stops the release. |
987
+ | `deploy` | object | - | Deploy stage. |
988
+ | `deploy.live_release_command` | string | none | Command that reads the live release. |
989
+ | `deploy.freeze_variable` | string | none | Repository variable that freezes deploys. |
990
+ | `deploy.concurrency_group` | string | none | Concurrency group of the deploy workflows. |
991
+ | `deploy.start_timeout_s` | number | 60 | Seconds to wait for a deploy run to start. |
992
+ | `deploy.stage_timeout_s` | number | built-in | Seconds a deploy stage may run. |
993
+ | `deploy.expected_digests_command` | string | none | Command printing the image digests a deploy should end with. |
994
+ | `deploy.recovery` | object | - | Deploy recovery. |
995
+ | `deploy.recovery.rerun_max` | integer | built-in | Reruns of a failed stage. |
996
+ | `deploy.recovery.max_attempts` | integer | built-in | Total attempts. |
997
+ | `deploy.recovery.signatures` | array | none | Failure signatures that may be rerun. |
998
+ | `deploy.pipelines` | map | none | Named deploy pipelines. |
999
+ | `deploy.pipelines.<name>.workflow` | string | none | Workflow file. |
1000
+ | `deploy.pipelines.<name>.trigger` | push\|dispatch | none | `push` or `dispatch`. |
1001
+ | `deploy.pipelines.<name>.inputs` | map | none | String inputs passed on dispatch. |
1002
+ | `deploy.pipelines.<name>.wait` | boolean | none | Wait for the run to finish. |
1003
+ | `verify` | object | - | Deploy verification (#5562). |
1004
+ | `verify.workflow` | string | none | Verification workflow. |
1005
+ | `verify.results` | array | none | Result workflows to read. |
1006
+ | `verify.results[].workflow` | string | none | Workflow file. |
1007
+ | `verify.results[].kind` | smoke\|edge\|convergence | none | `smoke`, `edge` or `convergence`. |
1008
+ | `verify.flags` | array | none | Flags the verification can turn off. |
1009
+ | `verify.flags[].flag` | string | none | Flag name. |
1010
+ | `verify.flags[].off_command` | string | none | Command that turns it off. |
1011
+ | `verify.slis` | array | none | SLI checks; free-form entries. |
1012
+ | `verify.post_deploy_checks_file` | string | none | File of post-deploy checks. |
1013
+ | `verify.close_requires` | verified\|deployed | none | `verified` or `deployed`: what closes an issue. |
1014
+ | `rollback` | object | - | Rollback ladder (#5563). |
1015
+ | `rollback.triggers` | array | none | `smoke`, `health`, `livecheck`, `sli`, `crashloop` or `human`. |
1016
+ | `rollback.ladder` | array | none | Steps in order: `flag`, `unit`, `full`, `stop`. |
1017
+ | `rollback.refuse_across` | array | none | Changes a rollback must not cross (`destructive_migration`). |
1018
+ | `rollback.open_revert_pr` | boolean | none | Open a revert PR after a rollback. |
1019
+ | `rollback.flags` | array | none | Kill switches. |
1020
+ | `rollback.flags[].flag` | string | none | Flag name. |
1021
+ | `rollback.flags[].kill_command` | string | none | Command that kills it. |
1022
+ | `rollback.unit_workflow` | string | none | Workflow that rolls one unit back. |
1023
+ | `rollback.unit_action` | string | none | Action name passed to it. |
1024
+ | `rollback.full_workflow` | string | none | Workflow that rolls everything back. |
1025
+ | `rollback.health_command` | string | none | Command that reports health. |
1026
+ | `rollback.result_command` | string | none | Command that reports the rollback result. |
1027
+ | `events` | object | - | Event sinks. |
1028
+ | `events.webhook_url` | string | none | Webhook that receives release events. |
1029
+ | `quarantine` | object | - | Quarantine limits. |
1030
+ | `quarantine.days` | number | none | Days a quarantine lasts. |
1031
+ | `quarantine.max` | number | none | Maximum quarantined tests. |
1032
+ | `gates` | object | - | Deploy gate catalogue settings (#5583). |
1033
+ | `gates.demote_fb_rate` | number | 5 | False-block percent above which a gate is demoted. |
1034
+ | `gates.demote_window` | integer | 20 | Runs in the demotion window. |
1035
+ | `gates.safety` | array | built-in list | Gates never demoted. |
1036
+ | `gates.paths` | array | built-in globs | Paths a gate-only fix may touch (regate). |
1037
+ | `gates.workflow_steps` | array | none | Workflow steps that count as gate code. |
1038
+ | `controls` | object | - | Operator controls (#5555, #5556, #5564). |
1039
+ | `controls.intake` | any | none | Intake pause settings. |
1040
+ | `controls.conductor` | any | none | Conductor workflow settings. |
1041
+ | `controls.exempt` | any | none | Exemption settings. |
1042
+
1043
+ #### Zero-config profile
1044
+
1045
+ `forgedock release init` writes exactly this to `.forge/release.yaml` and never overwrites an existing file; `release init --conductor` also installs the conductor workflow.
1046
+
1047
+ ```yaml
1048
+ schema: 1
1049
+ branches: {default: main}
1050
+ plan: {approval: wait}
1051
+ lanes: {release: {pipeline: existing}}
1052
+ merge: {approval: confirm}
1053
+ ```
1054
+
1055
+ #### Deferred keys
1056
+
1057
+ These keys are rejected by `release check-config` until their phase ships:
1058
+
1059
+ - `plan.auto_if`
1060
+ - `retention_days`
1061
+ - `ci.forbid_per_issue_steps`
1062
+ - `couplings[].refine`
1063
+ - `ci.provider=command`
1064
+ - `risk.weights`
1065
+
1066
+ #### CLI reference
1067
+
1068
+ | Command | Purpose |
1069
+ |---------|---------|
1070
+ | `forgedock release` | Run the staging to default release as one resumable job (`--merge`, `--watch`, `--resume <id>`). |
1071
+ | `forgedock release p0` | Hotfix lane for an issue or branch (`--units`, `--preempt`, `--yes`). |
1072
+ | `forgedock release verify` | Verify a release sha, or re-run deploy verification of a release id. |
1073
+ | `forgedock release recover` | Recover a release that stopped mid-deploy. |
1074
+ | `forgedock release rollback` | Roll a release back (`--reason`, `--to flag\|unit\|full`, `--later`). |
1075
+ | `forgedock release plan` | Build the release plan for a lane. |
1076
+ | `forgedock release start` | Start a planned release (`--plan`, `--approve`, `--wave`). |
1077
+ | `forgedock release go` | Advance a started release (`--plan`, `--merge`, `--activate <key>`). |
1078
+ | `forgedock release status` | Read-only state of a release (`--watch`, `--json`). |
1079
+ | `forgedock release explain` | Rule trace for an id, issue or PR. |
1080
+ | `forgedock release check-config` | Validate the policy file (`--ref`, `--coverage`). |
1081
+ | `forgedock release init` | Write the zero-config profile. |
1082
+ | `forgedock release control` | Audited controls: `hold`, `resume`, `cancel`, `lane`, `exempt`, `freeze`, `unfreeze`; each also runs as `forgedock release <verb>` and needs `--reason`. `demote`, `promote`, `rollback` and `regate` are control verbs too. |
1083
+ | `forgedock release gates` | Gate telemetry (`check`, `demote`, `record`). |
1084
+ | `forgedock release report` | Model vs measured Actions minutes. |
1085
+ | `forgedock intake` | `pause`, `resume` or `status` of issue intake (`_active.intake`). |
1086
+ | `forgedock ci budget` | Actions-minute budget and CI placement (#5278). |
1087
+ | `controls log` | The `controls.jsonl` audit line every control verb appends; read it through `release status` and `release explain`. |
1088
+ | `ci flakes`, `ci nightly` | Records, not commands: the flake ledger (`_active.flakes`) and the nightly result, read through `release status`, `release explain` and `release report`. |
1089
+
869
1090
  ## `issue_watch` (OPTIONAL)
870
1091
 
871
1092
  Named, scoped, capped watches for `forgedock issue-watch` (see [ISSUE-WATCH.md](ISSUE-WATCH.md)). Write `issue_watch:`, then `watches:`, then one block per watch name. The release keys need `mode: release` and at least a `threshold` or `immediate`.
@@ -1033,6 +1254,7 @@ lean:
1033
1254
  builder_routing: on # on (default) | off: route the build to a mid-tier model by the frozen contract
1034
1255
  builder_mid_model: claude-sonnet-5-5 # optional mid-tier builder model (default claude-sonnet-5-5)
1035
1256
  contract_max_corrections: 3 # #5623: builder correction rounds for a builder-correctable invalid contract before it ends contract.invalid (which a batch then requeues once with a fresh plan)
1257
+ review_max_resumes: 3 # #5644: builder resume rounds, each with only the open findings, for builder-fixable review/conformance failures (regression, unimplemented, omission, deferral, scope) before needs-human; stops early when a round changes nothing
1036
1258
  light:
1037
1259
  mode: shadow # off | shadow (default) | on: light-lane eligibility (#4448; lane wiring #4450)
1038
1260
  max_lines: 40 # upgrade to the full lane above this many non-test diff lines
@@ -1649,6 +1871,8 @@ topology:
1649
1871
  | `coupled_files` | map (glob → glob list) | No | Default unset (#5079). "If file A changes, file B must change": a block map `{when glob: required glob[, glob]}`, e.g. `"infra/guard/bootstrap.sh": "infra/guard/MANIFEST.sha256"`. A key prefixed `added:` fires only for files the lane adds (`"added:scripts/tests/test_*.py": ".github/workflows/ci.yml"`). A lane that changes a `when` file without a matching required file fails precheck with `coupled_file_missing` (`conformance.unimplemented`, builder resumed once). Quote keys that contain `*`, and list alternatives as separate keys: brace globs (`*.{ts,tsx}`) are not expanded. |
1650
1872
  | `verify.baselines` | map (glob → command) | No | Default unset (#5448). Baseline suites validate runs whenever a changed path matches the glob, e.g. `baselines:` with `"shared/content/**": make stealth-baseline`; each distinct command runs once, a non-zero exit fails the gate (`conformance.regression`). The contract's `regression` set (existing tests of callers, shared modules, sibling configs) is folded into `validate` at freeze. A post-deploy requirement needs a registered check id and `local_infeasible_why`; a check-less one is rejected at freeze unless it needs an owner or read-only prod data, and development work is never deferrable as prod-only. |
1651
1873
  | `validate.recipes` | map (regex → replacement) | No | Default unset. A top-level `validate:` block with a block-style `recipes:` map, e.g. `"poetry run pytest": "uv run --with-requirements r.txt pytest"`. Each key is a regex source; the first recipe that matches a frozen validate or `repro_test` command rewrites it at contract freeze (`applyValidateRecipes`), recorded as a decision. Use it for commands whose environment is not installed in lane sandboxes. |
1874
+ | `validate.catalog` | comma list | No | Default `.github/workflows/ci.yml, scripts/ci-local.sh`. CI files from which the engine derives rewrite entries (the repo's own pytest or JS runner) for validate commands freeze preflight finds unrunnable; `validate.recipes` entries take precedence (#5653). |
1875
+ | `validate.regenerate` | string | No | Default unset. Command that regenerates generated artifacts. When a validate failure reads as a stale artifact, it runs once and the validate is rerun; it counts only if regeneration changes no tracked file (#5653). |
1652
1876
  | `topology.route_reachability` | string (command) | No | Default unset (no check, no behaviour change). A repo-supplied command that takes the route paths a diff adds (Next.js `app/**/route.*`, `pages/api/**`; URL form, route groups removed) as arguments and exits non-zero when the production ingress does not deliver them to the service that implements them. Runs in the lean lane after validate and in `review-pr-staging`; a non-zero exit blocks (`conformance.unimplemented`, kind `route_unreachable`). Read by `readEnvConfig` (`bin/engine-cli.mjs`), run by `bin/lean/routecheck.mjs`. |
1653
1877
  | `pages.enabled` / `pages.routes` | bool / list | No | Page gate (#5428). Default on only when the repo tracks Next `app/**/page.*` files; `enabled: false` turns it off, and `routes` globs add non-Next page files. A diff touching a public page needs `page_gate` {design_spec, seo, geo} in the contract (checked by `validateContract`), and `page_missing`-class precheck rows (`page_design_missing`, `page_visual_missing`, `page_metadata_missing`, `page_canonical_missing`, `page_structured_data_missing`, `page_sitemap_missing`, `page_forbidden_pattern`, `page_link_broken`, `page_lint_failed`) fail as `conformance.unimplemented`. Read by `readEnvConfig`, checked by `bin/lean/pagegate.mjs`. |
1654
1878
  | `pages.exclude` / `pages.design_only` | lists | No | Globs (#5585). `exclude` drops internal, auth-gated or admin routes from the page gate entirely (no `page_gate` brief, no `page_*` rows). `design_only` keeps the `design` requirement (`page_gate.design_spec`, an approved spec, 390/1440 screenshots) but skips SEO/GEO. A page whose own file or an ancestor `layout.*` declares `robots: { index: false }` or `noindex` is excluded automatically (needs the file to exist in the worktree). Default empty. |
@@ -62,6 +62,7 @@ The lane follows the repo rule: a milestone issue goes to `milestone/<slug>` (fo
62
62
  - `mode: batch`: claims are `--add`ed to one long-lived `orchestrate` batch, so its K (`parallel:`), the `Depends on` DAG (claims are ordered dependencies first), the supervisor and the report apply. When the batch writes its report the watch starts a new one with the next claims. If another running (not reported, not cancelled) batch of the same repo and lane exists, claims are `--add`ed to it instead of starting a new one. A slow `orchestrate` start (no batch dir within 60 s) never stops the watch: the claims are kept in a `pendingStart` record, later passes adopt the batch when it appears, and after 10 minutes without one the claims are released. An error in any pass is logged, saved as `passError` in `status.json`, shown by `issue-watch status`, and the next pass runs (with `--once` the process still exits non-zero).
63
63
 
64
64
  - `mode: release`: see [Release mode](#release-mode).
65
+ - `mode: triage` (#5558): filing an issue never starts work. Each pass lists new open issues and makes one small model call per issue (text only), then writes a `FORGE:CLASSIFY` comment (`source: text-only`, confidence at most `classify.text_only_cap` (0.5), `migrations` never `none`), applies `type:*`, `priority:*` and `lane:*` suggestion labels and `needs-info` when the body has no `Acceptance` heading or checklist item (no model call). It never claims or builds, makes no call and no write while intake is paused, and skips issues that already carry a `FORGE:CLASSIFY` comment. Keys: `triage.max_per_hour` (model calls per rolling hour, the rest wait for the next pass; falls back to `classify.triage_max_per_hour`, then 10) and `trust_app` (the ForgeDock App is a trusted author; other authors follow the usual trust rules). `release_pause` defaults to on.
65
66
 
66
67
  ## Follow-ups
67
68
 
@@ -20,6 +20,16 @@ Opt-in per repo through forge.yaml `design.routes` (see [`docs/CONFIG.md`](../CO
20
20
 
21
21
  With `design.gate: blocking` every finding is a BLOCKER (`Visual: <route> <kind>`) and the review posts `FORGE:GATE_FAILURE`. With `advisory` the same findings are reported and the gate never fails.
22
22
 
23
+ ## Modified pages (#5648)
24
+
25
+ The spec requirement follows what the diff does to a page, not its path (`pageChange` in `bin/lean/pagegate.mjs`):
26
+
27
+ - **new** (added, or no added list or diff to judge by: fails closed) and **rewrite** (any markup, `className`/`style` or import/export line changed, or churn at or over `pages.rewrite_threshold`, default `0.6`, of the file) need an approved FORGE:DESIGN_SPEC.
28
+ - **copy** (only text or data lines changed in an existing page) takes the visual-check path: no spec, no new-page SEO/GEO briefs, still the 390px and 1440px screenshots.
29
+ - **generated** pages (a `generated/` or `__generated__/` path, a `pages.generated` glob, or an `@generated` header in the first lines) are exempt.
30
+
31
+ At contract time a page deliverable already on the base is not asked for `page_gate`; the lane precheck judges it from the diff.
32
+
23
33
  ## Regression fixture
24
34
 
25
35
  `bin/lean/design-gate.test.mjs` and `bin/lean/visual-gate.test.mjs` hold the fixture from the 2026-11-09 Hands pages: a plain-text hero (`h1` and prose), empty Needs/Evidence/Action boxes and a bare "Get access" link. A bundle adding it fails the gate; a page with a component hero, filled cards and a real button passes.
@@ -60,6 +60,7 @@ Use `--arms control` or `--issues id,id` to rerun part of the set, and `--keep`
60
60
  | Integration points missed | For each `integration` row, the number of `must_touch` paths absent from the diff against the base. |
61
61
  | Oracle pass rate | Over the rows with an oracle (`valid`): the upstream fix tests pass after being overlaid on the arm's head. |
62
62
  | Cost and wall time | Sum of `cost_usd` and `wall_ms`, as in `lightlane-bench.md`. |
63
+ | Sandbox start | Sum of `start_ms`, the lane result's `phases.sandbox_start.ms` (#5620), to compare runs with and without `execution.warm_sandboxes`. Rows with no phases (the control arm, a missing result file) count in `start_unobserved`. |
63
64
 
64
65
  Grading is deterministic: the diff paths and added lines, never an LLM. The scorecard records the run date, the model and the corpus revision (`version@base+<hash of the corpus file>`).
65
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgedock",
3
- "version": "1.59.2",
3
+ "version": "1.60.1",
4
4
  "description": "An AI engineering team that ships to production",
5
5
  "bin": {
6
6
  "forgedock": "bin/forgedock.mjs"
package/pool/README.md CHANGED
@@ -15,3 +15,5 @@ Claude login choice (#5165): among the router host's logins with 30+ minutes lef
15
15
  Disk reporting (#5535, all fields optional; absent from an old agent means unknown): the agent's `GET /capacity` carries `disk_free_gb` (free space under its state dir) and `sandbox_disk_mb` (`{sandbox id: MB}`, refreshed at most every 60s). The router's `GET /agents` passes `disk_free_gb` through in `agents[]` and adds `disk_used_mb` to each `sandboxes[id]`. `forgedock gc` prints the disk used per pool entry (`unknown` when absent) and `forgedock doctor` shows each agent's free disk, warning below `hygiene.min_free_gb`.
16
16
 
17
17
  The `forgedock pool` CLI wiring is tracked separately (#4544).
18
+
19
+ Per-repo lane tools (#5650): forge.yaml `execution.lane_tools` (`name` or `name@version`) rides in the launch spec as `lane_tools`. The agent resolves the image in `launch` (`bin/pool/lane-tools.mjs`): no tools keeps the base `forgedock-lane:<version>`; otherwise it uses `<base>-t<sha256 of the sorted list, 12 hex>`, building it once `FROM` the base with one recipe per tool (warm sandboxes keep `lane_tools` in their stored spec, so they use the same image). A tool with no recipe fails before any build (`lane_tools.unknown_recipe`, naming the tool and the known recipes); a failed or timed-out build is `lane_tools.build_failed` and the launch records the error. To add a recipe, add an entry to `RECIPES` in `bin/pool/lane-tools.mjs`: `{versioned, steps(version) -> Dockerfile instructions}` for the Debian/Ubuntu lane image; tool names appear nowhere else.
@@ -101,9 +101,12 @@ while IFS= read -r f; do
101
101
  mkdir -p "$BASE_WT/$(dirname "$f")" && cp -p "$REPO/$f" "$BASE_WT/$f" 2>/dev/null && [ -f "$BASE_WT/$f" ] || OVERLAY_OK=false
102
102
  done <<< "$CHANGED"
103
103
  # Untracked dependency trees (never in git): link head's so a missing install is not mistaken for a red run (#4334):
104
- # every node_modules next to a tracked package.json (workspace packages too, e.g. apps/web/node_modules) and a root .venv.
104
+ # every node_modules next to a tracked package.json (workspace packages too, e.g. apps/web/node_modules), and every .venv
105
+ # next to a tracked Python manifest (root or a monorepo service, e.g. services/api/.venv).
105
106
  DEPS=$( { git -C "$REPO" ls-files -- package.json '*/package.json' 2>/dev/null | while IFS= read -r p; do
106
- d=$(dirname "$p"); [ "$d" = "." ] && echo node_modules || echo "$d/node_modules"; done; echo .venv; } | sort -u )
107
+ d=$(dirname "$p"); [ "$d" = "." ] && echo node_modules || echo "$d/node_modules"; done
108
+ git -C "$REPO" ls-files -- pyproject.toml '*/pyproject.toml' poetry.lock '*/poetry.lock' uv.lock '*/uv.lock' 'requirements*.txt' '*/requirements*.txt' 2>/dev/null | while IFS= read -r p; do
109
+ d=$(dirname "$p"); [ "$d" = "." ] && echo .venv || echo "$d/.venv"; done; echo .venv; } | sort -u )
107
110
  while IFS= read -r t; do
108
111
  [ -n "$t" ] || continue
109
112
  case "$t" in */node_modules/*) continue ;; esac # a package.json inside an installed tree