forgedock 1.51.0 → 1.53.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/engine/outcome-codes.mjs +3 -0
- package/bin/engine/telemetry-seam.mjs +4 -2
- package/bin/engine-cli.mjs +61 -17
- package/bin/experiment.mjs +58 -6
- package/bin/forge-utils.mjs +6 -2
- package/bin/forgedock.mjs +25 -1
- package/bin/lean/account-watch.mjs +28 -0
- package/bin/lean/account-watch.test.mjs +30 -0
- package/bin/lean/activation.mjs +20 -0
- package/bin/lean/activation.test.mjs +14 -1
- package/bin/lean/basered.mjs +115 -0
- package/bin/lean/basered.test.mjs +66 -0
- package/bin/lean/batch-health.mjs +40 -6
- package/bin/lean/batch-health.test.mjs +34 -1
- package/bin/lean/batch.mjs +41 -2
- package/bin/lean/batch.test.mjs +104 -2
- package/bin/lean/checkpoint-reconcile.mjs +43 -0
- package/bin/lean/checkpoint-reconcile.test.mjs +95 -0
- package/bin/lean/conformance.e2e.test.mjs +1 -1
- package/bin/lean/conformance.mjs +205 -23
- package/bin/lean/conformance.test.mjs +164 -3
- package/bin/lean/context.mjs +27 -17
- package/bin/lean/context.test.mjs +15 -0
- package/bin/lean/effects.mjs +11 -7
- package/bin/lean/execution.mjs +19 -3
- package/bin/lean/execution.test.mjs +39 -0
- package/bin/lean/findinglabel.mjs +16 -0
- package/bin/lean/findinglabel.test.mjs +39 -0
- package/bin/lean/heavy.mjs +6 -3
- package/bin/lean/hostload.mjs +78 -0
- package/bin/lean/hostload.test.mjs +117 -0
- package/bin/lean/hotspots-remote.e2e.test.mjs +71 -0
- package/bin/lean/issuewatch-release.mjs +6 -2
- package/bin/lean/issuewatch-release.test.mjs +16 -0
- package/bin/lean/issuewatch.mjs +11 -1
- package/bin/lean/lanelock.mjs +14 -0
- package/bin/lean/lean.mjs +171 -36
- package/bin/lean/lean.test.mjs +302 -10
- package/bin/lean/light.mjs +48 -7
- package/bin/lean/light.test.mjs +37 -3
- package/bin/lean/limits.test.mjs +142 -9
- package/bin/lean/orchestrate-cancel.test.mjs +143 -0
- package/bin/lean/orchestrate.mjs +110 -26
- package/bin/lean/postdeploy-check.test.mjs +39 -0
- package/bin/lean/prompts.mjs +8 -7
- package/bin/lean/quota.mjs +39 -0
- package/bin/lean/recovery.test.mjs +10 -0
- package/bin/lean/relaxation.mjs +73 -0
- package/bin/lean/relaxation.test.mjs +54 -0
- package/bin/lean/release-postmerge.mjs +119 -0
- package/bin/lean/release-rehearsal.mjs +63 -0
- package/bin/lean/release-rehearsal.test.mjs +93 -0
- package/bin/lean/release-review.e2e.test.mjs +77 -0
- package/bin/lean/release-review.mjs +198 -0
- package/bin/lean/release-review.test.mjs +180 -0
- package/bin/lean/release.mjs +228 -0
- package/bin/lean/release.test.mjs +292 -0
- package/bin/lean/rotator.mjs +150 -31
- package/bin/lean/rotator.test.mjs +105 -2
- package/bin/lean/sandbox-remote.mjs +9 -2
- package/bin/lean/schedd.mjs +56 -6
- package/bin/lean/schedd.test.mjs +108 -6
- package/bin/lean/verifier.mjs +3 -2
- package/bin/lean/verify.mjs +2 -1
- package/bin/lean/verify.test.mjs +6 -0
- package/bin/pool/agent.mjs +18 -4
- package/bin/pool/router.mjs +68 -25
- package/bin/review-staging.mjs +23 -0
- package/bin/stats/conformance-outcomes.mjs +208 -0
- package/bin/stats/conformance-outcomes.test.mjs +188 -0
- package/bin/stats/depth.mjs +218 -0
- package/bin/stats/depth.test.mjs +133 -0
- package/bin/stats/experiment.mjs +7 -5
- package/bin/stats/github-source.mjs +2 -2
- package/bin/stats/index.mjs +64 -2
- package/bin/stats/local-source.mjs +11 -0
- package/bin/stats/query.mjs +69 -0
- package/bin/stats/selffiled.mjs +52 -0
- package/bin/stats/selffiled.test.mjs +71 -0
- package/commands/orchestrate.md +1 -1
- package/commands/review-pr-agents/security.md +4 -0
- package/commands/review-pr-staging.md +2 -0
- package/commands/work-on/build.md +4 -6
- package/docs/CONFIG.md +66 -8
- package/docs/ISSUE-WATCH.md +2 -0
- package/docs/OUTCOME-CODES.md +3 -0
- package/docs/STATS.md +44 -0
- package/docs/TELEMETRY.md +1 -1
- package/package.json +1 -1
- package/pool/README.md +1 -1
- package/pool/image/cs-cred +14 -1
- package/pool/install/install-agent.ps1 +6 -2
- package/scripts/backfill-finding-labels.mjs +50 -0
- package/scripts/backfill-finding-labels.test.mjs +36 -0
- package/scripts/doctor-pipeline-state.sh +21 -6
- package/scripts/file-deferred-followups.sh +60 -238
- package/scripts/file-deferred-followups.test.sh +99 -187
- package/scripts/followup-route.mjs +12 -0
- package/scripts/hotspots.sh +12 -8
- package/scripts/hotspots.test.sh +22 -0
- package/scripts/owner-route-parity.test.sh +17 -1
- package/scripts/prior-attempts.test.mjs +1 -1
- package/scripts/review-pr-side-effects.test.sh +40 -0
package/bin/stats/query.mjs
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* run_terminal: reason, pr, milestone, conformance_mode, shadow_would
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { listBatches } from "../lean/batch.mjs";
|
|
14
|
+
|
|
11
15
|
const list = (v) => (typeof v === "string" && v !== "none" ? v.split(",").filter(Boolean) : []);
|
|
12
16
|
const day = (ts) => (typeof ts === "string" ? ts.slice(0, 10) : "unknown");
|
|
13
17
|
|
|
@@ -275,3 +279,68 @@ export function renderLaneProfiles(rep) {
|
|
|
275
279
|
+ `| Profile | Runs | Conformance rate (reviewed) | Shadow would-block |\n| --- | --- | --- | --- |\n${conf.length ? conf.join("\n") : "| none | 0 | | |"}\n\n`
|
|
276
280
|
+ `Issues with a finished run under every profile: ${rep?.issues_in_all?.length ? rep.issues_in_all.map((i) => `#${i}`).join(", ") : "none"}`;
|
|
277
281
|
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* #5210: the last conformance verdict of each lane PR, for `forgedock stats --conformance-outcomes`. Sources, latest wins:
|
|
285
|
+
* FORGE:TELEMETRY `run_terminal` (pr, conformance_mode, shadow_would) plus the issue's last `conformance_shadow` failures;
|
|
286
|
+
* local run-log summaries (local-source summariseLog: pr, conformanceMode, shadowWould, conformanceFailures);
|
|
287
|
+
* batch report rows (`conformance: {mode, would, kinds}`, written by orchestrate from the lane result).
|
|
288
|
+
* would "conforms" is conforming, any other would is nonconforming (its failure codes are the kinds); an enforce merge with
|
|
289
|
+
* no would passed the enforced gate, so it conforms. A shadow run with no would never reached the gate: no verdict.
|
|
290
|
+
* Returns a Map keyed `pr:<n>` and `issue:<n>` of {issue, pr, mode, state, kinds, ts, source}.
|
|
291
|
+
*/
|
|
292
|
+
const codes = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === "string" && x) : list(v));
|
|
293
|
+
export function verdictOf({ mode, would, merged, failures }) {
|
|
294
|
+
const m = mode === "enforce" || mode === "shadow" ? mode : null;
|
|
295
|
+
if (typeof would === "string" && would) return { mode: m, state: would === "conforms" ? "conforms" : "nonconforming", kinds: would === "conforms" ? [] : [...new Set(codes(failures))].sort() };
|
|
296
|
+
if (m === "enforce" && merged) return { mode: m, state: "conforms", kinds: [] };
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
export function conformanceVerdicts({ records = [], runs = [], batchRows = [] } = {}) {
|
|
300
|
+
const out = new Map();
|
|
301
|
+
const put = (v) => {
|
|
302
|
+
if (!v) return;
|
|
303
|
+
for (const k of [v.pr != null ? `pr:${v.pr}` : null, v.issue != null ? `issue:${v.issue}` : null]) {
|
|
304
|
+
if (!k) continue;
|
|
305
|
+
const cur = out.get(k);
|
|
306
|
+
if (!cur || String(v.ts ?? "") >= String(cur.ts ?? "")) out.set(k, v);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const int = (x) => (Number.isSafeInteger(Number(x)) && Number(x) > 0 ? Number(x) : null);
|
|
310
|
+
for (const row of batchRows) {
|
|
311
|
+
const c = row?.conformance;
|
|
312
|
+
if (!c || typeof c !== "object") continue;
|
|
313
|
+
const v = verdictOf({ mode: c.mode, would: c.would, merged: row.outcome === "merged", failures: c.kinds });
|
|
314
|
+
if (v) put({ issue: int(row.issue), pr: int(row.pr), ...v, ts: row.ts ?? row.created ?? "", source: "batch" });
|
|
315
|
+
}
|
|
316
|
+
for (const r of runs) {
|
|
317
|
+
if (!r?.finished) continue;
|
|
318
|
+
const v = verdictOf({ mode: r.conformanceMode, would: r.shadowWould, merged: r.reason === "merged", failures: r.conformanceFailures });
|
|
319
|
+
if (v) put({ issue: int(r.issue), pr: int(r.pr), ...v, ts: r.endTs ?? "", source: "local" });
|
|
320
|
+
}
|
|
321
|
+
const shadows = new Map();
|
|
322
|
+
for (const r of records) {
|
|
323
|
+
if (r?.event !== "conformance_shadow" || r.issue == null) continue;
|
|
324
|
+
const cur = shadows.get(r.issue);
|
|
325
|
+
if (!cur || String(r.ts ?? "") >= String(cur.ts ?? "")) shadows.set(r.issue, r);
|
|
326
|
+
}
|
|
327
|
+
for (const r of records) {
|
|
328
|
+
if (r?.event !== "run_terminal") continue;
|
|
329
|
+
const sh = shadows.get(r.issue);
|
|
330
|
+
const v = verdictOf({ mode: r.conformance_mode, would: r.shadow_would, merged: r.reason === "merged", failures: sh && String(sh.ts ?? "") <= String(r.ts ?? "") ? sh.failures : null });
|
|
331
|
+
if (v) put({ issue: int(r.issue), pr: int(r.pr), ...v, ts: r.ts ?? "", source: "github" });
|
|
332
|
+
}
|
|
333
|
+
return out;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** #5210: report.json rows of the repo's local batches, each stamped with its batch's plan.created as `ts` (no network). */
|
|
337
|
+
export function readBatchRows({ batchRoot, repo = null } = {}) {
|
|
338
|
+
const readJson = (f) => { try { return JSON.parse(readFileSync(f, "utf8")); } catch { return null; } };
|
|
339
|
+
const rows = [];
|
|
340
|
+
for (const id of batchRoot && existsSync(batchRoot) ? listBatches(batchRoot) : []) {
|
|
341
|
+
const dir = join(batchRoot, id), plan = readJson(join(dir, "plan.json")) ?? {};
|
|
342
|
+
if (repo && plan.repo && String(plan.repo).toLowerCase() !== String(repo).toLowerCase()) continue;
|
|
343
|
+
for (const row of readJson(join(dir, "report.json"))?.rows ?? []) if (row && typeof row === "object") rows.push({ ...row, ts: typeof plan.created === "string" ? plan.created : "" });
|
|
344
|
+
}
|
|
345
|
+
return rows;
|
|
346
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
/**
|
|
4
|
+
* forgedock stats --self-filed (#5207): the share of new issues the pipeline filed itself, by kind, against a 15% target.
|
|
5
|
+
* The kind comes from the deterministic markers and labels the pipeline writes (scripts/file-deferred-followups.sh,
|
|
6
|
+
* scripts/review-finalize.sh, bin/review-staging.mjs), never from the author: lane-created issues share the bot author.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const SELF_FILED_KINDS = Object.freeze(["follow-up", "review-finding", "staging-review", "rollup"]);
|
|
10
|
+
export const SELF_FILED_TARGET = 0.15;
|
|
11
|
+
const ROLLUP_RE = /FORGE:(POSTDEPLOY_ROLLUP|EXTERNAL_BATCH|BACKLOG_BATCH|HOST_BATCH):/;
|
|
12
|
+
const labelNames = (issue) => (issue?.labels ?? []).map((l) => (typeof l === "string" ? l : l?.name)).filter(Boolean);
|
|
13
|
+
|
|
14
|
+
/** The pipeline-filed kind of one issue (precedence rollup, follow-up, staging-review, review-finding), else null. */
|
|
15
|
+
export function selfFiledKind(issue) {
|
|
16
|
+
const body = String(issue?.body ?? ""), title = String(issue?.title ?? "");
|
|
17
|
+
if (ROLLUP_RE.test(body)) return "rollup";
|
|
18
|
+
if (body.includes("FORGE:DEFERRED_FROM") || /^follow-up:/i.test(title)) return "follow-up";
|
|
19
|
+
const labels = labelNames(issue);
|
|
20
|
+
if (labels.includes("staging-review")) return "staging-review";
|
|
21
|
+
if (labels.includes("review-finding")) return "review-finding";
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** {repo, since, total, pipeline, share, by_kind, target, met}; share is null when no issue was opened in the window. */
|
|
26
|
+
export function selfFiledReport({ issues, since = null, repo = null }) {
|
|
27
|
+
const sinceMs = since ? Date.parse(since) : NaN;
|
|
28
|
+
const inWindow = (issues ?? []).filter((i) => Number.isNaN(sinceMs) || !i?.createdAt || Date.parse(i.createdAt) >= sinceMs);
|
|
29
|
+
const by_kind = Object.fromEntries(SELF_FILED_KINDS.map((k) => [k, 0]));
|
|
30
|
+
for (const i of inWindow) { const k = selfFiledKind(i); if (k) by_kind[k]++; }
|
|
31
|
+
const total = inWindow.length, pipeline = Object.values(by_kind).reduce((a, b) => a + b, 0);
|
|
32
|
+
const share = total ? pipeline / total : null;
|
|
33
|
+
return { repo, since, total, pipeline, share, by_kind, target: SELF_FILED_TARGET, met: share == null ? null : share < SELF_FILED_TARGET };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The issues created on/after `since` (YYYY-MM-DD). gh: async (args) => stdout. Unreadable output throws (never a silent 0%). */
|
|
37
|
+
export async function gatherIssues({ gh, repo, since }) {
|
|
38
|
+
const out = await gh(["issue", "list", "-R", repo, "--state", "all", "--search", `created:>=${since}`, "--limit", "1000", "--json", "number,title,body,labels,createdAt"]);
|
|
39
|
+
let issues;
|
|
40
|
+
try { issues = JSON.parse(String(out ?? "")); } catch { throw new Error(`self-filed: unreadable gh issue list output for ${repo}`); }
|
|
41
|
+
if (!Array.isArray(issues)) throw new Error(`self-filed: gh issue list for ${repo} did not return a list`);
|
|
42
|
+
return issues;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const pct = (x) => (x == null ? "n/a" : `${(x * 100).toFixed(1)}%`);
|
|
46
|
+
/** One line per kind plus the total share against the target. */
|
|
47
|
+
export function renderSelfFiled(r) {
|
|
48
|
+
const lines = [`self-filed issues, ${r.repo ?? "?"} since ${r.since ?? "?"}: ${r.total} new issue${r.total === 1 ? "" : "s"}`];
|
|
49
|
+
for (const k of SELF_FILED_KINDS) lines.push(` ${k.padEnd(15)} ${String(r.by_kind[k]).padStart(5)} ${pct(r.total ? r.by_kind[k] / r.total : null)}`);
|
|
50
|
+
lines.push(` ${"total".padEnd(15)} ${String(r.pipeline).padStart(5)} ${pct(r.share)} (target < ${pct(r.target)}: ${r.met == null ? "n/a" : r.met ? "met" : "not met"})`);
|
|
51
|
+
return lines.join("\n");
|
|
52
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { selfFiledKind, selfFiledReport, gatherIssues, renderSelfFiled, SELF_FILED_KINDS, SELF_FILED_TARGET } from "./selffiled.mjs";
|
|
6
|
+
import { buildReport, parseArgs, runStats } from "./index.mjs";
|
|
7
|
+
|
|
8
|
+
const iss = (n, extra = {}) => ({ number: n, title: `issue ${n}`, body: "", labels: [], createdAt: "2026-11-01T00:00:00Z", ...extra });
|
|
9
|
+
const ISSUES = [
|
|
10
|
+
iss(1, { body: "x\n<!-- FORGE:POSTDEPLOY_ROLLUP: default -->\n### #4\n<!-- FORGE:DEFERRED_FROM: #4 -->" }), // rollup wins over follow-up
|
|
11
|
+
iss(2, { body: "<!-- FORGE:EXTERNAL_BATCH: b1 -->" }),
|
|
12
|
+
iss(3, { body: "<!-- FORGE:HOST_BATCH: b1 -->" }),
|
|
13
|
+
iss(4, { body: "<!-- FORGE:BACKLOG_BATCH: b0 -->" }),
|
|
14
|
+
iss(5, { body: "<!-- FORGE:DEFERRED_FROM: #9 -->", labels: [{ name: "review-finding" }] }), // follow-up wins over the label
|
|
15
|
+
iss(6, { title: "follow-up: 3 deferred item(s) from #9" }),
|
|
16
|
+
iss(7, { labels: [{ name: "staging-review" }, { name: "review-finding" }] }),
|
|
17
|
+
iss(8, { labels: ["review-finding"] }),
|
|
18
|
+
...Array.from({ length: 12 }, (_, i) => iss(100 + i, { labels: [{ name: "bug" }] })),
|
|
19
|
+
iss(200, { createdAt: "2026-09-01T00:00:00Z", body: "<!-- FORGE:EXTERNAL_BATCH: old -->" }), // outside the window
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
describe("stats --self-filed (#5207)", () => {
|
|
23
|
+
it("classifies by precedence rollup, follow-up, staging-review, review-finding, else null", () => {
|
|
24
|
+
assert.deepEqual(ISSUES.slice(0, 8).map(selfFiledKind), ["rollup", "rollup", "rollup", "rollup", "follow-up", "follow-up", "staging-review", "review-finding"]);
|
|
25
|
+
assert.equal(selfFiledKind(iss(9, { labels: [{ name: "bug" }] })), null);
|
|
26
|
+
assert.equal(selfFiledKind({}), null);
|
|
27
|
+
});
|
|
28
|
+
it("reports the share by kind against the 15% target", () => {
|
|
29
|
+
const r = selfFiledReport({ issues: ISSUES, since: "2026-10-08", repo: "o/r" });
|
|
30
|
+
assert.deepEqual(r.by_kind, { "follow-up": 2, "review-finding": 1, "staging-review": 1, rollup: 4 });
|
|
31
|
+
assert.equal(r.total, 20); assert.equal(r.pipeline, 8); assert.equal(r.share, 0.4);
|
|
32
|
+
assert.equal(r.target, SELF_FILED_TARGET); assert.equal(r.met, false);
|
|
33
|
+
assert.equal(selfFiledReport({ issues: ISSUES.slice(8, 20).concat(ISSUES[7]), since: "2026-10-08" }).met, true);
|
|
34
|
+
const none = selfFiledReport({ issues: [], since: "2026-10-08" });
|
|
35
|
+
assert.equal(none.share, null); assert.equal(none.met, null);
|
|
36
|
+
const out = renderSelfFiled(r);
|
|
37
|
+
for (const k of SELF_FILED_KINDS) assert.match(out, new RegExp(`^ ${k} +\\d+ `, "m"));
|
|
38
|
+
assert.match(out, /total +8 +40\.0% \(target < 15\.0%: not met\)/);
|
|
39
|
+
});
|
|
40
|
+
it("gatherIssues lists every state since the date; unreadable output is an error, never 0%", async () => {
|
|
41
|
+
const calls = [];
|
|
42
|
+
const gh = async (a) => { calls.push(a); return JSON.stringify(ISSUES); };
|
|
43
|
+
assert.equal((await gatherIssues({ gh, repo: "o/r", since: "2026-10-08" })).length, ISSUES.length);
|
|
44
|
+
assert.deepEqual(calls[0], ["issue", "list", "-R", "o/r", "--state", "all", "--search", "created:>=2026-10-08", "--limit", "1000", "--json", "number,title,body,labels,createdAt"]);
|
|
45
|
+
await assert.rejects(gatherIssues({ gh: async () => "rate limited", repo: "o/r", since: "2026-10-08" }), /unreadable/);
|
|
46
|
+
await assert.rejects(gatherIssues({ gh: async () => "{}", repo: "o/r", since: "2026-10-08" }), /did not return a list/);
|
|
47
|
+
});
|
|
48
|
+
it("wires --self-filed through parseArgs and buildReport (default window: 30 days)", async () => {
|
|
49
|
+
assert.equal(parseArgs(["--self-filed"]).selfFiled, true); assert.equal(parseArgs([]).selfFiled, false);
|
|
50
|
+
let seen;
|
|
51
|
+
const gh = async (a) => { seen = a; return JSON.stringify(ISSUES); };
|
|
52
|
+
const r = await buildReport({ ...parseArgs(["--self-filed"]), repo: "o/r" }, { gh, now: () => Date.parse("2026-11-07T00:00:00Z") });
|
|
53
|
+
assert.equal(seen[seen.indexOf("--search") + 1], "created:>=2026-10-08");
|
|
54
|
+
assert.equal(r.query.self_filed.pipeline, 8);
|
|
55
|
+
const d = await buildReport({ ...parseArgs(["--self-filed", "--since", "2026-11-02"]), repo: "o/r" }, { gh });
|
|
56
|
+
assert.equal(d.query.self_filed.since, "2026-11-02"); assert.equal(d.query.self_filed.total, 0);
|
|
57
|
+
await assert.rejects(buildReport({ ...parseArgs(["--self-filed", "--since", "1.2.0"]), repo: "o/r" }, { gh }), /must be a date/);
|
|
58
|
+
});
|
|
59
|
+
it("runStats prints the report, or exits 1 on unreadable gh output", async () => {
|
|
60
|
+
const write = process.stdout.write, err = process.stderr.write; let out = "";
|
|
61
|
+
process.stdout.write = (t) => { out += t; return true; }; process.stderr.write = () => true;
|
|
62
|
+
try {
|
|
63
|
+
assert.equal(await runStats(["--self-filed", "--repo", "o/r", "--since", "2026-10-08"], { gh: async () => JSON.stringify(ISSUES) }), 0);
|
|
64
|
+
assert.match(out, /self-filed issues, o\/r since 2026-10-08: 20 new issues/);
|
|
65
|
+
out = "";
|
|
66
|
+
assert.equal(await runStats(["--self-filed", "--repo", "o/r", "--json"], { gh: async () => JSON.stringify(ISSUES) }), 0);
|
|
67
|
+
assert.equal(JSON.parse(out).query.self_filed.target, 0.15);
|
|
68
|
+
assert.equal(await runStats(["--self-filed", "--repo", "o/r"], { gh: async () => "not json" }), 1);
|
|
69
|
+
} finally { process.stdout.write = write; process.stderr.write = err; }
|
|
70
|
+
});
|
|
71
|
+
});
|
package/commands/orchestrate.md
CHANGED
|
@@ -105,7 +105,7 @@ remaining maintenance once no feature is pending; otherwise the rest ends `held
|
|
|
105
105
|
`forgedock orchestrate --add <id> N...` (or `--resume <id> N...`), under its K and DAG; never start a second batch
|
|
106
106
|
for them. After a decision (a `FORGE:DECISION` posted and `needs-human` removed), a blocked issue that already ended in the batch
|
|
107
107
|
(`needs-human`, `invalid`, `skipped`, `dependency-*`, `ci-pending`, `deferred`) returns to it with
|
|
108
|
-
`forgedock orchestrate --requeue <id> N... --reason "..."` (refused while it is labelled `needs-human` or closed; skipped dependents
|
|
108
|
+
`forgedock orchestrate --requeue <id> N... --reason "..."` (it also releases an issue shown as `paused (quota) until <ISO>`) (refused while it is labelled `needs-human` or closed; skipped dependents
|
|
109
109
|
return to pending with it; a finished batch is reopened); `--add` on a `skipped` issue re-queues it (other ended issues still report `already in batch`). A dependency-skipped issue shows as `waiting on #X` while the batch runs (the blocker is re-checked each pass; merged or closed re-admits it, closed as not planned keeps it skipped) and ends `skipped` only if the blocker never resolved. Its pre-filter still closes already-fixed ones. The runner requeues `deferred` lanes by code (host busy and a full sandbox pool after their
|
|
110
110
|
retry-in, uncapped, a usage limit holds admissions for that account (backend identity) until the reset, never capped, across every batch on
|
|
111
111
|
the host; `forgedock limits show|clear <id>|--all` lists or drops holds; transient merge/push/idle failures back off; other
|
|
@@ -241,6 +241,9 @@ For each named volume found: determine its container mount point. Named volumes
|
|
|
241
241
|
**Severity**: HIGH — filesystem writes fail silently at runtime with `PermissionError`; no startup crash, so the failure only surfaces when the code path executes.
|
|
242
242
|
**Evidence**: When a container's runtime user changes from root to a non-root UID, Docker named volumes retain their existing ownership (root:root). Any code path that writes to a path under a named volume mount point will fail with `[Errno 13] Permission denied`. The fix is to add `chown -R <user>:<group> <mount_point>` to the entrypoint script before the privilege-drop `exec` call. <!-- Added: forge#323 -->
|
|
243
243
|
|
|
244
|
+
### Step 2.10: Production side effects × frequency
|
|
245
|
+
If the diff adds or changes code that creates, mutates, deletes or sends production resources (accounts, payments, emails, DNS, side-effecting external calls) and it runs from a loop, cron, `schedule:`, probe/monitor or retry, state: (a) runs/day derived from the schedule; (b) downstream effects (metrics, emails, credits, billing); (c) idempotent or rate-bounded? Per-cycle or unbounded without explicit justification, or cleanup that leaves downstream effects: CONFIRMED HIGH, blocking.
|
|
246
|
+
|
|
244
247
|
## Step 3: Code Quality Scan
|
|
245
248
|
1. **Error handling**: Exceptions swallowed silently, generic except clauses
|
|
246
249
|
2. **Resource leaks**: Unclosed connections, files, async tasks not awaited
|
|
@@ -392,6 +395,7 @@ EOF
|
|
|
392
395
|
| XSS | Step 2.6 | COVERED | |
|
|
393
396
|
| Token privilege confusion | Step 2.7 | COVERED | |
|
|
394
397
|
| Unbounded resource consumption | Step 2.8 | COVERED | |
|
|
398
|
+
| Per-cycle production side effects | Step 2.10 | COVERED | #5238 |
|
|
395
399
|
| API information disclosure | Step 2.9 (a/b/c) | COVERED | #302 |
|
|
396
400
|
| Port bind address exposure | Step 2.5A | COVERED | #296 |
|
|
397
401
|
| Missing container USER directive | Step 2.5B | COVERED | #296 |
|
|
@@ -10,6 +10,8 @@ install: core
|
|
|
10
10
|
|
|
11
11
|
# Staging Review
|
|
12
12
|
|
|
13
|
+
> **Default path:** `forgedock release [--repo R] [--merge] [--resume <id>]` runs the whole staging→default release (PR, review panel, findings, gate, promotion, post-merge) as one resumable job; issue-watch `mode: release` starts it for the deploy PR it opens. This spec is the manual fallback when the job is unavailable or you need to drive a step by hand.
|
|
14
|
+
|
|
13
15
|
> **Skill names**: `{FORGE_SKILL_PREFIX}` is `forgedock:` (plugin install) or empty (`install.sh`), resolved once per run by `commands/work-on.md` § Skill Name Resolution. If the skill is not found under either name, STOP and report "skill not found" — never run the phase inline.
|
|
14
16
|
|
|
15
17
|
**Trigger**: Invoked by the orchestrator via `Skill("{FORGE_SKILL_PREFIX}review-pr-staging", $ARGUMENTS)`, or directly with `$ARGUMENTS` = "staging", a PR number targeting main, or "staging:feature".
|
|
@@ -376,7 +376,7 @@ Every item in the contract's `### Out of Scope` section must carry exactly one d
|
|
|
376
376
|
- **Known-flaw rule**: a contract that keeps a known-flawed design (a design the investigation or architect plan identified as flawed, a fail-open caller, an unsound threshold) must state the flaw and list it as a `deferred → #N` item with a linked follow-up. It may not hide behind `accepted-risk` or free text.
|
|
377
377
|
- Free-text exclusions without a disposition are invalid. `->` is accepted for `→`.
|
|
378
378
|
|
|
379
|
-
**Fold, then batch** <!-- Added: forge#3843 -->: before filing anything, fold small siblings into scope. A candidate deferred item that is the same mechanical change at a sibling path and fits the remaining scope budget (a small fraction of the plan's own estimate: at most 20% of the current `ESTIMATED_DIFF_LINES`, or 200 lines when no estimate exists) goes into the contract's Deliverables, not Out of Scope; count it as `folded`. Defer only genuinely separate work (different module, design or owner).
|
|
379
|
+
**Fold, then batch** <!-- Added: forge#3843 -->: before filing anything, fold small siblings into scope. A candidate deferred item that is the same mechanical change at a sibling path and fits the remaining scope budget (a small fraction of the plan's own estimate: at most 20% of the current `ESTIMATED_DIFF_LINES`, or 200 lines when no estimate exists) goes into the contract's Deliverables, not Out of Scope; count it as `folded`. Defer only genuinely separate work (different module, design or owner). Engineering items are never filed (#5207): fold them into scope, or list them in the PR body under Out of scope. Only `post-deploy:`/`external:`/`ops:`/`host:` items are piped to `scripts/file-deferred-followups.sh`, which appends them to the aggregates (the release rollup, the batch external aggregate, the batch host aggregate), never a per-parent issue; an engineering row exits 2.
|
|
380
380
|
|
|
381
381
|
**File the `deferred` follow-ups** (skip the filing on resume when the contract already exists):
|
|
382
382
|
|
|
@@ -384,7 +384,7 @@ Every item in the contract's `### Out of Scope` section must carry exactly one d
|
|
|
384
384
|
# <Script resolution block from work-on/build.md, verbatim>
|
|
385
385
|
# DEFERRED_TSV: one line per remaining deferred item: path-or-`-`<TAB>one-line why<TAB>known-flaw (or empty)[<TAB>class<TAB>label]
|
|
386
386
|
# Column 1 must be a path or `-` (never requirement text or an `R<n>:` prefix: that exits 2, nothing filed); a requirement-level item
|
|
387
|
-
# is `-` with its text in the label column. class:
|
|
387
|
+
# is `-` with its text in the label column. class: post-deploy|external|ops|host (default: the why's prefix; none = engineering, rejected).
|
|
388
388
|
SCRIPT_REF=$(resolve_script 'file-deferred-followups')
|
|
389
389
|
case "$SCRIPT_REF" in
|
|
390
390
|
prose:*) echo "DEFERRED_SCRIPT=PROSE" ;; # file ONE issue by hand: marker + checklist of every path (see below)
|
|
@@ -695,7 +695,6 @@ if [ -n "$JUSTIFICATION" ]; then echo "OVERRIDE=VALID"; else echo "OVERRIDE=NONE
|
|
|
695
695
|
# <Script resolution block from above goes here, verbatim>
|
|
696
696
|
MB=$(git -C "{WORKTREE_PATH}" merge-base HEAD "origin/{PR_BASE}") || { echo "TRIM=FAILED"; exit 0; }
|
|
697
697
|
PATCH_PATH="$(git -C "{WORKTREE_PATH}" rev-parse --git-common-dir)/forge-trimmed-{NUMBER}.patch"
|
|
698
|
-
DEFERRED_TSV=""
|
|
699
698
|
# OOP_PATHS: the out_of_plan= values, one per line (data, never evaluated)
|
|
700
699
|
while IFS= read -r _p; do
|
|
701
700
|
[ -n "$_p" ] || continue
|
|
@@ -705,12 +704,11 @@ while IFS= read -r _p; do
|
|
|
705
704
|
else
|
|
706
705
|
git -C "{WORKTREE_PATH}" rm -q -f --cached -- "$_p" && rm -f -- "{WORKTREE_PATH}/$_p" || { echo "TRIM=FAILED"; exit 0; }
|
|
707
706
|
fi
|
|
708
|
-
DEFERRED_TSV="${DEFERRED_TSV}${_p}"$'\t'"out-of-plan hunks trimmed from #{NUMBER}; saved in ${PATCH_PATH}"$'\t'$'\n'
|
|
709
707
|
done <<< "$OOP_PATHS"
|
|
710
|
-
|
|
708
|
+
echo "TRIMMED_PATCH=${PATCH_PATH}"
|
|
711
709
|
```
|
|
712
710
|
|
|
713
|
-
`
|
|
711
|
+
The trimmed paths and `TRIMMED_PATCH` go into the PR body under Out of scope, never into a follow-up issue (#5207). `TRIM=FAILED` → do not trim further; keep whatever state is staged, fall back to the flag outcome (`SCOPE_FLAGGED`, nothing lost), and say so in the comment. After a successful trim re-run Step 2 once so `FORGE:DIFF_SIZE` records the trimmed numbers, set `trimmed: <N> file(s) -> <patch path>` and result `SCOPE_FLAGGED`.
|
|
714
712
|
|
|
715
713
|
**Step 5 — record.** Set `DIFF_LINES`, `EXCLUDED_LINES`, `WS_LINES`, `REVIEW_WEIGHT`, `MODULES`, `ESTIMATE`, `SCOPE`, `REVIEW_DEPTH` and `RESULT` from the steps above, then post one `<!-- FORGE:DIFF_SIZE -->` comment, idempotently: find the latest trusted comment starting with the marker and edit it, otherwise create it (on resume never stack duplicates; readers use the latest trusted one). `diff_lines` stays the first field close.md and the protocol read:
|
|
716
714
|
|
package/docs/CONFIG.md
CHANGED
|
@@ -643,7 +643,7 @@ engine:
|
|
|
643
643
|
| `cli_max_minutes` | number | No | Absolute ceiling for a core builder session (code `cli.timeout`), replacing the fixed 60-minute kill. A session that keeps making progress is never idle-killed. Default 180. On either kill, uncommitted work is committed as `wip(forge): checkpoint after <reason>` and the lane branch is pushed (with the push retry), the builder retries once from the checkpoint, and a second kill ends `deferred`; a rerun resumes from the branch. |
|
|
644
644
|
| `turn_budget_s` / `turn_budget_m` / `turn_budget_l` | number | No | Core implement turn budget per lane size (#4392). Size comes from a `size:S|M|L` issue label, else the frozen contract's distinct deliverable paths (S ≤ 2, M ≤ 5, else L). The build call and its context/timeout restarts share the budget; at the limit the session is stopped, checkpointed, and one fresh wrap-up session of max(5, budget/5) turns either finishes or writes `status: budget-exceeded` with a digest. A stop or overrun ends with the non-human `budget-exceeded` reason and code `budget.exceeded` (no `needs-human` label, forge#4505), which `forgedock orchestrate` recovers once (continue from the checkpoint or split); a batch that does not recover it labels it `needs-human` once. Lane results carry `turns: {size, budget, build, total, exceeded}`, and the batch report prints `turns by size`. Defaults 25 / 60 / 100; 0 disables that size. An L lane's budget scales with the contract: +10 turns per distinct deliverable path above 5 (capped at +2x `turn_budget_l`), and a `budget.exceeded` recovery of an L lane gets a further +50% of `turn_budget_l` (#4587). |
|
|
645
645
|
| `lane_limits` | map | No | Cap each core lane's whole process tree (#4115, #4690), under `pipeline:` or `engine:`: `tasks_max` (default `1024`; `0`/`off` disables), `memory_max` (for example `3G`) and `cpu_quota` (for example `150%`). Where `systemd-run --user --scope` works (probed once) every lane's builder CLI is spawned as `systemd-run --user --scope -q --unit=forgedock-lane-... -p TasksMax=... -p MemoryMax=... -p CPUQuota=... -- claude ...` by default. `memory_max` has no default: lanes get no `MemoryMax` unless it is set (`off` also disables; #4740). A lane that hits `TasksMax` or `MemoryMax` is stopped and ends `needs-human` with `env.lane_limit` (not an engine-error, so the breaker ignores it). Where scopes are unavailable the run logs one line saying lanes are uncapped and the limits are ignored. Write it nested or flat (`lane_limits_tasks_max`, `lane_limits_memory_max`, `lane_limits_cpu_quota`). While a builder runs the engine polls host load and memory every 15 s against the `admission` thresholds: over them it SIGSTOPs the lane's process group, under them SIGCONT, and never pauses longer than 10 minutes. |
|
|
646
|
-
| `admission` | map | No | Host-resource admission for the core work-on (#4105), checked before the lease, worktree or any GitHub call. When a check fails the run ends `deferred` (code `host.busy`, exit 75) with a last line such as `issue #N → deferred (host busy: mem 1.2G < 2G; retry in 60s)`; no lease is taken and nothing is posted. Keys: `enabled` (default `true`; `false` disables admission), `min_free_mem_mb` (default 2048; `MemAvailable` from `/proc/meminfo`, else `os.freemem()`), `min_free_tmp_mb` (default 1024; free space of the run TMPDIR filesystem, `~/.forge/tmp`, and of `/tmp`, via `statfs`), `max_load_per_core` (default 4; 1-minute load average divided by cores), `lane_cpu_reservation` (default 1) and `lane_mem_mb` (default 2048). The last two feed the live local lane cap (#4777), on by default: `min(--parallel / global_parallel, max(1, min(floor(cores / lane_cpu_reservation), floor((MemAvailable - min_free_mem_mb) / lane_mem_mb))))`, re-probed at every admission attempt, so `--parallel 12` on a 4-core / 8 GB host runs fewer concurrent local lanes. Remote sandbox lanes are exempt; `enabled: false` removes the cap. The cap reads the `forge.yaml` of the batch's repo, also when the batch runs under the schedd daemon. Write it nested (`engine:` then `admission:` with the keys indented) or flat as `admission_enabled`, `admission_min_free_mem_mb`, `admission_min_free_tmp_mb`, `admission_max_load_per_core`, `admission_lane_cpu_reservation`, `admission_lane_mem_mb`; the parser reads one nested level into `engine`. `/orchestrate` requeues a host-busy lane and lowers K by 1 for 5 minutes. |
|
|
646
|
+
| `admission` | map | No | Host-resource admission for the core work-on (#4105), checked before the lease, worktree or any GitHub call. When a check fails the run ends `deferred` (code `host.busy`, exit 75) with a last line such as `issue #N → deferred (host busy: mem 1.2G < 2G; retry in 60s)`; no lease is taken and nothing is posted. Keys: `enabled` (default `true`; `false` disables admission), `min_free_mem_mb` (default 2048; `MemAvailable` from `/proc/meminfo`, else `os.freemem()`), `min_free_tmp_mb` (default 1024; free space of the run TMPDIR filesystem, `~/.forge/tmp`, and of `/tmp`, via `statfs`), `max_load_per_core` (default 4; 1-minute load average divided by cores), `lane_cpu_reservation` (default 1) and `lane_mem_mb` (default 2048). The last two feed the live local lane cap (#4777), on by default: `min(--parallel / global_parallel, max(1, min(floor(cores / lane_cpu_reservation), floor((MemAvailable - min_free_mem_mb) / lane_mem_mb))))`, re-probed at every admission attempt, so `--parallel 12` on a 4-core / 8 GB host runs fewer concurrent local lanes. Remote sandbox lanes are exempt; `enabled: false` removes the cap. The cap reads the `forge.yaml` of the batch's repo, also when the batch runs under the schedd daemon. Write it nested (`engine:` then `admission:` with the keys indented) or flat as `admission_enabled`, `admission_min_free_mem_mb`, `admission_min_free_tmp_mb`, `admission_max_load_per_core`, `admission_lane_cpu_reservation`, `admission_lane_mem_mb`; the parser reads one nested level into `engine`. `/orchestrate` requeues a host-busy lane and lowers K by 1 for 5 minutes. Host overload hold (#5174): `overload_load_per_core` (flat `admission_overload_load_per_core`; default 2, `0` disables) holds every new local lane admission of a host-wide batch while the 1-minute load average divided by cores is above it; the issue stays queued and is retried on the next poll, and remote sandbox placements are never held. While it holds, the batch log has one `host-overloaded` row per episode, and `forgedock status` (`host` row) and `forgedock schedd status` print `host_overloaded (load X.X/core > T): new local admissions held` (otherwise `load X.X/core (threshold T)`). Unlike `max_load_per_core` it never defers a running lane. The env `FORGEDOCK_OVERLOAD_LOAD_PER_CORE` (same values) overrides it for every batch on the host. Local heavy steps (the heavy-shim semaphore path) run at nice 10 and, on Linux with `ionice` on PATH, in the idle IO class, so test runners and installs do not starve the schedd daemon. |
|
|
647
647
|
| `merge_wait` | string | No | Core work-on merge gate. `required` (default): wait only for the status checks the base branch requires: the union of classic branch protection (`gh api repos/{o}/{r}/branches/{base}/protection/required_status_checks`, contexts and checks) and repository rulesets (`gh api repos/{o}/{r}/rules/branches/{base}`, `required_status_checks` rules); with neither (404 or empty) merge right after review PASS. A merge rejected by base branch policy (PR `MERGEABLE` but `BLOCKED`) is waited on and retried within the CI budget, then left `ci-pending`; it is never base-synced and never `base.conflict`. A failing required check is `needs-human`; a pending one is polled with backoff and never `needs-human`. `all`: wait for every check (`scripts/wait-ci-green.sh`). `none`: merge right after review. Always `--match-head-commit` at the reviewed head. The policy used is recorded in the `FORGE:WORK-ON` comment. |
|
|
648
648
|
| `context_pack` | string | No | Context pack (#4275). Before the plan call the core compiles the issue's GitHub/git neighbourhood into a small, budgeted pack: linked issues and PRs (parent, `Depends on`, body links, same-repo cross-references, siblings), prior attempts, merged PRs on the issue's files that were reverted or whose decisions/findings name a symbol from the issue, structured `FORGE:FACTS` records of earlier lanes on the issue's files (rejected approaches with why, hot spots, decisions, conventions, baselines; #4401), and repo-fact file pointers (found in the lane worktree or, for untracked caches, the main checkout; #4400). `shadow` (default): the pack is compiled, posted on the issue as a collapsed `FORGE:CONTEXT` comment and logged as a `CONTEXT_PACK` event; the builder prompt is unchanged. `on`: it is also appended to the plan prompt as hints. `off`: nothing is gathered, posted or logged. `ab` (#4444): the A/B experiment. Each issue gets a stable arm, `on` or `shadow`, from a hash of `repo#issue`, logged as that mode with `context_ab: true`; the default stays `shadow`. The pack never enters the text contract quotes are checked against. Values read from linked issues' `FORGE:STATE` are kept only when they are outcome codes. Compare with `forgedock stats --context-ab` (per lane type and mode: first-pass yield, turns and cache-read per merge, rework rate, and recovery lanes' implement attempt against the first run on the same issue). Unless `off`, a resumed or recovery lane also gets a bounded resume digest of its last run in the builder prompt (end reason, validate results per command, deliver requirements, files changed; logged as `RESUME_DIGEST`; #4400), whatever the mode. |
|
|
649
649
|
| `context_pack_sources` | string | No | Comma list of the pack sources to use: `graph`, `attempts`, `pitfalls`, `ledger`, `facts` (earlier lanes' `FORGE:FACTS` on the issue's files plus repo-fact file pointers). Default: all five. |
|
|
@@ -721,6 +721,38 @@ selftest:
|
|
|
721
721
|
|
|
722
722
|
---
|
|
723
723
|
|
|
724
|
+
## `release` (OPTIONAL)
|
|
725
|
+
|
|
726
|
+
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. `--watch` is accepted and has no effect until the review step lands.
|
|
727
|
+
|
|
728
|
+
```yaml
|
|
729
|
+
release:
|
|
730
|
+
auto_merge: false
|
|
731
|
+
artifact_check: ""
|
|
732
|
+
version_sync: false
|
|
733
|
+
publish_workflow: publish.yml
|
|
734
|
+
rehearsal_command: ""
|
|
735
|
+
rehearsal_timeout: 1200
|
|
736
|
+
rehearsal_blocking: true
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
The forge.yaml reader handles two levels, so the rehearsal block is written as the flat keys `rehearsal_command`, `rehearsal_timeout` and `rehearsal_blocking`.
|
|
740
|
+
|
|
741
|
+
| Key | Type | Required | Description |
|
|
742
|
+
|-----|------|----------|-------------|
|
|
743
|
+
| `auto_merge` | boolean | No | `true` merges the release PR with `--match-head-commit` once `FORGE:GATE_PASS` is posted and `forge/deploy-gate` is success, as `--merge` does. Default: `false` (the job stops at GATE_PASS and prints the merge command). |
|
|
744
|
+
| `artifact_check` | string | No | Shell command that confirms the published artifact (e.g. `npm view pkg@1.2.3 version`). Post-merge retries it with a bounded exponential backoff (npm propagation delay) and blocks when it keeps failing. Default: none. |
|
|
745
|
+
| `version_sync` | boolean | No | The repo pushes a `chore/sync-version-<VERSION>` branch after a release. Post-merge opens its PR to `branches.staging` if missing and merges it with `--match-head-commit` once its checks are green (no checks, or a red one, blocks the job). Default: `false`. |
|
|
746
|
+
| `publish_workflow` | string | No | Workflow file post-merge looks for (and dispatches when no run appears) for the merge commit. Default: `publish.yml`. |
|
|
747
|
+
|
|
748
|
+
| `rehearsal_command` | string | No | Shell command run on the host (not as Actions minutes) in the repo checkout, on the release-PR head after review and before promotion (#5253). Wire the project's deploy dry-run here: bundle build, env load and the trusted-runtime closure check, e.g. `rehearsal_command: ./scripts/deploy-dry-run.sh` where the script builds the release bundle, loads the production env file in check mode and verifies the trusted-runtime closure, exiting non-zero on the first failure. Unset: no rehearsal, release behavior is unchanged. |
|
|
749
|
+
| `rehearsal_timeout` | integer | No | Seconds before the command is killed (counts as a failure). Default: `1200`. |
|
|
750
|
+
| `rehearsal_blocking` | boolean | No | `true` (default): a failure files one `release-blocker` issue per release head (a re-run at the same head comments on it) with the output tail and the head SHA, and stops the job before promotion; fix it and `--resume <id>`. `false`: the failure is recorded and promotion goes on. |
|
|
751
|
+
|
|
752
|
+
The result (pass or fail, head SHA, blocker issue) is recorded in the release state (`steps.rehearsal`) and in a `FORGE:REHEARSAL` section of the release PR body next to the gate result.
|
|
753
|
+
|
|
754
|
+
**Commands that use this section**: `forgedock release`
|
|
755
|
+
|
|
724
756
|
## `issue_watch` (OPTIONAL)
|
|
725
757
|
|
|
726
758
|
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`.
|
|
@@ -775,11 +807,12 @@ Deferred follow-ups (`scripts/file-deferred-followups.sh`) are routed by kind (#
|
|
|
775
807
|
| Kind | Where it goes |
|
|
776
808
|
|---|---|
|
|
777
809
|
| Post-promotion, production-verify, rollout-promote (`post-deploy`, `owner:orchestrator`, `owner:promote:<flag>`, or an owner why such as "after release", "rollout", "purge") | A checklist line in the repo's ONE open post-deploy rollup (`FORGE:POSTDEPLOY_ROLLUP`, else the lowest open issue labelled `followups.rollup_issue_label`). Never a new issue when one is open. |
|
|
778
|
-
| Read-only production data or capture (bucket `host`, or an owner why naming obs-psql, a `*-monitor` or a read-only prod query) |
|
|
779
|
-
| Truly external (credentials, spend, an account, a third party, a customer) | ONE issue per batch (`FORGE:EXTERNAL_BATCH: <batch id>`) holding every item under a `### #<parent>` heading, labelled `followup:external`, `external-prerequisite` and `needs-human`. |
|
|
780
|
-
|
|
|
810
|
+
| Read-only production data or capture (bucket `host`, or an owner why naming obs-psql, a `*-monitor` or a read-only prod query) | ONE host aggregate per batch (`FORGE:HOST_BATCH: <batch id>`) holding every item under a `### #<parent>` heading. Labels `followup:host` and `host-task`, never `needs-human` (#5207). |
|
|
811
|
+
| Truly external, and `ops` (credentials, spend, an account, a third party, a customer) | ONE issue per batch (`FORGE:EXTERNAL_BATCH: <batch id>`) holding every item under a `### #<parent>` heading, labelled `followup:external`, `external-prerequisite` and `needs-human`. |
|
|
812
|
+
| `verify-now` | The release rollup, like `post-deploy` (#5207). |
|
|
813
|
+
| Engineering (bucket `new-issue`, class `engineering`, or no class) | Never filed (#5207): the conformance review rejects the deferral and the builder delivers it in the same lane; the script exits 2. No per-parent follow-up issue is filed for any class. |
|
|
781
814
|
|
|
782
|
-
Each issue carries the label `followup:<class>` and inherits the parent's milestone. A requirement may set an optional `class` in the contract. Otherwise `post-deploy` items are `post-deploy` and the rest `engineering
|
|
815
|
+
Each issue carries the label `followup:<class>` and inherits the parent's milestone. A requirement may set an optional `class` in the contract. Otherwise `post-deploy` items are `post-deploy` and the rest `engineering` (rejected). A parent milestone that has shipped (closed) is replaced by the next open milestone by due date, else `followups.default_milestone`. The batch report lists `follow-ups appended: #N (<class>: k item(s) from #a,#b)` per issue, not "issues filed".
|
|
783
816
|
|
|
784
817
|
```yaml
|
|
785
818
|
followups:
|
|
@@ -815,6 +848,29 @@ A post-deploy requirement carries a check id (`[check:<id>]` in the follow-up it
|
|
|
815
848
|
|
|
816
849
|
`pass` is `exit 0` (default) or a `/regex/flags` over the output; `timeout` is seconds. When the gate reports the follow-up ready, the check runs with no model call: pass closes the follow-up with a `FORGE:PROBE` record, fail reopens the parent with the output. An item with no check id, or an id the default branch does not define, gets the `awaiting-measurement` label and never a lane. A contract's check id must be on the default branch or added by the same PR.
|
|
817
850
|
|
|
851
|
+
### Experiment arm overrides (#5206)
|
|
852
|
+
|
|
853
|
+
An `experiment:` arm can carry config overrides that apply only to the lanes hashed to that arm, so one batch, one checkout and the normal issue flow run both arms. A key is `<arm>.<key>: <value>`, where `<arm>` is a declared arm:
|
|
854
|
+
|
|
855
|
+
```yaml
|
|
856
|
+
experiment:
|
|
857
|
+
id: explore-ab
|
|
858
|
+
arms: on,off
|
|
859
|
+
on.lean.explore: on
|
|
860
|
+
off.lean.explore: off
|
|
861
|
+
min_n: 20
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
| Override key | Values | Overrides |
|
|
865
|
+
|---|---|---|
|
|
866
|
+
| `lean.explore` | `on`, `off` | `lean.explore` |
|
|
867
|
+
| `lean.explore_model` | a model id | `lean.explore_model` |
|
|
868
|
+
| `lean.light_mode` | `off`, `shadow`, `on` | `lean.light_mode` |
|
|
869
|
+
| `context_pack` | `shadow`, `on`, `off` (not `ab`) | `engine.context_pack` |
|
|
870
|
+
| `review.verifier` | `off`, `shadow`, `enforce` | `review.verifier` |
|
|
871
|
+
|
|
872
|
+
Any other dotted key, a key for an undeclared arm, or an invalid value makes the whole `experiment:` declaration invalid. The experiment is then ignored, with the reason printed to stderr, and no override is ever partly applied. The lane applies its arm's overrides before it reads any of these settings. `RUN_TERMINAL` (and `phase_attempt` telemetry) records `arm_overrides`: the applied overrides as a sorted `key=value` list, or `none`. `forgedock stats --experiment <id>` adds an `applied` column per arm: the runs whose recorded overrides match the arm's. A count below `n` means the toggle did not apply on some runs.
|
|
873
|
+
|
|
818
874
|
Closing an experiment follow-up (#4634): add a check that runs `forgedock stats --experiment <id> --require-met` (exit 0 only when every target of the forge.yaml `experiment:` is met; n/a below min n is not met), and put `[check:<check id>]` in the follow-up item:
|
|
819
875
|
|
|
820
876
|
```json
|
|
@@ -876,9 +932,9 @@ lean:
|
|
|
876
932
|
| `repro_test` | string | No | `prefer` (default): on an issue labelled `bug` or `type:bug`, the plan step must freeze a `repro_test` in the contract (`{"path","id","command"}`) when the bug is testable. Before review, the engine runs `scripts/acceptance-red-green.sh` for that command on the host in every verify mode: one targeted test, red on the base (head's changed test files overlaid) and green on head. A test that ran but is not red on the base and green on head fails the precheck as `conformance.unimplemented` (it blocks in shadow too) and goes back to the builder for one in-session fix round. A head the harness could not run at all (timeout, missing runner or dependencies) ends `needs-human` with the recoverable code `env.repro_unrunnable`, not a builder round: the batch runner's recovery lane reruns it through the repo's own toolchain (see docs/OUTCOME-CODES.md). The harness runs with the lane env (`TMPDIR`, toolchain) and the workspace dependency trees, and a repro test file that is new on head is run against the base sources. A bug that is not testable (specs, docs, workflows, environment) records `"repro_test":"none"` with a one-line `repro_test_reason` and the lane continues as before. `off` gives exactly the previous contract and precheck. Each proof emits a `REPRO_RED_GREEN` run-log event (`base`, `head`) and adds a trajectory decision. |
|
|
877
933
|
| `precheck.max_minutes` | number | No | Total budget in minutes (1–120) of one round of pre-PR check commands (#4331). The flat form `lean.precheck_max_minutes` also works and wins. When unset, `verify.precheck_total_seconds` applies (default 600 s). Check commands run change-scoped (a learned command with a test-map entry runs only when its globs match the changed files; unmapped commands always run), concurrently up to the host worker cap under one heavy slot, each timed (`ms` in the `PRECHECK_COMMANDS` run-log event). Commands not started when the budget runs out are recorded `deferred-to-ci` (an anomaly, not a failure) and left to CI. |
|
|
878
934
|
| `fix_model` | string | No | Model of fresh fix-round sessions (#4363; `engine.lean_fix_model` is also read). Default: the reviewer model (`engine.lean_reviewer_model`, else Sonnet). Fix rounds for precheck, CI, docs, structure, enumerating-test and sequence-number failures, and conformance or review FAILs whose failures all cite a `file:line`, run in a fresh session (no resume of the builder's transcript) whose prompt carries only the round's failure output, the capped `git diff <base>...HEAD`, the frozen contract and the issue title and summary (under 60K characters). A fresh session that makes no commit gets one resume of the original builder session in the same round. Other rounds (block or contract corrections, CI unavailable, base-sync conflicts, failures without a file:line) resume the builder as before; round limits (`verify.max_rounds`, the one review retry) are unchanged. The run log's `PHASE_ATTEMPT_USAGE` records `mode: "fresh"\|"resume"` on each fix-round attempt. Plan and build sessions keep the builder model. |
|
|
879
|
-
| `builder_routing` | string | No | `on` (default) or `off` (#4394). After the contract is frozen, the lane is classed from its deliverable paths only: `risk` (any path with a built-in risk word such as auth, billing, payments, session, secret or migration, or matching a `review.risk_paths` glob), `docs-config-test` (every path is a test, doc or config file; lockfiles count as code), `small` (at most 2 non-test deliverables) or `large` (more, or none). `docs-config-test` and `small` build on the mid tier (`builder_mid_model`); `risk` and `large` build on the top model (`--model`, else the CLI default). The plan and contract-correction calls always run on the top model. A failed validate round on the mid tier (`precheck`, `ci_red`, `merge_ci`) escalates the lane once: that fix round and every later builder call, fresh fix sessions included, run on the top model. Escalation adds no round. Conformance or review fix rounds do not escalate and keep `fix_model`. `off` keeps every builder call on the top model, as before, and still records the class. The run log gets `BUILDER_ROUTE {mode, class, tier, model, risk}` and `BUILDER_ESCALATED {from, to, trigger}`, and `RUN_TERMINAL` gets `builder_tier`, `builder_class`, `builder_escalated` and `builder_model`. `forgedock stats --tiers` reports merge, conformance and post-merge-rework rates, first-pass yield and cost per tier (`mid`, `mid->top`, `top`) and class, from local run logs. Target-repo risk areas (for example detection code) belong in `review.risk_paths`. |
|
|
935
|
+
| `builder_routing` | string | No | `on` (default) or `off` (#4394). After the contract is frozen, the lane is classed from its deliverable paths only: `risk` (any path with a built-in risk word such as auth, billing, payments, session, secret or migration, or matching a `review.risk_paths` glob), `docs-config-test` (every path is a test, doc or config file; lockfiles count as code), `small` (at most 2 non-test deliverables) or `large` (more, or none). `docs-config-test` and `small` build on the mid tier (`builder_mid_model`); `risk` and `large` build on the top model (`--model`, else the CLI default). The plan and contract-correction calls always run on the top model. A failed validate round on the mid tier (`precheck`, `ci_red`, `merge_ci`) escalates the lane once: that fix round and every later builder call, fresh fix sessions included, run on the top model. Escalation adds no round. Conformance or review fix rounds do not escalate and keep `fix_model`. `off` keeps every builder call on the top model, as before, and still records the class. The run log gets `BUILDER_ROUTE {mode, class, tier, model, risk}` and `BUILDER_ESCALATED {from, to, trigger}`, and `RUN_TERMINAL` gets `builder_tier`, `builder_class`, `builder_escalated` and `builder_model`. `forgedock stats --tiers` reports merge, conformance and post-merge-rework rates, first-pass yield and cost per tier (`mid`, `mid->top`, `top`) and class, from local run logs. Target-repo risk areas (for example detection code) belong in `review.risk_paths`. A diff that relaxes a rule in a declared `review.risk_paths` path (a new accept/rescue/allow branch or a removed deny) must add a negative test (`conformance.unimplemented` `relaxation_untested` otherwise) and always gets the independent verifier, even with `review.verifier: off` (#5237). |
|
|
880
936
|
| `builder_mid_model` | string | No | Mid-tier builder model for `builder_routing` (#4394; `engine.lean_builder_mid_model` is also read). Default `claude-sonnet-5-5`. An invalid id is ignored. |
|
|
881
|
-
| `light.mode` | string | No | `off`, `shadow` (default) or `on` (#4448). `bin/lean/light.mjs` decides whether an issue qualifies for the light lane: a repro, steps to reproduce, expected or actual behaviour or a code block in the body; 1 to `max_files` predicted non-test files; no `size:M`/`size:L` label; no predicted path with a built-in risk word or matching `review.risk_paths`; not an `investigate(` issue, a post-deploy issue (`post-deploy`/`awaiting-promotion` label, or only post-deploy checklist items) or a decision issue (`decision`, `needs-decision`, `product-decision`, `rfc` or `adr` label, or a `decision(`/`rfc(`/`adr(` title). A missing repro or file prediction is `ambiguous`, left to a cheap classifier. `off` is never eligible; `shadow` reports the verdict without changing the lane; `on` lets an eligible issue run light. The lane wiring is #4450. A light lane posts a `FORGE:LITE` receipt on the issue (outcome light or upgraded, diff stat, red/green repro, gates, true cost from the #4407 per-session deltas, eligibility reason, upgrade reasons), and the batch efficiency report ends with a `lanes:` line: the light/upgraded/full split with cost and the upgrade rate, upgraded ÷ (light + upgraded) (#4452). The flat form `lean.light_mode` also works and wins. |
|
|
937
|
+
| `light.mode` | string | No | `off`, `shadow` (default) or `on` (#4448). `bin/lean/light.mjs` decides whether an issue qualifies for the light lane: a repro, steps to reproduce, expected or actual behaviour or a code block in the body; 1 to `max_files` predicted non-test files; no `size:M`/`size:L` label; no predicted path with a built-in risk word or matching `review.risk_paths`; not an `investigate(` issue, a post-deploy issue (`post-deploy`/`awaiting-promotion` label, or only post-deploy checklist items) or a decision issue (`decision`, `needs-decision`, `product-decision`, `rfc` or `adr` label, or a `decision(`/`rfc(`/`adr(` title). A missing repro or file prediction is `ambiguous`, left to a cheap classifier. `off` is never eligible; `shadow` reports the verdict without changing the lane; `on` lets an eligible issue run light. The lane wiring is #4450. A light lane posts a `FORGE:LITE` receipt on the issue (outcome light or upgraded, diff stat, red/green repro, gates, true cost from the #4407 per-session deltas, eligibility reason, upgrade reasons), and the batch efficiency report ends with a `lanes:` line: the light/upgraded/full split with cost and the upgrade rate, upgraded ÷ (light + upgraded) (#4452). A predicted file over `maintenance.hotspot.file_lines` is a hard `hotspot` reason, and every evaluated signal (repro, named files, churn, hotspot, risk path, `docs`/`config`/`chore` labels, size) is recorded in the `LIGHT_ELIGIBILITY` event's `signals` without changing the verdict (#5209). `forgedock stats --depth` reports outcomes per verdict and signal and whether the #5052 promotion criterion is met; flipping `mode: on` stays a config decision. The flat form `lean.light_mode` also works and wins. |
|
|
882
938
|
| `light.max_lines` | number | No | Upgrade trigger (#4448): a light lane whose non-test diff (added + deleted lines) exceeds this moves to the full lane. Default 40. The other triggers: more than `max_files` non-test changed files, a repro that is not red on the base, two failed test runs, a touched risk path, or a public-API-shape change (#4449). Flat `lean.light_max_lines` wins. |
|
|
883
939
|
| `light.max_files` | number | No | Max predicted non-test files for eligibility and max changed non-test files before an upgrade (#4448). Default 2. Flat `lean.light_max_files` wins. |
|
|
884
940
|
| `sequence.regenerate` | string | No | Command run in the lane worktree (`sh -c`) after the engine renumbers a schema-changing sequence-numbered migration (#4386), to regenerate its snapshot, e.g. `pnpm --filter @x/db db:generate`. The flat form `lean.sequence_regenerate` also works and wins. When a lane-added numbered file (`NNNN_*.sql`, a drizzle `meta/_journal.json` + `meta/NNNN_snapshot.json`, a numbered ADR) shares its number with the base, the engine renumbers it without a builder session: `git mv` to max(base)+1…, the document's own number in its heading, references to the old name repo-wide, the base journal plus the lane's entries, and a data-only migration's snapshot cloned from the base tip with a new `id`/`prevId`. A schema-changing migration without this command, or a migration in another language (`.py`, `.ts`), falls back to the builder renumber, and the trajectory records why. When the generator writes no snapshot for a hand-written migration (no schema diff), the engine reruns it with ` --custom` appended (drizzle-kit's empty migration), keeps its snapshot and restores the lane's SQL byte-identical, so the command must forward trailing args (a pnpm/yarn script, or `npm run x --`). A base-sync whose conflicts are only in such files is resolved the same way, with no re-review. At the merge gate a lane with numbered files holds a host sequence lease per (repo, lane branch, directory) from its last renumber check through the merge, so only one numbered-file PR is in the renumber→CI→merge window at a time. |
|
|
@@ -939,6 +995,7 @@ verify:
|
|
|
939
995
|
".py": "scripts/pytest {path}"
|
|
940
996
|
e2e: auto # optional e2e merge gate: auto (default) | always | never
|
|
941
997
|
precheck_block: false # optional (#5079); true: a declared pre-PR check still failing after the fix round (or a round with no commit) ends the lane needs-human ci.red (recoverable) instead of opening the PR with an anomaly
|
|
998
|
+
guard_block: true # optional (#5239); default true: verify.invariants (the pre-merge guard set) block the merge; false keeps a failing invariant advisory
|
|
942
999
|
e2e_label: full-ci # PR label that makes the repo's CI run e2e (label path)
|
|
943
1000
|
e2e_checks: "e2e" # check names of the e2e jobs the label path waits on
|
|
944
1001
|
# e2e_workflow: e2e.yml # or: a workflow_dispatch workflow that runs e2e (wins over the label)
|
|
@@ -958,6 +1015,7 @@ verify:
|
|
|
958
1015
|
| `precheck_total_seconds` | integer | No | Total budget of one round of pre-PR check commands (1–7200, default 600; it was 1800 before 1.30.0). `lean.precheck.max_minutes` takes precedence. Commands not started within the budget are deferred to CI, not failed. |
|
|
959
1016
|
| `checks` | string | No | Comma-separated check names that gate CI verification without `workflow` (forge#4387). Overrides the required-check set; other checks are reported, not gating. |
|
|
960
1017
|
| `invariants` | list | No | Block list of cheap repo-wide check commands (#4585), e.g. the suites that list every table, export, key or namespace (cross-tenant registry, export and purge coverage, i18n status, boundary tests). They run in the pre-PR check round in every verify mode, whichever tests the test map selected: never scoped away by `.forge/test-map.json`, deduplicated against the learned commands, and subject to the same round budget and per-command timeout. A failure goes to the builder in the precheck fix round like a failed declared check. The plan and implement prompts also carry an invariants checklist built from the list (a new table, export or key must join every registry that enumerates its kind). `forgedock check` and the light lane run them too. Absent: nothing changes. |
|
|
1018
|
+
| `guard_block` | boolean | No | Default `true` (#5239). `invariants` are the repo's pre-merge guard set: they also run on the merged tree after a base-sync (before the push), and one still failing after the fix rounds ends the lane needs-human `ci.red` instead of opening or merging the PR. Before spending a builder round, a failing invariant is run once on the merge base: if it fails there too the base is already red, so the lane ends `deferred` with `base.red` (never needs-human, retried after 900 s), the commit that last changed the files the failure names is found with `git log`, and the issue it belongs to (closing keyword, `issue-N` branch, or last `(#N)` in the message) gets a `FORGE:BASE_RED` comment and is reopened if closed; with no issue number a tracking issue is filed. `false`: failing invariants stay advisory as before. No effect without `invariants`. |
|
|
961
1019
|
| `guard_command` | map | No | Guard gate (#4693) test-file command per extension (#4792), e.g. `".py": "scripts/pytest {path}"` for a repo whose tests need a managed environment. Consulted before the contract's validate commands and the hard-coded `node --test` / `python -m pytest -q` fallbacks. `{path}` is replaced by the repo-relative path of the guard's base copy (`<name>__guardbase.<ext>`); a template without `{path}` gets it appended. Runs from the worktree root. Keys may be written with or without the leading dot. Absent: unchanged. |
|
|
962
1020
|
| `check_run` | boolean | No | Default `false` (no Checks API call, behaviour unchanged). `true`: after each push of a reviewed head (PR open, base-sync, merge-time fix round) the engine posts one completed `forgedock/verify` check run on that head (forge#4270), `success` iff every deterministic gate the lane already ran passed: declared check commands, undeclared package edges, docs freshness, contract scope, validate ids, requirement status, hotspot growth, amendments. The output carries each gate's id, pass/fail and evidence as JSON; the run log records a `VERIFY` event. Report only: ForgeDock never makes it required and never waits on it (it is ignored by its own CI waits); requiring it is the repository's branch-protection choice. Creating check runs needs a token that may (a GitHub App with `checks: write`); a Checks API failure is logged as an anomaly and never fails the lane. |
|
|
963
1021
|
| `post_merge` | string | No | Command run in the lane worktree on the merged tree after each base-sync merge, before the push (forge#4406). Default: the typecheck rows of the lane's change-scoped checks (`bin/lean/checks.mjs`), in `local` and `hybrid` mode only; `ci` mode runs no host typecheck unless `post_merge` is set. A failure resumes the builder with the output, up to `max_rounds` rounds, and the fixed head is re-reviewed; still failing is a trajectory anomaly and CI stays the gate. |
|
|
@@ -1070,7 +1128,7 @@ execution:
|
|
|
1070
1128
|
| `day_budget_minutes`, `day_budget_usd` | number | No | The same cap per host UTC day, summed over every batch on the host from the host-day store (`execution-budget.json` in `~/.forge/sched/`, or `FORGEDOCK_EXECUTION_BUDGET_FILE`). A corrupt or unreadable store refuses remote lanes while a day cap is set; remove the file to reset it. |
|
|
1071
1129
|
| `fallback_local` | boolean | No | `true`: a remote-placed lane runs on the host while the provider reports no agent online (`GET {endpoint}/status -> {"online": N}`, the built-in router answers it with `online`, `total` and per-agent `ok`/`paused`), so a batch completes locally with every pool agent offline or asleep (forge#4547). Default `false`: such lanes defer (`sandbox.capacity`). A missing or failing `/status` is unknown and never triggers it. It also covers a sustained `sandbox.capacity`: an issue the pool refused `capacity_fallback_after` times (default 3) for capacity runs on the host when the host has headroom (the host-busy guard; a busy host or a failing probe keeps it waiting remote) (forge#5112). |
|
|
1072
1130
|
| `capacity_fallback_after` | integer | No | With `fallback_local: true`: how many `sandbox.capacity` deferrals of one issue make it run on the host, subject to the host-busy guard (forge#5112). Default: 3. A missing, non-integer or non-positive value uses the default. |
|
|
1073
|
-
| `account_rotator` | string | No | `tokenbaton`: the `claude` on PATH is the tokenbaton shim, which runs each call on the logged-in account with the most room (`CLAUDE_CONFIG_DIR=~/.claude-<n>`) (forge#5094). forgedock reads `~/.tokenbaton
|
|
1131
|
+
| `account_rotator` | string | No | `tokenbaton`: the `claude` on PATH is the tokenbaton shim, which runs each call on the logged-in account with the most room (`CLAUDE_CONFIG_DIR=~/.claude-<n>`) (forge#5094). Unset: detected (forge#5205) when `TOKENBATON_HOME` is set or the first `claude` on PATH resolves to `tokenbaton-exec` / a `.tokenbaton/shim/claude`; `off` (also `none`, `false`) or env `FORGEDOCK_ACCOUNT_ROTATOR=off` disables it. forgedock reads `$TOKENBATON_HOME` (as-is, else `~/.tokenbaton`): `current` (the account number) and `live.<n>` (`<5h used %> <5h reset s> <weekly used %> <weekly reset s> <updated s>`), re-read on every check and never written. An account has headroom when its 5-hour use is under 95% and its weekly use under 100%; a sample whose reset has passed is stale: unknown, never 0%, worth one try but ranked after fresh samples. While any account has headroom no host-wide usage hold is recorded and admissions continue. A lane whose call hits a usage limit records that account (from the run's `/proc/<pid>/environ`), excludes it until its reset, and relaunches the same call (same session) at once pinned to the account tokenbaton picks (the real `claude` past the shim, `CLAUDE_CONFIG_DIR=~/.claude-<n>`), at most once per account; the lane result reports `rotations` and `limited`, and the batch keeps excluding those accounts until their reset. Only when no account has room does the lane pause or defer, and the batch holds until tokenbaton's earliest reset over every account. When the installed tokenbaton has the tokenbaton#3 API, forgedock uses `tokenbaton --pick --json --exclude <n,..>` (exit 2 = none with room, `earliest_reset`) and `tokenbaton-ctl mark-limited <n> --until <s>`; otherwise it computes the same from `live.<n>`. `forgedock limits show` lists each account's 5-hour use, `(stale)` for a passed reset. Any other value, or unreadable files: off (per-account holds as before). |
|
|
1074
1132
|
| `warm_sandboxes` | integer | No | Warm sandboxes per repo the pool agent keeps ready (checkout at the base ref, dependency cache primed). When `N > 0` the launch spec carries `warm: N` and the lane first calls `POST {endpoint}/sandboxes/claim`; a ready warm sandbox takes the lane (refreshed to the lane's base ref with an incremental fetch before work starts), and when none is ready, the claim fails or the endpoint lacks the route the lane starts cold. Default `0` (off): no claim call and the launch spec is unchanged (forge#4912). |
|
|
1075
1133
|
| `unreachable_window_min` | number | No | Remote providers: how long a lane keeps polling (with backoff, up to 30s) after the provider's transport fails (connection refused/reset, `fetch failed`, timeout, 502/503/504) before it ends `deferred` with `sandbox.unreachable` (forge#4672). Inside the window the lane never ends and the sandbox is never torn down; after it the sandbox is kept and adopted on the next attempt or `--resume`; the engine-error breaker does not count it. `adopt` applies the same window. Default: 5 |
|
|
1076
1134
|
| `on_budget` | string | No | `stop` (default): running lanes finish and the rest end `held` (`execution budget: ...`) for a later `--resume`. `local`: the rest run as detached host lanes. |
|
package/docs/ISSUE-WATCH.md
CHANGED
|
@@ -107,6 +107,8 @@ All pass: the issue counts as **verified**, and a `FORGE:WATCH_VERIFY` comment r
|
|
|
107
107
|
|
|
108
108
|
`mode: release` claims nothing immediately. It pools the issues that match the selectors and cut a **themed release** when a trigger fires, then orchestrates just that set.
|
|
109
109
|
|
|
110
|
+
Once the batch reports and the deploy PR is open, the watch starts `forgedock release` for it (resumable; promotion stays opt-in via `--merge` / `release.auto_merge`, the watch never merges).
|
|
111
|
+
|
|
110
112
|
```yaml
|
|
111
113
|
issue_watch:
|
|
112
114
|
watches:
|
package/docs/OUTCOME-CODES.md
CHANGED
|
@@ -45,8 +45,10 @@ An absent or unknown code is recorded as `unclassified`, with the raw reason kep
|
|
|
45
45
|
| `gh.auth` | A `gh` call in a core run answered HTTP 401 (expired or revoked bot token) and one run of `scripts/refresh-bot-token.sh` plus a retry did not fix it; the run is `deferred` (retry in 120s), never `engine-error`. See `docs/CONFIG.md` "Bot token refresh" | lean | `bin/lean/retry.mjs` |
|
|
46
46
|
| `rate_limited` | Session or usage limit outlasted the pause budget | engine | `err.usageLimit` / `err.resetAtEpochMs` |
|
|
47
47
|
| `backend.auth` | The claude CLI login failed ("Failed to authenticate", expired or invalid login); the lane is `deferred` (retry in 900s) under a per-account hold like a usage limit, never `engine-error`, never relaunched or counted by the breaker (#5168) | lean | `bin/runner.mjs` `err.authFailure` |
|
|
48
|
+
| `quota.exhausted` | No account has capacity (the rotator picks none: every login at its ceiling); the lane is `deferred` until the earliest reset, never spawned through the shim, never `backend.auth` (#5236) | lean | `bin/lean/quota.mjs` `poolExhausted` |
|
|
48
49
|
| `engine.error` | Engine or tool failure (missing key/SDK, CLI crash, max turns, unresolved args, runner threw every attempt) | engine | `err.code` |
|
|
49
50
|
| `engine.dco_rewrite` | Core work-on (forge#4997): the DCO sign-off rewrite (`git filter-branch`) of the lane's unpushed commits failed, or the lane's uncommitted changes could not be restored after it (kept on `refs/forgedock/dco-stash`). A mechanical engine step, not a human block: the lane ends `engine-error` (never `needs-human`), which `forgedock orchestrate` relaunches like any engine-error | lean | `bin/lean/signoff.mjs` `ensureSignedOff` |
|
|
51
|
+
| `engine.push_diverged` | Core work-on (forge#5202): the lane-branch push was rejected non-fast-forward and no other live lane owns the branch (no open PR, no live lease), after the pre-push reconcile could not merge the remote-only commits (they are not this worktree's own `wip(forge): checkpoint` commits). The lane's own history diverged: a mechanical engine state, not a human block. The lane ends `engine-error` (never `needs-human`), which `forgedock orchestrate` relaunches; the exit rescue pushes HEAD to `forge-salvage/<issue>-<sha>` | lean | `bin/lean/lean.mjs` push-rejection classification, `bin/lean/checkpoint-reconcile.mjs` |
|
|
50
52
|
| `engine.validate_result_lost` | Core work-on (forge#4708): a validate result recorded before a merge-time CI fix round is missing from the fix session's result file and could not be carried forward; an engine bookkeeping error, not an unimplemented requirement | lean | `bin/lean/lean.mjs` `mergeFixRound` |
|
|
51
53
|
| `infra.disk_quota` | Disk full or quota exhausted (EDQUOT/ENOSPC, errno -28/-122); retryable infra failure, never `needs-human` | engine | Runner error text |
|
|
52
54
|
| `infra.cli_spawn_transient` | CLI spawn failed transiently before the child ran (ETIMEDOUT, EAGAIN, ENOMEM, EMFILE); retried with backoff on a separate bounded counter that does not consume a phase attempt | engine | `err.code` `CLI_SPAWN_TRANSIENT` |
|
|
@@ -58,6 +60,7 @@ An absent or unknown code is recorded as `unclassified`, with the raw reason kep
|
|
|
58
60
|
| `env.repro_unrunnable` | Core work-on (forge#4334): on a bug lane the frozen `repro_test` could not be run on head by `scripts/acceptance-red-green.sh` (`HEAD=UNRUNNABLE`: timeout, exit 126/127, unclassifiable output) or the harness returned no result. An environment error, not a conformance failure: no builder resume, no reviewer. Ends `needs-human`; recoverable by `forgedock orchestrate` (the recovery lane reruns the repro command through the repo's own toolchain and installed dependencies). Other non-proofs (passes on base, fails on head, base unrunnable) stay `conformance.unimplemented` | lean | `gate()` `io.redGreen` words, classified by `conformance.mjs` `reproFailures` |
|
|
59
61
|
| `env.capability_remote` | Core work-on (forge#4542): a lane placed in a remote sandbox ended `builder.blocked (credentials)` and its summary names only host capabilities declared in `execution.host_capabilities` (SOPS/age key, ops credentials, prod monitor SSH), which the sandbox does not relay but the dispatching host has. Recoverable by `forgedock orchestrate`: the recovery lane is placed local, once, under the same lease. A credential need the host lacks too stays `builder.blocked` | lean | `endBlocked` via `execution.mjs` `hostCapabilityBlock` |
|
|
60
62
|
| `sandbox.start_failed` | A `forgedock orchestrate` lane sandbox (forge.yaml `execution`, provider `container` or `remote`) could not start: bad image, missing endpoint, a refused launch (HTTP 4xx other than 401/403/429) or a non-HTTP start failure. The lane never ran. Final `needs-human` row: not relaunched and not counted by the engine-error circuit breaker | orchestrate | `bin/lean/execution.mjs` `providerLanes`: `provider.start` threw without `retryable`, `transient` or a 5xx/401/403 `status` |
|
|
63
|
+
| `base.red` | Core work-on: a `verify.invariants` guard command fails on the base too (forge#5239). `deferred` (retry 900 s), never needs-human; the introducing issue gets a `FORGE:BASE_RED` comment (reopened if closed) | lean | `bin/lean/basered.mjs` guard run on the base |
|
|
61
64
|
| `sandbox.capacity` | The sandbox provider had no capacity for the lane (HTTP 429/503 from the remote transport). `deferred`, requeued after `Retry-After` when sent, else 60s; not counted toward `orchestration.max_deferrals`, like `host.busy` (forge#4528) | orchestrate | `provider.start` threw with `err.retryable: true` |
|
|
62
65
|
| `sandbox.transient` | The remote sandbox provider answered HTTP 500/502/504 on launch: a router or agent infrastructure failure, not a code or human problem (forge#5095). `deferred`, requeued after `Retry-After` when sent, else 60s; counted toward `orchestration.max_deferrals` (so a broken pool ends `deferred`, never `needs-human`); not counted by the engine-error circuit breaker | orchestrate | `bin/lean/execution.mjs` `providerLanes` `startFailed`: `provider.start` threw with `err.status` 5xx (not retryable) or `err.transient` |
|
|
63
66
|
| `sandbox.auth` | The remote sandbox provider refused the lane's credential (HTTP 401/403) at start (forge#4685). `deferred`, retried after 300s, never `needs-human`; the pool token resolves from the env, the keychain, then `~/.config/computeshare/forgedock.token` | orchestrate | `provider.start` threw with `err.status` 401/403 |
|
package/docs/STATS.md
CHANGED
|
@@ -106,6 +106,25 @@ conformance pass, and then the post − pre delta.
|
|
|
106
106
|
the result is under `query.efficiency.compare`. Cohorts are split by batch `plan.created`, as `--window` is; a lane run
|
|
107
107
|
outside a batch is in neither.
|
|
108
108
|
|
|
109
|
+
## Lane depth (`--depth`, forge#5209)
|
|
110
|
+
|
|
111
|
+
`forgedock stats --depth [--since <version|date>] [--min-n N] [--offline] [--repo <owner/repo>] [--json]` reads the local
|
|
112
|
+
run logs (`~/.forge/runs/*.jsonl`, every RUN_START..RUN_TERMINAL slice that logged `LIGHT_ELIGIBILITY`) and uses gh only
|
|
113
|
+
for post-merge defect signals; `--offline` skips that crawl (defects print n/a, as does a gh failure).
|
|
114
|
+
|
|
115
|
+
Columns per cell: n, merge rate, first-pass rate, needs-human rate, median cost, median wall minutes, median wall/model
|
|
116
|
+
time, review findings per lane (conformance failures + verifier findings) and the share of lanes with any, conformance
|
|
117
|
+
failure rate, and the post-merge defect rate (a reopen, a revert naming the PR, or a `fix`/`bug` PR touching the same
|
|
118
|
+
non-test files within 7 days) over merged lanes with known defect data.
|
|
119
|
+
|
|
120
|
+
Cells are grouped by verdict (eligible, ambiguous, ineligible) and by every reason and signal code (`hotspot`,
|
|
121
|
+
`churn_high`, `label_docs`, `size_S`, ...), so outcomes can be attributed to each signal.
|
|
122
|
+
|
|
123
|
+
Promotion (#5052): treatment = light-shaped lanes (light or upgraded), control = full lanes the gate rated eligible, in the
|
|
124
|
+
size buckets both have. Met when median cost ratio <= 1.2x, median wall/model <= 1.3x and the treatment defect rate is no
|
|
125
|
+
worse than the control's; a cell under `--min-n` (default 10) is `insufficient data`, with n per cell printed. Flipping
|
|
126
|
+
`lean.light.mode: on` stays a config decision.
|
|
127
|
+
|
|
109
128
|
## Pool utilisation (`--pool`, forge#4549)
|
|
110
129
|
|
|
111
130
|
`forgedock stats --pool [--window 7d,30d] [--json]` reads the repo's local batch `report.json` rows and prints, per window,
|
|
@@ -133,6 +152,31 @@ Efficiency next to quality: run `forgedock stats --efficiency --compare <date|ve
|
|
|
133
152
|
$/merge, turns/merge and wall p50. Baseline before #4693 enforces: run `forgedock stats --compounding --json --since <date>` in
|
|
134
153
|
a full clone of this repo and one other and keep the output with the #4697 tracker.
|
|
135
154
|
|
|
155
|
+
## Conformance outcomes (`--conformance-outcomes`, forge#5210)
|
|
156
|
+
|
|
157
|
+
`forgedock stats --conformance-outcomes [--repo R] [--since <date>] [--window-days 7] [--min-n 20] [--json]` asks whether conformance
|
|
158
|
+
blocks predict post-merge defects. Read only, no model and no GitHub writes. GitHub reads are one `gh api graphql` search per
|
|
159
|
+
page of 100 merged PRs (`repo:R is:pr is:merged merged:>=<since>`, `--since` defaults to 30 days ago; GitHub search stops at
|
|
160
|
+
1000 results, flagged `capped`) plus the usual FORGE:TELEMETRY crawl. Verdicts also come from the local run logs and batch
|
|
161
|
+
reports unless `--no-local`.
|
|
162
|
+
|
|
163
|
+
- **lane PR**: a merged PR with a conformance verdict (`query.mjs` `conformanceVerdicts`; the latest of the telemetry
|
|
164
|
+
`run_terminal`/`conformance_shadow`, run-log `RUN_TERMINAL`/`CONFORMANCE_SHADOW`/`CONFORMANCE` and batch-row `conformance`
|
|
165
|
+
wins). `shadow_would: conforms` conforms. Any other `would` is nonconforming, and its failure codes are the kinds. An
|
|
166
|
+
enforce merge with no `would` passed the enforced gate and conforms. A merged PR without a verdict counts under `unjoined`.
|
|
167
|
+
- **signals** inside `--window-days` after the merge:
|
|
168
|
+
- `reverted`: a later merged `Revert ...` PR naming `#N`, `Reverts R#N` or the title.
|
|
169
|
+
- `reopened`: a closing issue was reopened.
|
|
170
|
+
- `cited`: a later merged PR says `fix ... #N` or `review-finding ... #N` for the PR or its issue on one line.
|
|
171
|
+
- `same_hunks`: a later `fix`/`revert` PR whose old-side lines `git blame` to this PR's merge commit. Only in a clone of R.
|
|
172
|
+
Otherwise it is `null` and counted under `same_hunks_unresolved`.
|
|
173
|
+
- A PR is defective when any signal is true. A PR whose window has not elapsed is `pending` and is not counted.
|
|
174
|
+
- **cells**: per repo, then the same split per mode and per failure kind. Each cell is `defects/n rate [Wilson 95% interval]`
|
|
175
|
+
for nonconforming-merged vs conforming-merged, `n/a` under `--min-n` (default 20 per cell).
|
|
176
|
+
- **conclusion** (last line): `nonconforming merges show a higher defect rate` when the nonconforming interval lies wholly
|
|
177
|
+
above the conforming one, `no higher defect rate shown for nonconforming merges` otherwise, and `insufficient data` when
|
|
178
|
+
either overall cell is under min n.
|
|
179
|
+
|
|
136
180
|
## Explorer A/B (`--explore-ab`, forge#4418)
|
|
137
181
|
|
|
138
182
|
Compares lanes run with forge.yaml `lean.explore: on` against `off` (#4391), from the local run logs only (no GitHub
|