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
package/bin/lean/lean.mjs CHANGED
@@ -16,24 +16,27 @@ import { hostname as osHostname, tmpdir as osTmpdir } from "node:os";
16
16
  import { appendEvent } from "../engine/runlog.mjs";
17
17
  import { testAdequacyRows, testAdequacyFailures, testAdequacyTelemetry, adequacyCounts, regressionRan } from "./testadequacy.mjs";
18
18
  import { readSelfReview, compareSelfReview, firstReviewRecord, selfCheckFailures } from "./selfreview.mjs";
19
- import { codeForTerminalReason, OUTCOME_CODES, ENV_VALIDATE_TIMEOUT, ENV_VALIDATE_PLACEMENT, ENV_ENGINE_OWNED_CODES } from "../engine/outcome-codes.mjs";
19
+ import { codeForTerminalReason, parkedLabel, OUTCOME_CODES, ENV_VALIDATE_TIMEOUT, ENV_VALIDATE_PLACEMENT, ENV_ENGINE_OWNED_CODES } from "../engine/outcome-codes.mjs";
20
20
  import { ciPollDelayMs, ENGINE_VERSION, DEFAULT_MAX_SESSION_LIMIT_PAUSES, DEFAULT_SESSION_LIMIT_WAIT_MS, parseLeaseHolder, sanitizeLeaseHost } from "../engine.mjs";
21
21
  import { openDependency, laneMergedPrs, dependencyOnLane, isTrustedComment, decomposedSubissues, isDecomposedRecord, reopenRevokedDecomposition } from "../engine/phases.mjs";
22
22
  import { createHash, randomBytes } from "node:crypto";
23
23
  import { otherLaneOwner } from "./lanelock.mjs";
24
24
  import { stampText, checkStamp } from "./stagestamp.mjs";
25
25
  import { acquireBranchLock, waitPidsExit } from "./branchlock.mjs";
26
- import { parseRecurrenceConfig, recurrenceFacts, recursLinks, designLaneNote } from "./recurrence.mjs"; // #5751
26
+ import { parseRecurrenceConfig, recurrenceFacts, recursLinks, designLaneNote, designDemanded } from "./recurrence.mjs"; // #5751
27
27
  import { areaOf, acquireHotArea, countCounters } from "./hotarea.mjs"; // #5751
28
- import { isEnvValidateFailure, outputTail, contractRuleCounts, onlyTestPlanProblems, isTestPath, applyValidateRecipes, rewriteProjectDirCommand, deferChecklessPostDeploy, autoPostDeployE2e, applyRequirementDecisions, dedupeAddRequirements, loneE2eRows, reproEnvMiss, resolveForgedockPaths, resolvingIo, portableForgedockPaths, FORGEDOCK_CHECKS_VAR, FORGEDOCK_ENTRY_VAR, describesUnrunnableCommand, removedPathsOf, TRACKED, normalizeKindModes, blockingFailures, unverifiedRequirements, mutationTargets, mutationFailures, runMutationCheck, MUTATION_SURVIVED, isBugIssue, scopeText, explainFailures, inIssue, validateContract, snapQuotes, cliUsageError, normalizeRunnerCommand, applyAmendments, amendmentKindProblems, precheck, alreadyFixedOnBase, READONLY_PROD_RE, EXTERNAL_NEED_RE, intakeHostWork, repoTracks, dropScopeValidates, tagOutOfBand, parseReview, decide, mergeReviewRows, reaskable, criterionLines, closePlan, followupItems, renderPendingFollowups, bucketTally, pendingTracking, unnamedEdges, structureNote, impliedDocDeliverables, convertDelivered } from "./conformance.mjs";
28
+ import { isEnvValidateFailure, outputTail, contractRuleCounts, onlyTestPlanProblems, isTestPath, applyValidateRecipes, rewriteProjectDirCommand, deferChecklessPostDeploy, autoPostDeployE2e, applyRequirementDecisions, dedupeAddRequirements, loneE2eRows, reproEnvMiss, resolveForgedockPaths, resolvingIo, portableForgedockPaths, FORGEDOCK_CHECKS_VAR, FORGEDOCK_ENTRY_VAR, describesUnrunnableCommand, removedPathsOf, TRACKED, normalizeKindModes, blockingFailures, splitAdvisory, unverifiedRequirements, mutationTargets, mutationFailures, runMutationCheck, MUTATION_SURVIVED, isBugIssue, scopeText, explainFailures, inIssue, validateContract, snapQuotes, cliUsageError, normalizeRunnerCommand, applyAmendments, amendmentKindProblems, precheck, alreadyFixedOnBase, READONLY_PROD_RE, EXTERNAL_NEED_RE, intakeHostWork, repoTracks, dropScopeValidates, tagOutOfBand, parseReview, decide, mergeReviewRows, reaskable, criterionLines, closePlan, followupItems, renderPendingFollowups, bucketTally, pendingTracking, unnamedEdges, structureNote, impliedDocDeliverables, convertDelivered } from "./conformance.mjs";
29
29
  import { checkAdmission, hostParallelism, ADMISSION_RETRY_SECONDS } from "./admission.mjs";
30
30
  import { namedPaths, isTrustedIssueComment, prodFailureSignal } from "./prefilter.mjs";
31
- import { writeStatus, postUpsert, isStatusPost, isUpsertPost, hasSection, clearPipelineLabels } from "./statuscomment.mjs";
31
+ import { validateAmendments } from "./attempts.mjs";
32
+ import { writeStatus, postUpsert, postKeyed, isKeyedPost, isStatusPost, isUpsertPost, hasSection, clearPipelineLabels, IN_PLACE_MARKERS, commentId } from "./statuscomment.mjs";
33
+ import { decidePost } from "./commentstate.mjs"; // #5979
34
+ import { repeatSignature, countIdentical, shouldPark, summaryComment } from "./failure-stop.mjs"; // #5979
32
35
  import { checksAt, mergeCheckEntries, CHECKS_FILE } from "./postdeploy-check.mjs";
