forgedock 1.66.0 → 1.67.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 (72) hide show
  1. package/bin/config-schema.mjs +2 -0
  2. package/bin/engine/outcome-codes.mjs +1 -0
  3. package/bin/engine-cli.mjs +96 -17
  4. package/bin/forgedock.mjs +7 -0
  5. package/bin/help-text.mjs +3 -3
  6. package/bin/introspect-schedule.mjs +98 -0
  7. package/bin/introspect-schedule.test.mjs +67 -0
  8. package/bin/lean/advisory.test.mjs +49 -0
  9. package/bin/lean/amendment-schema.mjs +31 -0
  10. package/bin/lean/attempts.mjs +159 -0
  11. package/bin/lean/attempts.test.mjs +127 -0
  12. package/bin/lean/basered.mjs +55 -0
  13. package/bin/lean/basered.test.mjs +68 -1
  14. package/bin/lean/batch-health.mjs +3 -0
  15. package/bin/lean/batch-health.test.mjs +16 -0
  16. package/bin/lean/batch.mjs +45 -0
  17. package/bin/lean/batch.test.mjs +54 -3
  18. package/bin/lean/capwait.mjs +14 -3
  19. package/bin/lean/capwait.test.mjs +20 -0
  20. package/bin/lean/clear-breaker.mjs +14 -0
  21. package/bin/lean/commentstate.mjs +41 -0
  22. package/bin/lean/commentstate.test.mjs +32 -0
  23. package/bin/lean/concurrency.mjs +89 -0
  24. package/bin/lean/concurrency.test.mjs +113 -0
  25. package/bin/lean/conformance.e2e.test.mjs +4 -2
  26. package/bin/lean/conformance.mjs +35 -3
  27. package/bin/lean/conformance.test.mjs +52 -0
  28. package/bin/lean/efficiency.mjs +162 -0
  29. package/bin/lean/efficiency.test.mjs +79 -0
  30. package/bin/lean/execution.mjs +31 -13
  31. package/bin/lean/execution.test.mjs +46 -0
  32. package/bin/lean/failure-stop.mjs +46 -0
  33. package/bin/lean/failure-stop.test.mjs +45 -0
  34. package/bin/lean/fixtures/capacity-storm.json +609 -0
  35. package/bin/lean/lean.mjs +123 -24
  36. package/bin/lean/lean.test.mjs +137 -46
  37. package/bin/lean/liveness.mjs +37 -0
  38. package/bin/lean/liveness.test.mjs +33 -0
  39. package/bin/lean/orchestrate-attempts.test.mjs +74 -0
  40. package/bin/lean/orchestrate-pause.test.mjs +23 -0
  41. package/bin/lean/orchestrate-reconcile.test.mjs +147 -0
  42. package/bin/lean/orchestrate.mjs +170 -26
  43. package/bin/lean/phaseledger.mjs +6 -0
  44. package/bin/lean/phaseledger.test.mjs +13 -1
  45. package/bin/lean/prompts.mjs +6 -10
  46. package/bin/lean/reconcile.mjs +90 -0
  47. package/bin/lean/recurrence.mjs +38 -2
  48. package/bin/lean/recurrence.test.mjs +56 -1
  49. package/bin/lean/sandbox-remote.mjs +33 -2
  50. package/bin/lean/sched.mjs +19 -0
  51. package/bin/lean/sched.test.mjs +11 -1
  52. package/bin/lean/schedd-health.mjs +4 -4
  53. package/bin/lean/schedd-health.test.mjs +8 -4
  54. package/bin/lean/schedd.mjs +34 -2
  55. package/bin/lean/schedd.test.mjs +55 -2
  56. package/bin/lean/slo.mjs +126 -0
  57. package/bin/lean/slo.test.mjs +112 -0
  58. package/bin/lean/statuscomment.mjs +37 -0
  59. package/bin/lean/statuscomment.test.mjs +48 -1
  60. package/bin/lean/verify.mjs +2 -1
  61. package/bin/pool/agent.mjs +2 -2
  62. package/bin/pool/cli.mjs +16 -1
  63. package/bin/pool/lane-tools.mjs +21 -0
  64. package/bin/stats/attempts.mjs +54 -0
  65. package/bin/stats/attempts.test.mjs +30 -0
  66. package/bin/stats/churn.mjs +49 -0
  67. package/bin/stats/churn.test.mjs +31 -0
  68. package/bin/stats/index.mjs +11 -3
  69. package/commands/orchestrate.md +21 -18
  70. package/docs/OUTCOME-CODES.md +1 -0
  71. package/package.json +1 -1
  72. package/scripts/check-devdocs-freshness.sh +1 -1
