forgedock 1.43.0 → 1.44.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.
Files changed (58) hide show
  1. package/bin/engine/outcome-codes.mjs +3 -2
  2. package/bin/engine/telemetry-seam.mjs +1 -1
  3. package/bin/engine-cli.mjs +59 -10
  4. package/bin/forgedock.mjs +50 -24
  5. package/bin/gc.mjs +3 -1
  6. package/bin/hooks/pre-tool-use.mjs +54 -3
  7. package/bin/journey.mjs +2 -2
  8. package/bin/lean/autochildren.mjs +13 -5
  9. package/bin/lean/autochildren.test.mjs +36 -18
  10. package/bin/lean/batch.mjs +3 -1
  11. package/bin/lean/batch.test.mjs +83 -0
  12. package/bin/lean/conformance.mjs +72 -13
  13. package/bin/lean/conformance.test.mjs +100 -9
  14. package/bin/lean/decision-engine.mjs +1 -1
  15. package/bin/lean/decision-engine.test.mjs +11 -0
  16. package/bin/lean/effects.mjs +1 -1
  17. package/bin/lean/execution.test.mjs +9 -6
  18. package/bin/lean/gatewatch.test.mjs +5 -5
  19. package/bin/lean/issuewatch.mjs +2 -2
  20. package/bin/lean/lane.mjs +22 -4
  21. package/bin/lean/lane.test.mjs +33 -1
  22. package/bin/lean/lean.mjs +65 -17
  23. package/bin/lean/lean.test.mjs +84 -2
  24. package/bin/lean/orchestrate-blocked.test.mjs +28 -0
  25. package/bin/lean/orchestrate-children.test.mjs +16 -4
  26. package/bin/lean/orchestrate.mjs +58 -11
  27. package/bin/lean/pmap.mjs +17 -0
  28. package/bin/lean/pmap.test.mjs +27 -0
  29. package/bin/lean/probe.mjs +1 -1
  30. package/bin/lean/prodwatch-triage.mjs +6 -0
  31. package/bin/lean/prodwatch-triage.test.mjs +14 -1
  32. package/bin/lean/prodwatch.mjs +1 -3
  33. package/bin/lean/recovery.test.mjs +21 -4
  34. package/bin/lean/retry.mjs +11 -0
  35. package/bin/lean/retry.test.mjs +16 -0
  36. package/bin/lean/sched.mjs +25 -2
  37. package/bin/lean/sched.test.mjs +58 -1
  38. package/bin/lean/schedd.mjs +38 -5
  39. package/bin/lean/schedd.test.mjs +109 -0
  40. package/bin/lean/selftest-live.mjs +57 -32
  41. package/bin/lean/selftest-live.test.mjs +48 -6
  42. package/bin/lean/selftest-nightly.mjs +8 -4
  43. package/bin/lean/selftest-nightly.test.mjs +24 -2
  44. package/bin/lean/selftest-static.mjs +18 -11
  45. package/bin/lean/selftest-static.test.mjs +8 -0
  46. package/bin/lean/signoff.mjs +14 -2
  47. package/bin/lean/signoff.test.mjs +45 -1
  48. package/bin/pool/agent.mjs +1 -1
  49. package/bin/pool/cli.mjs +29 -1
  50. package/bin/runner.mjs +1 -1
  51. package/commands/orchestrate.md +5 -2
  52. package/docs/CONFIG.md +9 -4
  53. package/docs/DECISIONS.md +5 -1
  54. package/docs/OUTCOME-CODES.md +3 -2
  55. package/docs/TELEMETRY.md +1 -1
  56. package/package.json +1 -1
  57. package/scripts/ci-local/run.mjs +1 -1
  58. package/scripts/plan-validate-live.mjs +15 -8
@@ -18,15 +18,20 @@ export function listSources(dir) {
18
18
  return out.sort();
19
19
  }
20
20
 