33
36
  import { matchBaselines, baselineFailures, foldRegression } from "./baselines.mjs";
34
37
  import { readRollouts, detectNewOffKeys, rolloutModes, liveDeferralBlocks } from "./activation.mjs";
35
38
  import { toolMisses } from "./toolplace.mjs";
36
- import { hasRecipe, installLaneTools, RECIPES } from "../pool/lane-tools.mjs";
39
+ import { hasRecipe, installLaneTools, genericInstallCommands, RECIPES } from "../pool/lane-tools.mjs";
37
40
  import { testRunnerProblems, preflightProbes, preflightProblems, unsetEnvVars, runPreflight, knownToContract, declaredEnv, depInstallFailures, toolMissingInstalls, testRunSummary, projectBinDirs, withLocalBins, manifestDepOwner } from "./preflight.mjs";
38
41
  import { resolveLane, isDefaultLane, isShippedLane, DEFAULT_STAGING_BRANCH } from "./lane.mjs";
39
42
  import { splitGate, rationaleLine } from "./decompose.mjs";
@@ -67,7 +70,7 @@ import { reserveForBuild, revalidate } from "./seqreserve.mjs";
67
70
  import { patchEcho, mutationsOf, runReproMutations, classifyRepro } from "./reproquality.mjs";
68
71
  import { CHECKS_CLI, FORGEDOCK_CLI, REVIEWER_SYSTEM, LEAN_DIR, RESULT_FILE, INVESTIGATION_FILE, IMPLEMENTATION_FILE, CONTRACT_FILE, builderPlanPrompt, builderImplementPrompt, contractCorrectionPrompt, conformanceResumePrompt, amendmentCorrectionPrompt, reviewerPrompt, investigationVerdict, decisionNote, reviewerRepairPrompt, REVIEW_DIFF_MAX_BYTES, blockCorrectionPrompt, HUMAN_BLOCK_REASONS, structurePrompt, hotspotPlanNote, hotspotBuildRule, reproPlanNote, unrunnableValidateNote, docsPlanNote, pagePlanNote, contextPackNote, buildOpeningNote, sequenceBuildRule, docsPrompt, ciFailurePrompt, ciUnavailablePrompt, precheckFailurePrompt, contextRestartPrompt, routeDigestPrompt, turnBudgetWrapupPrompt, syncChecks, GROUPING_SYSTEM, enumeratingPlanNote, enumeratingBuildRule, invariantsPlanNote, invariantsBuildRule, missingEntriesPrompt, sequencePrompt, sequenceSyncNote, sequenceSyncPrompt, fixSessionPrompt, postMergeFailurePrompt, duplicateExportsPrompt, migrationGeneratorPrompt, i18nCopiesPrompt, narrowFixPrompt } from "./prompts.mjs";
69
72
  import { postMergeCommands } from "./postmerge.mjs";
70
- import { classifyBaseRed, attribute as attributeBaseRed, runOnBase, reportBaseRed } from "./basered.mjs"; // #5239
73
+ import { classifyBaseRed, attribute as attributeBaseRed, runOnBase, reportBaseRed, recordBaseVerdict, bypassesGuard } from "./basered.mjs"; // #5239
71
74
  import { guardAfterMerge, withHistoryRows } from "./guards.mjs";
72
75
  import { parseProdParity, prodParityFailures as prodParityOf } from "./prodparity.mjs";
73
76
  import { routePathsFromFiles, routeReachabilityFailures } from "./routecheck.mjs";
@@ -123,8 +126,9 @@ import { makePostRun } from "./postrun.mjs";
123
126
  import { ensureSignedOff, salvageBranch, dropSalvageTracking } from "./signoff.mjs";
124
127
  import { reconcileCheckpoints } from "./checkpoint-reconcile.mjs";
125
128
  import { guardStagedDeletions, deletionEvidence, maxForeignDeletions } from "./delguard.mjs";
126
- import { createLedger, flattenPhases } from "./phaseledger.mjs";
129
+ import { createLedger, flattenPhases, overheadStats } from "./phaseledger.mjs";
127
130
  import { DEFAULT_CATALOG_SOURCES, deriveCatalog, mergeRecipes, rewriteMissed, isDriftFailure, rewriteSubprojectVenv } from "./validate-catalog.mjs";
131
+ import { holderGone } from "./liveness.mjs";
128
132
  import { planStale, stackedBaseBlock, validStackedOn, cascadeDecision, invalidatedChecks } from "./stacking.mjs";
129
133
  import { runLightStep, runLightTests, lightBuildPrompt, upgradeNote, renderLiteReceipt } from "./lightlane.mjs";
130
134
 
@@ -460,6 +464,9 @@ export async function runCore(o) {
460
464
  usage.input += u.input_tokens ?? 0; usage.output += u.output_tokens ?? 0;
461
465
  usage.cache += (u.cache_read_input_tokens ?? 0) + (u.cache_creation_input_tokens ?? 0);
462
466
  }
467
+ let iss; // the issue as read at intake; declared early so the comment helpers below can see it
468
+ const localPosts = []; // #5979: comments this lane created, so a second post in the same run sees them
469
+ const allComments = () => [...(iss?.comments ?? []), ...localPosts];
463
470
  let statusCache = null; // #5592: {id, sections} of this issue's one FORGE:STATUS comment, edited in place
