audit-tools 0.30.14 → 0.30.16

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.
@@ -156,6 +156,16 @@ export declare function rebaseBranchOntoHead(root: string, worktreePath: string,
156
156
  /** Worktree path for a remediation block. */
157
157
  export declare function worktreePath(root: string, blockId: string, runId: string): string;
158
158
  export declare function remediationBranchName(runId: string): string;
159
+ /**
160
+ * Lock path for the base-mutating accept critical section (INV-2/CE-001), keyed on
161
+ * the base repo root + run's remediation branch. DISTINCT from the per-run
162
+ * `rolling-session.lock` (`withFileLock` is non-reentrant — an exclusive `wx`
163
+ * create — so the base lock MUST be a different path than the session lock
164
+ * `advanceHostRolling` already holds, or the nested acquire would self-deadlock).
165
+ * Both rolling drivers (host-subagent + in-process) serialize the rebase →
166
+ * cherry-pick → cross-package check → reset sequence through this single lock.
167
+ */
168
+ export declare function baseBranchLockPath(root: string, runId: string): string;
159
169
  /**
160
170
  * Preserve a failed-but-committed node's work so it can never be lost. A node that
161
171
  * committed real edits to its worktree branch but then failed verify / the
@@ -188,18 +198,7 @@ export declare function listQuarantinedCommits(root: string, runId: string): Arr
188
198
  * non-git callers/tests are unaffected. Returns the branch name on success.
189
199
  */
190
200
  export declare function ensureRemediationBranchCheckedOut(root: string, runId: string): string | null;
191
- /**
192
- * Stage and commit all of a worktree's edits onto its branch. The TOOL owns this
193
- * commit (never the worker/host) so that the branch has a real commit for two
194
- * downstream invariants: `gitEditedFilesForBranch` (the write-scope ground truth,
195
- * `HEAD...<branch>`) and `mergeWorktree`'s cherry-pick both operate on the worker's
196
- * changes rather than an empty diff against HEAD. Gitignored paths (node_modules,
197
- * .audit-tools artifacts, the result file written to the main artifacts dir) are
198
- * excluded by `git add -A` honoring .gitignore, so the commit captures exactly the
199
- * source edits. Returns `committed:false` (not an error) when the worker made no
200
- * tracked edits — there is then nothing to verify or merge.
201
- */
202
- export declare function commitWorktree(worktreeRoot: string, message: string): {
201
+ export declare function commitWorktree(worktreeRoot: string, message: string, declaredWritePaths?: string[]): {
203
202
  committed: boolean;
204
203
  error?: string;
205
204
  };
@@ -260,6 +259,21 @@ export interface AcceptNodeWorktreeParams {
260
259
  write_paths: string[];
261
260
  }>;
262
261
  };
262
+ /**
263
+ * The block's OWN declared write paths (INV-1). Threaded into `commitWorktree`
264
+ * so worker-created new SOURCE files under scope are force-added past
265
+ * `.gitignore` and a generated-artifact / out-of-scope new file fails loudly.
266
+ * Omit (lifecycle unit tests with no scope) → no new-file inclusion.
267
+ */
268
+ writePaths?: string[];
269
+ /**
270
+ * The cross-package check command run in the MAIN checkout AFTER the cherry-pick
271
+ * lands (INV-2): a RED check rolls the base back to its captured HEAD OID. Defaults
272
+ * to `npm run check`. Tests inject a deterministic pass/fail command (a `t.mock.module`
273
+ * seam is unusable under tsx/esm). Pass `null` to skip the merged-base check entirely
274
+ * (legacy lifecycle unit tests on a minimal repo with no check script).
275
+ */
276
+ mergedBaseCheckCommand?: string | null;
263
277
  }
