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.
Files changed (103) hide show
  1. package/bin/engine/outcome-codes.mjs +3 -0
  2. package/bin/engine/telemetry-seam.mjs +4 -2
  3. package/bin/engine-cli.mjs +61 -17
  4. package/bin/experiment.mjs +58 -6
  5. package/bin/forge-utils.mjs +6 -2
  6. package/bin/forgedock.mjs +25 -1
  7. package/bin/lean/account-watch.mjs +28 -0
  8. package/bin/lean/account-watch.test.mjs +30 -0
  9. package/bin/lean/activation.mjs +20 -0
  10. package/bin/lean/activation.test.mjs +14 -1
  11. package/bin/lean/basered.mjs +115 -0
  12. package/bin/lean/basered.test.mjs +66 -0
  13. package/bin/lean/batch-health.mjs +40 -6
  14. package/bin/lean/batch-health.test.mjs +34 -1
  15. package/bin/lean/batch.mjs +41 -2
  16. package/bin/lean/batch.test.mjs +104 -2
  17. package/bin/lean/checkpoint-reconcile.mjs +43 -0
  18. package/bin/lean/checkpoint-reconcile.test.mjs +95 -0
  19. package/bin/lean/conformance.e2e.test.mjs +1 -1
  20. package/bin/lean/conformance.mjs +205 -23
  21. package/bin/lean/conformance.test.mjs +164 -3
  22. package/bin/lean/context.mjs +27 -17
  23. package/bin/lean/context.test.mjs +15 -0
  24. package/bin/lean/effects.mjs +11 -7
  25. package/bin/lean/execution.mjs +19 -3
  26. package/bin/lean/execution.test.mjs +39 -0
  27. package/bin/lean/findinglabel.mjs +16 -0
  28. package/bin/lean/findinglabel.test.mjs +39 -0
  29. package/bin/lean/heavy.mjs +6 -3
  30. package/bin/lean/hostload.mjs +78 -0
  31. package/bin/lean/hostload.test.mjs +117 -0
  32. package/bin/lean/hotspots-remote.e2e.test.mjs +71 -0
  33. package/bin/lean/issuewatch-release.mjs +6 -2
  34. package/bin/lean/issuewatch-release.test.mjs +16 -0
  35. package/bin/lean/issuewatch.mjs +11 -1
  36. package/bin/lean/lanelock.mjs +14 -0
  37. package/bin/lean/lean.mjs +171 -36
  38. package/bin/lean/lean.test.mjs +302 -10
  39. package/bin/lean/light.mjs +48 -7
  40. package/bin/lean/light.test.mjs +37 -3
  41. package/bin/lean/limits.test.mjs +142 -9
  42. package/bin/lean/orchestrate-cancel.test.mjs +143 -0
  43. package/bin/lean/orchestrate.mjs +110 -26
  44. package/bin/lean/postdeploy-check.test.mjs +39 -0
  45. package/bin/lean/prompts.mjs +8 -7
  46. package/bin/lean/quota.mjs +39 -0
  47. package/bin/lean/recovery.test.mjs +10 -0
  48. package/bin/lean/relaxation.mjs +73 -0
  49. package/bin/lean/relaxation.test.mjs +54 -0
  50. package/bin/lean/release-postmerge.mjs +119 -0
  51. package/bin/lean/release-rehearsal.mjs +63 -0
  52. package/bin/lean/release-rehearsal.test.mjs +93 -0
  53. package/bin/lean/release-review.e2e.test.mjs +77 -0
  54. package/bin/lean/release-review.mjs +198 -0
  55. package/bin/lean/release-review.test.mjs +180 -0
  56. package/bin/lean/release.mjs +228 -0
  57. package/bin/lean/release.test.mjs +292 -0
  58. package/bin/lean/rotator.mjs +150 -31
  59. package/bin/lean/rotator.test.mjs +105 -2
  60. package/bin/lean/sandbox-remote.mjs +9 -2
  61. package/bin/lean/schedd.mjs +56 -6
  62. package/bin/lean/schedd.test.mjs +108 -6
  63. package/bin/lean/verifier.mjs +3 -2
  64. package/bin/lean/verify.mjs +2 -1
  65. package/bin/lean/verify.test.mjs +6 -0
  66. package/bin/pool/agent.mjs +18 -4
  67. package/bin/pool/router.mjs +68 -25
  68. package/bin/review-staging.mjs +23 -0
  69. package/bin/stats/conformance-outcomes.mjs +208 -0
  70. package/bin/stats/conformance-outcomes.test.mjs +188 -0
  71. package/bin/stats/depth.mjs +218 -0
  72. package/bin/stats/depth.test.mjs +133 -0
  73. package/bin/stats/experiment.mjs +7 -5
  74. package/bin/stats/github-source.mjs +2 -2
  75. package/bin/stats/index.mjs +64 -2
  76. package/bin/stats/local-source.mjs +11 -0
  77. package/bin/stats/query.mjs +69 -0
  78. package/bin/stats/selffiled.mjs +52 -0
  79. package/bin/stats/selffiled.test.mjs +71 -0
  80. package/commands/orchestrate.md +1 -1
  81. package/commands/review-pr-agents/security.md +4 -0
  82. package/commands/review-pr-staging.md +2 -0
  83. package/commands/work-on/build.md +4 -6
  84. package/docs/CONFIG.md +66 -8
  85. package/docs/ISSUE-WATCH.md +2 -0
  86. package/docs/OUTCOME-CODES.md +3 -0
  87. package/docs/STATS.md +44 -0
  88. package/docs/TELEMETRY.md +1 -1
  89. package/package.json +1 -1
  90. package/pool/README.md +1 -1
  91. package/pool/image/cs-cred +14 -1
  92. package/pool/install/install-agent.ps1 +6 -2
  93. package/scripts/backfill-finding-labels.mjs +50 -0
  94. package/scripts/backfill-finding-labels.test.mjs +36 -0
  95. package/scripts/doctor-pipeline-state.sh +21 -6
  96. package/scripts/file-deferred-followups.sh +60 -238
  97. package/scripts/file-deferred-followups.test.sh +99 -187
  98. package/scripts/followup-route.mjs +12 -0
  99. package/scripts/hotspots.sh +12 -8
  100. package/scripts/hotspots.test.sh +22 -0
  101. package/scripts/owner-route-parity.test.sh +17 -1
  102. package/scripts/prior-attempts.test.mjs +1 -1
  103. package/scripts/review-pr-side-effects.test.sh +40 -0