464
471
  const post = async (marker, body, on = issue) => {
465
472
  if (on === issue && isStatusPost(marker)) { // machine-state markers: a section of the one status comment, not a comment of their own
@@ -474,9 +481,24 @@ export async function runCore(o) {
474
481
  if (on === issue && isUpsertPost(marker)) { // one comment edited in place across requeues (the marker still leads the body)
475
482
  return postUpsert({ gh: ghw, repo, issue: on, markers: marker, body, comments: iss?.comments, cap: capComment });
476
483
  }
484
+ if (on === issue && isKeyedPost(marker)) { // #5986: one comment per (kind, content hash) with a repeat counter; at 12 engine comments edit in place only
485
+ return postKeyed({ gh: ghw, repo, issue: on, marker: Array.isArray(marker) ? marker[0] : marker, body, cap: capComment });
486
+ }
477
487
  const marks = (Array.isArray(marker) ? marker : [marker]).map((m) => `<!-- ${m} -->`).join("\n");
478
- const out = String(await ghw(["issue", "comment", String(on), "-R", repo, "--body", capComment(`${marks}\n${body}`)])).trim();
479
- return /https?:\/\/\S+/.exec(out)?.[0] ?? null;
488
+ const full = capComment(`${marks}\n${body}`);
489
+ const first = Array.isArray(marker) ? marker[0] : marker;
490
+ if (on === issue && IN_PLACE_MARKERS.includes(first)) { // #5979: re-post only on a state change; FACTS and DEPENDENCY are edited in place
491
+ const d = decidePost({ marker: first, body: full, comments: allComments(), trusted: (c) => c?.__mine === true || isTrustedIssueComment(c) });
492
+ if (d.action === "skip") return d.prior.url ?? null;
493
+ const id = d.action === "patch" ? commentId(d.prior) : null;
494
+ if (id) {
495
+ try { await ghw(["api", "-X", "PATCH", `repos/${repo}/issues/comments/${id}`, "-f", `body=${full}`]); d.prior.body = full; return d.prior.url ?? null; } catch { /* deleted or not ours: a new comment */ }
496
+ }
497
+ }
498
+ const out = String(await ghw(["issue", "comment", String(on), "-R", repo, "--body", full])).trim();
499
+ const url = /https?:\/\/\S+/.exec(out)?.[0] ?? null;
500
+ if (on === issue) localPosts.push({ body: full, url, __mine: true });
501
+ return url;
480
502
  };
481
503
  /** Best effort; `true` when the transition succeeded (#4337: the decomposed close needs to know). */
482
504
  const label = async (state) => { try { await retrying(() => io.transitionLabel(issue, state), { transient: GH_TRANSIENT_RE, attempts: 4, sleep: sleepFn, random }); return true; } catch { /* labels are best effort */ return false; } };
@@ -495,10 +517,12 @@ export async function runCore(o) {
495
517
  if (!h || !Number.isSafeInteger(pid) || pid <= 0 || sanitizeLeaseHost(h) !== sanitizeLeaseHost(myHost)) return false;
496
518
  try { (o.killFn ?? process.kill.bind(process))(pid, 0); return false; } catch (e) { return e?.code === "ESRCH"; }
497
519
  };
520
+ // #5991: a lease of a batch that no longer owns the issue (a sandbox holder is pid 1 on another host) is taken over at once
521
+ const gone = (l) => holderDead(l) || holderGone(l, { liveBatches: typeof o.liveBatches === "function" ? (() => { try { const ids = o.liveBatches(issue); return Array.isArray(ids) ? [...ids, o.batchId] : null; } catch { return null; } })() : null });
498
522
  const leaseTtlMs = o.leaseTtlMs ?? 25 * 60000; // below the projector's 30 min honour cap
499
523
  let leaseState = null, leaseTimer = null;
500
524
  const writeLease = (lease, extra = {}) => io.projector.writeState(issue, { ...leaseState, ...extra, lease });
501
- const renew = async () => { if (io.projector && leaseState && !finishing) { /* never re-take a lease a finish (or signal) released */ try { await writeLease(leaseObj()); } catch { /* best effort */ } } };
525
+ const renew = async () => { if (io.projector && leaseState && !finishing) { /* never re-take a lease a finish (or signal) released */ try { if (o.batchId && io.projector.readState && (await io.projector.readState(issue))?.suspend) return; /* #6008: the dispatcher's suspend marker stays; the lease is not renewed under it */ await writeLease(leaseObj()); } catch { /* best effort */ } } };
502
526
  async function releaseLease(reason, code = null, mergedTo = null) {
503
527
  if (leaseTimer) { clearInterval(leaseTimer); leaseTimer = null; }
504
528
  if (!io.projector || !leaseState) return;
@@ -589,7 +613,7 @@ export async function runCore(o) {
589
613
  // #4169: heavy steps take a host semaphore slot (io.heavy); LLM phases are not gated. `heavyEnv` puts the heavy shims on
590
614
  // the runner PATH; `waits` ({phase: ms}) and `heavyQueueMax` ride on the lane result for the batch report.
591
615
  const heavyCfg = o.heavy ?? {}, heavyOn = Boolean(io.heavy) && heavyCfg.enabled !== false;
592
- let heavyEnv = null, heavyWaitsFile = null, heavyQueueMax = 0, stage = "plan", iss;
616
+ let heavyEnv = null, heavyWaitsFile = null, heavyQueueMax = 0, stage = "plan";
593
617
  let seqBuildNote = ""; // #5235: numbers reserved for this lane at build start (prompt paragraph)
594
618
  const recCfg = parseRecurrenceConfig(o.recurrenceConfig); // #5751: forge.yaml recurrence: (absent: mode on, threshold 2, no hot areas or counters)
595
619
  let recurrence = null, hotLock = null; // #5751: the recurrence detection; the hot-area locks held until teardown
@@ -750,6 +774,7 @@ export async function runCore(o) {
750
774
  ...(reproQ ? { repro_quality: reproQ } : {}), conformance_mode: conformance === "enforce" || riskEnforced ? "enforce" : "shadow", ...(shadowWould ? { shadow_would: shadowWould } : {}), ...(firstReview ? { first_review: firstReview } : {}), ...(adequacyTel ?? {}),
751
775
  ...(laneHead && reason !== "merged" ? { lane_branch: laneHead.pushedTo ?? "unpushed", lane_sha: laneHead.sha } : {}), context_pack: ctxCfg.mode, ...ctxAb, ...expTag, explore: exploreCfg.mode, wall_ms: now() - t0, ...(guardAddedMs ? { guard_added_ms: guardAddedMs } : {}), model_ms: modelMs, ...(usageUnknown ? { usage_unknown: true } : {}), light, ...(ctxLane ? { lane_type: ctxLane } : {}), ...(pitMatched != null ? { pitfalls_matched: pitMatched } : {}), ...(tb.record() ? { turns: tb.record() } : {}),
752
776
  ...(route ? { builder_tier: route.tier, builder_class: route.class, builder_escalated: escalated, builder_model: route.model ?? "default" } : {}) }; // forge#4275: the on/off A/B groups runs by these; #4394: per-tier stats
777
+ Object.assign(term, overheadStats(null, term.wall_ms, term.model_ms)); // fixed_overhead_ms + model_share for the SLO
753
778
  const phases = phaseLedger.snapshot(); // #4908: run log gets the nested ledger, FORGE:TELEMETRY the flattened scalars
754
779
  ev({ ...term, phases });
755
780
  await emit({ ...term, ...flattenPhases(phases) });
@@ -759,7 +784,7 @@ export async function runCore(o) {
759
784
  // either launches the next attempt or relabels in settle.
760
785
  if (recoverUnlabelled && recover.final && (reason === "ci-pending" || reason === "budget-exceeded")) { // #4505: budget-exceeded too
761
786
  try {
762
- await post("FORGE:NEEDS_HUMAN", `## Needs human\n${laneRecoveryEvidence(reason, code, detail)}\n\n_${usageLine()}_`);
787
+ await post("FORGE:NEEDS_HUMAN", `## Needs human\n${laneRecoveryEvidence(reason, code, detail)}\n\nsig=${repeatSignature(code, detail)}\n\n_${usageLine()}_`);
763
788
  await ghc(["issue", "edit", String(issue), "-R", repo, "--add-label", "needs-human"]);
764
789
  } catch { /* best effort */ }
765
790
  }
@@ -836,8 +861,18 @@ export async function runCore(o) {
836
861
  if (reg.existing && (!recover || recover.final) && await duplicateAskIssue(reg.existing, [why, askText])) return finish("invalid", `only content is the owner ask of #${reg.existing}; closed as a duplicate`); // #4730
837
862
  link = reg.existing ? `Same owner ask as #${reg.existing} (one ask, linked): answering it unblocks this issue too.` : reg.entry ?? "";
838
863
  }
864
+ // #5979: the second identical failure (same code and normalised detail as an earlier NEEDS_HUMAN/PARKED of this issue) parks with one summary, no recovery
865
+ const sig = repeatSignature(code, why);
866
+ const stoppable = code !== OUTCOME_CODES.BUILDER_BLOCKED && code !== OUTCOME_CODES.FAILURE_REPEATED && !ENV_ENGINE_OWNED_CODES.includes(code);
867
+ const identical = stoppable ? countIdentical(allComments(), sig, (c) => c?.__mine === true || isTrustedIssueComment(c)) + 1 : 1;
868
+ if (shouldPark(identical)) {
869
+ try { await post("FORGE:PARKED", summaryComment({ attempts: identical, code, detail: why, sig })); } catch (e) { labelFailed("comment", e); }
870
+ try { await ghc(["issue", "edit", String(issue), "-R", repo, "--add-label", "needs-human", "--add-label", parkedLabel(OUTCOME_CODES.FAILURE_REPEATED)]); } catch (e) { labelFailed("label", e); }
871
+ T.decisions.push(`Identical failure ${code} (${sig}) seen ${identical}x: parked as ${OUTCOME_CODES.FAILURE_REPEATED}, not relaunched`);
872
+ return finish("needs-human", why, { code: OUTCOME_CODES.FAILURE_REPEATED, ...extra, ...(recover ? { recovery: true } : {}) }, OUTCOME_CODES.FAILURE_REPEATED);
873
+ }
839
874
  const notes = [premiseAnnotation(predicate), closedEdgeNote(closedDeps), link, askNote].filter(Boolean).join("\n");
840
- try { await post("FORGE:NEEDS_HUMAN", `## Needs human\n${why}${notes ? `\n\n${notes}` : ""}${recoverUnlabelled ? `\n\n${laneRecoveryEvidence("needs-human", code, "")}` : ""}\n\n_${usageLine()}_`); }
875
+ try { await post("FORGE:NEEDS_HUMAN", `## Needs human\n${why}${notes ? `\n\n${notes}` : ""}${recoverUnlabelled ? `\n\n${laneRecoveryEvidence("needs-human", code, "")}` : ""}\n\nsig=${sig}\n\n_${usageLine()}_`); }
841
876
  catch (e) { labelFailed("comment", e); }
842
877
  // #5423/#5755: an environment gap is the engine's to recover or hold on an env issue, so a first lane leaves the issue visible; a final recovery lane (no seam) still labels
843
878
  if (!(!recover && ENV_ENGINE_OWNED_CODES.includes(code))) {
@@ -1043,9 +1078,23 @@ export async function runCore(o) {
1043
1078
  } else if (r.state === "foreign" || r.state === "error") ev({ event: "CHECKPOINT_RECONCILE_SKIPPED", state: r.state, ...(r.commits ? { commits: r.commits.length } : {}), ...(r.error ? { error: r.error } : {}) });
1044
1079
  return r;
1045
1080
  };
1081
+ /** #6008: a batch-dispatched lane re-reads its FORGE:STATE before it pushes or merges. No current lease of its batch, or a dispatcher hold/pause marker (`suspend`), suspends it (deferred, sandbox kept for adopt). Lanes without a batch (run-issue, tests) are not guarded. */
1082
+ const suspensionGuard = async (what) => {
1083
+ if (!o.batchId || !io.projector?.readState || !leaseState) return;
1084
+ let st = null;
1085
+ try { st = await io.projector.readState(issue); } catch { return; /* unreadable: fail open like admission */ }
1086
+ if (!st) return; // no FORGE:STATE readable at all: unknown, fail open
1087
+ const l = st?.lease, mine = l && (l.by === agentId || l.batch === o.batchId);
1088
+ const why = st?.suspend ? `the issue is ${st.suspend.reason ?? "held"} by the dispatcher (${st.suspend.batch ?? "batch"})`
1089
+ : !l ? "no dispatcher lease is current" : l.until <= now() ? "the dispatcher lease expired" : !mine && !gone(l) ? `the lease belongs to ${l.batch ?? l.by}, not batch ${o.batchId}` : null;
1090
+ if (!why) return;
1091
+ ev({ event: "LANE_SUSPENDED", what, reason: why });
1092
+ throw Object.assign(new Error(`refusing to ${what}: ${why}`), { deferCode: "lane.suspended", deferDetail: `suspended before ${what}: ${why}; the sandbox is kept for adopt` });
1093
+ };
1046
1094
  const gitPush = async (args) => {
1047
1095
  if (deletionRefusal && !args.includes("--delete")) throw Object.assign(new Error(deletionRefusal), { engineCode: OUTCOME_CODES.ENGINE_ERROR }); // #5819
1048
1096
  await assertConfined(`git ${args.join(" ").slice(0, 80)}`); // #5825
1097
+ if (!args.includes("--delete")) await suspensionGuard("push"); // #6008
1049
1098
  if (!args.includes("--delete")) { await untrackToolState({ git, base, ev, keep: await keepPaths() });
1050
1099
  await reconcileLaneBranch();
1051
1100
  try { await signOffUnpushed(); }
@@ -1548,7 +1597,7 @@ export async function runCore(o) {
1548
1597
  if (io.projector) {
1549
1598
  let st = null;
1550
1599
  try { st = await io.projector.readState(issue); } catch { /* unreadable: proceed */ }
1551
- if (st?.lease && st.lease.until > now() && st.lease.by !== agentId && holderDead(st.lease)) {
1600
+ if (st?.lease && st.lease.until > now() && st.lease.by !== agentId && gone(st.lease)) {
1552
1601
  ev({ event: "LEASE_TAKEOVER", from: st.lease.by, host: st.lease.host ?? null, pid: st.lease.pid ?? null });
1553
1602
  onProgress({ event: "lease_takeover", detail: `taking over the lease of dead holder ${st.lease.by} (pid ${st.lease.pid ?? "?"} gone)` });
1554
1603
  } else if (st?.lease && st.lease.until > now() && st.lease.by !== agentId) {
@@ -1583,7 +1632,7 @@ export async function runCore(o) {
1583
1632
  ev({ event: "RUN_START", run: `core_${issue}_${t0}`, issue, lane, path: "core", version: ENGINE_VERSION, forge_version: ENGINE_VERSION, repo });
1584
1633
  await emit({ event: "RUN_START", run: `core_${issue}_${t0}`, lane, path: "core" }); // #4630: lifecycle event stream
1585
1634
  try {
1586
- iss = JSON.parse(await ghc(["issue", "view", String(issue), "-R", repo, "--json", "number,title,body,state,comments,labels,updatedAt"]));
1635
+ iss = JSON.parse(await ghc(["issue", "view", String(issue), "-R", repo, "--json", "number,title,body,state,comments,labels,updatedAt,createdAt"]));
1587
1636
  } catch (e) {
1588
1637
  if (e?.deferCode) return finish("deferred", e.deferDetail ?? String(e.message), { code: e.deferCode, ...(e.retryInSeconds ? { retryInSeconds: e.retryInSeconds } : {}), ...(e.backendId ? { backendId: e.backendId } : {}), ...(e.cliResult != null ? { cliResult: e.cliResult } : {}), ...(typeof e.cliIsError === "boolean" ? { cliIsError: e.cliIsError } : {}), ...(e.account ? { account: e.account } : {}) }, e.deferCode); // #4662; #5168 backendId
1589
1638
  return finish("engine-error", `cannot read issue: ${e.message}`);
@@ -2032,7 +2081,7 @@ export async function runCore(o) {
2032
2081
  /** #4188: the builder reads the live issue, so quotes are checked against the current text, not the RUN_START snapshot. Best effort. */
2033
2082
  async function refreshIssue(stage) {
2034
2083
  let next;
2035
- try { next = JSON.parse(String(await ghc(["issue", "view", String(issue), "-R", repo, "--json", "number,title,body,state,comments,labels,updatedAt"]))); } catch { return; }
2084
+ try { next = JSON.parse(String(await ghc(["issue", "view", String(issue), "-R", repo, "--json", "number,title,body,state,comments,labels,updatedAt,createdAt"]))); } catch { return; }
2036
2085
  if (!next || typeof next !== "object") return;
2037
2086
  const tc = trustedOf(next), text = textOf(next, tc);
2038
2087
  if (contractHash(issueText) === contractHash(text)) return;
@@ -2413,8 +2462,9 @@ export async function runCore(o) {
2413
2462
  // #4450: the light lane (lean.light mode on, eligible, fresh lane): one builder session, derived contract, or an upgrade
2414
2463
  const waitMs = Math.max(0, Number(contextWaitSeconds) || 0) * 1000, tHot = now();
2415
2464
  if (recCfg.mode === "on" && !recurrence && (namedPaths(iss.body ?? "").length || recursLinks(iss.body ?? "").length)) { // #5751: 0 LLM calls; an issue naming no path and no Recurs link cannot recur
2416
- recurrence = await recurrenceFacts({ io: { gh: ghc, git: (a) => git(a) }, repo, issue, title: iss.title, body: iss.body ?? "", base, namedPaths: namedPaths(iss.body ?? ""), threshold: recCfg.threshold }).catch(() => null);
2465
+ recurrence = await recurrenceFacts({ io: { gh: ghc, git: (a) => git(a) }, repo, issue, title: iss.title, body: iss.body ?? "", base, namedPaths: namedPaths(iss.body ?? ""), threshold: recCfg.threshold, createdAt: iss.createdAt ?? null }).catch(() => null);
2417
2466
  if (recurrence?.recurs) {
2467
+ recurrence.demanded = designDemanded(allComments()); // #5979: the design block is demanded once
2418
2468
  ev({ event: "RECURRENCE", count: recurrence.count, threshold: recurrence.threshold, fixes: recurrence.evidence.map((e) => e.number), reason: recurrence.reason });
2419
2469
  T.decisions.push(`Design lane (#5751): ${recurrence.reason}`);
2420
2470
  try { await post("FORGE:RECURRENCE", `Routed to a design lane: ${recurrence.reason}.\nThe contract must say why the earlier fixes did not hold, whether to delete or replace them, and a measurable outcome; it may decompose into ordinary lanes.`); } catch { /* best effort */ }
@@ -2671,7 +2721,8 @@ export async function runCore(o) {
2671
2721
  // #5331: a tool the sandbox itself lacks (probed where the lane runs) ends the lane before the builder implements; the tool-missing recovery places it on the host (orchestrate placeOf)
2672
2722
  const remoteDeps = await depOwnerOf(); // #5683: a tool that is a tracked manifest dependency is prepared in the sandbox, never a lane_tools recipe or a host tool
2673
2723
  const ownedDep = (t) => t === "forgedock" || remoteDeps.owner(t) !== null, notOwned = (m) => ({ ...m, tools: m.tools.filter((t) => !ownedDep(t)) });
2674
- let tm0 = toolMisses(planMisses ?? await preflightValidates(frozen).catch(() => [])), tm = notOwned(tm0);
2724
+ let rawMisses = planMisses ?? await preflightValidates(frozen).catch(() => []);
2725
+ let tm0 = toolMisses(rawMisses), tm = notOwned(tm0);
2675
2726
  if (tm0.tools.length && !tm.tools.length) { try { if (io.deps?.prepare) await io.deps.prepare({ wt, repoKey: depcacheNamespace({ repo, fallback: repoKey(cwd) }), env: toolchain?.env ?? undefined }); ev({ event: "REMOTE_PROJECT_DEPS", tools: tm0.tools }); } catch { /* the install gate reports failures */ } }
2676
2727
  if (tm.tools.length) { // #5423: provision the sandbox once (nested lockfiles, pytest) and re-probe before giving the lane up
2677
2728
  try {
@@ -2690,6 +2741,22 @@ export async function runCore(o) {
2690
2741
  tm = notOwned(toolMisses(await preflightValidates(frozen).catch(() => [])));
2691
2742
  ev({ event: "REMOTE_PROVISIONED", remaining: tm.tools });
2692
2743
  }
2744
+ if (noRecipe.length && tm.tools.some((t) => noRecipe.includes(t)) && io.runCommand) { // unclog: a generic pip/npm/apt install before any park
2745
+ const root = process.getuid?.() === 0, tried = [];
2746
+ for (const t of noRecipe.filter((x) => tm.tools.includes(x))) {
2747
+ const miss = (Array.isArray(rawMisses) ? rawMisses : []).find((m) => String(m?.tool) === t) ?? { kind: "command", tool: t };
2748
+ const shim = (o.hostCaps?.offloadWrappers ?? []).includes(t) && /^[A-Za-z0-9._-]+$/.test(t) // the sandbox is already where the wrapper sends work: run its argument directly
2749
+ ? [`${root ? "" : "sudo "}sh -c 'printf "#!/bin/sh\\nexec \\"\\$@\\"\\n" > /usr/local/bin/${t} && chmod +x /usr/local/bin/${t}'`] : null;
2750
+ for (const command of shim ?? genericInstallCommands(miss, { root })) {
2751
+ const r = await io.runCommand({ command, cwd: wt, timeoutMs: 600000, env: laneEnv() }).catch((e) => ({ rc: 1, stderr: String(e?.message ?? e) }));
2752
+ tried.push({ tool: t, kind: miss.kind, rc: r?.rc ?? 0 });
2753
+ }
2754
+ }
2755
+ rawMisses = await preflightValidates(frozen).catch(() => []);
2756
+ tm = notOwned(toolMisses(rawMisses));
2757
+ ev({ event: "REMOTE_TOOLS_GENERIC", tried, remaining: tm.tools });
2758
+ if (tried.length) T.decisions.push(`Remote sandbox lacked ${tried.map((x) => `${x.tool} (${x.kind})`).join(", ")}: generic install ${tm.tools.length ? `left ${tm.tools.join(", ")} missing` : "provided them"}`);
2759
+ }
2693
2760
  if (noRecipe.length && tm.tools.some((t) => noRecipe.includes(t))) return await needsHuman(`Remote sandbox lacks ${noRecipe.join(", ")}, and no lane_tools recipe exists for ${noRecipe.length > 1 ? "them" : "it"}. Add it to \`execution.lane_tools\` in forge.yaml once a recipe exists, or add a recipe for ${noRecipe.join(", ")} in bin/pool/lane-tools.mjs (RECIPES). Known recipes: ${Object.keys(RECIPES).join(", ")}.`, OUTCOME_CODES.ENV_TOOL_MISSING, { toolNoRecipe: true }); // #5727: the orchestrator re-places it on the host without spending an attempt
2694
2761
  }
2695
2762
  if (tm.tools.length) {
@@ -2852,7 +2919,7 @@ export async function runCore(o) {
2852
2919
  const names = failed.map((f) => `\`${f.command}\` (exit ${f.rc})`).join(", ");
2853
2920
  if (isSplit) return await needsHuman(`Declared check command(s) fail on the refactor:split move (no builder edits a split); nothing merged: ${names}`, OUTCOME_CODES.CI_RED);
2854
2921
  checkCommandsFailing = true;
2855
- { const red = await guardRed(failed); if (red) return red; } // #5239: a guard that also fails on the base defers the lane
2922
+ { const red = await guardRed(failed, { bypass: vcfg.guardBypass === true }); if (red === "bypass") { checkCommandsFailing = false; break; } if (red) return red; } // #5239: a guard that also fails on the base defers the lane; #5992: unless the lane is clear of the guarded surface
2856
2923
  if (round >= vcfg.maxRounds || !sessionId) { if (vcfg.precheckBlock || guardFailing(failed)) return await needsHuman(`Declared check command(s) still failing before the PR (verify.precheck_block); nothing merged: ${names}`, OUTCOME_CODES.CI_RED); T.anomalies.push(`Declared check command(s) still failing before the PR: ${names}`); break; }
2857
2924
  T.decisions.push(`Declared check command(s) failed: ${names}; builder resumed (round ${round + 1}/${vcfg.maxRounds})`);
2858
2925
  const before = String(await git(["rev-parse", "HEAD"])).trim();
@@ -3114,7 +3181,7 @@ export async function runCore(o) {
3114
3181
  function guardOn() { return vcfg.guardBlock !== false && (vcfg.invariants ?? []).length > 0; }
3115
3182
  function guardFailing(failed) { return guardOn() && failed.some((f) => vcfg.invariants.includes(f.command)); }
3116
3183
  /** #5239: guard commands failing here are run once on the base; failing there too, the lane is deferred (base.red) and the introducing issue is told. null: the failure is the lane's. */
3117
- async function guardRed(failed) {
3184
+ async function guardRed(failed, { bypass = false } = {}) {
3118
3185
  const g = failed.filter((f) => guardFailing([f]));
3119
3186
  if (!g.length || isSplit || !io.runCommand) return null;
3120
3187
  const baseRuns = await heavyStep("precheck", () => runOnBase({ commands: g.map((f) => f.command), git, runCommand: io.runCommand, mergeBase: base, cwd: wt, env: laneEnv(), timeoutMs: vcfg.precheckTimeoutSeconds * 1000 }));
@@ -3132,12 +3199,22 @@ export async function runCore(o) {
3132
3199
  }
3133
3200
  if (!baseRed.length) return null;
3134
3201
  const att = await attributeBaseRed({ failed: baseRed, git, base });
3202
+ if (bypass && baseRed.length === failed.length) { // R2: bypass only when every failed command is base-red; non-guard or lane-broken failures stay the lane's. #5992: a lane clear of the guarded surface goes on; the guard is re-run on the merged tree at merge (the base-sync post-merge gate)
3203
+ let laneFiles = [];
3204
+ try { laneFiles = String(await git(["diff", "--name-only", `${base}...HEAD`])).split("\n"); } catch { /* no diff: no bypass */ }
3205
+ if (bypassesGuard({ laneFiles, att })) {
3206
+ T.decisions.push(`Guard command(s) ${baseRed.map((f) => `\`${f.command}\``).join(", ")} are red on ${base} (last change ${att.sha.slice(0, 12)}${att.issue ? `, #${att.issue}` : ""}) but this lane touches none of the files they name; proceeding, the guard is re-run at merge`);
3207
+ ev({ event: "BASE_RED_BYPASS", commands: baseRed.map((f) => f.command), sha: att.sha, issue: att.issue ?? null });
3208
+ return "bypass";
3209
+ }
3210
+ }
3135
3211
  let baseSha = "", commitDate = "";
3136
3212
  try { baseSha = String(await git(["rev-parse", base])).trim(); } catch { /* key falls back to the attributed sha */ }
3137
3213
  try { if (att?.sha) commitDate = String(await git(["show", "-s", "--format=%cI", att.sha])).trim(); } catch { /* no reopen */ }
3138
3214
  const cmds = baseRed.map((f) => f.command), outputs = Object.fromEntries(cmds.map((c) => [c, tailOf(c)]));
3139
3215
  const n = await reportBaseRed({ ghc: ghw, repo, base, att, laneIssue: issue, commands: cmds, outputs, baseSha, commitDate });
3140
3216
  T.decisions.push(`Guard command(s) ${cmds.map((c) => `\`${c}\``).join(", ")} also fail on ${base}${att ? ` (last change ${att.sha.slice(0, 12)}${att.issue ? `, #${att.issue}` : ""})` : ""}; lane deferred behind ${n ? `#${n}` : "the base fix"}`);
3217
+ recordBaseVerdict({ repo, base, sha: baseSha, red: true, att, commands: cmds, outputs }); // #5992: later lanes and the dispatcher's probe reuse this verdict
3141
3218
  ev({ event: "BASE_RED", commands: cmds, output: cmds.map((c) => tailOf(c).slice(-500)), sha: att?.sha ?? null, issue: att?.issue ?? null, tracked: n });
3142
3219
  return await finish("deferred", `base ${base} is red on guard command(s) ${cmds.join(", ")}; deferred behind ${n ? `#${n}` : "the base fix"}`, { code: OUTCOME_CODES.BASE_RED, retryInSeconds: 900 }, OUTCOME_CODES.BASE_RED);
3143
3220
  }
@@ -3257,12 +3334,23 @@ export async function runCore(o) {
3257
3334
  const kindsNow = () => (riskEnforced ? null : kinds);
3258
3335
  const recording = () => shadow || (!riskEnforced && Object.keys(kinds).length > 0); // the gate records what it would have blocked
3259
3336
  const blockingOf = (fs, allow) => blockingFailures(fs, { shadow, kinds: kindsNow(), allow });
3337
+ const enforcedKinds = () => Object.entries(kinds ?? {}).filter(([, m]) => m === "enforce").map(([c]) => c); // unclog: an explicit enforce re-promotes an advisory code
3260
3338
  let effective = frozen, review = null, lastAmend = "", resumes = 0, lastFailKey = null, verdict = null, degraded = null, triggerSkipped = false, selfReviewCompared = false;
3261
3339
  const TRIGGER_SKIP = "skipped (review.trigger enforce: no risk trigger)";
3262
3340
  const triggerSkipNote = "## Conformance Review\n**Skipped by `review.trigger: enforce`:** no risk path, package edge or hotspot in the diff, and every deterministic gate passed; no reviewer ran (#4273).";
3263
3341
  let pendingDecisions = [], firstRounds = null, firstReply = null, lastDecided = "";
3264
3342
  let baseTree = null; // #4695: the base file list, read once and only when a decision amendment needs it
3265
3343
  let genPaths = null; // forge#4519: maintenance.generated_paths from hotspots.sh (plan facts; one config-only call without them, never on light lanes)
3344
+ const advisorySeen = new Set();
3345
+ /** unclog: an advisory row is recorded once per lane as a decision line (trajectory + PR), never as a failure. */
3346
+ function noteAdvisory(rows) {
3347
+ for (const f of rows ?? []) {
3348
+ const line = `Advisory (not blocking): ${f.code}${f.kind ? ` ${f.kind}` : ""}: ${String(f.detail ?? "").slice(0, 300)}`;
3349
+ if (advisorySeen.has(line)) continue;
3350
+ advisorySeen.add(line); T.decisions.push(line);
3351
+ }
3352
+ if (rows?.length) ev({ event: "ADVISORY", rows: rows.map((f) => f.kind ?? f.code) });
3353
+ }
3266
3354
  async function amend() {
3267
3355
  genPaths ??= (hotFacts ? hotFacts.generated_paths : light ? [] : (await hotspotsOf({ paths: [] }))?.generated_paths) ?? [];
3268
3356
  const wantsDecision = (Array.isArray(result?.amendments) ? result.amendments : []).some((x) => x?.kind === "decision");
@@ -3289,7 +3377,7 @@ export async function runCore(o) {
3289
3377
  }
3290
3378
  pendingDecisions = a.decisions; // #4737: persisted only once the PR merges
3291
3379
  effective = a.contract;
3292
- return a.problems.map((d) => ({ code: OUTCOME_CODES.CONFORMANCE_UNIMPLEMENTED, detail: d }));
3380
+ return a.problems.map((d) => ({ code: OUTCOME_CODES.CONFORMANCE_UNIMPLEMENTED, kind: "amendment_invalid", detail: d })); // unclog: advisory, the amendment is simply not applied
3293
3381
  }
3294
3382
  const IGNORE = [`${LEAN_DIR}/`];
3295
3383
  /** Up to two reviewer runs; a reply without usable rows (unparseable, incomplete, inconsistent) is re-asked, never charged to the builder. */
@@ -3514,9 +3602,11 @@ export async function runCore(o) {
3514
3602
  domainsLogged = domains.join(",");
3515
3603
  ev({ event: "REVIEW_DOMAINS", domains, enforced: dHits.length ? dHits : undefined, ...(pd === null ? { error: "roster.failed" } : {}) });
3516
3604
  }
3517
- if (!amendFixed && sessionId && amendmentKindProblems(result?.amendments).length) { // #5089: one in-lane correction, outside the conformance resume budget
3605
+ const vIds = [...(frozen?.validate ?? []), ...(frozen?.regression ?? [])].map((v) => v?.id);
3606
+ const amendBad = (am) => [...new Set([...validateAmendments(am), ...amendmentKindProblems(am, vIds)])]; // #5089/#5986: the shared amendment schema, plus #5979's validate-row supersedes hint
3607
+ if (!amendFixed && sessionId && amendBad(result?.amendments).length) { // one in-lane correction, outside the conformance resume budget; a still-invalid shape is never posted
3518
3608
  amendFixed = true;
3519
- const bad = amendmentKindProblems(result.amendments);
3609
+ const bad = amendBad(result.amendments);
3520
3610
  T.decisions.push(`Amendment kinds invalid (${bad.length}); builder asked to correct ${RESULT_FILE} once`);
3521
3611
  await builder(++attemptN, amendmentCorrectionPrompt(bad), sessionId, false, undefined, { mode: "resume", trigger: "contract_correction" });
3522
3612
  result = (await readResult()) ?? result;
@@ -3653,7 +3743,9 @@ export async function runCore(o) {
3653
3743
  // #4323/#4334: a missing host tool or module, or a repro test the harness could not run, is an environment error:
3654
3744
  // never a conformance failure, never a builder resume
3655
3745
  const envFails = pc.failures.filter((f) => ENV_CODES.includes(f.code));
3656
- const pre = [...pc.failures.filter((f) => !ENV_CODES.includes(f.code)), ...amendProblems, ...mutBlock, ...adqFail];
3746
+ const preSplit = splitAdvisory([...pc.failures.filter((f) => !ENV_CODES.includes(f.code)), ...amendProblems, ...mutBlock, ...adqFail], { enforce: enforcedKinds() });
3747
+ noteAdvisory(preSplit.advisory);
3748
+ const pre = preSplit.block;
3657
3749
  if (pre.length) ev({ event: "PRECHECK", failures: pre.map((f) => f.code) });
3658
3750
  // #5080: the repro already passes on the base and the diff changes no source: the fix is on the base, not missing
3659
3751
  if (alreadyFixedOnBase(pre, files, IGNORE)) return { state: "already-fixed", by: "precheck", failures: pre };
@@ -3700,6 +3792,12 @@ export async function runCore(o) {
3700
3792
  const vf = await runVerifier();
3701
3793
  if (vf.length) d = { state: "nonconforming", failures: vf, by: "verifier" };
3702
3794
  }
3795
+ if (d.state === "nonconforming") { // unclog: advisory kinds from the reviewer/verifier never park a lane either
3796
+ const ds = splitAdvisory(d.failures, { enforce: enforcedKinds() });
3797
+ noteAdvisory(ds.advisory);
3798
+ if (!ds.block.length) d = { ...d, state: "conforms", failures: [] };
3799
+ else d = { ...d, failures: ds.block };
3800
+ }
3703
3801
  if (!recording()) return { ...d, by: d.by ?? "review" };
3704
3802
  // shadow: record what enforce would have done; block only on what the previous reviewer blocked on
3705
3803
  const would = d.state === "conforms" && !pre.length ? "conforms" : d.state.startsWith("review.") ? d.state : "nonconforming";
@@ -4415,6 +4513,7 @@ export async function runCore(o) {
4415
4513
  }
4416
4514
  T.merge = [policyText, `merged at ${localHead.slice(0, 12)}`];
4417
4515
  laneGuard(resumed?.base ?? lane, "merge");
4516
+ await suspensionGuard("merge"); // #6008
4418
4517
  try {
4419
4518
  phaseLedger.enter("merge");
4420
4519
  await ghc(["pr", "merge", String(pr), "-R", repo, "--merge", "--match-head-commit", localHead]);