21
- /** @returns {{cmd:string, fields:string[], line:number}[]} the literal gh `--json` field lists of `text` (cmd e.g. "issue view"). */
21
+ /**
22
+ * The `gh issue|pr view|list --json <fields>` uses of `text`. A literal field list is `{cmd, fields, line}`; a list the
23
+ * scan cannot read (a variable or template, e.g. `"--json", fields`) is `{cmd, fields: [], unchecked: true, line}`.
24
+ * @returns {{cmd:string, fields:string[], line:number, unchecked?:true}[]} cmd e.g. "issue view"
25
+ */
22
26
  export function extractJsonFields(text) {
23
- const out = [];
24
- const re = /\[([^[\]]*?)["'`]--json["'`]\s*,\s*["'`]([A-Za-z0-9_,]+)["'`]/g;
27
+ const out = [], re = /["'`]--json["'`]\s*,\s*/g;
25
28
  for (let m; (m = re.exec(text));) {
26
- const words = [...m[1].matchAll(/["'`]([a-z-]+)["'`]/g)].map((x) => x[1]);
27
- const i = words.findIndex((w, k) => (w === "issue" || w === "pr") && (words[k + 1] === "view" || words[k + 1] === "list"));
28
- if (i < 0) continue;
29
- out.push({ cmd: `${words[i]} ${words[i + 1]}`, fields: m[2].split(",").filter(Boolean), line: text.slice(0, m.index).split("\n").length });
29
+ const before = text.slice(Math.max(0, m.index - 300), m.index), seg = before.slice(before.lastIndexOf(";") + 1);
30
+ const cmds = [...seg.matchAll(/["'`](issue|pr)["'`]\s*,\s*["'`](view|list)["'`]/g)];
31
+ if (!cmds.length) continue;
32
+ const c = cmds.at(-1), lit = /^["'`]([A-Za-z0-9_,]+)["'`]\s*[,\])]/.exec(text.slice(m.index + m[0].length));
33
+ const row = { cmd: `${c[1]} ${c[2]}`, fields: lit ? lit[1].split(",").filter(Boolean) : [], line: text.slice(0, m.index).split("\n").length };
34
+ out.push(lit ? row : { ...row, unchecked: true });
30
35
  }
31
36
  return out;
32
37
  }
@@ -47,14 +52,15 @@ export function parseHelpFields(help) {
47
52
 
48
53
  /**
49
54
  * @param {{root:string, io:{gh:(args:string[])=>string, read?:(p:string)=>string, list?:(d:string)=>string[]}}} a
50
- * @returns {{ok:boolean, checked:number, missing:{file:string,line:number,cmd:string,field:string}[], errors:string[]}}
55
+ * @returns {{ok:boolean, checked:number, unchecked:{file:string,line:number,cmd:string}[], missing:{file:string,line:number,cmd:string,field:string}[], errors:string[]}}
51
56
  */
52
57
  export function staticCheck({ root, io }) {
53
58
  const read = io.read ?? ((p) => readFileSync(p, "utf8")), list = io.list ?? listSources;
54
- const known = new Map(), errors = [], missing = [];
59
+ const known = new Map(), errors = [], missing = [], unchecked = [];
55
60
  let checked = 0;
56
61
  for (const file of list(root)) {
57
62
  for (const u of extractJsonFields(read(file))) {
63
+ if (u.unchecked) { unchecked.push({ file, line: u.line, cmd: u.cmd }); continue; } // reported, never silently skipped (#4952)
58
64
  if (!known.has(u.cmd)) {
59
65
  let fields = [];
60
66
  try { fields = parseHelpFields(io.gh([...u.cmd.split(" "), "--help"])); } catch (e) { errors.push(`gh ${u.cmd} --help failed: ${e.message}`); }
@@ -67,7 +73,7 @@ export function staticCheck({ root, io }) {
67
73
  for (const field of u.fields) if (!set.has(field)) missing.push({ file, line: u.line, cmd: u.cmd, field });
68
74
  }
69
75
  }
70
- return { ok: !missing.length && !errors.length, checked, missing, errors };
76
+ return { ok: !missing.length && !errors.length, checked, unchecked, missing, errors };
71
77
  }
72
78
 
73
79
  export const realGh = (args) => execFileSync("gh", args, { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
@@ -76,6 +82,7 @@ export function formatStatic(r) {
76
82
  return [
77
83
  ...r.missing.map((m) => `${m.file}:${m.line}: gh ${m.cmd} --json field "${m.field}" is not offered by this gh`),
78
84
  ...r.errors,
79
- `static check: ${r.ok ? "ok" : "FAILED"} (${r.checked} field lists checked)`,
85
+ ...(r.unchecked ?? []).map((u) => `${u.file}:${u.line}: gh ${u.cmd} --json field list is not a string literal: unchecked`),
86
+ `static check: ${r.ok ? "ok" : "FAILED"} (${r.checked} field lists checked, ${(r.unchecked ?? []).length} unchecked)`,
80
87
  ].join("\n");
81
88
  }
@@ -29,4 +29,12 @@ describe("selftest static check (#4865)", () => {
29
29
  const r = staticCheck({ root: "/bin", io: { gh: () => { throw new Error("no gh"); }, list: () => ["/a.mjs"], read: () => 'x(["pr", "view", "--json", "title"])' } });
30
30
  assert.equal(r.ok, false);
31
31
  });
32
+ it("reports a non-literal --json list as unchecked, not as checked (#4952)", () => {
33
+ const t = 'x();\ngh(["issue", "view", String(n), ...(repo ? ["-R", repo] : []), "--json", fields]);\ngh(["pr", "list", "--json", `a,${f}`]);';
34
+ assert.deepEqual(extractJsonFields(t), [{ cmd: "issue view", fields: [], line: 2, unchecked: true }, { cmd: "pr list", fields: [], line: 3, unchecked: true }]);
35
+ const r = staticCheck({ root: "/bin", io: { gh, list: () => ["/bin/a.mjs"], read: () => t } });
36
+ assert.equal(r.ok, true); assert.equal(r.checked, 0); assert.equal(r.unchecked.length, 2);
37
+ assert.match(formatStatic(r), /a\.mjs:2: gh issue view --json field list is not a string literal: unchecked/);
38
+ assert.match(formatStatic(r), /0 field lists checked, 2 unchecked/);
39
+ });
32
40
  });
@@ -8,6 +8,7 @@
8
8
  * never in the range, so they are never rewritten. Deterministic, 0 LLM calls.
9
9
  */
10
10
  const SEP = "\x1f", END = "\x1e";
11
+ const STASH_REF = "refs/forgedock/dco-stash";
11
12
  const PLACEHOLDER_RE = /@localhost$/i;
12
13
 
13
14
  /** True when the commit must be rewritten: placeholder author or committer, or no sign-off naming its author. */
@@ -59,8 +60,19 @@ export async function ensureSignedOff({ git, lane, branch, env = process.env })
59
60
  throw Object.assign(new Error(`${bad.length} unpushed commit(s) fail DCO (placeholder author or no sign-off: ${bad.slice(0, 5).map((c) => c.sha.slice(0, 8)).join(", ")}) and the worktree has no usable git identity to rewrite them`), { noIdentity: true });
60
61
  }
61
62
  const fenv = { FD_BAD: bad.map((c) => c.sha).join(" "), FD_NAME: name, FD_EMAIL: email, FILTER_BRANCH_SQUELCH_WARNING: "1" };
63
+ // filter-branch refuses a dirty tree (lockfile churn, build output): park tracked changes on a private ref, never the shared stash stack
64
+ const porcelain = await ok(["status", "--porcelain", "--untracked-files=no"]);
65
+ const dirty = porcelain ? porcelain.split("\n").map((l) => l.replace(/^\s*\S+\s+/, "")).slice(0, 20) : []; // #4905: the dirty paths are reported so the source of the dirt (validate/format output) is visible
66
+ const saved = porcelain ? await ok(["stash", "create"]) : "";
67
+ if (saved) { await git(["update-ref", STASH_REF, saved]); await git(["reset", "-q", "--hard", "HEAD"]); }
68
+ let failure = null;
62
69
  try { await git(["filter-branch", "-f", "--env-filter", ENV_FILTER, "--msg-filter", MSG_FILTER, "--", "HEAD", ...exclude], { env: fenv }); }
63
- catch (e) { throw Object.assign(new Error(`could not rewrite ${bad.length} unpushed commit(s) for DCO: ${String(e?.stderr ?? e?.message ?? e).slice(0, 300)}`), { noIdentity: false }); }
70
+ catch (e) { failure = `could not rewrite ${bad.length} unpushed commit(s) for DCO: ${String(e?.stderr ?? e?.message ?? e).slice(0, 300)}${dirty.length ? ` (dirty tracked files: ${dirty.join(", ")})` : ""}`; }
71
+ if (saved) {
72
+ try { await git(["stash", "apply", saved]); await ok(["update-ref", "-d", STASH_REF]); }
73
+ catch { failure = `${failure ? `${failure}; ` : ""}could not restore the lane's uncommitted changes after the DCO rewrite; they are kept as ${saved} (${STASH_REF})`; }
74
+ }
75
+ if (failure) throw Object.assign(new Error(failure), { noIdentity: false, engineCode: "engine.dco_rewrite" });
64
76
  await ok(["for-each-ref", "--format=delete %(refname)", "refs/original/"]).then(async (l) => { for (const r of l.split("\n").map((x) => x.replace(/^delete /, "")).filter(Boolean)) await ok(["update-ref", "-d", r]); });
65
- return { rewritten: bad.length };
77
+ return { rewritten: bad.length, ...(dirty.length ? { dirty } : {}) };
66
78
  }
@@ -4,7 +4,7 @@
4
4
  import { describe, it } from "node:test";
5
5
  import assert from "node:assert/strict";
6
6
  import { execFileSync } from "node:child_process";
7
- import { writeFileSync } from "node:fs";
7
+ import { readFileSync, writeFileSync } from "node:fs";
8
8
  import { join } from "node:path";
9
9
  import { tmpDir } from "../tests/_tmp.mjs";
10
10
  import { ensureSignedOff, needsSignoff, offendersOf } from "./signoff.mjs";
@@ -99,4 +99,48 @@ describe("ensureSignedOff", () => {
99
99
  await assert.rejects(ensureSignedOff({ git: f.git, lane: "staging", branch: "feat/x", env: {} }), (e) => e.noIdentity === true);
100
100
  assert.equal(f.sh("rev-parse", "HEAD"), bad);
101
101
  });
102
+ it("rewrites on a dirty worktree and keeps the dirty tracked and untracked files (#4905)", async () => {
103
+ const f = fixture();
104
+ f.commit("b.txt", "unpushed placeholder", "placeholder");
105
+ writeFileSync(join(f.wt, "base.txt"), "modified\n");
106
+ writeFileSync(join(f.wt, "new.txt"), "untracked\n");
107
+ const r = await ensureSignedOff({ git: f.git, lane: "staging", branch: "feat/x", env: {} });
108
+ assert.equal(r.rewritten, 1);
109
+ assert.deepEqual(r.dirty, ["base.txt"]); // the source of the dirt is reported
110
+ assert.equal(readFileSync(join(f.wt, "base.txt"), "utf8"), "modified\n");
111
+ assert.equal(readFileSync(join(f.wt, "new.txt"), "utf8"), "untracked\n");
112
+ assert.match(f.sh("status", "--porcelain"), /M base\.txt/);
113
+ assert.equal(f.sh("log", "-1", "--format=%ae"), "lane@example.com");
114
+ });
115
+ it("restores the dirty file when the rewrite itself fails (#4905)", async () => {
116
+ const f = fixture();
117
+ f.commit("b.txt", "unpushed placeholder", "placeholder");
118
+ writeFileSync(join(f.wt, "base.txt"), "modified\n");
119
+ const git = async (a, o) => { if (a[0] === "filter-branch") throw Object.assign(new Error("boom"), { stderr: "boom" }); return f.git(a, o); };
120
+ await assert.rejects(ensureSignedOff({ git, lane: "staging", branch: "feat/x", env: {} }), /could not rewrite 1 unpushed.*dirty tracked files: base\.txt/s);
121
+ assert.equal(readFileSync(join(f.wt, "base.txt"), "utf8"), "modified\n");
122
+ });
123
+
124
+ it("rewrites on a dirty tree (#4997): unstaged and staged tracked changes survive, no stash entry is left", async () => {
125
+ const f = fixture();
126
+ f.commit("a.txt", "unpushed placeholder", "placeholder");
127
+ writeFileSync(join(f.wt, "base.txt"), "churn\n");
128
+ writeFileSync(join(f.wt, "a.txt"), "staged\n"); f.sh("add", "a.txt");
129
+ const r = await ensureSignedOff({ git: f.git, lane: "staging", branch: "feat/x", env: {} });
130
+ assert.equal(r.rewritten, 1);
131
+ assert.equal(readFileSync(join(f.wt, "base.txt"), "utf8"), "churn\n");
132
+ assert.equal(readFileSync(join(f.wt, "a.txt"), "utf8"), "staged\n");
133
+ assert.equal(f.sh("stash", "list"), "");
134
+ assert.equal(f.sh("for-each-ref", "refs/forgedock/"), "");
135
+ assert.match(f.sh("log", "-1", "--format=%B"), /Signed-off-by: Lane Bot/);
136
+ });
137
+
138
+ it("a failed rewrite carries engineCode engine.dco_rewrite, restores the tree, and is not noIdentity (#4997)", async () => {
139
+ const f = fixture();
140
+ f.commit("a.txt", "unpushed placeholder", "placeholder");
141
+ writeFileSync(join(f.wt, "base.txt"), "churn\n");
142
+ const git = async (a, o) => { if (a[0] === "filter-branch") throw new Error("boom"); return f.git(a, o); };
143
+ await assert.rejects(ensureSignedOff({ git, lane: "staging", branch: "feat/x", env: {} }), (e) => e.engineCode === "engine.dco_rewrite" && e.noIdentity === false && /boom/.test(e.message));
144
+ assert.equal(readFileSync(join(f.wt, "base.txt"), "utf8"), "churn\n");
145
+ });
102
146
  });
@@ -364,7 +364,7 @@ export function createAgent(cfg, { docker, now = () => Date.now(), log = console
364
364
  // systemd services lack WSL_INTEROP; point it at a live interop socket so wsl.exe can run.
365
365
  const sock = (() => { try { return readdirSync("/run/WSL").filter((f) => f.endsWith("_interop")).map((f) => join("/run/WSL", f)).sort().pop(); } catch { return null; } })();
366
366
  setTimeout(() => {
367
- const child = spawn("/mnt/c/Windows/System32/wsl.exe", ["--shutdown"], { detached: true, stdio: "ignore", env: { ...process.env, ...(sock ? { WSL_INTEROP: sock } : {}) } });
367
+ const child = spawn("/mnt/c/Windows/System32/wsl.exe", ["--shutdown"], { detached: true, windowsHide: true, stdio: "ignore", env: { ...process.env, ...(sock ? { WSL_INTEROP: sock } : {}) } });
368
368
  child.unref();
369
369
  }, 1500);
370
370
  }
package/bin/pool/cli.mjs CHANGED
@@ -15,10 +15,38 @@ import { call as httpCall } from "./http.mjs";
15
15
  const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
16
16
  const loadJson = (p) => JSON.parse(readFileSync(p, "utf8"));
17
17
 
18
+ const USAGE = "usage: forgedock pool router [install] | enroll [--cpus N --mem GB] | status | upgrade [agent] | remove <agent> [--config path]";
19
+ const HELP_FLAGS = ["--help", "-h"];
20
+ // Flags each verb accepts: `value` flags consume the next token, `bool` flags stand alone. Anything else dash-prefixed is rejected (#5008).
21
+ const VERB_FLAGS = {
22
+ router: { value: ["--config"], bool: [] },
23
+ agent: { value: ["--config"], bool: [] },
24
+ status: { value: ["--config"], bool: [] },
25
+ upgrade: { value: ["--config"], bool: [] },
26
+ remove: { value: ["--config"], bool: [] },
27
+ enroll: { value: ["--config", "--cpus", "--mem"], bool: [] },
28
+ "install-command": { value: ["--config", "--cpus", "--mem"], bool: [] },
29
+ resize: { value: ["--config", "--cpus", "--mem", "--vm-cpus", "--vm-mem", "--vm-swap"], bool: ["--drain"] },
30
+ };
31
+
32
+ function rejectUnknownFlags(cmd, rest) {
33
+ const spec = VERB_FLAGS[cmd];
34
+ if (!spec) return;
35
+ for (let i = 0; i < rest.length; i++) {
36
+ const t = rest[i];
37
+ if (spec.value.includes(t)) { i++; continue; }
38
+ if (spec.bool.includes(t)) continue;
39
+ if (t.startsWith("-") && !/^-\d/.test(t)) throw new Error(`usage: unknown flag ${t} for 'forgedock pool ${cmd}'. ${USAGE.slice("usage: ".length)}`);
40
+ }
41
+ }
42
+
18
43
  /** The `forgedock pool` verbs (and the `computeshare` script). Throws on usage or router errors; `deps` injects the HTTP client and config. */
19
44
  export async function runPoolCli(argv, deps = {}) {
20
45
  const [cmd, ...rest] = argv;
21
46
  const call = deps.call ?? httpCall;
47
+ // Help never reaches the router or starts a service (#5008).
48
+ if (HELP_FLAGS.includes(cmd) || cmd === "help" || rest.some((x) => HELP_FLAGS.includes(x))) { console.log(USAGE); return; }
49
+ rejectUnknownFlags(cmd, rest);
22
50
  const flag = (name, dflt) => { const i = rest.indexOf(`--${name}`); return i >= 0 ? rest[i + 1] : dflt; };
23
51
 
24
52
  function routerConfig() {
@@ -103,7 +131,7 @@ export async function runPoolCli(argv, deps = {}) {
103
131
  break;
104
132
  }
105
133
  default:
106
- throw new Error("usage: forgedock pool router [install] | enroll [--cpus N --mem GB] | status | upgrade [agent] | remove <agent> [--config path]");
134
+ throw new Error(USAGE);
107
135
  }
108
136
  }
109
137
 
package/bin/runner.mjs CHANGED
@@ -2092,7 +2092,7 @@ export async function runCliBackendAsync(opts) {
2092
2092
  const finish = (r) => { if (settled) return; settled = true; clearInterval(timer); resolveP(r); };
2093
2093
  let child;
2094
2094
  const input = typeof o.input === "string" ? o.input : null; // forge#4129: large prompt over stdin
2095
- try { child = spawn(bin, args, { cwd: o.cwd, env: o.env, stdio: [input === null ? "ignore" : "pipe", "pipe", "pipe"], detached: true }); }
2095
+ try { child = spawn(bin, args, { cwd: o.cwd, env: o.env, stdio: [input === null ? "ignore" : "pipe", "pipe", "pipe"], detached: true, windowsHide: true }); }
2096
2096
  catch (error) { return finish({ status: null, signal: null, pid: 0, error, stdout: "", stderr: "" }); }
2097
2097
  if (input !== null) { child.stdin.on("error", () => { /* child exited before reading: surfaced by close */ }); child.stdin.end(input); }
2098
2098
  const signalGroup = (sig) => { try { process.kill(-child.pid, sig); } catch { try { child.kill(sig); } catch { /* gone */ } } };
@@ -150,7 +150,10 @@ When a lane finishes (agent lanes; the batch runner applies the same rules itsel
150
150
  - `needs-human` with a **recoverable code**: `ci.red`, `base.conflict` (merge conflict), `ci-pending` on a conflicting
151
151
  PR, `contract.invalid` caused by an issue edited mid-run, `builder.block_untyped` (an in-scope technical choice),
152
152
  and the environment codes `env.tool_missing` (a validate command the host cannot run) and `env.repro_unrunnable`
153
- (the repro harness could not run the repro test).
153
+ (the repro harness could not run the repro test), and the conformance gaps `conformance.unimplemented`,
154
+ `conformance.omission` and `conformance.unjustified_deferral` (the recovery lane delivers the gap, or defers an optional
155
+ clause with a why so a tracked follow-up is filed; `conformance.regression`, `guard_broken`, `scope_creep` and
156
+ `e2e_unverified` stay terminal).
154
157
  These are mechanical. **Do not ask for confirmation on them.** The batch runner recovers each one itself
155
158
  (`orchestration.recovery.max_attempts`, default 1 per issue). It launches one recovery lane under the same lease, lane
156
159
  and admission rules as any lane, with `run-issue --recover <code> [--recover-attempt n]` (core path only:
@@ -166,7 +169,7 @@ When a lane finishes (agent lanes; the batch runner applies the same rules itsel
166
169
  the issue's last comment for the reason, mark its dependents skipped, and add it to the escalation list (step 4). Only
167
170
  explicit or logical edges skip a dependent (after you decide the block in scope, clear the label and run
168
171
  `forgedock orchestrate --requeue <id> N... --reason "..."`, never a second batch); an issue that merely overlaps the same file keeps running.
169
- - `needs-human` with a **terminal code** that is neither recoverable nor human (for example a `conformance.*` code, or
172
+ - `needs-human` with a **terminal code** that is neither recoverable nor human (for example `conformance.regression`, or
170
173
  `contract.invalid` without a mid-run issue edit): the runner does not recover it and it is not an escalation. The
171
174
  batch report lists it as `unrecovered: #N (<code>: <detail>)`, like a recovery that did not merge. Mark its dependents
172
175
  skipped and leave the issue for a later run once its cause is fixed.
package/docs/CONFIG.md CHANGED
@@ -439,10 +439,10 @@ orchestration:
439
439
  | `breaker.errors` / `breaker.window_min` | integer | No | `forgedock orchestrate` circuit breaker (#4121): after `errors` engine-errors within `window_min` minutes the batch stops admitting lanes, lets running lanes finish, and keeps the rest pending for `--resume`. `errors: 0` turns it off. Default: 3 in 30 |
440
440
  | `max_deferrals` | integer | No | `forgedock orchestrate`: requeues of one issue after a non-host `deferred` (usage limit, merge/push transient, CLI idle, lease held, gh unavailable) before its row is final. `host.busy` and `sandbox.capacity` (sandbox pool full) deferrals are not capped. Default: 3 |
441
441
  | `blocked_label` | string | No | `forgedock orchestrate` (#4773): an open issue carrying this label is admitted to the batch but not dispatched; removing the label releases it on the next scheduler pass. A `Blocked by #N` / `Depends on #N` line in the body of a trusted author (OWNER, MEMBER, COLLABORATOR or a bot) is a DAG edge to #N, and `--add` prints the edges it created. Empty turns the label off. Default: `blocked` |
442
- | `auto_add_children` | string | No | `forgedock orchestrate` (#4965): which children a running batch adds by itself. `off` (no auto-adds; a decomposed lane's sub-issues stay out too), `decomposed` (a decomposed lane's sub-issues join, as before), `epic` (also the open children of every batch issue and of each `--epic N`, found by a `**Parent**: #P` line, the `parent` field or GitHub sub-issues, including children filed after the batch started) or `all`. Children labelled `needs-human` and children another live batch of the repo still holds are not added. Each pass that adds posts one batch decision and one `added` row listing the children and edges. `forgedock orchestrate --auto-children <mode>` overrides it per batch and `--resume` keeps it. Default: `decomposed` |
442
+ | `auto_add_children` | string | No | `forgedock orchestrate` (#4965): which children a running batch adds by itself. `off` (no auto-adds; a decomposed lane's sub-issues stay out too), `decomposed` (a decomposed lane's sub-issues join, as before), `epic` (also the open children of every batch issue and of each `--epic N`, found by a `**Parent**: #P` line, the `parent` field or GitHub sub-issues, including children filed after the batch started) or `all`. Only children whose author is trusted (an owner, member or collaborator, or a bot, the `Blocked by` rule) are auto-added; any other is skipped with a logged row. Children labelled `needs-human` and children another live batch of the repo still holds are not added. Each pass that adds posts one batch decision and one `added` row listing the children and edges. `forgedock orchestrate --auto-children <mode>` overrides it per batch and `--resume` keeps it. Default: `decomposed` |
443
443
  | `auto_add_children_poll_s` | integer | No | Seconds between child scans for `epic`/`all` (one `gh issue list` per scan). Default: `120` |
444
444
  | `global_parallel` | integer | No | `forgedock orchestrate` (#4191): host-wide cap on running lanes across every batch and repo on the host, enforced through the host lane registry (`~/.forge/sched/`, or `FORGEDOCK_SCHED_DIR`). A freed slot goes to the highest-priority queued issue (`priority:P<n>` / `P<n>` labels, unlabelled P2); within a priority, slots are shared across repos by weight (#4193: `forgedock sched weight <owner/repo> N`, `--clear` resets; default equal, FIFO inside a repo), and priority always dominates weights; running lanes are never preempted and `--parallel` K still bounds each batch. `forgedock sched cap N` overrides it live for the whole host (`--clear` reverts); `forgedock sched show` lists the weights, slots and the queue. Default: unset (no global cap) |
445
- | `recovery.max_attempts` | integer | No | `forgedock orchestrate` in-batch recovery (#4267): how many recovery lanes the batch launches per issue for a `needs-human` with a mechanical code (`ci.red`, `base.conflict`, `ci-pending` on a conflicting PR, `contract.invalid` after a mid-run issue edit, `builder.block_untyped`). A recovery lane (`run-issue --recover <code>`) removes `needs-human`, posts a `FORGE:DECISION`, resumes the open PR and re-queues the issue with its dependents. If it ends anything but `merged`, the issue is labelled `needs-human` again with a recovery-evidence `FORGE:NEEDS_HUMAN` comment. Human codes are never recovered. Flat form: `recovery_max_attempts`. Default: 1; `0` disables in-batch recovery (a mechanical `needs-human` is final, as before). |
445
+ | `recovery.max_attempts` | integer | No | `forgedock orchestrate` in-batch recovery (#4267): how many recovery lanes the batch launches per issue for a `needs-human` with a mechanical code (`ci.red`, `base.conflict`, `ci-pending` on a conflicting PR, `contract.invalid` after a mid-run issue edit, `builder.block_untyped`, the `env.*` codes, `contract.invalid_command`, `budget.exceeded`, and since #5035 `conformance.unimplemented`, `conformance.omission` and `conformance.unjustified_deferral`; the full list is in docs/OUTCOME-CODES.md). A recovery lane (`run-issue --recover <code>`) removes `needs-human`, posts a `FORGE:DECISION`, resumes the open PR and re-queues the issue with its dependents. If it ends anything but `merged`, the issue is labelled `needs-human` again with a recovery-evidence `FORGE:NEEDS_HUMAN` comment. Human codes are never recovered. Flat form: `recovery_max_attempts`. Default: 1; `0` disables in-batch recovery (a mechanical `needs-human` is final, as before). |
446
446
  | `recovery.mechanical_max_attempts` | integer | No | `forgedock orchestrate` (#4725): the separate recovery budget of mechanical `needs-human` rows (`env.*`, `base.conflict`, a conflicting PR); never below `recovery.max_attempts`. Flat form: `recovery_mechanical_max_attempts`. Default: 2, so with the default config such a row gets 2 recovery lanes, not 1. |
447
447
  | `base_sync.enabled` | boolean | No | `forgedock orchestrate` parked-PR base sync (#4525): every 10 min while the batch runs, an open PR of a `needs-human` row is merged with its moved base in a throwaway worktree. A clean merge, or one whose only conflicts are hunks where both sides purely added lines in a `union_globs` file, is pushed as a plain merge commit (never forced). Any other conflict is aborted, the branch left alone, and its paths are posted once per base sha as a `FORGE:DECISION` on the issue. Sequence/`_journal.json` files are never resolved here. Flat form: `base_sync_enabled`. Default: `true`; `false` opts out. |
448
448
  | `base_sync.union_globs` | string | No | Comma-separated globs (`*` within a segment, `**` across; no `/` matches the file name anywhere) of well-known append-only files (registries, changelogs) whose two-sided line additions the base sync keeps both of. Flat form: `base_sync_union_globs`. Default: none (every conflict is reported). |
@@ -472,7 +472,7 @@ orchestration:
472
472
 
473
473
  ## `decisions` (OPTIONAL)
474
474
 
475
- Decision engine (#4766, see [DECISIONS.md](DECISIONS.md)). The parser has one nesting level and no arrays, so lists are comma-separated.
475
+ Decision engine (#4766, see [DECISIONS.md](DECISIONS.md)). **Not yet wired:** nothing calls `settle` in production, so `mode` (including `live`), `veto_hours` and `reversal_max` have no effect today; `policy` and `human_only` are read by prodwatch and issue-watch (`loadPolicy`) only. The parser has one nesting level and no arrays, so lists are comma-separated.
476
476
 
477
477
  | Key | Type | Description |
478
478
  |---|---|---|
@@ -605,7 +605,7 @@ engine:
605
605
  | `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. |
606
606
  | `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). |
607
607
  | `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. |
608
- | `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`; the parser reads one nested level into `engine`. `/orchestrate` requeues a host-busy lane and lowers K by 1 for 5 minutes. |
608
+ | `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. |
609
609
  | `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. |
610
610
  | `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. |
611
611
  | `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. |
@@ -1337,6 +1337,10 @@ verification:
1337
1337
  consumer_sweep:
1338
1338
  mode: advisory # advisory (default) | blocking
1339
1339
  budget_seconds: 60 # wall-clock budget for the sweep
1340
+
1341
+ test_runners: # path prefix -> runner command prefix (block-style map)
1342
+ services/worker: "poetry -C services/worker run"
1343
+ web: "pnpm --filter web exec"
1340
1344
  ```
1341
1345
 
1342
1346
  | Field | Type | Required | Description |
@@ -1353,6 +1357,7 @@ verification:
1353
1357
  | `commands.typescript.test_changed`, `commands.typescript.typecheck_changed`, `commands.python.test_changed` | string | No | Changed-file scoped steps for `/review-pr` Phase 2 (repos where the full typecheck or suite is too slow or heavy). They run in the per-PR worktree and read the PR's changed files that still exist from `$FORGE_CHANGED_FILES` (newline-separated environment variable; never spliced into the command string). Reported as Phase 2 evidence with `EXIT <lang>.<step>=<code>` like the full-repo steps; a non-zero `typecheck_changed` blocks, a failing `test_changed` follows the REAL/flaky rule of `test`. Examples: `vitest related $FORGE_CHANGED_FILES --run`; `pytest -q $(printf '%s\n' $FORGE_CHANGED_FILES \| grep 'test_.*\.py$')`. For `typecheck_changed`, filter the compiler output to the changed files so pre-existing errors elsewhere do not block. `forgedock init` suggests them when vitest or pytest is detected |
1354
1358
  | `consumer_sweep.mode` | string | No | `advisory` (default): the validate consumer sweep (`scripts/consumer-sweep.sh`, V4.6) records unaddressed referencing sites and never fails. `blocking`: unaddressed sites fail validate with `consumer_unaddressed`, build runs one repair round, and sites still unaddressed are recorded as `CONSUMERS: unresolved` and passed to review as known risk (never `needs-human`). Flip to `blocking` only after `bash scripts/consumer-sweep.sh --eval-history 20` shows a mean of at most 2 flagged sites per merge and none above 10 on your repo |
1355
1359
  | `consumer_sweep.budget_seconds` | integer | No | Wall-clock budget for the sweep (default `60`). When it runs out the sweep stops with `BUDGET_EXCEEDED`, reports the partial result, and never fails, in either mode |
1360
+ | `test_runners` | map (path prefix → runner) | No | Default unset (no runner enforced). For repos whose validate commands need a managed runner (uv, poetry, pnpm workspace). The lean engine checks it at contract freeze (`testRunnerProblems`, `bin/lean/preflight.mjs`): a validate command that touches a configured path prefix without containing that prefix's runner string is reported as a contract problem, instead of failing later as `contract.invalid_command` / `env.tool_missing`. Paths in the command are relative to the runner's cwd. Write it as a block-style map: `parseForgeYaml` does not read inline `{ ... }` maps. |
1356
1361
 
1357
1362
  **Commands that use this section**: `quality-gate`, `validate` (V2 runs `verification.commands`; V4.8 runs the local CI gate; health checks and `consumer_sweep`), `work-on`
1358
1363
 
package/docs/DECISIONS.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Decision engine (#4766)
2
2
 
3
+ > **Status: not yet wired.** No production code calls `settle` yet: the issue-watch stage does not run it, so `decisions.mode`
4
+ > (including `live`), `veto_hours` and `reversal_max` have no effect and no `decision_engine` telemetry is emitted. Only the policy
5
+ > and authority-matrix reads (`loadPolicy`) are used today, by prodwatch and issue-watch. The flow below describes the intended behaviour.
6
+
3
7
  Settles a lane's decision-only `needs-human` escalation against the target repo's own north star instead of parking it.
4
8
  Only external actions stay with a human. Code: `bin/lean/decision-engine.mjs`. Config: [`decisions:`](CONFIG.md).
5
9
 
@@ -29,4 +33,4 @@ Only external actions stay with a human. Code: `bin/lean/decision-engine.mjs`. C
29
33
  ## Not in this module
30
34
 
31
35
  The `issue-watch` stage that lists `needs-human` issues and calls `settle` (`sweep_needs_human`, `--dry-run` via `classify`, caps, status counts)
32
- lands with #4765. Running a declared monitor query for `evidence` and folding `post-deploy` items into the release checklist are follow-ups.
36
+ did not land with #4765 (merged without the sweep); a follow-up issue tracks it. Running a declared monitor query for `evidence` and folding `post-deploy` items into the release checklist are follow-ups.
@@ -45,6 +45,7 @@ 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
  | `engine.error` | Engine or tool failure (missing key/SDK, CLI crash, max turns, unresolved args, runner threw every attempt) | engine | `err.code` |
48
+ | `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` |
48
49
  | `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` |
49
50
  | `infra.disk_quota` | Disk full or quota exhausted (EDQUOT/ENOSPC, errno -28/-122); retryable infra failure, never `needs-human` | engine | Runner error text |
50
51
  | `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` |
@@ -107,13 +108,13 @@ An absent or unknown code is recorded as `unclassified`, with the raw reason kep
107
108
  `forgedock orchestrate` recovers mechanical outcomes inside the batch:
108
109
 
109
110
  - **recoverable**:
110
- - needs-human with `ci.red`, `base.conflict`, `builder.block_untyped`, `env.tool_missing`, `env.repro_unrunnable`, `env.validate_timeout`, `env.capability_remote`, `contract.invalid_command` or `budget.exceeded`;
111
+ - needs-human with `ci.red`, `base.conflict`, `builder.block_untyped`, `env.tool_missing`, `env.repro_unrunnable`, `env.validate_timeout`, `env.capability_remote`, `contract.invalid_command`, `budget.exceeded`, `conformance.unimplemented`, `conformance.omission` or `conformance.unjustified_deferral` (#5035: the recovery lane resumes the lane branch, delivers the named gap or records a defer-with-why amendment that files a tracked follow-up);
111
112
  - `contract.invalid` when the issue was edited mid-run (`issueEdited`);
112
113
  - `ci-pending` on a conflicting PR, recovered as `base.conflict`.
113
114
 
114
115
  The runner relaunches the issue once per `orchestration.recovery.max_attempts` (default 1) as a recovery lane (`run-issue --recover <code>`), under the normal admission rules. That lane removes the `needs-human` label, posts `FORGE:DECISION`, and resumes the open PR: base-sync, then CI fix rounds from the failed-check logs. Dependents stay queued. A merged recovery is reported as `recovered`. A failed one is final, keeps the recovery evidence on the row, and skips its dependents. A failed recovery stays `needs-human`: the lane re-adds the label (with a `FORGE:NEEDS_HUMAN` comment carrying the evidence) only for a final `needs-human` or `ci-pending`, and only when it is the last attempt (`attempt == max_attempts`); a non-final attempt that ends `needs-human` or `ci-pending` without another attempt following is re-labelled once by the batch runner; the batch runner re-adds it, once, for a final `engine-error` or `deferred` after the recovery pass (those may be requeued, so the lane cannot know). `invalid`, `decomposed`, `dependency-*` and `merged` never re-label. In-batch recovery is off when `engine.path: full`: the runner passes no recovery to the batch, and `run-issue --path full` rejects `--recover`.
115
116
  - **human**: `builder.blocked`, which is only reached by a typed human block: credentials, spend, promotion, customer or product-decision. It is never recovered, it skips dependents, and it is the only class in the report's escalation list.
116
- - **terminal**: every other code. No recovery runs, dependents are skipped, and the row is reported as `unrecovered`.
117
+ - **terminal**: every other code, including `conformance.regression`, `conformance.guard_broken` and `conformance.scope_creep`. No recovery runs, dependents are skipped, and the row is reported as `unrecovered`.
117
118
 
118
119
  ## Known limits
119
120
 
package/docs/TELEMETRY.md CHANGED
@@ -71,7 +71,7 @@ issue or PR.
71
71
 
72
72
  ## `decision_engine` (#4766)
73
73
 
74
- One record per escalation the north-star decision engine handled (`bin/lean/decision-engine.mjs`): `decided`, `escalated`,
74
+ Not emitted yet: the decision engine is not wired into issue-watch, so no record is written until it is. One record per escalation the north-star decision engine handled (`bin/lean/decision-engine.mjs`): `decided`, `escalated`,
75
75
  `vetoed`, `reversed` (counts, 0 or 1 per issue), `mode` (`shadow` or `live`), and `needs_human_before` / `needs_human_after`
76
76
  (the repo's open needs-human count around a sweep). A reversal rate (`reversed` over `decided`) above `decisions.reversal_max`
77
77
  turns the engine back to shadow. See [DECISIONS.md](DECISIONS.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgedock",
3
- "version": "1.43.0",
3
+ "version": "1.44.0",
4
4
  "description": "Autonomous development pipeline for coding agents. GitHub as institutional memory, with native Claude Code and OpenCode entrypoints.",
5
5
  "bin": {
6
6
  "forgedock": "bin/forgedock.mjs"
@@ -86,7 +86,7 @@ export async function acquireSlot(owner, deadline) {
86
86
  function exec(argv, { cwd, env, timeoutMs, onData }) {
87
87
  return new Promise((resolve) => {
88
88
  let child; let killed = false; let timer;
89
- try { child = spawn(argv[0], argv.slice(1), { cwd, env, detached: true, stdio: ['ignore', 'pipe', 'pipe'] }); } catch (e) { resolve({ code: 127, signal: null, error: e.message, timedOut: false }); return; }
89
+ try { child = spawn(argv[0], argv.slice(1), { cwd, env, detached: true, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] }); } catch (e) { resolve({ code: 127, signal: null, error: e.message, timedOut: false }); return; }
90
90
  const kill = () => { try { process.kill(-child.pid, 'SIGTERM'); } catch { /* gone */ } setTimeout(() => { try { process.kill(-child.pid, 'SIGKILL'); } catch { /* gone */ } }, 3000).unref(); };
91
91
  const unreg = () => { cleanups.delete(hard); };
92
92
  const hard = () => { try { process.kill(-child.pid, 'SIGKILL'); } catch { /* gone */ } };
@@ -58,11 +58,13 @@ export async function readLive({ gh, repo }) {
58
58
 
59
59
  /**
60
60
  * Parallel-start gate: dependencies of `issues` (not themselves in the batch) that are not merged into `baseOf(issue)`.
61
- * A dep is merged when it is CLOSED by a PR that is merged with that base. Unreadable issues are skipped (fail open:
61
+ * A dep is merged when it is CLOSED by a PR that is merged with that base, or whose merge commit is an ancestor of
62
+ * that base (`isAncestor(sha, base)`, e.g. it arrived through a milestone sync). Unreadable issues are skipped (fail open:
62
63
  * the engine's own openDependency still guards each lane); an unreadable dep counts as unmet.
63
- * @returns {Promise<Array<{ issue: number, dep: number, base: string, why: string }>>}
64
+ * `sha`/`kind` (#5031): `kind` is "commit" when the dependency merged but its commit is not on the base yet (`sha`), else "other".
65
+ * @returns {Promise<Array<{ issue: number, dep: number, base: string, why: string, sha: string|null, kind: "commit"|"other" }>>}
64
66
  */
65
- export async function unmetDependencies({ issues, baseOf, gh, repo }) {
67
+ export async function unmetDependencies({ issues, baseOf, gh, repo, isAncestor }) {
66
68
  const r = repo ? ["-R", repo] : [];
67
69
  const view = async (n, fields) => parse(await gh(["issue", "view", String(n), ...r, "--json", fields]));
68
70
  const inBatch = new Set(issues);
@@ -74,20 +76,25 @@ export async function unmetDependencies({ issues, baseOf, gh, repo }) {
74
76
  const base = await baseOf(n);
75
77
  if (!base) continue;
76
78
  for (const dep of parseDependsOn(rec.body, n).filter((d) => !inBatch.has(d))) {
77
- let why = null;
79
+ let why = null, sha = null;
78
80
  try {
79
81
  const d = await view(dep, "state,closedByPullRequestsReferences");
80
82
  if (String(d?.state).toUpperCase() !== "CLOSED") why = "not closed";
81
83
  else {
82
84
  let merged = false;
85
+ let missing = null;
83
86
  for (const pr of d.closedByPullRequestsReferences ?? []) {
84
- const p = parse(await gh(["pr", "view", String(pr.number), ...r, "--json", "baseRefName,mergedAt"]));
85
- if (p?.mergedAt && p.baseRefName === base) { merged = true; break; }
87
+ const p = parse(await gh(["pr", "view", String(pr.number), ...r, "--json", "baseRefName,mergedAt,mergeCommit"]));
88
+ if (!p?.mergedAt) continue;
89
+ const sha = p.mergeCommit?.oid;
90
+ if (p.baseRefName === base || (sha && isAncestor && await isAncestor(sha, base))) { merged = true; break; }
91
+ if (sha) missing ??= sha;
86
92
  }
87
- if (!merged) why = `closed but not merged into ${base}`;
93
+ if (!merged) sha = missing;
94
+ if (!merged) why = missing ? `merge commit ${missing.slice(0, 10)} is not on ${base}` : `closed but not merged into ${base}`;
88
95
  }
89
96
  } catch { why = "unreadable"; }
90
- if (why) unmet.push({ issue: n, dep, base, why });
97
+ if (why) unmet.push({ issue: n, dep, base, why, sha, kind: sha ? "commit" : "other" });
91
98
  }
92
99
  }
93
100
  return unmet;