package/docs/TELEMETRY.md CHANGED
@@ -43,7 +43,7 @@ is dropped. Payload keys are `[A-Za-z0-9_]+` and cannot shadow the shared keys;
43
43
  | `ci_local_check` | `scripts/ci-local.sh run`, one per scoped, widened or executed check (at most 20 per run) | `job`, `selector`, `selected`, `total`, `cache` = `hit` \| `miss` \| `dedup` \| `na`, `duration_ms`, `wait_ms` (job slot wait), `widen` (reason or `none`). A remote-CI failure at merge on a check recorded here as narrowed is a selector bug |
44
44
  | `liveness` | `scripts/remediate-liveness.sh` | `decision` = `PROCEED` \| `DEFER` \| `EXHAUSTED`, `why` |
45
45
  | `phase_attempt` | the engine (`bin/engine/telemetry-seam.mjs`, one per phase attempt; `phase` = the phase id) | `attempt`, `trigger` (#4362: why the attempt ran, one of `plan`, `build`, `block_correction`, `contract_correction`, `precheck`, `structure`, `docs`, `enumerating`, `sequence`, `ci_unavailable`, `ci_red`, `conformance`, `review`, `merge_ci`, `timeout_restart`, `recovery`; `restart_of` = the trigger a `timeout_restart` replaced), `model`, `backend` (`cli`/`api`), `turns`, `duration_ms`, `cost_usd` (the raw reported value: a running total when the attempt resumed a CLI session), `cost_usd_delta` (#4407: this attempt's cost; consumers sum it when present, else `cost_usd`), `cost_usd_session` (the CLI session's running total), `input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_creation_tokens` (any value the runner did not report is omitted) |
46
- | `run_terminal` | the engine (`terminate()`, one per run segment) | `experiment` and `arm` (#4629, only when forge.yaml declares an `experiment:`; also on `phase_attempt`), `reason` (terminal reason), `code` (see `docs/OUTCOME-CODES.md`), `wall_ms` (this engine process, start to terminal) |
46
+ | `run_terminal` | the engine (`terminate()`, one per run segment) | `experiment` and `arm` (#4629, only when forge.yaml declares an `experiment:`; also on `phase_attempt`), `arm_overrides` (#5206, with them: the arm's applied overrides as sorted `key=value,...`, `none` when the arm has none), `reason` (terminal reason), `code` (see `docs/OUTCOME-CODES.md`), `wall_ms` (this engine process, start to terminal) |
47
47
 
48
48
  The engine records carry `run` = `r_<issue>_<start epoch seconds>` (one per `forgedock run-issue` process) so `forgedock stats`
49
49
  (`docs/STATS.md`) can group the attempts of a run and tell a finished run from an unfinished one. They are the GitHub-side
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgedock",
3
- "version": "1.51.0",
3
+ "version": "1.53.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"
package/pool/README.md CHANGED
@@ -10,6 +10,6 @@ ForgeDock's built-in remote compute pool (imported from computeshare; AGPL-3.0-o
10
10
 
11
11
  The module boundary is the ForgeDock HTTP sandbox protocol: the router speaks it to the dispatcher and relays to agents over HTTP. Sandboxes receive only short-lived GitHub and Claude access tokens; refresh tokens stay on the router host.
12
12
 
13
- Claude login choice (#5165): among the router host's logins with 30+ minutes left, the router hands out the one with the lowest 5-hour use in tokenbaton's `live.<n>` (account `n` = `~/.claude-<n>`), read from router.json `usage_source` (default `$TOKENBATON_HOME`, else `~/.tokenbaton`); validity only breaks ties. An account at or above `usage_ceiling_pct` (default 95) or at 100% weekly use is skipped; when every login is, `/agent/creds/claude` answers a typed 429 (`code: rate_limited`, `reset_at` = the earliest reset, `retry-after`), which the agent passes through and `cs-cred` prints as `usage limit hit; resets at <ISO>` so the lane defers. Without readable usage it falls back to the longest validity and logs a warning. The selected account index and usage are logged, never the token.
13
+ Claude login choice (#5165): among the router host's logins with 30+ minutes left, the router hands out the one with the lowest 5-hour use in tokenbaton's `live.<n>` (account `n` = `~/.claude-<n>`), read from router.json `usage_source` (default `$TOKENBATON_HOME`, else `~/.tokenbaton`); validity only breaks ties. An account at or above `usage_ceiling_pct` (default 95) or at 100% weekly use is skipped; when every login is, `/agent/creds/claude` answers a typed 429 (`code: rate_limited`, `reset_at` = the earliest reset, `retry-after`), which the agent passes through and `cs-cred` prints as `usage limit hit; resets at <ISO>` so the lane defers. Without readable usage it falls back to the longest validity and logs a warning. The selected account index and usage are logged, never the token. A sample whose 5-hour reset has passed is stale (#5205): unknown usage, never 0%, ranked after fresh samples. A lane that hits a usage limit runs `cs-cred claude --limited <reset>`, which drops the sandbox's cached token and posts to `/sandboxes/<id>/creds/claude/limited`; the agent drops its own cache and forwards to the router's `POST /agent/creds/claude/limited`, which excludes the account it last handed that agent until the reset (default one hour), then the lane fetches the next login and relaunches at once. With every login excluded or blocked, the 429 carries the earliest reset, limited accounts included.
14
14
 
15
15
  The `forgedock pool` CLI wiring is tracked separately (#4544).
@@ -2,9 +2,19 @@
2
2
  # SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
3
3
  # SPDX-License-Identifier: AGPL-3.0-or-later
4
4
  # cs-cred <github|claude>: prints a current credential, fetched through the agent and cached briefly.
5
+ # cs-cred claude --limited [reset]: the lane hit a usage limit (#5205): drop the cache, report it (reset: epoch s or
6
+ # unknown) so the router excludes that account until then, and fetch the next login's token as usual.
5
7
  set -euo pipefail
6
8
  kind="${1:?kind}"; ttl=240; [ "$kind" = claude ] && ttl=600
7
9
  cache="/tmp/.cs-cred-$kind"
10
+ if [ "$kind" = claude ] && [ "${2:-}" = --limited ]; then
11
+ rm -f "$cache"
12
+ [ -n "${CS_CRED_BASE:-}" ] || { echo "no credential relay (CS_CRED_BASE)" >&2; exit 1; }
13
+ reset="${3:-}"; [[ "$reset" =~ ^[0-9]+$ ]] || reset=""
14
+ acct=$(cat "$cache.account" 2>/dev/null || true); [[ "$acct" =~ ^[0-9]+$ ]] || acct=""
15
+ curl -sS --max-time 30 -o /dev/null -X POST -H "authorization: Bearer ${CS_CRED_TOKEN}" -H "content-type: application/json" \
16
+ -d "{\"reset_at\":${reset:-null},\"account\":${acct:-null}}" "$CS_CRED_BASE/claude/limited" || true
17
+ fi
8
18
  if [ -s "$cache" ] && [ $(( $(date +%s) - $(stat -c %Y "$cache") )) -lt $ttl ]; then cat "$cache"; exit 0; fi
9
19
  [ -n "${CS_CRED_BASE:-}" ] || { echo "no credential relay (CS_CRED_BASE)" >&2; exit 1; }
10
20
  body=$(mktemp); trap 'rm -f "$body"' EXIT
@@ -16,4 +26,7 @@ if [ "$code" = 429 ]; then
16
26
  fi
17
27
  tok=""; [ "$code" = 200 ] && tok=$(jq -r .token "$body" 2>/dev/null || true)
18
28
  [ -n "$tok" ] && [ "$tok" != null ] || { echo "credential fetch failed ($kind)" >&2; exit 1; }
19
- umask 077; printf '%s' "$tok" > "$cache"; printf '%s' "$tok"
29
+ umask 077; printf '%s' "$tok" > "$cache"
30
+ acct=""; [ "$code" = 200 ] && acct=$(jq -r '.account // empty' "$body" 2>/dev/null || true)
31
+ if [[ "$acct" =~ ^[0-9]+$ ]]; then printf '%s' "$acct" > "$cache.account"; else rm -f "$cache.account"; fi
32
+ printf '%s' "$tok"
@@ -17,6 +17,7 @@ param(
17
17
  [int] $AllowCpus = 0, # 0 = logical CPUs minus 4 (min 2)
18
18
  [int] $AllowMemGb = 0, # 0 = half of physical RAM (min 4)
19
19
  [string] $Distro = 'computeshare',
20
+ [ValidateSet('auto', 'mirrored', 'nat')] [string] $Networking = 'auto', # nat: for PCs where mirrored mode fails (e.g. WSL error 0x8007054f)
20
21
  [switch] $Force # kept for compatibility; the install never prompts
21
22
  )
22
23
  $ErrorActionPreference = 'Stop'
@@ -106,7 +107,7 @@ if ($needReboot) {
106
107
  }
107
108
 
108
109
  $build = [int](Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuildNumber
109
- $mirrored = $build -ge 22621
110
+ $mirrored = switch ($Networking) { 'nat' { $false } 'mirrored' { $true } default { $build -ge 22621 } }
110
111
  Say ("Networking: " + ($(if ($mirrored) { 'mirrored (agent listens on the Tailscale IP directly)' } else { 'NAT + portproxy (Windows 10 / older 11)' })))
111
112
 
112
113
  # .wslconfig is per Windows user and applies to every distro: merge our keys, keep everything else.
@@ -116,6 +117,7 @@ $want = [ordered]@{ processors = "$AllowCpus"; memory = "${vmMemGb}GB"; vmIdleTi
116
117
  if ($mirrored) { $want['networkingMode'] = 'mirrored' }
117
118
  $out = New-Object System.Collections.Generic.List[string]; $inWsl2 = $false; $seen = @{}
118
119
  foreach ($l in $lines) {
120
+ if (-not $mirrored -and $l -match '^\s*networkingMode\s*=\s*mirrored\s*$') { $out.Add("# $l # disabled by computeshare: -Networking nat"); continue }
119
121
  if ($l -match '^\s*\[(.+)\]\s*$') {
120
122
  if ($inWsl2) { foreach ($k in $want.Keys) { if (-not $seen[$k]) { $out.Add("$k=$($want[$k])"); $seen[$k] = $true } } }
121
123
  $inWsl2 = ($Matches[1].Trim().ToLower() -eq 'wsl2')
@@ -211,7 +213,9 @@ $taskArgs = "-NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$kee
211
213
  $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $taskArgs
212
214
  $trigger = New-ScheduledTaskTrigger -AtLogOn -User "$env:USERDOMAIN\$env:USERNAME"
213
215
  $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit ([TimeSpan]::Zero) -RestartCount 999 -RestartInterval (New-TimeSpan -Minutes 1)
214
- Register-ScheduledTask -TaskName 'computeshare-keepalive' -Action $action -Trigger $trigger -Settings $settings -Description 'computeshare agent keep-alive' -Force | Out-Null
216
+ # Highest: on NAT networking the task maintains a netsh portproxy, which needs an elevated token.
217
+ $principal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME" -LogonType Interactive -RunLevel Highest
218
+ Register-ScheduledTask -TaskName 'computeshare-keepalive' -Action $action -Trigger $trigger -Settings $settings -Principal $principal -Description 'computeshare agent keep-alive' -Force | Out-Null
215
219
  Start-ScheduledTask -TaskName 'computeshare-keepalive'
216
220
 
217
221
  Start-Sleep -Seconds 5
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
3
+ // SPDX-License-Identifier: AGPL-3.0-or-later
4
+ /**
5
+ * One-shot backfill (#5254): closed `review-finding` issues still labelled `needs-validation`.
6
+ * workflow:merged -> validated; workflow:invalid or closed "not planned" -> false-positive; anything else is skipped.
7
+ * Dry run by default: prints the counts it would change; edits only with --apply.
8
+ * Usage: backfill-finding-labels.mjs --repo owner/name [--apply] [--limit N]
9
+ */
10
+ import { execFileSync } from "node:child_process";
11
+ import { fileURLToPath } from "node:url";
12
+
13
+ const names = (i) => (i.labels ?? []).map((l) => l?.name ?? l);
14
+
15
+ /** The label an old closed finding should carry, or null when its outcome is not derivable. */
16
+ export function targetLabel(issue) {
17
+ const l = names(issue);
18
+ if (l.includes("workflow:invalid") || issue.stateReason === "NOT_PLANNED") return "false-positive";
19
+ if (l.includes("workflow:merged")) return "validated";
20
+ return null;
21
+ }
22
+
23
+ export function backfill({ issues, apply = false, edit }) {
24
+ const counts = { validated: 0, "false-positive": 0, skipped: 0, failed: 0 };
25
+ const changes = [];
26
+ for (const i of issues) {
27
+ const t = targetLabel(i);
28
+ if (!t) { counts.skipped++; continue; }
29
+ if (apply) {
30
+ try { edit(i.number, t); } catch { counts.failed++; continue; }
31
+ }
32
+ counts[t]++; changes.push({ number: i.number, add: t });
33
+ }
34
+ return { mode: apply ? "apply" : "dry-run", counts, changes };
35
+ }
36
+
37
+ function main(argv) {
38
+ const get = (f) => { const k = argv.indexOf(f); return k >= 0 ? argv[k + 1] : null; };
39
+ const repo = get("--repo"), limit = get("--limit") ?? "1000", apply = argv.includes("--apply");
40
+ if (!repo) { console.error("usage: backfill-finding-labels.mjs --repo owner/name [--apply] [--limit N]"); return 2; }
41
+ const gh = (a) => execFileSync("gh", a, { encoding: "utf8" });
42
+ const issues = JSON.parse(gh(["issue", "list", "-R", repo, "--state", "closed", "--label", "review-finding", "--label", "needs-validation", "--limit", limit, "--json", "number,labels,stateReason"]) || "[]");
43
+ const edit = (n, add) => gh(["issue", "edit", String(n), "-R", repo, "--add-label", add, "--remove-label", "needs-validation"]);
44
+ const r = backfill({ issues, apply, edit });
45
+ const c = r.counts;
46
+ console.log(`${apply ? "applied" : "dry-run (pass --apply to change)"}: ${c.validated} -> validated, ${c["false-positive"]} -> false-positive, ${c.skipped} skipped${c.failed ? `, ${c.failed} failed` : ""}`);
47
+ return c.failed ? 1 : 0;
48
+ }
49
+
50
+ if (process.argv[1] === fileURLToPath(import.meta.url)) process.exit(main(process.argv.slice(2)));
@@ -0,0 +1,36 @@
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 { backfill, targetLabel } from "./backfill-finding-labels.mjs";
6
+
7
+ const issues = [
8
+ { number: 1, labels: [{ name: "workflow:merged" }] },
9
+ { number: 2, labels: [{ name: "workflow:invalid" }] },
10
+ { number: 3, labels: [], stateReason: "NOT_PLANNED" },
11
+ { number: 4, labels: [{ name: "workflow:merged" }, { name: "workflow:invalid" }] },
12
+ { number: 5, labels: [] },
13
+ ];
14
+
15
+ describe("backfill-finding-labels (#5254)", () => {
16
+ it("maps merged to validated, invalid / not planned to false-positive, else null", () => {
17
+ assert.deepEqual(issues.map(targetLabel), ["validated", "false-positive", "false-positive", "false-positive", null]);
18
+ });
19
+ it("dry-run reports counts and edits nothing", () => {
20
+ const calls = [];
21
+ const r = backfill({ issues, edit: (...a) => calls.push(a) });
22
+ assert.equal(r.mode, "dry-run");
23
+ assert.deepEqual(r.counts, { validated: 1, "false-positive": 3, skipped: 1, failed: 0 });
24
+ assert.deepEqual(calls, []);
25
+ });
26
+ it("--apply edits each mapped issue", () => {
27
+ const calls = [];
28
+ const r = backfill({ issues, apply: true, edit: (n, l) => calls.push([n, l]) });
29
+ assert.equal(r.mode, "apply");
30
+ assert.deepEqual(calls, [[1, "validated"], [2, "false-positive"], [3, "false-positive"], [4, "false-positive"]]);
31
+ });
32
+ it("a failed edit is counted, not reported as changed", () => {
33
+ const r = backfill({ issues: [issues[0]], apply: true, edit: () => { throw new Error("x"); } });
34
+ assert.deepEqual(r.counts, { validated: 0, "false-positive": 0, skipped: 0, failed: 1 });
35
+ });
36
+ });
@@ -41,9 +41,11 @@
41
41
  # I1 Issues stuck in workflow:investigating beyond threshold
42
42
  # I2 Issues stuck in workflow:building beyond threshold
43
43
  # I3 Issues stuck in workflow:in-review beyond threshold
44
- # I4 Issues in workflow:building with no FORGE:BUILDER annotation
44
+ # I4 Issues in workflow:building past the threshold with no builder evidence
45
+ # (FORGE:BUILDER, or the lean FORGE:CONTRACT / FORGE:PLAN / FORGE:WORK-ON)
45
46
  # I5 Issues in workflow:in-review with no open PR
46
- # I6 PRs open without a FORGE:CONTRACT or FORGE:BUILDER annotation
47
+ # I6 PRs open without a FORGE: marker that are not lane PRs (lean head branch or
48
+ # pipeline bot author) or dependency-bot PRs (dependabot, renovate)
47
49
  # I7 Orphaned worktree branches (local branches fix/* with no open PR)
48
50
  # I8 FORGE-referenced gists with public visibility (KNOWLEDGE_GIST, MILESTONE_INDEX,
49
51
  # PRIOR_GIST annotations in recent issue comments)
@@ -401,16 +403,21 @@ while IFS= read -r row; do
401
403
  done < <(echo "$ENGINE_ERRORS" | jq -c '.[]')
402
404
 
403
405
  # ---------------------------------------------------------------------------
404
- # I4: Issues in workflow:building with no FORGE:BUILDER annotation
406
+ # I4: Issues in workflow:building with no builder evidence
407
+ # Lean lanes never write FORGE:BUILDER; FORGE:CONTRACT / FORGE:PLAN / FORGE:WORK-ON
408
+ # count as evidence. Issues active within the stuck threshold are in flight, not broken.
405
409
  # ---------------------------------------------------------------------------
406
410
  while IFS= read -r row; do
407
411
  num=$(echo "$row" | jq -r '.number')
408
- # Check for FORGE:BUILDER annotation in issue comments.
412
+ if [ "$(hours_since "$(echo "$row" | jq -r '.updatedAt')")" -lt "$STUCK_HOURS" ]; then
413
+ continue
414
+ fi
415
+ # Check for builder evidence in issue comments.
409
416
  # Distinguish a confirmed-absent annotation from a gh API failure (rate limit,
410
417
  # network blip, auth issue) — an API failure must NOT be treated as confirmed-missing.
411
418
  if ! has_builder=$(gh issue view "$num" $GH_FLAG \
412
419
  --json comments \
413
- --jq '[.comments[].body | contains("FORGE:BUILDER")] | any' 2>"$GH_STDERR_TMP"); then
420
+ --jq '[.comments[].body | test("FORGE:(BUILDER|CONTRACT|PLAN|WORK-ON)")] | any' 2>"$GH_STDERR_TMP"); then
414
421
  echo "WARNING: gh issue view failed for #$num — I4 check inconclusive, skipping (not treated as missing): $(cat "$GH_STDERR_TMP")" >&2
415
422
  add_skip "I4" "$num" "gh issue view failed: $(bounded_reason "$(cat "$GH_STDERR_TMP")")"
416
423
  continue
@@ -458,7 +465,7 @@ done < <(echo "$IN_REVIEW" | jq -c '.[]')
458
465
  if ! OPEN_PRS=$(gh pr list $GH_FLAG \
459
466
  --state open \
460
467
  --limit 50 \
461
- --json number,title,body,createdAt 2>"$GH_STDERR_TMP"); then
468
+ --json number,title,body,createdAt,author,headRefName 2>"$GH_STDERR_TMP"); then
462
469
  echo "WARNING: gh pr list failed for open PRs — I6 check inconclusive, skipping (not treated as empty): $(cat "$GH_STDERR_TMP")" >&2
463
470
  add_skip "I6" "all" "gh pr list failed: $(bounded_reason "$(cat "$GH_STDERR_TMP")")"
464
471
  OPEN_PRS="[]"
@@ -474,6 +481,14 @@ while IFS= read -r row; do
474
481
  continue
475
482
  fi
476
483
  has_forge=$(echo "$body" | grep -c "FORGE:" || true)
484
+ # Lane PRs (lean head branch or pipeline bot app) and dependency-bot PRs are not hand-made.
485
+ head_ref=$(echo "$row" | jq -r '.headRefName // ""')
486
+ author=$(echo "$row" | jq -r '.author.login // ""')
487
+ if [[ "$head_ref" =~ ^(feat|fix)/issue-[0-9]+-lean$ ]] || \
488
+ [[ "$author" =~ ^(app/)?(rapiercraft-forgedock|forgedock)(\[bot\])?$ ]] || \
489
+ [[ "$author" =~ ^(app/)?(dependabot|renovate)(\[bot\])?$ ]]; then
490
+ continue
491
+ fi
477
492
  if [ "$has_forge" -eq 0 ]; then
478
493
  add_finding \
479
494
  "pr_missing_annotations" "warning" \