264
278
  export interface AcceptNodeWorktreeResult {
265
279
  /** The LIFECYCLE outcome (verify/merge applied), distinct from the worker transport outcome. */
@@ -295,7 +309,7 @@ export interface AcceptNodeWorktreeResult {
295
309
  * verified branch, aborts cleanly on conflict). No state mutation here — the
296
310
  * caller persists via `mergeImplementResults`.
297
311
  */
298
- export declare function acceptNodeWorktree(params: AcceptNodeWorktreeParams): AcceptNodeWorktreeResult;
312
+ export declare function acceptNodeWorktree(params: AcceptNodeWorktreeParams): Promise<AcceptNodeWorktreeResult>;
299
313
  /**
300
314
  * Sidecar path for a node's tool-owned accept (verify/merge) outcome. Written by
301
315
  * BOTH rolling drivers as each node is accepted, read by `mergeImplementResults`.
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/remediate/steps/dispatch.ts"],"names":[],"mappings":"AASA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAML,KAAK,gBAAgB,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AM,EAAE,CAAA;CAAE,CAAC,EACrE,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAaf;AAMD,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,oFAAoF;AACpF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,gBAAgB,EAAE,GAChC,eAAe,EAAE,CAwBnB;AAoBD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,gBAAgB,CAAC,CAkC3B;AAojBD,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAE9B;AAED,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,uBAAuB,CAAC,CAElC"}
@@ -9,6 +9,7 @@ import { verifyPairingForFinding } from "../contractPipeline/changeClassificatio
9
9
  import { spawnSync } from "node:child_process";
10
10
  import { StateStore } from "../state/store.js";
11
11
  import { REMEDIATION_STEP, isClarificationCategory, } from "../state/types.js";
12
+ import { withFileLock } from "audit-tools/shared";
12
13
  import { captureStepBoundaryFriction } from "audit-tools/shared";
13
14
  import { findingLead, renderFindingBadgeBody } from "audit-tools/shared";
14
15
  import { runShellCommand } from "../utils/commands.js";
@@ -566,6 +567,18 @@ function refSafeSegment(s, fallback) {
566
567
  export function remediationBranchName(runId) {
567
568
  return `remediation/${refSafeSegment(runId, "run")}`;
568
569
  }
570
+ /**
571
+ * Lock path for the base-mutating accept critical section (INV-2/CE-001), keyed on
572
+ * the base repo root + run's remediation branch. DISTINCT from the per-run
573
+ * `rolling-session.lock` (`withFileLock` is non-reentrant — an exclusive `wx`
574
+ * create — so the base lock MUST be a different path than the session lock
575
+ * `advanceHostRolling` already holds, or the nested acquire would self-deadlock).
576
+ * Both rolling drivers (host-subagent + in-process) serialize the rebase →
577
+ * cherry-pick → cross-package check → reset sequence through this single lock.
578
+ */
579
+ export function baseBranchLockPath(root, runId) {
580
+ return join(root, ".audit-tools", "remediation", "runs", refSafeSegment(runId, "run"), "base-branch.lock");
581
+ }
569
582
  /** Durable ref under which a failed-but-committed node's commit is preserved. */
570
583
  function quarantineRef(runId, blockId) {
571
584
  return `refs/remediation-quarantine/${refSafeSegment(runId, "run")}/${refSafeSegment(blockId, "node")}`;
@@ -670,7 +683,143 @@ export function ensureRemediationBranchCheckedOut(root, runId) {
670
683
  * source edits. Returns `committed:false` (not an error) when the worker made no
671
684
  * tracked edits — there is then nothing to verify or merge.
672
685
  */
673
- export function commitWorktree(worktreeRoot, message) {
686
+ /**
687
+ * Source-file extensions a worker is allowed to CREATE as a brand-new untracked
688
+ * file that `.gitignore` happens to shadow. A new source file (a .ts the build
689
+ * compiles, a .js shim, a source .json fixture/config) is real work that MUST land
690
+ * even though `git add -A` honours `.gitignore` and would silently drop it
691
+ * (CE-003/CE-004 — the dogfood lost a gitignored friction-dir file exactly this
692
+ * way). A new
693
+ * file with any OTHER suffix under write scope is a GENERATED artifact (`.tsbuildinfo`,
694
+ * an emitted `.d.ts`, a coverage dump, …) — committing it would land a stale build
695
+ * output, so those FAIL LOUDLY rather than commit a half-change.
696
+ */
697
+ const SOURCE_NEW_FILE_EXTENSIONS = new Set([
698
+ ".ts",
699
+ ".tsx",
700
+ ".mts",
701
+ ".cts",
702
+ ".js",
703
+ ".jsx",
704
+ ".mjs",
705
+ ".cjs",
706
+ ".json",
707
+ ]);
708
+ /**
709
+ * A new untracked-ignored file is a SOURCE file (force-add it) iff its extension
710
+ * is in {@link SOURCE_NEW_FILE_EXTENSIONS} AND it is not a generated declaration
711
+ * (`.d.ts` / `.d.mts` / `.d.cts`) — a generated `.d.ts` has a `.ts` suffix but is
712
+ * build output, so it must be excluded from the source set.
713
+ */
714
+ function isSourceNewFile(rel) {
715
+ const lower = rel.toLowerCase();
716
+ if (/\.d\.[cm]?ts$/.test(lower))
717
+ return false;
718
+ const dot = lower.lastIndexOf(".");
719
+ if (dot < 0)
720
+ return false;
721
+ return SOURCE_NEW_FILE_EXTENSIONS.has(lower.slice(dot));
722
+ }
723
+ /**
724
+ * Whether a repo-relative path falls UNDER one of the block's declared write
725
+ * paths. A declared path matches a new file when it is the file itself, a
726
+ * directory prefix of it (declared `src/x` matches `src/x/new.ts`), or a glob
727
+ * whose pre-wildcard directory prefix contains it (a leading-wildcard glob like
728
+ * a friction-dir pattern matches `src/a/friction/new.ts`). Declared paths and the
729
+ * candidate are normalized to
730
+ * repo-relative forward-slash form so the comparison is OS-agnostic.
731
+ */
732
+ function isUnderWritePaths(rel, declaredWritePaths, root) {
733
+ const target = toRepoRelative(rel, root);
734
+ for (const raw of declaredWritePaths) {
735
+ const declared = toRepoRelative(raw, root);
736
+ if (declared === target)
737
+ return true;
738
+ // Glob: reduce a wildcard pattern to the leading literal dir segment(s)
739
+ // before the first wildcard and treat that as a containing prefix.
740
+ const wildcard = declared.search(/[*?[]/);
741
+ const literalPrefix = (wildcard >= 0 ? declared.slice(0, wildcard) : declared)
742
+ .replace(/\/+$/, "");
743
+ if (literalPrefix.length === 0) {
744
+ // A leading-wildcard glob (a friction-dir style pattern) — match on the
745
+ // trailing literal segment appearing anywhere in the candidate's path.
746
+ const trailing = declared.replace(/^[*?/]+/, "").replace(/\/+$/, "");
747
+ if (trailing.length > 0 && (target === trailing || target.includes(`/${trailing}/`) || target.includes(`${trailing}/`))) {
748
+ return true;
749
+ }
750
+ continue;
751
+ }
752
+ if (target === literalPrefix || target.startsWith(`${literalPrefix}/`))
753
+ return true;
754
+ }
755
+ return false;
756
+ }
757
+ /**
758
+ * Force-add worker-created NEW files that `.gitignore` shadows so genuine new
759
+ * source work lands in the commit. `git add -A` (and any diff) honour `.gitignore`
760
+ * and can ONLY be enumerated via `git ls-files --others --ignored
761
+ * --exclude-standard`. For each such file: a source-extension file UNDER the
762
+ * block's declared write scope is `git add -f`'d so it lands; a non-source file
763
+ * under scope (generated artifact) OR any new file OUTSIDE scope FAILS LOUDLY
764
+ * (returns an error naming the file) rather than committing a half-change.
765
+ * `declaredWritePaths` undefined → the lifecycle unit-test path with no scope:
766
+ * skip force-add entirely (no new-file inclusion, legacy behaviour).
767
+ */
768
+ function forceAddNewSourceFiles(worktreeRoot, declaredWritePaths) {
769
+ if (declaredWritePaths === undefined)
770
+ return { ok: true };
771
+ const ls = spawnSync("git", ["ls-files", "--others", "--ignored", "--exclude-standard"], { cwd: worktreeRoot, encoding: "utf8", shell: false });
772
+ if (ls.error || ls.status !== 0) {
773
+ return {
774
+ ok: false,
775
+ error: `git ls-files (untracked-ignored enumeration) failed: ${(ls.stderr ?? ls.error?.message ?? "").toString().trim()}`,
776
+ };
777
+ }
778
+ const newFiles = (ls.stdout ?? "")
779
+ .split(/\r?\n/)
780
+ .map((l) => l.trim().replace(/\\/g, "/"))
781
+ .filter((l) => l.length > 0);
782
+ const toForceAdd = [];
783
+ for (const rel of newFiles) {
784
+ const underScope = isUnderWritePaths(rel, declaredWritePaths, worktreeRoot);
785
+ if (underScope && isSourceNewFile(rel)) {
786
+ toForceAdd.push(rel);
787
+ continue;
788
+ }
789
+ if (underScope) {
790
+ return {
791
+ ok: false,
792
+ error: `Worker created a new non-source (generated) file under its write scope: ${rel}. ` +
793
+ `Only source-extension new files are committed; a generated artifact must not land. ` +
794
+ `Refusing to commit a half-change.`,
795
+ };
796
+ }
797
+ return {
798
+ ok: false,
799
+ error: `Worker created a new file OUTSIDE its declared write scope: ${rel}. ` +
800
+ `New files must fall under the block's write_paths. Refusing to commit a half-change.`,
801
+ };
802
+ }
803
+ for (const rel of toForceAdd) {
804
+ const add = spawnSync("git", ["add", "-f", "--", rel], {
805
+ cwd: worktreeRoot,
806
+ encoding: "utf8",
807
+ shell: false,
808
+ });
809
+ if (add.status !== 0) {
810
+ return { ok: false, error: `git add -f ${rel} failed: ${(add.stderr ?? "").trim()}` };
811
+ }
812
+ }
813
+ return { ok: true };
814
+ }
815
+ export function commitWorktree(worktreeRoot, message, declaredWritePaths) {
816
+ // Force-add worker-created new SOURCE files that `.gitignore` shadows (and fail
817
+ // loudly on a generated-artifact / out-of-scope new file) BEFORE `git add -A`,
818
+ // which on its own silently drops every untracked-ignored path (CE-003/CE-004).
819
+ const forced = forceAddNewSourceFiles(worktreeRoot, declaredWritePaths);
820
+ if (!forced.ok) {
821
+ return { committed: false, error: forced.error };
822
+ }
674
823
  const add = spawnSync("git", ["add", "-A"], {
675
824
  cwd: worktreeRoot,
676
825
  encoding: "utf8",
@@ -742,7 +891,7 @@ export function ensureWorktreeNodeModules(mainRoot, worktreeRoot) {
742
891
  * verified branch, aborts cleanly on conflict). No state mutation here — the
743
892
  * caller persists via `mergeImplementResults`.
744
893
  */
745
- export function acceptNodeWorktree(params) {
894
+ export async function acceptNodeWorktree(params) {
746
895
  const { root, runId, blockId, worktreeRoot: wt, branch, workerOutcome, targetedCommands, additionalVerifyCommands } = params;
747
896
  let verifyPassed = false;
748
897
  let merged = false;
@@ -751,9 +900,10 @@ export function acceptNodeWorktree(params) {
751
900
  removeWorktree(root, wt);
752
901
  return { outcome: workerOutcome, verifyPassed, merged };
753
902
  }
754
- const commit = commitWorktree(wt, `remediate ${blockId} (${runId})`);
903
+ const commit = commitWorktree(wt, `remediate ${blockId} (${runId})`, params.writePaths);
755
904
  if (commit.error) {
756
- // Could not commit the worker's edits cannot safely land; drop it.
905
+ // Could not commit the worker's edits (or a new-file inclusion violation)
906
+ // cannot safely land; drop it.
757
907
  removeWorktree(root, wt);
758
908
  return { outcome: "error", verifyPassed, merged, diagnostic: commit.error };
759
909
  }
@@ -763,79 +913,142 @@ export function acceptNodeWorktree(params) {
763
913
  removeWorktree(root, wt);
764
914
  return { outcome: "success", verifyPassed, merged };
765
915
  }
766
- // Rebase the node's branch onto the current remediation HEAD BEFORE verify, so a
767
- // sibling that merged after this worktree was created is folded in. Verify, the
768
- // write-scope gate, and the cherry-pick then all operate on the FINAL to-be-merged
769
- // content (green-at-merge; the later cherry-pick can no longer conflict). A true
770
- // hunk conflict here is a genuine seam preserve the work and route to triage
771
- // rather than land a broken merge.
772
- const rebase = rebaseBranchOntoHead(root, wt, branch);
773
- if (!rebase.ok) {
774
- quarantineFailedNodeCommit(root, branch, runId, blockId);
775
- removeWorktree(root, wt);
776
- return { outcome: "error", verifyPassed, merged, diagnostic: rebase.error };
777
- }
778
- // Verify commands: when the host omits them (real rolling drivers), DERIVE them
779
- // from the just-committed branch's touched test filescorrect paths/runner by
780
- // construction, only this node's own tests, never the whole suite. An explicit
781
- // list (or `[]` to skip) overrides; both used by lifecycle unit tests. task_7d35176d:
782
- // run the derive AND the node's own build-free `targeted_commands` (deduped) — the
783
- // auditor's fix-specific regression checks the derive misses when a fix touches no
784
- // test. `additionalVerifyCommands` is ignored on the explicit-override path.
785
- const baseCommands = targetedCommands === undefined
786
- ? deriveVerifyCommandsFromBranch(root, branch)
787
- : targetedCommands;
788
- const verifyCommands = targetedCommands === undefined
789
- ? [...new Set([...baseCommands, ...buildFreeVerifyCommands(additionalVerifyCommands)])]
790
- : baseCommands;
791
- const verify = verifyCommands.length > 0
792
- ? verifyNodeInWorktree(wt, verifyCommands)
793
- : { passed: true, output: "" };
794
- verifyPassed = verify.passed;
795
- if (!verify.passed) {
796
- // Verify failed: do not merge; drop the worktree so the main tree stays clean.
797
- // The node DID commit real edits, so preserve them under a durable quarantine
798
- // ref before the worktree/branch go away — a tool-verify false-negative must
799
- // not destroy a good fix (the dogfood lost one this way). Carry the failing
800
- // command + output so triage isn't blind on outcome:error.
801
- quarantineFailedNodeCommit(root, branch, runId, blockId);
802
- removeWorktree(root, wt);
803
- return { outcome: "error", verifyPassed, merged, diagnostic: verify.output };
804
- }
805
- // Write-scope gate (OBL-DS-06), BEFORE the cherry-pick: an out-of-scope or
806
- // seam-conflicting edit must never land in the main tree, so it is adjudicated
807
- // against the branch's git diff (the ground truth) here rather than reported
808
- // after `mergeWorktree` already merged it. The gate routes the node's ACTUAL
809
- // out-of-declared edits (git diff, never a self-report): an edit to a file no
810
- // sibling block owns widens the effective scope, while one owned by another
811
- // block blocks as a seam conflict.
812
- if (params.scope) {
813
- const decision = enforceAcceptWriteScope({
814
- root,
815
- branch,
816
- blockId,
817
- allBlockScopes: params.scope.allBlockScopes,
916
+ // Base-mutating critical section (INV-2/INV-3/CE-001/CE-002/CE-005) under a DISTINCT
917
+ // base-branch lock NOT the per-run rolling-session.lock `advanceHostRolling` holds
918
+ // (withFileLock is non-reentrant, so a same-path nested acquire would self-deadlock).
919
+ // Acquired exactly ONCE here so BOTH rolling drivers serialize the rebase →
920
+ // cherry-pick cross-package check reset sequence through one lock. The base HEAD
921
+ // OID is captured before the cherry-pick so a RED merged-base check rolls the base
922
+ // back bit-identically. The lock is released on EVERY exit path (success, verify
923
+ // fail, scope fail, check fail, subprocess fail) by withFileLock's finally.
924
+ return withFileLock(baseBranchLockPath(root, runId), async () => {
925
+ // Rebase the node's branch onto the current remediation HEAD BEFORE verify, so a
926
+ // sibling that merged after this worktree was created is folded in. Verify, the
927
+ // write-scope gate, and the cherry-pick then all operate on the FINAL to-be-merged
928
+ // content (green-at-merge; the later cherry-pick can no longer conflict). A true
929
+ // hunk conflict here is a genuine seampreserve the work and route to triage
930
+ // rather than land a broken merge.
931
+ const rebase = rebaseBranchOntoHead(root, wt, branch);
932
+ if (!rebase.ok) {
933
+ quarantineFailedNodeCommit(root, branch, runId, blockId);
934
+ removeWorktree(root, wt);
935
+ return { outcome: "error", verifyPassed, merged, diagnostic: rebase.error };
936
+ }
937
+ // Verify commands: when the host omits them (real rolling drivers), DERIVE them
938
+ // from the just-committed branch's touched test files — correct paths/runner by
939
+ // construction, only this node's own tests, never the whole suite. An explicit
940
+ // list (or `[]` to skip) overrides; both used by lifecycle unit tests. task_7d35176d:
941
+ // run the derive AND the node's own build-free `targeted_commands` (deduped) — the
942
+ // auditor's fix-specific regression checks the derive misses when a fix touches no
943
+ // test. `additionalVerifyCommands` is ignored on the explicit-override path.
944
+ const baseCommands = targetedCommands === undefined
945
+ ? deriveVerifyCommandsFromBranch(root, branch)
946
+ : targetedCommands;
947
+ const verifyCommands = targetedCommands === undefined
948
+ ? [...new Set([...baseCommands, ...buildFreeVerifyCommands(additionalVerifyCommands)])]
949
+ : baseCommands;
950
+ const verify = verifyCommands.length > 0
951
+ ? verifyNodeInWorktree(wt, verifyCommands)
952
+ : { passed: true, output: "" };
953
+ verifyPassed = verify.passed;
954
+ if (!verify.passed) {
955
+ // Verify failed: do not merge; drop the worktree so the main tree stays clean.
956
+ // The node DID commit real edits, so preserve them under a durable quarantine
957
+ // ref before the worktree/branch go away a tool-verify false-negative must
958
+ // not destroy a good fix (the dogfood lost one this way). Carry the failing
959
+ // command + output so triage isn't blind on outcome:error.
960
+ quarantineFailedNodeCommit(root, branch, runId, blockId);
961
+ removeWorktree(root, wt);
962
+ return { outcome: "error", verifyPassed, merged, diagnostic: verify.output };
963
+ }
964
+ // Write-scope gate (OBL-DS-06), BEFORE the cherry-pick: an out-of-scope or
965
+ // seam-conflicting edit must never land in the main tree, so it is adjudicated
966
+ // against the branch's git diff (the ground truth) here rather than reported
967
+ // after `mergeWorktree` already merged it. The gate routes the node's ACTUAL
968
+ // out-of-declared edits (git diff, never a self-report): an edit to a file no
969
+ // sibling block owns widens the effective scope, while one owned by another
970
+ // block blocks as a seam conflict.
971
+ if (params.scope) {
972
+ const decision = enforceAcceptWriteScope({
973
+ root,
974
+ branch,
975
+ blockId,
976
+ allBlockScopes: params.scope.allBlockScopes,
977
+ });
978
+ if (decision.blocked) {
979
+ // Scope-blocked but the node committed real work — preserve it for recovery.
980
+ quarantineFailedNodeCommit(root, branch, runId, blockId);
981
+ removeWorktree(root, wt);
982
+ return { outcome: "error", verifyPassed, merged: false, diagnostic: decision.reason };
983
+ }
984
+ }
985
+ // Capture the base HEAD OID BEFORE the cherry-pick so a RED merged-base check can
986
+ // roll the base back to a bit-identical state.
987
+ const baseHeadBefore = spawnSync("git", ["rev-parse", "HEAD"], {
988
+ cwd: root,
989
+ encoding: "utf8",
990
+ shell: false,
818
991
  });
819
- if (decision.blocked) {
820
- // Scope-blocked but the node committed real work — preserve it for recovery.
992
+ if (baseHeadBefore.error || baseHeadBefore.status !== 0) {
821
993
  quarantineFailedNodeCommit(root, branch, runId, blockId);
822
994
  removeWorktree(root, wt);
823
- return { outcome: "error", verifyPassed, merged: false, diagnostic: decision.reason };
995
+ return {
996
+ outcome: "error",
997
+ verifyPassed,
998
+ merged,
999
+ diagnostic: `could not capture base HEAD before merge: ${(baseHeadBefore.stderr ?? baseHeadBefore.error?.message ?? "").toString().trim()}`,
1000
+ };
824
1001
  }
825
- }
826
- // mergeWorktree cherry-picks the verified branch and removes the worktree (on
827
- // success AND on conflict-abort), so no explicit cleanup is needed afterwards.
828
- const mergeRes = mergeWorktree(root, wt, branch);
829
- merged = mergeRes.success;
830
- if (!mergeRes.success) {
831
- // Cherry-pick conflict: the committed work would otherwise be orphaned — preserve it.
832
- quarantineFailedNodeCommit(root, branch, runId, blockId);
833
- return { outcome: "error", verifyPassed, merged, diagnostic: mergeRes.error };
834
- }
835
- // Landed successfully: clear any quarantine ref left by a prior failed attempt
836
- // for this node so the recovery report lists only genuinely-unrecovered work.
837
- clearQuarantinedCommit(root, runId, blockId);
838
- return { outcome: "success", verifyPassed, merged };
1002
+ const baseOid = baseHeadBefore.stdout.trim();
1003
+ // mergeWorktree cherry-picks the verified branch and removes the worktree (on
1004
+ // success AND on conflict-abort), so no explicit cleanup is needed afterwards.
1005
+ const mergeRes = mergeWorktree(root, wt, branch);
1006
+ merged = mergeRes.success;
1007
+ if (!mergeRes.success) {
1008
+ // Cherry-pick conflict: the committed work would otherwise be orphaned — preserve it.
1009
+ quarantineFailedNodeCommit(root, branch, runId, blockId);
1010
+ return { outcome: "error", verifyPassed, merged, diagnostic: mergeRes.error };
1011
+ }
1012
+ // Merged-base-green (INV-2): the cherry-pick landed in the MAIN checkout, where
1013
+ // node_modules is faithful (the worktree's @audit-tools junction resolves to main
1014
+ // and is unfaithful, so the per-node worktree verify cannot catch a cross-package
1015
+ // break). Run the REAL cross-package check in the main tree. On RED, roll the base
1016
+ // back to its captured OID bit-identically, scoped-clean the cherry-pick's emitted
1017
+ // untracked files, quarantine, and fail — never leave a broken base for the sibling.
1018
+ const checkCommand = params.mergedBaseCheckCommand === undefined ? "npm run check" : params.mergedBaseCheckCommand;
1019
+ if (checkCommand !== null) {
1020
+ // Paths the just-landed pick touched, so the scoped clean nukes only those
1021
+ // (never unrelated untracked state). Resolved BEFORE the check runs.
1022
+ const pickedFiles = gitEditedFilesForBranch(root, branch);
1023
+ const check = runShellCommand(checkCommand, { cwd: root, encoding: "utf8" });
1024
+ const checkFailed = !!check.error || check.status !== 0;
1025
+ if (checkFailed) {
1026
+ const detail = check.error
1027
+ ? check.error.message
1028
+ : [check.stdout ?? "", check.stderr ?? ""].filter(Boolean).join("\n");
1029
+ // Roll the base back to its pre-pick OID, bit-identical.
1030
+ spawnSync("git", ["reset", "--hard", baseOid], { cwd: root, shell: false });
1031
+ // Scoped clean: remove only the cherry-pick / check-emitted untracked files
1032
+ // under the paths the pick touched — never a blanket `git clean` that could
1033
+ // nuke unrelated untracked state.
1034
+ if (pickedFiles.available && pickedFiles.files.size > 0) {
1035
+ spawnSync("git", ["clean", "-fdq", "--", ...[...pickedFiles.files]], { cwd: root, shell: false });
1036
+ }
1037
+ quarantineFailedNodeCommit(root, branch, runId, blockId);
1038
+ return {
1039
+ outcome: "error",
1040
+ verifyPassed,
1041
+ merged: false,
1042
+ diagnostic: `$ ${checkCommand}\n${detail}`,
1043
+ };
1044
+ }
1045
+ }
1046
+ // Landed successfully and the merged base is green: clear any quarantine ref left
1047
+ // by a prior failed attempt for this node so the recovery report lists only
1048
+ // genuinely-unrecovered work.
1049
+ clearQuarantinedCommit(root, runId, blockId);
1050
+ return { outcome: "success", verifyPassed, merged };
1051
+ });
839
1052
  }
840
1053
  /**
841
1054
  * Sidecar path for a node's tool-owned accept (verify/merge) outcome. Written by
@@ -912,7 +1125,7 @@ export async function executeNodeInWorktree(args) {
912
1125
  // actually-touched tests inside acceptNodeWorktree (post-commit) — omit them so a
913
1126
  // host-authored path can't mis-verify. The write-scope gate adjudicates the node's
914
1127
  // ACTUAL git edits against every block's declared scope.
915
- const accept = acceptNodeWorktree({
1128
+ const accept = await acceptNodeWorktree({
916
1129
  root,
917
1130
  runId,
918
1131
  blockId: block.block_id,
@@ -921,6 +1134,8 @@ export async function executeNodeInWorktree(args) {
921
1134
  workerOutcome: result.outcome,
922
1135
  additionalVerifyCommands,
923
1136
  scope: { allBlockScopes },
1137
+ // The block's OWN declared write paths (INV-1 new-file inclusion).
1138
+ writePaths: allBlockScopes.find((b) => b.block_id === block.block_id)?.write_paths ?? [],
924
1139
  });
925
1140
  await recordNodeAcceptOutcome(artifactsDir, runId, block.block_id, accept);
926
1141
  return { result, accept };