@@ -0,0 +1,31 @@
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 { churnStats, formatChurnLines, readChurn } from "./churn.mjs";
6
+
7
+ const c = (marker, extra = "") => ({ body: `<!-- FORGE:${marker} -->\n${extra}` });
8
+ describe("comment churn (#5979)", () => {
9
+ const issues = [
10
+ { issue: 1, comments: [c("NEEDS_HUMAN", "sig=aaaaaaaaaaaa"), c("PARKED", "sig=aaaaaaaaaaaa"), c("DEPENDENCY"), { body: "a person wrote this" }] },
11
+ { issue: 2, comments: [c("STATUS")] },
12
+ ];
13
+ it("counts FORGE comments per issue and repeated failures", () => {
14
+ const s = churnStats(issues);
15
+ assert.deepEqual(s.perIssue, [{ issue: 1, comments: 3, repeats: 1 }, { issue: 2, comments: 1, repeats: 0 }]);
16
+ assert.equal(s.max, 3);
17
+ assert.equal(s.median, 2);
18
+ assert.equal(s.repeated, 1);
19
+ });
20
+ it("different signatures are not a repeat", () => {
21
+ assert.equal(churnStats([{ issue: 3, comments: [c("NEEDS_HUMAN", "sig=aaaaaaaaaaaa"), c("NEEDS_HUMAN", "sig=bbbbbbbbbbbb")] }]).repeated, 0);
22
+ });
23
+ it("formats lines, and none for no issues", () => {
24
+ assert.match(formatChurnLines(churnStats(issues))[0], /comments per issue: max 3, median 2 \(#1: 3, #2: 1\); repeated failures: 1/);
25
+ assert.deepEqual(formatChurnLines(churnStats([])), []);
26
+ });
27
+ it("readChurn never throws", async () => {
28
+ assert.deepEqual(await readChurn({ gh: async () => { throw new Error("x"); }, repo: "o/r", issues: [1] }), []);
29
+ assert.deepEqual(await readChurn({ gh: null, repo: "o/r", issues: null }), []);
30
+ });
31
+ });
@@ -23,6 +23,7 @@ import { readExperiment } from "../experiment.mjs";
23
23
  import { compoundingReport, gatherCompounding, renderCompounding, DEFAULT_BUCKETS, DEFAULT_WINDOW_MS } from "./compounding.mjs";
24
24
  import { poolUtilisation, formatPoolLines } from "./pool.mjs";
25
25
  import { chainsReport, formatChainLines } from "./chains.mjs";
26
+ import { attemptsReport, formatAttemptLines } from "./attempts.mjs";
26
27
  import { ciAwarenessReport, readCiLogs, renderCiAwareness } from "./ci-awareness.mjs";
27
28
  import { gatherIssues, selfFiledReport, renderSelfFiled } from "./selffiled.mjs";
28
29
  import { firstReviewReport, renderFirstReview } from "./first-review.mjs";
@@ -43,6 +44,7 @@ export const HELP = `Usage: forgedock stats [--since <version|date>] [--repo <ow
43
44
  forgedock stats --by version [--post-metrics <pr>] [--min-n N] [--repo <owner/repo>] [--json]
44
45
  forgedock stats --pool [--window 7d,30d] [--repo <owner/repo>] [--json]
45
46
  forgedock stats --chains [--window 7d,30d] [--repo <owner/repo>] [--json]
47
+ forgedock stats --attempts [--window 7d,30d] [--repo <owner/repo>] [--json]
46
48
  forgedock stats --ci-awareness [--repo <owner/repo>] [--since <date>] [--json]
47
49
  forgedock stats --first-review [--repo <owner/repo>] [--since <date>] [--min-n 20] [--json]
48
50
  forgedock stats --first-merge [--repo <owner/repo>[,<owner/repo>...]] [--json]
@@ -105,6 +107,7 @@ Pool (forge#4549; local batch reports, no gh):
105
107
  --ci-awareness median/p90 CI awareness latency, CI rounds per PR and wall per round, per engine version, from local run logs (#5692);
106
108
  --since <date> keeps only the lanes started on/after that date
107
109
  --pool remote lane minutes, lanes and share per pool agent over --window (default 7d,30d)
110
+ --attempts lanes per merged issue (failed lanes in the attempts ledger + the merging one) and engine comments per issue, from local batch files (#5986)
108
111
  --chains stacked-lane chains from local batch reports: wall time p50 by depth, per-link overlap, cascade rework rate (#5834)
109
112
 
110
113
  Efficiency (forge#4402; local batch dirs and run logs, gh only for merged issues' bodies, labels and probes):
@@ -174,7 +177,7 @@ Lane profile baseline (forge#4436; local run logs only, every run of each issue,
174
177
  export function experimentExit(opts, report) { return opts.requireMet && report.targets_met !== true ? 1 : 0; }
175
178
 
176
179
  export function parseArgs(argv) {
177
- const o = { card: false, week: false, month: false, includeRepoNames: false, publicRepo: false, out: null, depth: false, conformanceOutcomes: false, windowDays: null, since: null, repo: null, edge: null, milestone: null, contextAb: false, exploreAb: false, tiers: false, compounding: false, selfFiled: false, origin: false, firstMerge: false, bucket: null, laneProfile: false, issues: null, efficiency: false, pool: false, chains: false, ciAwareness: false, batch: null, windows: null, compare: null, by: null, experiment: null, emitEvent: false, requireMet: false, postMetrics: null, offline: false, json: false, refresh: false, compact: false, local: true, cache: true, minN: DEFAULT_MIN_N, releaseTimes: null, help: false };
180
+ const o = { card: false, week: false, month: false, includeRepoNames: false, publicRepo: false, out: null, depth: false, conformanceOutcomes: false, windowDays: null, since: null, repo: null, edge: null, milestone: null, contextAb: false, exploreAb: false, tiers: false, compounding: false, selfFiled: false, origin: false, firstMerge: false, bucket: null, laneProfile: false, issues: null, efficiency: false, pool: false, chains: false, attempts: false, ciAwareness: false, batch: null, windows: null, compare: null, by: null, experiment: null, emitEvent: false, requireMet: false, postMetrics: null, offline: false, json: false, refresh: false, compact: false, local: true, cache: true, minN: DEFAULT_MIN_N, releaseTimes: null, help: false };
178
181
  const val = (i, name) => {
179
182
  const v = argv[i + 1];
180
183
  if (v == null || v.startsWith("--")) throw new Error(`${name} needs a value`);
@@ -210,6 +213,7 @@ export function parseArgs(argv) {
210
213
  else if (name === "--depth") o.depth = true;
211
214
  else if (name === "--pool") o.pool = true;
212
215
  else if (name === "--chains") o.chains = true;
216
+ else if (name === "--attempts") o.attempts = true;
213
217
  else if (name === "--release-ledger") o.releaseLedger = true;
214
218
  else if (name === "--baseline") { const v = take(); if (v !== "save" && v !== "compare") throw new Error("--baseline must be save or compare"); o.baseline = v; }
215
219
  else if (name === "--baseline-file") o.baselineFile = take();
@@ -246,10 +250,10 @@ export function parseArgs(argv) {
246
250
  }
247
251
  if ((o.week || o.month || o.includeRepoNames || o.publicRepo || o.out) && !o.card) throw new Error("--week, --month, --include-repo-names, --public-repo and --out need --card");
248
252
  if (o.week && o.month) throw new Error("--week and --month are mutually exclusive");
249
- if (o.card && (o.depth || o.pool || o.chains || o.ciAwareness || o.efficiency || o.compounding || o.selfFiled || o.conformanceOutcomes || o.contextAb || o.exploreAb || o.tiers || o.laneProfile || o.edge || o.milestone || o.experiment || o.by)) throw new Error("--card cannot be combined with another query mode");
253
+ if (o.card && (o.depth || o.pool || o.chains || o.attempts || o.ciAwareness || o.efficiency || o.compounding || o.selfFiled || o.conformanceOutcomes || o.contextAb || o.exploreAb || o.tiers || o.laneProfile || o.edge || o.milestone || o.experiment || o.by)) throw new Error("--card cannot be combined with another query mode");
250
254
  if (o.card && (o.week || o.month) && o.since) throw new Error("--week/--month and --since are mutually exclusive");
251
255
  if (o.batch && !o.efficiency) throw new Error("--batch and --window need --efficiency");
252
- if (o.windows && !o.efficiency && !o.pool && !o.chains && !o.compounding) throw new Error("--batch and --window need --efficiency");
256
+ if (o.windows && !o.efficiency && !o.pool && !o.chains && !o.attempts && !o.compounding) throw new Error("--batch and --window need --efficiency");
253
257
  if (o.bucket && !o.compounding) throw new Error("--bucket needs --compounding");
254
258
  if (o.compare && !o.efficiency) throw new Error("--compare and --offline need --efficiency");
255
259
  if (o.offline && !o.efficiency && !o.depth) throw new Error("--compare and --offline need --efficiency (--offline also works with --depth)");
@@ -429,6 +433,9 @@ export async function buildReport(opts, deps = {}) {
429
433
  const pool = poolUtilisation({ batchRoot: deps.batchRoot ?? batchRoot(env), repo, windows: opts.windows ?? parseWindows("7d,30d"), now: deps.now?.() ?? Date.now() });
430
434
  return { repo, query: { pool } };
431
435
  }
436
+ if (opts.attempts) { // #5986: local batch files only
437
+ return { repo, query: { attempts: attemptsReport({ batchRoot: deps.batchRoot ?? batchRoot(env), repo, windows: opts.windows ?? parseWindows("7d,30d"), now: deps.now?.() ?? Date.now() }) } };
438
+ }
432
439
  if (opts.chains) { // #5834: local batch reports only
433
440
  return { repo, query: { chains: chainsReport({ batchRoot: deps.batchRoot ?? batchRoot(env), repo, windows: opts.windows ?? parseWindows("7d,30d"), now: deps.now?.() ?? Date.now() }) } };
434
441
  }
@@ -583,6 +590,7 @@ export async function runStats(argv, deps = {}) {
583
590
  if (report.query?.self_filed && !opts.json) { process.stdout.write(`${renderSelfFiled(report.query.self_filed)}\n`); return 0; }
584
591
  if (report.query?.depth && !opts.json) { process.stdout.write(`${renderDepth(report.query.depth, { repo: report.repo, since: opts.since })}\n`); return 0; }
585
592
  if (report.query?.ci_awareness && !opts.json) { process.stdout.write(`${renderCiAwareness(report.query.ci_awareness)}\n`); return 0; }
593
+ if (report.query?.attempts && !opts.json) { process.stdout.write(`${formatAttemptLines(report.query.attempts).join("\n")}\n`); return 0; }
586
594
  if (report.query?.chains && !opts.json) { process.stdout.write(`${formatChainLines(report.query.chains).join("\n")}\n`); return 0; }
587
595
  if (report.query?.pool && !opts.json) { process.stdout.write(`${formatPoolLines(report.query.pool).join("\n")}\n`); return 0; }
588
596
  if (report.query?.efficiency && !opts.json) {
@@ -58,12 +58,10 @@ Do this yourself. Spawn no sub-agents here.
58
58
  `K` = `--parallel` if given, otherwise `orchestration.max_concurrent` from the repo's `forge.yaml`
59
59
  (`yq '.orchestration.max_concurrent' forge.yaml`), otherwise 3.
60
60
 
61
- **Lanes (base branches).** Each issue has its own lane, and ForgeDock works it out: an issue with a milestone
62
- goes to forge.yaml `branches.feature_pattern` (`milestone/<slug>`, which must exist on origin), any other issue
63
- to `branches.staging`. The default (production) branch is never a lane. Do not pass `--lane`; a `--lane` that
64
- differs from the issue's lane is refused (`lane-refused`, `lane.mismatch`). A dependency edge between two lanes
65
- (for example a milestone issue waiting on a staging-lane fix) never gets that fix on its base: list it in the
66
- plan and either re-milestone the dependency or wait for a milestone sync. Never mix lanes silently.
61
+ **Lanes (base branches).** ForgeDock picks each issue's lane: a milestone issue goes to forge.yaml
62
+ `branches.feature_pattern` (`milestone/<slug>`, must exist on origin), any other to `branches.staging`, never the
63
+ default branch. Do not pass `--lane` (a mismatch is refused: `lane-refused`, `lane.mismatch`). A cross-lane dependency
64
+ never gets the fix on its base: list it, then re-milestone the dependency or wait for a milestone sync.
67
65
 
68
66
  ## 3. Launch lanes
69
67
 
@@ -119,14 +117,11 @@ remaining maintenance once no feature is pending; otherwise the rest ends `held
119
117
  When a lane finishes (agent lanes; the batch runner applies the same rules itself):
120
118
  - `deferred` (lease held by another or a dead session): put it back in the queue and retry after the
121
119
  lease time printed in its output.
122
- - `deferred` with "host busy" (code `host.busy`: the host is short of memory, tmp space or CPU headroom;
123
- no lease was taken and nothing was posted): put the issue back in the queue and lower the effective K by
124
- 1 for the next 5 minutes, never below 1. Before raising K back, start one lane and check that it is not
125
- host busy again.
126
- - `deferred` with `rate_limited` (usage limit; the last output line carries the reset time): stop launching
127
- new lanes until that reset time, let running lanes finish, then resume the queue.
128
- - `dependency-open`: the engine or the builder found a dependency you missed (its output names it). This is a
129
- scheduling fact, not a failure: add the edge and requeue the issue behind it. Do not skip its dependents.
120
+ - `deferred` `host.busy` (host short of memory, tmp or CPU; nothing taken or posted): requeue it and lower K by 1
121
+ for 5 minutes (never below 1); before raising K, check one lane is not host busy again.
122
+ - `deferred` `rate_limited`: launch nothing until the reset time on its last line; running lanes finish.
123
+ - `dependency-open`: the engine or the builder found a dependency you missed (its output names it). A
124
+ scheduling fact, not a failure: add the edge and requeue the issue behind it. Keep its dependents.
130
125
  If the dependency is outside the set and agents can resolve it, add it to the batch and launch it.
131
126
  - `lane-refused` (codes `lane.mismatch`, `lane.default_branch`, `lane.branch_missing`, `lane.unresolved`): nothing
132
127
  ran (no lease, comment or worktree). Report the code and its detail (for example a missing `milestone/<slug>`
@@ -191,10 +186,7 @@ other lane running meanwhile.
191
186
 
192
187
  ## 3b. Settle scope (#4665)
193
188
 
194
- When settle begins, freeze the milestone's issue set (`scripts/settle-scope.mjs` `freezeScope`). Issues filed later are
195
- classified by `classifyNew`: decomposition children of a frozen issue stay in the milestone and join the measured set;
196
- deferred follow-ups go to the next milestone or the backlog; review findings and others count as growth only.
197
- `convergence` measures the frozen set plus those children; a STOP prints `formatStopReport` (growth and sources).
189
+ At settle, freeze the milestone's issue set and classify later issues with `scripts/settle-scope.mjs` (its header documents the rules).
198
190
 
199
191
  ## 4. Report
200
192
 
@@ -207,3 +199,14 @@ show `invalid (pre-filter)`). Then print:
207
199
  5. one escalation list: the human-code `needs-human` issues only, asked once.
208
200
 
209
201
  Nothing else.
202
+
203
+ ## Standing orders (`--select`)
204
+
205
+ `forgedock orchestrate --select '<query>'` (a GitHub issue search: `no:milestone`, `milestone:X`, `label:Y`) stores the selector in the batch and keeps owning it; no watcher process is needed (the schedd-hosted runner reconciles every few minutes):
206
+
207
+ - matching open issues join under the same DAG, priority and lane rules as `--add`; closed or moved ones leave.
208
+ - an issue stays scheduled until it is closed, merged, or blocked by a human code (credentials, spend, customer, promotion, product decision). Re-admission needs no operator command: `deferred` retries with exponential backoff (cap 2 h); `held` / `engine-error` re-admit on an agent or lane-image version change or after a 6 h cooldown; a conformance failure gets one more attempt after the base moves, then is listed in a single "needs decision" digest; the engine's `env.*` issue joins the order and its closure re-admits the waiters.
209
+ - the breaker resets itself after a cooldown when the failures were environmental (VM restart, mirror, network) and the pool is healthy, with a FORGE:DECISION.
210
+ - a merge into a staging lane branch closes the issue (and notes it on the post-deploy rollup when `FORGE_POSTDEPLOY_ROLLUP=<issue>` is set).
211
+
212
+ `forgedock orchestrate --status <id>` shows the coverage: matching open = running + queued + backing-off + waiting on deps + human-blocked (listed) + unscheduled. `unscheduled: 0` is the healthy state.
@@ -96,6 +96,7 @@ An absent or unknown code is recorded as `unclassified`, with the raw reason kep
96
96
  | `conformance.omission` | Core work-on: an issue requirement is missing from or narrowed by the frozen contract, after one builder resume | lean | Review `issue_coverage` row not `covered` |
97
97
  | `conformance.unimplemented` | Core work-on: a contracted requirement is partial, missing or unvalidated, or a validate command failed, after one builder resume (a validate the host cannot run for a missing tool or module is `env.tool_missing`, and a repro test the harness cannot run on head is `env.repro_unrunnable`, instead) | lean | Precheck (result.json, validation) or review requirement row |
98
98
  | `conformance.scope_creep` | Core work-on: a changed file is not authorized by a deliverable or typed amendment, after one builder resume | lean | Precheck changed files or review `scope` row `none` |
99
+ | `failure.repeated` | Core work-on: the same failure (code and normalised detail) ended a second lane of the issue; parked with one summary comment, never recovered (#5979) | lean | Second NEEDS_HUMAN/PARKED comment carrying the same `sig=` |
99
100
  | `conformance.untracked_deferral` | Core work-on: a requirement was deferred without a typed amendment or a tracking issue, after one builder resume | lean | Precheck or review requirement row `deferred` on a `deliver` requirement |
100
101
  | `conformance.e2e_unverified` | Core work-on: a `[type:e2e]` requirement is implemented but its validate is not a real end-to-end check (the repo's e2e set, Playwright, live stack), after one builder resume | lean | Review requirement row `implemented` with a unit-test `validated_by` (`bin/lean/conformance.mjs` `e2eVerified`) |
101
102
  | `conformance.unjustified_deferral` | Core work-on: the reviewer judged a deferred or post-deploy requirement unjustified (it belongs in this change), after one builder resume; nothing is filed or merged | lean | Review requirement row `deferral_ok: false` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgedock",
3
- "version": "1.66.0",
3
+ "version": "1.67.0",
4
4
  "description": "An AI engineering team that ships to production",
5
5
  "bin": {
6
6
  "forgedock": "bin/forgedock.mjs"
@@ -118,8 +118,8 @@ echo "ERROR: behaviour changed under bin/lean/ or scripts/ without a docs update
118
118
  printf '%s' "$MISSING" | sed 's/^/ - /'
119
119
  echo ""
120
120
  echo "Fix with one of:"
121
+ echo " - add devdocs/decisions/<issue>-<slug>.md (preferred: a new file never conflicts with parallel PRs)"
121
122
  echo " - edit the matching dossier (devdocs/index.yaml modules: glob -> devdocs/modules/*.md)"
122
123
  echo " - update NORTHSTAR.md § Runtime map"
123
- echo " - add devdocs/decisions/<issue>-<slug>.md"
124
124
  echo " - or add a line 'docs-not-needed: <reason>' to the PR body"
125
125
  exit 1