oh-my-copilot 5.26.0 → 5.28.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -1
- package/agents/executor.md +1 -0
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +23572 -17129
- package/bridge/mcp-server.cjs +2721 -1497
- package/bridge/runtime-cli.cjs +4707 -1925
- package/bridge/team-mcp.cjs +2917 -816
- package/bridge/team.js +5397 -2381
- package/copilot/agents/executor.md +1 -0
- package/copilot/hooks.json +3 -3
- package/dist/__tests__/arguments-literal-substitution.test.d.ts +2 -0
- package/dist/__tests__/arguments-literal-substitution.test.d.ts.map +1 -0
- package/dist/__tests__/arguments-literal-substitution.test.js +34 -0
- package/dist/__tests__/arguments-literal-substitution.test.js.map +1 -0
- package/dist/__tests__/bridge-self-contained.test.d.ts +2 -0
- package/dist/__tests__/bridge-self-contained.test.d.ts.map +1 -0
- package/dist/__tests__/bridge-self-contained.test.js +44 -0
- package/dist/__tests__/bridge-self-contained.test.js.map +1 -0
- package/dist/__tests__/context-safety.test.js +1 -1
- package/dist/__tests__/context-safety.test.js.map +1 -1
- package/dist/__tests__/copilot-hook-dispatch.test.js +5 -1
- package/dist/__tests__/copilot-hook-dispatch.test.js.map +1 -1
- package/dist/__tests__/copilot-hooks-manifest.test.js +15 -1
- package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
- package/dist/__tests__/directory-context-injector-registration.test.js +5 -2
- package/dist/__tests__/directory-context-injector-registration.test.js.map +1 -1
- package/dist/__tests__/doctor-conflicts.test.js +61 -0
- package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
- package/dist/__tests__/hook-command-normalizer.test.js +96 -58
- package/dist/__tests__/hook-command-normalizer.test.js.map +1 -1
- package/dist/__tests__/hooks/session-end-cleanup.test.js +87 -1
- package/dist/__tests__/hooks/session-end-cleanup.test.js.map +1 -1
- package/dist/__tests__/hooks-command-escaping.test.js +18 -16
- package/dist/__tests__/hooks-command-escaping.test.js.map +1 -1
- package/dist/__tests__/hud/omc-state.test.js +62 -1
- package/dist/__tests__/hud/omc-state.test.js.map +1 -1
- package/dist/__tests__/installer-mcp-config.test.js +39 -1
- package/dist/__tests__/installer-mcp-config.test.js.map +1 -1
- package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js +1 -1
- package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js.map +1 -1
- package/dist/__tests__/keyword-detector-echo-guard.test.js +13 -1
- package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -1
- package/dist/__tests__/keyword-detector-script.test.js +201 -0
- package/dist/__tests__/keyword-detector-script.test.js.map +1 -1
- package/dist/__tests__/npm-package-surface-helpers.d.ts.map +1 -1
- package/dist/__tests__/npm-package-surface-helpers.js +8 -4
- package/dist/__tests__/npm-package-surface-helpers.js.map +1 -1
- package/dist/__tests__/plugin-setup-deps.test.js +144 -71
- package/dist/__tests__/plugin-setup-deps.test.js.map +1 -1
- package/dist/__tests__/preemptive-compaction-hook.test.js +62 -5
- package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
- package/dist/__tests__/ralph-prd-mandatory.test.js +3 -0
- package/dist/__tests__/ralph-prd-mandatory.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts +10 -0
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts.map +1 -0
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js +241 -0
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js.map +1 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts +9 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts.map +1 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.js +162 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.js.map +1 -0
- package/dist/__tests__/repair-plugin-cache-script.test.js +7 -1
- package/dist/__tests__/repair-plugin-cache-script.test.js.map +1 -1
- package/dist/__tests__/run-cjs-graceful-fallback.test.js +3 -2
- package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +4 -1
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -1
- package/dist/__tests__/setup-contracts-regression.test.js +13 -10
- package/dist/__tests__/setup-contracts-regression.test.js.map +1 -1
- package/dist/__tests__/skills.test.js +10 -9
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/alias-retirement/__tests__/registry.test.js +2 -2
- package/dist/cli/__tests__/doctor-conflicts-json.test.js +2 -2
- package/dist/cli/__tests__/doctor-conflicts-json.test.js.map +1 -1
- package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts +10 -0
- package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts.map +1 -0
- package/dist/cli/__tests__/herdr-no-raw-calls.test.js +54 -0
- package/dist/cli/__tests__/herdr-no-raw-calls.test.js.map +1 -0
- package/dist/cli/__tests__/interop-herdr.test.d.ts +9 -0
- package/dist/cli/__tests__/interop-herdr.test.d.ts.map +1 -0
- package/dist/cli/__tests__/interop-herdr.test.js +138 -0
- package/dist/cli/__tests__/interop-herdr.test.js.map +1 -0
- package/dist/cli/__tests__/launch-herdr.test.d.ts +10 -0
- package/dist/cli/__tests__/launch-herdr.test.d.ts.map +1 -0
- package/dist/cli/__tests__/launch-herdr.test.js +141 -0
- package/dist/cli/__tests__/launch-herdr.test.js.map +1 -0
- package/dist/cli/__tests__/launch.test.js +140 -10
- package/dist/cli/__tests__/launch.test.js.map +1 -1
- package/dist/cli/__tests__/plugin-dir-capture.test.js +2 -0
- package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-afk.test.js +392 -2
- package/dist/cli/__tests__/ralph-afk.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-closeout.test.d.ts +2 -0
- package/dist/cli/__tests__/ralph-closeout.test.d.ts.map +1 -0
- package/dist/cli/__tests__/ralph-closeout.test.js +156 -0
- package/dist/cli/__tests__/ralph-closeout.test.js.map +1 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.d.ts +2 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.d.ts.map +1 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.js +86 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.js.map +1 -0
- package/dist/cli/__tests__/team-resume-v2.test.js +46 -0
- package/dist/cli/__tests__/team-resume-v2.test.js.map +1 -1
- package/dist/cli/__tests__/team.test.js +24 -0
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/wait-teleport-json.test.js +2 -2
- package/dist/cli/__tests__/wait-teleport-json.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-run-cli.test.js +20 -0
- package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/release-cli.test.js +11 -0
- package/dist/cli/commands/__tests__/release-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/ship-cli.test.js +1 -1
- package/dist/cli/commands/__tests__/ship-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/teleport.test.js +42 -0
- package/dist/cli/commands/__tests__/teleport.test.js.map +1 -1
- package/dist/cli/commands/__tests__/wait.test.js +33 -1
- package/dist/cli/commands/__tests__/wait.test.js.map +1 -1
- package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
- package/dist/cli/commands/doctor-conflicts.js +6 -2
- package/dist/cli/commands/doctor-conflicts.js.map +1 -1
- package/dist/cli/commands/factory-bench.d.ts.map +1 -1
- package/dist/cli/commands/factory-bench.js +17 -3
- package/dist/cli/commands/factory-bench.js.map +1 -1
- package/dist/cli/commands/factory-dashboard.d.ts +5 -1
- package/dist/cli/commands/factory-dashboard.d.ts.map +1 -1
- package/dist/cli/commands/factory-dashboard.js +6 -2
- package/dist/cli/commands/factory-dashboard.js.map +1 -1
- package/dist/cli/commands/factory.d.ts +6 -0
- package/dist/cli/commands/factory.d.ts.map +1 -1
- package/dist/cli/commands/factory.js +45 -4
- package/dist/cli/commands/factory.js.map +1 -1
- package/dist/cli/commands/ralph.d.ts +36 -1
- package/dist/cli/commands/ralph.d.ts.map +1 -1
- package/dist/cli/commands/ralph.js +298 -50
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/release.d.ts +3 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +12 -3
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/ship.d.ts.map +1 -1
- package/dist/cli/commands/ship.js +8 -4
- package/dist/cli/commands/ship.js.map +1 -1
- package/dist/cli/commands/team.d.ts.map +1 -1
- package/dist/cli/commands/team.js +2 -0
- package/dist/cli/commands/team.js.map +1 -1
- package/dist/cli/commands/teleport.d.ts.map +1 -1
- package/dist/cli/commands/teleport.js +6 -1
- package/dist/cli/commands/teleport.js.map +1 -1
- package/dist/cli/commands/wait.d.ts.map +1 -1
- package/dist/cli/commands/wait.js +3 -1
- package/dist/cli/commands/wait.js.map +1 -1
- package/dist/cli/index.js +8 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interop.d.ts +4 -3
- package/dist/cli/interop.d.ts.map +1 -1
- package/dist/cli/interop.js +95 -4
- package/dist/cli/interop.js.map +1 -1
- package/dist/cli/launch.d.ts +17 -2
- package/dist/cli/launch.d.ts.map +1 -1
- package/dist/cli/launch.js +110 -12
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +4 -1
- package/dist/cli/team.js.map +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +17 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/copilot-run/job.d.ts +2 -0
- package/dist/copilot-run/job.d.ts.map +1 -1
- package/dist/copilot-run/job.js +3 -0
- package/dist/copilot-run/job.js.map +1 -1
- package/dist/copilot-run/sandbox.d.ts +16 -0
- package/dist/copilot-run/sandbox.d.ts.map +1 -1
- package/dist/copilot-run/sandbox.js +29 -2
- package/dist/copilot-run/sandbox.js.map +1 -1
- package/dist/factory/bench/__tests__/bench.units.test.js +133 -1
- package/dist/factory/bench/__tests__/bench.units.test.js.map +1 -1
- package/dist/factory/bench/score.d.ts +33 -1
- package/dist/factory/bench/score.d.ts.map +1 -1
- package/dist/factory/bench/score.js +95 -5
- package/dist/factory/bench/score.js.map +1 -1
- package/dist/factory/board/__tests__/board.test.js +31 -1
- package/dist/factory/board/__tests__/board.test.js.map +1 -1
- package/dist/factory/board/collect.d.ts +5 -2
- package/dist/factory/board/collect.d.ts.map +1 -1
- package/dist/factory/board/collect.js +7 -2
- package/dist/factory/board/collect.js.map +1 -1
- package/dist/factory/check/cli.d.ts.map +1 -1
- package/dist/factory/check/cli.js +6 -2
- package/dist/factory/check/cli.js.map +1 -1
- package/dist/factory/dashboard/__tests__/dashboard.test.js +10 -0
- package/dist/factory/dashboard/__tests__/dashboard.test.js.map +1 -1
- package/dist/factory/run/__tests__/auto-merge.test.js +2 -0
- package/dist/factory/run/__tests__/auto-merge.test.js.map +1 -1
- package/dist/factory/run/__tests__/claims.test.js +15 -0
- package/dist/factory/run/__tests__/claims.test.js.map +1 -1
- package/dist/factory/run/__tests__/container-gate.test.js +59 -1
- package/dist/factory/run/__tests__/container-gate.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.js +6 -0
- package/dist/factory/run/__tests__/engine-local-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine-local-harness.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine-local-harness.test.js +23 -0
- package/dist/factory/run/__tests__/engine-local-harness.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.js +392 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.js +347 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js +235 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.js +171 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js +56 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.js +48 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.stall.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.stall.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.stall.test.js +137 -0
- package/dist/factory/run/__tests__/engine.stall.test.js.map +1 -0
- package/dist/factory/run/__tests__/fake-lanes.d.ts +6 -0
- package/dist/factory/run/__tests__/fake-lanes.d.ts.map +1 -1
- package/dist/factory/run/__tests__/fake-lanes.js +17 -1
- package/dist/factory/run/__tests__/fake-lanes.js.map +1 -1
- package/dist/factory/run/__tests__/human-merged.test.d.ts +2 -0
- package/dist/factory/run/__tests__/human-merged.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/human-merged.test.js +301 -0
- package/dist/factory/run/__tests__/human-merged.test.js.map +1 -0
- package/dist/factory/run/__tests__/lane.test.js +2 -0
- package/dist/factory/run/__tests__/lane.test.js.map +1 -1
- package/dist/factory/run/__tests__/merge-policy.test.js +16 -0
- package/dist/factory/run/__tests__/merge-policy.test.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts +2 -0
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js +137 -0
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js.map +1 -0
- package/dist/factory/run/__tests__/prepare-gates.crash.test.js +21 -0
- package/dist/factory/run/__tests__/prepare-gates.crash.test.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js +11 -0
- package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.test.js +39 -0
- package/dist/factory/run/__tests__/prepare-gates.test.js.map +1 -1
- package/dist/factory/run/__tests__/private-store.test.js +22 -1
- package/dist/factory/run/__tests__/private-store.test.js.map +1 -1
- package/dist/factory/run/__tests__/test-delta.test.d.ts +2 -0
- package/dist/factory/run/__tests__/test-delta.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/test-delta.test.js +239 -0
- package/dist/factory/run/__tests__/test-delta.test.js.map +1 -0
- package/dist/factory/run/__tests__/units.test.js +219 -2
- package/dist/factory/run/__tests__/units.test.js.map +1 -1
- package/dist/factory/run/__tests__/workspace-tree.test.js +16 -4
- package/dist/factory/run/__tests__/workspace-tree.test.js.map +1 -1
- package/dist/factory/run/auto-merge.d.ts +4 -0
- package/dist/factory/run/auto-merge.d.ts.map +1 -1
- package/dist/factory/run/auto-merge.js +3 -0
- package/dist/factory/run/auto-merge.js.map +1 -1
- package/dist/factory/run/budget.d.ts +6 -0
- package/dist/factory/run/budget.d.ts.map +1 -1
- package/dist/factory/run/budget.js +5 -0
- package/dist/factory/run/budget.js.map +1 -1
- package/dist/factory/run/claims.d.ts.map +1 -1
- package/dist/factory/run/claims.js +5 -3
- package/dist/factory/run/claims.js.map +1 -1
- package/dist/factory/run/container-gate.d.ts +14 -1
- package/dist/factory/run/container-gate.d.ts.map +1 -1
- package/dist/factory/run/container-gate.js +42 -4
- package/dist/factory/run/container-gate.js.map +1 -1
- package/dist/factory/run/engine.d.ts +46 -1
- package/dist/factory/run/engine.d.ts.map +1 -1
- package/dist/factory/run/engine.js +779 -68
- package/dist/factory/run/engine.js.map +1 -1
- package/dist/factory/run/human-merged.d.ts +105 -0
- package/dist/factory/run/human-merged.d.ts.map +1 -0
- package/dist/factory/run/human-merged.js +256 -0
- package/dist/factory/run/human-merged.js.map +1 -0
- package/dist/factory/run/lane.d.ts +2 -0
- package/dist/factory/run/lane.d.ts.map +1 -1
- package/dist/factory/run/lane.js +1 -0
- package/dist/factory/run/lane.js.map +1 -1
- package/dist/factory/run/merge-policy.d.ts +1 -2
- package/dist/factory/run/merge-policy.d.ts.map +1 -1
- package/dist/factory/run/merge-policy.js +5 -12
- package/dist/factory/run/merge-policy.js.map +1 -1
- package/dist/factory/run/prepare.d.ts +40 -1
- package/dist/factory/run/prepare.d.ts.map +1 -1
- package/dist/factory/run/prepare.js +240 -38
- package/dist/factory/run/prepare.js.map +1 -1
- package/dist/factory/run/private-run.d.ts +2 -1
- package/dist/factory/run/private-run.d.ts.map +1 -1
- package/dist/factory/run/private-run.js +5 -2
- package/dist/factory/run/private-run.js.map +1 -1
- package/dist/factory/run/prompts.d.ts +2 -2
- package/dist/factory/run/prompts.d.ts.map +1 -1
- package/dist/factory/run/prompts.js +7 -6
- package/dist/factory/run/prompts.js.map +1 -1
- package/dist/factory/run/sandbox-exec.d.ts +9 -1
- package/dist/factory/run/sandbox-exec.d.ts.map +1 -1
- package/dist/factory/run/sandbox-exec.js.map +1 -1
- package/dist/factory/run/state.d.ts +54 -1
- package/dist/factory/run/state.d.ts.map +1 -1
- package/dist/factory/run/state.js +23 -2
- package/dist/factory/run/state.js.map +1 -1
- package/dist/factory/run/test-delta.d.ts +123 -0
- package/dist/factory/run/test-delta.d.ts.map +1 -0
- package/dist/factory/run/test-delta.js +236 -0
- package/dist/factory/run/test-delta.js.map +1 -0
- package/dist/features/__tests__/checkpoint.test.js +118 -1
- package/dist/features/__tests__/checkpoint.test.js.map +1 -1
- package/dist/features/__tests__/jev-model-routing.test.js +20 -2
- package/dist/features/__tests__/jev-model-routing.test.js.map +1 -1
- package/dist/features/__tests__/jev-slop-warning.test.js +22 -2
- package/dist/features/__tests__/jev-slop-warning.test.js.map +1 -1
- package/dist/features/checkpoint/index.d.ts.map +1 -1
- package/dist/features/checkpoint/index.js +25 -8
- package/dist/features/checkpoint/index.js.map +1 -1
- package/dist/features/jev-slop-warning.d.ts +3 -2
- package/dist/features/jev-slop-warning.d.ts.map +1 -1
- package/dist/features/jev-slop-warning.js +5 -3
- package/dist/features/jev-slop-warning.js.map +1 -1
- package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/daemon.js +55 -9
- package/dist/features/rate-limit-wait/daemon.js.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.d.ts +33 -0
- package/dist/features/rate-limit-wait/tmux-detector.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.js +156 -0
- package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +4 -2
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
- package/dist/forge/ado/__tests__/adapter.test.js +7 -0
- package/dist/forge/ado/__tests__/adapter.test.js.map +1 -1
- package/dist/forge/ado/reviews.d.ts.map +1 -1
- package/dist/forge/ado/reviews.js +6 -0
- package/dist/forge/ado/reviews.js.map +1 -1
- package/dist/forge/github/__tests__/mergeability.test.d.ts +2 -0
- package/dist/forge/github/__tests__/mergeability.test.d.ts.map +1 -0
- package/dist/forge/github/__tests__/mergeability.test.js +34 -0
- package/dist/forge/github/__tests__/mergeability.test.js.map +1 -0
- package/dist/forge/github/reviews.d.ts +7 -1
- package/dist/forge/github/reviews.d.ts.map +1 -1
- package/dist/forge/github/reviews.js +13 -0
- package/dist/forge/github/reviews.js.map +1 -1
- package/dist/forge/local/__tests__/mirror.test.js +3 -1
- package/dist/forge/local/__tests__/mirror.test.js.map +1 -1
- package/dist/forge/local/__tests__/reviews.test.js +19 -0
- package/dist/forge/local/__tests__/reviews.test.js.map +1 -1
- package/dist/forge/local/mirror.d.ts +2 -0
- package/dist/forge/local/mirror.d.ts.map +1 -1
- package/dist/forge/local/mirror.js +2 -0
- package/dist/forge/local/mirror.js.map +1 -1
- package/dist/forge/local/reviews.d.ts.map +1 -1
- package/dist/forge/local/reviews.js +12 -1
- package/dist/forge/local/reviews.js.map +1 -1
- package/dist/forge/types.d.ts +13 -0
- package/dist/forge/types.d.ts.map +1 -1
- package/dist/graph/schema.d.ts +10 -10
- package/dist/hooks/__tests__/precompact-restore.test.js +38 -0
- package/dist/hooks/__tests__/precompact-restore.test.js.map +1 -1
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +7 -2
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
- package/dist/hooks/auto-slash-command/executor.js +1 -1
- package/dist/hooks/auto-slash-command/executor.js.map +1 -1
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js +24 -2
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js.map +1 -1
- package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/code-simplifier/jev-shadow.js +6 -4
- package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
- package/dist/hooks/jev/__tests__/client.test.js +20 -1
- package/dist/hooks/jev/__tests__/client.test.js.map +1 -1
- package/dist/hooks/jev/__tests__/log-context.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/log-context.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/log-context.test.js +97 -0
- package/dist/hooks/jev/__tests__/log-context.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.js +148 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.js +117 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/resolver.test.js +63 -1
- package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -1
- package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/shared-breaker.test.js +294 -0
- package/dist/hooks/jev/__tests__/shared-breaker.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.js +88 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.js.map +1 -0
- package/dist/hooks/jev/client.d.ts +34 -2
- package/dist/hooks/jev/client.d.ts.map +1 -1
- package/dist/hooks/jev/client.js +80 -5
- package/dist/hooks/jev/client.js.map +1 -1
- package/dist/hooks/jev/config.d.ts +78 -4
- package/dist/hooks/jev/config.d.ts.map +1 -1
- package/dist/hooks/jev/config.js +123 -9
- package/dist/hooks/jev/config.js.map +1 -1
- package/dist/hooks/jev/points.d.ts +2 -0
- package/dist/hooks/jev/points.d.ts.map +1 -1
- package/dist/hooks/jev/points.js +41 -10
- package/dist/hooks/jev/points.js.map +1 -1
- package/dist/hooks/jev/resolver.d.ts +27 -2
- package/dist/hooks/jev/resolver.d.ts.map +1 -1
- package/dist/hooks/jev/resolver.js +176 -20
- package/dist/hooks/jev/resolver.js.map +1 -1
- package/dist/hooks/jev/types.d.ts +21 -4
- package/dist/hooks/jev/types.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts +2 -0
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js +209 -0
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.js +6 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +15 -0
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +200 -2
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/keyword-detector/jev-shadow.js +3 -3
- package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +20 -1
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -1
- package/dist/hooks/learner/jev-shadow.js +3 -3
- package/dist/hooks/learner/jev-shadow.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts +2 -0
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js +280 -0
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/error-handling.test.js +2 -2
- package/dist/hooks/persistent-mode/__tests__/error-handling.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +47 -1
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +136 -40
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/jev-shadow.js +11 -7
- package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
- package/dist/hooks/pre-compact/index.d.ts.map +1 -1
- package/dist/hooks/pre-compact/index.js +8 -5
- package/dist/hooks/pre-compact/index.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts +11 -0
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts.map +1 -0
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js +227 -0
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js.map +1 -0
- package/dist/hooks/project-memory/index.d.ts.map +1 -1
- package/dist/hooks/project-memory/index.js +26 -6
- package/dist/hooks/project-memory/index.js.map +1 -1
- package/dist/hooks/ralph/__tests__/closeout.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/closeout.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/closeout.test.js +82 -0
- package/dist/hooks/ralph/__tests__/closeout.test.js.map +1 -0
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +572 -4
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -1
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js +23 -2
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js.map +1 -1
- package/dist/hooks/ralph/closeout.d.ts +34 -0
- package/dist/hooks/ralph/closeout.d.ts.map +1 -0
- package/dist/hooks/ralph/closeout.js +66 -0
- package/dist/hooks/ralph/closeout.js.map +1 -0
- package/dist/hooks/ralph/feedback-baseline.d.ts +60 -6
- package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -1
- package/dist/hooks/ralph/feedback-baseline.js +302 -15
- package/dist/hooks/ralph/feedback-baseline.js.map +1 -1
- package/dist/hooks/ralph/index.d.ts +1 -1
- package/dist/hooks/ralph/index.d.ts.map +1 -1
- package/dist/hooks/ralph/index.js +1 -1
- package/dist/hooks/ralph/index.js.map +1 -1
- package/dist/hooks/ralph/jev-shadow.js +3 -3
- package/dist/hooks/ralph/jev-shadow.js.map +1 -1
- package/dist/hooks/ralph/verifier.d.ts +5 -0
- package/dist/hooks/ralph/verifier.d.ts.map +1 -1
- package/dist/hooks/ralph/verifier.js +21 -10
- package/dist/hooks/ralph/verifier.js.map +1 -1
- package/dist/hooks/registry/__tests__/registry.test.js +6 -0
- package/dist/hooks/registry/__tests__/registry.test.js.map +1 -1
- package/dist/hooks/registry/registry.d.ts +6 -2
- package/dist/hooks/registry/registry.d.ts.map +1 -1
- package/dist/hooks/registry/registry.js +21 -6
- package/dist/hooks/registry/registry.js.map +1 -1
- package/dist/hooks/registry/types.d.ts +2 -0
- package/dist/hooks/registry/types.d.ts.map +1 -1
- package/dist/hooks/session-end/__tests__/callbacks.test.js +10 -1
- package/dist/hooks/session-end/__tests__/callbacks.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/worker.test.js +111 -2
- package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
- package/dist/hooks/session-end/callbacks.js +1 -1
- package/dist/hooks/session-end/callbacks.js.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.d.ts +2 -0
- package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.js +8 -0
- package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +21 -3
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/session-end/worker.d.ts.map +1 -1
- package/dist/hooks/session-end/worker.js +32 -2
- package/dist/hooks/session-end/worker.js.map +1 -1
- package/dist/hooks/setup/__tests__/windows-patch.test.js +89 -17
- package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
- package/dist/hooks/setup/index.d.ts +10 -21
- package/dist/hooks/setup/index.d.ts.map +1 -1
- package/dist/hooks/setup/index.js +14 -48
- package/dist/hooks/setup/index.js.map +1 -1
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +2 -1
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -1
- package/dist/hud/omc-state.d.ts +8 -0
- package/dist/hud/omc-state.d.ts.map +1 -1
- package/dist/hud/omc-state.js +23 -2
- package/dist/hud/omc-state.js.map +1 -1
- package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts +2 -0
- package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts.map +1 -0
- package/dist/installer/__tests__/claude-mcp-config-path.test.js +323 -0
- package/dist/installer/__tests__/claude-mcp-config-path.test.js.map +1 -0
- package/dist/installer/__tests__/mcp-registry.test.js +81 -3
- package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js +36 -0
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +16 -4
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/mcp-registry.d.ts +21 -1
- package/dist/installer/mcp-registry.d.ts.map +1 -1
- package/dist/installer/mcp-registry.js +101 -20
- package/dist/installer/mcp-registry.js.map +1 -1
- package/dist/lib/atomic-write.d.ts.map +1 -1
- package/dist/lib/atomic-write.js +61 -2
- package/dist/lib/atomic-write.js.map +1 -1
- package/dist/lib/one-line.d.ts +3 -0
- package/dist/lib/one-line.d.ts.map +1 -0
- package/dist/lib/one-line.js +5 -0
- package/dist/lib/one-line.js.map +1 -0
- package/dist/mcp/__tests__/team-cleanup.test.js +13 -0
- package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -1
- package/dist/mcp/team-job-convergence.d.ts.map +1 -1
- package/dist/mcp/team-job-convergence.js +4 -1
- package/dist/mcp/team-job-convergence.js.map +1 -1
- package/dist/mcp/team-server.js +2 -2
- package/dist/mcp/team-server.js.map +1 -1
- package/dist/notifications/__tests__/approval-reply.test.js +8 -0
- package/dist/notifications/__tests__/approval-reply.test.js.map +1 -1
- package/dist/notifications/__tests__/reply-herdr.test.d.ts +8 -0
- package/dist/notifications/__tests__/reply-herdr.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/reply-herdr.test.js +125 -0
- package/dist/notifications/__tests__/reply-herdr.test.js.map +1 -0
- package/dist/notifications/__tests__/tmux.test.js +56 -1
- package/dist/notifications/__tests__/tmux.test.js.map +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +22 -7
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/reply-listener.d.ts +28 -12
- package/dist/notifications/reply-listener.d.ts.map +1 -1
- package/dist/notifications/reply-listener.js +326 -172
- package/dist/notifications/reply-listener.js.map +1 -1
- package/dist/notifications/tmux.d.ts +22 -2
- package/dist/notifications/tmux.d.ts.map +1 -1
- package/dist/notifications/tmux.js +57 -2
- package/dist/notifications/tmux.js.map +1 -1
- package/dist/release/__tests__/engine.test.js +74 -2
- package/dist/release/__tests__/engine.test.js.map +1 -1
- package/dist/release/engine.d.ts +9 -1
- package/dist/release/engine.d.ts.map +1 -1
- package/dist/release/engine.js +41 -4
- package/dist/release/engine.js.map +1 -1
- package/dist/shared/types.d.ts +5 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/ship/__tests__/check-name.test.d.ts +2 -0
- package/dist/ship/__tests__/check-name.test.d.ts.map +1 -0
- package/dist/ship/__tests__/check-name.test.js +17 -0
- package/dist/ship/__tests__/check-name.test.js.map +1 -0
- package/dist/ship/__tests__/gates-settle.test.js +13 -1
- package/dist/ship/__tests__/gates-settle.test.js.map +1 -1
- package/dist/ship/__tests__/prepare-build.test.d.ts +2 -0
- package/dist/ship/__tests__/prepare-build.test.d.ts.map +1 -0
- package/dist/ship/__tests__/prepare-build.test.js +287 -0
- package/dist/ship/__tests__/prepare-build.test.js.map +1 -0
- package/dist/ship/__tests__/prepare-merge.test.js +8 -1
- package/dist/ship/__tests__/prepare-merge.test.js.map +1 -1
- package/dist/ship/__tests__/safety-state.test.js +4 -0
- package/dist/ship/__tests__/safety-state.test.js.map +1 -1
- package/dist/ship/check-name.d.ts +12 -0
- package/dist/ship/check-name.d.ts.map +1 -0
- package/dist/ship/check-name.js +13 -0
- package/dist/ship/check-name.js.map +1 -0
- package/dist/ship/config.d.ts +13 -0
- package/dist/ship/config.d.ts.map +1 -1
- package/dist/ship/config.js +18 -1
- package/dist/ship/config.js.map +1 -1
- package/dist/ship/exec.d.ts +8 -0
- package/dist/ship/exec.d.ts.map +1 -1
- package/dist/ship/exec.js +33 -5
- package/dist/ship/exec.js.map +1 -1
- package/dist/ship/gates.d.ts.map +1 -1
- package/dist/ship/gates.js +3 -2
- package/dist/ship/gates.js.map +1 -1
- package/dist/ship/merge.d.ts +11 -2
- package/dist/ship/merge.d.ts.map +1 -1
- package/dist/ship/merge.js +55 -10
- package/dist/ship/merge.js.map +1 -1
- package/dist/ship/prepare.d.ts +16 -4
- package/dist/ship/prepare.d.ts.map +1 -1
- package/dist/ship/prepare.js +108 -2
- package/dist/ship/prepare.js.map +1 -1
- package/dist/team/__tests__/herdr-session-realherdr.test.d.ts +9 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.d.ts.map +1 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.js +140 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.js.map +1 -0
- package/dist/team/__tests__/herdr-session.test.d.ts +9 -0
- package/dist/team/__tests__/herdr-session.test.d.ts.map +1 -0
- package/dist/team/__tests__/herdr-session.test.js +270 -0
- package/dist/team/__tests__/herdr-session.test.js.map +1 -0
- package/dist/team/__tests__/idle-nudge.test.js +17 -0
- package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
- package/dist/team/__tests__/mailbox-notification-guard.test.js +403 -181
- package/dist/team/__tests__/mailbox-notification-guard.test.js.map +1 -1
- package/dist/team/__tests__/scaling-launch-config.test.js +12 -0
- package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
- package/dist/team/__tests__/scaling.test.js +12 -0
- package/dist/team/__tests__/scaling.test.js.map +1 -1
- package/dist/team/__tests__/task-claim-renewal.test.d.ts +2 -0
- package/dist/team/__tests__/task-claim-renewal.test.d.ts.map +1 -0
- package/dist/team/__tests__/task-claim-renewal.test.js +421 -0
- package/dist/team/__tests__/task-claim-renewal.test.js.map +1 -0
- package/dist/team/__tests__/task-storage-integrity.test.js +34 -0
- package/dist/team/__tests__/task-storage-integrity.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts +11 -0
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.js +99 -0
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts +10 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.js +226 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.test.js +888 -721
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +19 -0
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/api-interop.d.ts +1 -1
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js +13 -1
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/herdr-session.d.ts +267 -0
- package/dist/team/herdr-session.d.ts.map +1 -0
- package/dist/team/herdr-session.js +508 -0
- package/dist/team/herdr-session.js.map +1 -0
- package/dist/team/idle-nudge.d.ts +1 -1
- package/dist/team/idle-nudge.d.ts.map +1 -1
- package/dist/team/idle-nudge.js +4 -4
- package/dist/team/idle-nudge.js.map +1 -1
- package/dist/team/mailbox-notification-guard.d.ts +24 -19
- package/dist/team/mailbox-notification-guard.d.ts.map +1 -1
- package/dist/team/mailbox-notification-guard.js +241 -148
- package/dist/team/mailbox-notification-guard.js.map +1 -1
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +1 -0
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/runtime-v2.d.ts +33 -33
- package/dist/team/runtime-v2.d.ts.map +1 -1
- package/dist/team/runtime-v2.js +2810 -1591
- package/dist/team/runtime-v2.js.map +1 -1
- package/dist/team/scaling.d.ts +3 -3
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +766 -402
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/tasks.d.ts +15 -1
- package/dist/team/state/tasks.d.ts.map +1 -1
- package/dist/team/state/tasks.js +56 -2
- package/dist/team/state/tasks.js.map +1 -1
- package/dist/team/team-ops.d.ts +3 -2
- package/dist/team/team-ops.d.ts.map +1 -1
- package/dist/team/team-ops.js +32 -5
- package/dist/team/team-ops.js.map +1 -1
- package/dist/team/tmux-session.d.ts +66 -40
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +1733 -1096
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/types.d.ts +8 -0
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/types.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +3 -0
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/tools/lsp/__tests__/devcontainer.test.js +39 -5
- package/dist/tools/lsp/__tests__/devcontainer.test.js.map +1 -1
- package/dist/tools/lsp/devcontainer.d.ts.map +1 -1
- package/dist/tools/lsp/devcontainer.js +25 -8
- package/dist/tools/lsp/devcontainer.js.map +1 -1
- package/dist/utils/__tests__/windows-search.test.js +17 -3
- package/dist/utils/__tests__/windows-search.test.js.map +1 -1
- package/dist/utils/plugin-cache-validation.d.ts.map +1 -1
- package/dist/utils/plugin-cache-validation.js +27 -18
- package/dist/utils/plugin-cache-validation.js.map +1 -1
- package/dist/workflow/__tests__/projections.test.js +3 -3
- package/dist/workflow/__tests__/projections.test.js.map +1 -1
- package/dist/workflow/__tests__/registry.test.js +3 -3
- package/dist/workflow/__tests__/registry.test.js.map +1 -1
- package/dist/workflow/registry.d.ts.map +1 -1
- package/dist/workflow/registry.js +1 -0
- package/dist/workflow/registry.js.map +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CLAUDE.md +1 -1
- package/docs/CREDITS.md +1 -0
- package/docs/FEATURES.md +18 -0
- package/docs/FIELD-TESTING.md +10 -0
- package/docs/HOOKS.md +339 -36
- package/docs/REFERENCE.md +82 -17
- package/docs/TEAM-MULTIPLEXER.md +107 -0
- package/hooks/hooks.json +204 -66
- package/hooks/jev-compaction.mjs +2404 -0
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/scripts/check-omc-playbooks.mjs +214 -124
- package/scripts/code-simplifier.mjs +26 -3
- package/scripts/copilot/build-hooks.mjs +24 -7
- package/scripts/generate-inventory-graph.mjs +77 -92
- package/scripts/jev-eval.mjs +123 -22
- package/scripts/jev-repair-transcript.mjs +331 -0
- package/scripts/jev-resolve.mjs +374 -22
- package/scripts/keyword-detector.mjs +427 -29
- package/scripts/lib/hook-command-normalizer.d.mts +33 -0
- package/scripts/lib/hook-command-normalizer.mjs +157 -60
- package/scripts/lib/jev-breaker.d.mts +73 -0
- package/scripts/lib/jev-breaker.mjs +830 -0
- package/scripts/lib/jev-compaction-state.mjs +320 -0
- package/scripts/lib/jev-delivery-guard.mjs +567 -0
- package/scripts/lib/jev-mask.mjs +36 -0
- package/scripts/lib/jev-shadow.mjs +363 -14
- package/scripts/lib/shell-checks.mjs +1121 -0
- package/scripts/lib/state-root.cjs +19 -8
- package/scripts/lib/state-root.mjs +19 -8
- package/scripts/persistent-mode.cjs +289 -1
- package/scripts/persistent-mode.mjs +540 -91
- package/scripts/plugin-setup.mjs +26 -30
- package/scripts/plugin-shipping-surface.mjs +4 -1
- package/scripts/post-tool-use-failure.mjs +18 -0
- package/scripts/post-tool-verifier.mjs +49 -3
- package/scripts/pre-tool-enforcer.mjs +658 -64
- package/scripts/run.cjs +4 -2
- package/scripts/session-start.mjs +54 -0
- package/skills/AGENTS.md +1 -0
- package/skills/ai-slop-cleaner/SKILL.md +14 -0
- package/skills/arena/SKILL.md +8 -1
- package/skills/babysit/SKILL.md +2 -1
- package/skills/create-formal-verification-skill/SKILL.md +6 -4
- package/skills/figure-it-out/SKILL.md +5 -0
- package/skills/fix-ci/SKILL.md +3 -1
- package/skills/how/references/explainer-prompt.md +7 -4
- package/skills/interrogate/SKILL.md +10 -6
- package/skills/ralph/SKILL.md +27 -2
- package/skills/ralph-experiment/SKILL.md +1 -1
- package/skills/sdd/SKILL.md +67 -0
- package/skills/sdd/phases/criteria.md +144 -0
- package/skills/sdd/phases/execute.md +226 -0
- package/skills/sdd/phases/review.md +216 -0
- package/skills/sdd/phases/rules.md +195 -0
- package/skills/sdd/phases/spec.md +75 -0
- package/skills/sdd/phases/tasks.md +162 -0
- package/skills/statechart/scripts/run.ts +6 -3
- package/skills/statechart/scripts/test/child-env.test.ts +53 -0
- package/templates/hooks/keyword-detector.mjs +172 -5
- package/templates/hooks/lib/state-root.mjs +19 -8
- package/templates/hooks/persistent-mode.mjs +296 -1
|
@@ -56,13 +56,14 @@ import { createHash } from 'crypto';
|
|
|
56
56
|
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'fs';
|
|
57
57
|
import { tmpdir } from 'os';
|
|
58
58
|
import { basename, dirname, isAbsolute, join, posix, relative, resolve } from 'path';
|
|
59
|
-
import { BASE_CONFIG_PATH, configuredProtectedPaths, DEFAULT_SHIP_CONFIG, isPlainBranchName, isRepoPath, loadBaseKnownFlaky, loadTrustedShipConfig, omgRepositoryFallback, readBaseFile, remoteRepoMismatch, resolveTrustedBases, userConfigLayers } from '../../ship/config.js';
|
|
59
|
+
import { BASE_CONFIG_PATH, configuredProtectedPaths, DEFAULT_SHIP_CONFIG, isPlainBranchName, isRepoPath, loadBaseKnownFlaky, loadTrustedShipConfig, omgRepositoryFallback, readBaseFile, remoteRepoMismatch, resolveTrustedBases, trustedUserConfigPath, userConfigLayers } from '../../ship/config.js';
|
|
60
60
|
import { scrubShipEnv, TRUSTED_READ_ENV } from '../../ship/exec.js';
|
|
61
|
+
import { checkName } from '../../ship/check-name.js';
|
|
61
62
|
import { listChangedFiles, protectedChanges } from '../../ship/merge.js';
|
|
62
63
|
import { ESLINT_SCRIPT, PREPARE_CONFIG_STEP, PREPARE_DETECT_STEP, PREPARE_SANDBOX_STEP, runPrepareAsync, VITEST_SCRIPT } from '../../ship/prepare.js';
|
|
63
64
|
import { parseJsonc } from '../../utils/jsonc.js';
|
|
64
|
-
import { nodeModulesTreeProblem, resolveGateIsolation, resolveGatesSandboxMode, resolveRequireDeniedPaths } from '../../copilot-run/sandbox.js';
|
|
65
|
-
import { CONTAINER_INCOMPATIBLE_ADVICE, containerRunLabel, GATE_CONTAINER_UNAVAILABLE_GATE } from './container-gate.js';
|
|
65
|
+
import { gitForWindowsShell, nodeModulesTreeProblem, resolveGateIsolation, resolveGatesSandboxMode, resolveRequireDeniedPaths, resolveWindowsGitTransport } from '../../copilot-run/sandbox.js';
|
|
66
|
+
import { CONTAINER_INCOMPATIBLE_ADVICE, CONTAINER_SRC, containerRunLabel, GATE_CONTAINER_UNAVAILABLE_GATE } from './container-gate.js';
|
|
66
67
|
import { CREDENTIAL_FILES_READABLE_NOTE, redactGateOutput, sandboxCommandTooLong, sandboxJobRoot, splitFileListArgs } from './sandbox-exec.js';
|
|
67
68
|
import { forgetWorktreeGitLinks, readWorktreeGitLinks, recordedWorktreeGitLinks, recordWorktreeGitLinks, removeStaleWorktreeEntry, removeWorkerWorktree, runHostGit, runHostGitBuffer, worktreeGitDirArgs, worktreeGitLinksIntact } from '../../team/git-worktree.js';
|
|
68
69
|
import { buildGitView, GIT_VIEW_MAX_BYTES, GIT_VIEW_MAX_OBJECTS } from './git-view.js';
|
|
@@ -70,6 +71,7 @@ import { driveGates } from './gates-driver.js';
|
|
|
70
71
|
import { missingCheckHint, NO_CI_CHECKS_NOTE, noHeadChecksText } from '../../ship/gates.js';
|
|
71
72
|
import { ghBranchTip, ghCheckRunApps, ghCheckSuites, ghCommitCheckNames, ghRequiredCheckRules } from '../../forge/github/checks.js';
|
|
72
73
|
import { ciFixPrompt, conflictFixPrompt, fenceFor, fenced, fixPrompt, implementPrompt, oneLine, reviewPrompt } from './prompts.js';
|
|
74
|
+
import { BASE_FAILURES_MAX, headRunSignals, parseVitestReport, readVitestReport, testDeltaVerdict, testIdText, vitestOutputFailures, vitestReportArgs, vitestReportPath } from './test-delta.js';
|
|
73
75
|
import { decisionsViolation, loadTeamContext, pathsInDiff, pathsInText } from '../team/context.js';
|
|
74
76
|
import { mergeComment, mergeDecision } from './merge-policy.js';
|
|
75
77
|
import { autoMergeComment, autoMergeVerdict, baseInstallFiles, baseTestSetup as baseTestSetupOf, classifyChanges, committedMergeConfig, hasFrontmatter, isFrontmatterCandidate, parseChangedEntries, patchLines, resolveAutoMergeConfig, TEST_CONFIG_NAME } from './auto-merge.js';
|
|
@@ -82,11 +84,12 @@ import { forgeTerms } from '../../forge/terms.js';
|
|
|
82
84
|
import { GhCommandError, ghRepoArg, ghRun } from '../../forge/github/gh.js';
|
|
83
85
|
import { adoptPreconditions, assignCodingAgent, codingAgentCloseArgs, codingAgentStatusArgs, parseCodingAgentStatus, } from '../../forge/github/coding-agent.js';
|
|
84
86
|
import { CODING_AGENT_ADOPT_GATE, CODING_AGENT_CONFIRM_READS, CODING_AGENT_FETCH_HEAD_ARGS, CODING_AGENT_GATE, CODING_AGENT_HEAD_MOVED_GATE, CODING_AGENT_REASSIGNED_GATE, CODING_AGENT_SESSION_USAGE, CODING_AGENT_SESSIONS_GATE, CODING_AGENT_TIMEOUT_GATE, CODING_AGENT_UNCONFIRMED_GATE, CODING_AGENT_WAIT_GATE, codingAgentFetchArgs, codingAgentLinkBody, codingAgentLinkCommentArgs, codingAgentRefusal, codingAgentRepoOf, codingAgentSessionsOn, codingAgentTreeArgs, linkEntries, loadCodingAgentChoice, openAgentPrs, PRE_ASSIGN_SINCE, recordCodingAgentSession, CodingAgentMirrorUnreadableError, CodingAgentSessionsBusyError, codingAgentMergeBaseArgs, isDefiniteAssignRefusal, releaseCodingAgentSession, reserveCodingAgentSession, DEFAULT_CODING_AGENT_CONFIG, } from './coding-agent-lane.js';
|
|
85
|
-
import { ghCommentPr, ghCreateDraftPr, ghFindOpenPr, ghMarkReady, ghMergeView, ghOpenPrs, ghPrHeadState, ghRepoView, githubReviews } from '../../forge/github/reviews.js';
|
|
87
|
+
import { ghCommentPr, ghCreateDraftPr, ghFindOpenPr, ghMarkReady, ghMergeView, ghOpenPrs, ghPrHeadState, ghPrMergeability, ghRepoView, githubReviews } from '../../forge/github/reviews.js';
|
|
86
88
|
import { ghDependsOn, ghIssueComment, ghIssueJson, ghIssueView, ghViewItem, githubTracker } from '../../forge/github/tracker.js';
|
|
87
89
|
import { isSatisfied } from '../check/score.js';
|
|
88
90
|
import { outcomePosts, postedBefore } from './outcome.js';
|
|
89
|
-
import {
|
|
91
|
+
import { forgePrStateReader, humanMergeCandidate, laneTrustProblem, markMergedByHuman } from './human-merged.js';
|
|
92
|
+
import { checkoutBranch, checkoutPath, checkoutWorker, defaultGateConfigLoader, FACTORY_CHECKOUT_TEAM, GATE_CACHE_DIRS, GATE_TREE_COPY_WHY, GATE_TREE_MARKER, gateTreeHasLinks, linkNodeModules, trustedNestedRels, unlinkNodeModules } from './prepare.js';
|
|
90
93
|
import { baseWorkspacePatterns } from './workspace-tree.js';
|
|
91
94
|
import { canTransition, createShipState, transition, latestVerdict, parseShipState, recordVerdict, shipStatePath, updateShipState, verifyShipIntegrity, } from '../../ship/state.js';
|
|
92
95
|
import { ghReviewFeedback } from '../../forge/github/reviews.js';
|
|
@@ -109,7 +112,7 @@ import { CI_TREE_PATHS, commitLaneWork, conflictFixStart, LANE_PROTECTED_PATHS,
|
|
|
109
112
|
import { proveLaneTreeGone } from './lane-procs.js';
|
|
110
113
|
import { quarantineTamper, RELEASE_TAMPER_COMMAND, STILL_ACTIVE, tamperHoldMessage, tamperHoldPath, writeTamperHold } from './tamper-quarantine.js';
|
|
111
114
|
import { currentBytes, defaultLedgerDir, EngineLedger, emptyHooksDir, userBaselineKey } from './ledger.js';
|
|
112
|
-
import { createFactoryProgress } from './progress.js';
|
|
115
|
+
import { createFactoryProgress, HEARTBEAT_MIN_MS } from './progress.js';
|
|
113
116
|
import { acquireFactoryClaim, claimBusyMessage, factoryClaimHolder, factoryClaimRepo, isShallowClaimRepo, localFactoryClaimRepo, shallowClaimWarning, settleFactoryClaim, trustedFactoryClaimRepo, trustedLocalFactoryClaimRepo } from './claims.js';
|
|
114
117
|
import { compareSnapshots, replaceObjectsProblem, samePath, snapshotRepo, verifyReviewWorktree } from './review-guard.js';
|
|
115
118
|
import { GATE_INSTALL_GATE, IMPORT_REFUSED_GATE, LAYOUT_UNSUPPORTED_GATE, PRIVATE_STORE_GATE, PrivateRun, REPO_GUARD_GATE, resolveGateInstall, resolveRunLayout } from './private-run.js';
|
|
@@ -127,7 +130,13 @@ const PREPARE_ENGINE_STEPS = new Set(['preflight', 'remote', 'fetch', 'merge-bas
|
|
|
127
130
|
/** Conflict-fix lanes (distinct start heads) before base conflicts park at awaiting-human: merge-conflicts. */
|
|
128
131
|
export const MAX_CONFLICT_FIX_ROUNDS = 2;
|
|
129
132
|
/** merge's gate read may send the run back to gates this often per invocation before awaiting-human: gates-disagree. */
|
|
130
|
-
export const MAX_MERGE_BOUNCES = 2;
|
|
133
|
+
export const MAX_MERGE_BOUNCES = 2;
|
|
134
|
+
/** Gates -> prepare returns for a PR that conflicts with its moved base, per run (across reruns), before awaiting-human: merge-conflicts. */
|
|
135
|
+
export const MAX_CONFLICT_REPREPARES = 3;
|
|
136
|
+
/** Reads of the forge's mergeability while it is unknown (GitHub computes it lazily after a push or a base move), MERGEABILITY_WAIT_MS apart. */
|
|
137
|
+
export const MERGEABILITY_READS = 4;
|
|
138
|
+
export const MERGEABILITY_WAIT_MS = 5_000;
|
|
139
|
+
/** Lane waits are sliced so the cancel flag is seen within this long. */
|
|
131
140
|
export const DEFAULT_POLL_MS = 5_000;
|
|
132
141
|
/** The engine cancels a lane this long past its own timeout (copilot_run enforces the timeout first). */
|
|
133
142
|
const LANE_GRACE_MS = 60_000;
|
|
@@ -290,6 +299,16 @@ const HEX40 = /^[0-9a-f]{40}$/;
|
|
|
290
299
|
const PARK_TAIL_LINES = 12;
|
|
291
300
|
const PARK_TAIL_LINE_CHARS = 200;
|
|
292
301
|
const PARK_TAIL_CHARS = 1_500;
|
|
302
|
+
/** True when `next` is a parseable time later than `prev` (or `prev` is absent). Unparseable values are not newer. */
|
|
303
|
+
export function isNewerEvent(next, prev) {
|
|
304
|
+
const n = next ? Date.parse(next) : NaN;
|
|
305
|
+
if (!Number.isFinite(n))
|
|
306
|
+
return false;
|
|
307
|
+
if (!prev)
|
|
308
|
+
return true;
|
|
309
|
+
const p = Date.parse(prev);
|
|
310
|
+
return !Number.isFinite(p) || n > p;
|
|
311
|
+
}
|
|
293
312
|
/** The last lines of `text`, redacted (token shapes), each made visible and one line, bounded: a gate's local `detail`. */
|
|
294
313
|
export function parkTail(text) {
|
|
295
314
|
const lines = redactGateOutput(text).split(/\r?\n/).map((l) => l.trim()).filter(Boolean).slice(-PARK_TAIL_LINES);
|
|
@@ -329,11 +348,31 @@ export function nodeModulesWriteDenied(tail) {
|
|
|
329
348
|
}
|
|
330
349
|
/** The advice when the base's gate runs git's own transport, which cannot run in the Copilot sandbox on Windows. */
|
|
331
350
|
export const GIT_TRANSPORT_SANDBOX_ADVICE = 'Your gate runs git clone, fetch or push (also to a local path or a temp repository), which cannot run in the OS sandbox on Windows: git starts that transport through Git for Windows\' sh.exe, and no MSYS2 program starts in the sandbox; the sandbox has no network either. Read-only git (rev-parse, ls-files, log) and git init, add and commit work. Make those tests skip the transport, run them outside prepare, or set factory.run.sandbox.isolation "container" (with an image that has git) in your user config';
|
|
351
|
+
/** What git prints when its transport process (sh.exe running git-receive-pack / git-upload-pack) died. */
|
|
352
|
+
export const GIT_TRANSPORT_FAILURE = 'Could not read from remote repository';
|
|
353
|
+
/**
|
|
354
|
+
* STATUS_DLL_INIT_FAILED (0xC0000142) as an exit status, unsigned and signed:
|
|
355
|
+
* an MSYS2 program in the Copilot sandbox on Windows. msys-2.0.dll's start
|
|
356
|
+
* makes a directory object under \BaseNamedObjects, which the sandbox's
|
|
357
|
+
* low-integrity token may not create (live 2026-11-12, Copilot CLI 1.0.105,
|
|
358
|
+
* Git for Windows 2.51.2: also with every path readable and with a copy of
|
|
359
|
+
* the runtime at another path). No filesystem grant or env var changes it.
|
|
360
|
+
*/
|
|
361
|
+
export const MSYS_DLL_INIT_FAILED = [0xc0000142, 0xc0000142 - 2 ** 32];
|
|
362
|
+
/** A base calibration's output that names git's failed transport, on Windows (the OS sandbox only). */
|
|
363
|
+
export const windowsGitTransportFailure = (output, platform = process.platform) => platform === 'win32' && !!output?.includes(GIT_TRANSPORT_FAILURE);
|
|
364
|
+
/**
|
|
365
|
+
* A base calibration's output that names esbuild's refused open of a package
|
|
366
|
+
* dir through the gate tree's junction, on Windows (the OS sandbox only;
|
|
367
|
+
* prepare.ts GATE_TREE_COPY_WHY): `Cannot read directory "node_modules/<pkg>":
|
|
368
|
+
* Access is denied.`
|
|
369
|
+
*/
|
|
370
|
+
export const windowsJunctionReadDenied = (output, platform = process.platform) => platform === 'win32' && !!output && /Cannot read directory "[^"\r\n]*node_modules[\\/][^"\r\n]*": Access is denied\./.test(output);
|
|
332
371
|
/** What the gate-sandbox-incompatible park of a failing base calibration tells the human to do. */
|
|
333
372
|
export function sandboxIncompatibleAdvice(tail, platform = process.platform) {
|
|
334
373
|
// git clone, fetch and push to a local path start git-upload-pack / git-receive-pack through Git for Windows' sh.exe,
|
|
335
374
|
// and no MSYS2 program starts in the Copilot sandbox on Windows (exit 0xC0000142, live 2026-11-12); no network either.
|
|
336
|
-
if (
|
|
375
|
+
if (windowsGitTransportFailure(tail, platform))
|
|
337
376
|
return GIT_TRANSPORT_SANDBOX_ADVICE;
|
|
338
377
|
const denied = tail ? nodeModulesWriteDenied(tail) : undefined;
|
|
339
378
|
// A per-run dir is writable in the tree already: a denial there is not this case.
|
|
@@ -401,6 +440,15 @@ function calibrationArgs(c, dir) {
|
|
|
401
440
|
return vitest ? [script, 'run', '--passWithNoTests', CALIBRATION_NO_TEST_FILTER] : [script, '--version'];
|
|
402
441
|
return vitest ? [script, 'run', ...files] : [script, ...files];
|
|
403
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* A run's vitest report: the gate container's (the result's `report`, its
|
|
445
|
+
* file names under CONTAINER_SRC), else `host` (read from the run dir).
|
|
446
|
+
*/
|
|
447
|
+
function runReport(r, host) {
|
|
448
|
+
return r.ran && r.report !== undefined ? parseVitestReport(r.report, CONTAINER_SRC) : host;
|
|
449
|
+
}
|
|
450
|
+
/** prepare's built-in vitest check (its args are ours, so its reporter is too). */
|
|
451
|
+
const isBuiltInVitest = (c) => c.kind === 'built-in' && c.args[0] === VITEST_SCRIPT;
|
|
404
452
|
/** The fixed failure text of a built-in eslint or vitest check whose one changed file name the sandbox shell cannot carry. */
|
|
405
453
|
export const BUILT_IN_FILE_NAME_TOO_LONG = 'a changed file name is too long for the sandbox shell';
|
|
406
454
|
/**
|
|
@@ -412,9 +460,17 @@ export function fileListParts(c, cwd, platform = process.platform) {
|
|
|
412
460
|
const script = c.args[0];
|
|
413
461
|
if (c.kind !== 'built-in' || (script !== VITEST_SCRIPT && script !== ESLINT_SCRIPT))
|
|
414
462
|
return [c];
|
|
415
|
-
const
|
|
463
|
+
const fixed = script === VITEST_SCRIPT ? 2 : 1;
|
|
464
|
+
// A vitest call also carries its report args (test-delta.ts): sized in, then taken out again.
|
|
465
|
+
const extra = sizingReportArgs(c, cwd);
|
|
466
|
+
const parts = splitFileListArgs(platform, c.exe, [...c.args.slice(0, fixed), ...extra, ...c.args.slice(fixed)], fixed + extra.length, cwd)
|
|
467
|
+
.map((args) => [...args.slice(0, fixed), ...args.slice(fixed + extra.length)]);
|
|
416
468
|
return parts.length === 1 ? [c] : parts.map((args) => ({ ...c, argv: [c.exe, ...args], args }));
|
|
417
469
|
}
|
|
470
|
+
/** The report args a built-in vitest call in `cwd` gets, at their real length (none for every other check). */
|
|
471
|
+
function sizingReportArgs(c, cwd) {
|
|
472
|
+
return isBuiltInVitest(c) ? vitestReportArgs(vitestReportPath(cwd)) : [];
|
|
473
|
+
}
|
|
418
474
|
function errText(error) {
|
|
419
475
|
return error instanceof Error ? error.message : String(error);
|
|
420
476
|
}
|
|
@@ -608,6 +664,8 @@ class FactoryEngine {
|
|
|
608
664
|
gatesAllowed;
|
|
609
665
|
/** factory.run.sandbox.gates, resolved once per trusted base commit. */
|
|
610
666
|
gatesModeCache;
|
|
667
|
+
/** Whether MSYS2 (Git for Windows' sh.exe) cannot start in the OS sandbox: probed once per invocation, when first needed. */
|
|
668
|
+
msysProbe;
|
|
611
669
|
/** The gate image's id (`sha256:...`) the last container run reported: base calibrations are keyed on it, not on the tag (L2, review-499). */
|
|
612
670
|
containerImageId;
|
|
613
671
|
/** The one-per-run warning that the sandbox on this host cannot deny paths was given. */
|
|
@@ -1037,15 +1095,19 @@ class FactoryEngine {
|
|
|
1037
1095
|
* layout, your checkout (its budget ledger stays denied; L1) and the job
|
|
1038
1096
|
* root under the run dir (L8).
|
|
1039
1097
|
*/
|
|
1040
|
-
sandboxRun(req) {
|
|
1098
|
+
sandboxRun(req, fallbackContainer) {
|
|
1041
1099
|
const p = this.privateRun();
|
|
1042
1100
|
// The nested workspace trees' targets the engine vouches for (review-501 M1): the PR-writable marker alone grants nothing.
|
|
1043
1101
|
const nested = trustedNestedRels(this.o.root, req.cwd, this.baseWorkspaces()).map((rel) => join(this.o.root, ...rel.split('/'), 'node_modules'));
|
|
1044
|
-
// isolation "container" (gatesSandbox, user config)
|
|
1045
|
-
|
|
1102
|
+
// isolation "container" (gatesSandbox, user config), or the Windows git-transport fallback's container: the runner
|
|
1103
|
+
// uses the container, labelled with this run.
|
|
1104
|
+
const settings = this.gatesModeCache?.container ?? fallbackContainer;
|
|
1046
1105
|
// review-499b N3: never the OS sandbox because gatesSandbox() was not resolved yet in this process.
|
|
1047
|
-
if (!
|
|
1106
|
+
if (!settings && this.containerIsolated())
|
|
1048
1107
|
return Promise.reject(new FactoryStepError('factory.run.sandbox.isolation "container" is set in your user config, but the gate settings were not resolved before a gate command; nothing ran'));
|
|
1108
|
+
// N2 (review-532b): once the image id is known, every container command of the run names it, never the tag again,
|
|
1109
|
+
// so the head and the base calibrations run the same image.
|
|
1110
|
+
const container = settings && this.containerImageId ? { ...settings, image: this.containerImageId } : settings;
|
|
1049
1111
|
const r = this.o.gateSandbox({ ...req, nodeModulesTarget: join(this.o.root, 'node_modules'), ...(nested.length > 0 ? { nestedNodeModulesTargets: nested } : {}), ...(p ? { mainRoot: this.o.root, jobRoot: this.gateJobRoot() } : {}), ...(container ? { container, runLabel: containerRunLabel(this.o.root, this.key) } : {}) });
|
|
1050
1112
|
if (!container)
|
|
1051
1113
|
return r;
|
|
@@ -1098,8 +1160,8 @@ class FactoryEngine {
|
|
|
1098
1160
|
* git. The OS sandbox: `run` as it is (the prepare checkout's link to its
|
|
1099
1161
|
* git dir works there, read-only).
|
|
1100
1162
|
*/
|
|
1101
|
-
async withGitView(sha, what, run) {
|
|
1102
|
-
if (!
|
|
1163
|
+
async withGitView(sha, what, run, inContainer = !!this.gatesModeCache?.container) {
|
|
1164
|
+
if (!inContainer)
|
|
1103
1165
|
return run({});
|
|
1104
1166
|
const jobRoot = this.gateJobRoot();
|
|
1105
1167
|
mkdirSync(jobRoot, { recursive: true });
|
|
@@ -1153,11 +1215,70 @@ class FactoryEngine {
|
|
|
1153
1215
|
this.wsGlobs = { baseSha: sha, globs: baseWorkspacePatterns(read) };
|
|
1154
1216
|
return this.wsGlobs.globs;
|
|
1155
1217
|
}
|
|
1156
|
-
/**
|
|
1157
|
-
|
|
1158
|
-
|
|
1218
|
+
/**
|
|
1219
|
+
* linkNodeModules with the base's workspaces; a layout it does not support
|
|
1220
|
+
* is a warning here (the base calibration parks on it). A copied tree
|
|
1221
|
+
* (`copy`, the run's gateTreeCopy by default) that cannot be built (over
|
|
1222
|
+
* the bounds, no disk space, a busy file) returns why, for the caller's
|
|
1223
|
+
* park (L2, review-546); a linked tree's error throws as before.
|
|
1224
|
+
*/
|
|
1225
|
+
linkGateTree(path, baseSha, copy = this.state.gateTreeCopy === true) {
|
|
1226
|
+
let problem;
|
|
1227
|
+
try {
|
|
1228
|
+
problem = linkNodeModules(this.o.root, path, this.o.warn, this.baseWorkspaces(baseSha), copy);
|
|
1229
|
+
}
|
|
1230
|
+
catch (error) {
|
|
1231
|
+
if (!copy)
|
|
1232
|
+
throw error;
|
|
1233
|
+
return `the copied node_modules tree of ${path} could not be built (${oneLine(errText(error), 300)})`;
|
|
1234
|
+
}
|
|
1159
1235
|
if (problem)
|
|
1160
1236
|
this.o.warn?.(`omg factory run: ${problem}; a gate that fails in the sandbox parks at ${GATE_SANDBOX_INCOMPATIBLE_GATE}`);
|
|
1237
|
+
return null;
|
|
1238
|
+
}
|
|
1239
|
+
/** The gate-sandbox-incompatible park of a copied tree linkGateTree could not build (`why`). */
|
|
1240
|
+
treeCopyPark(why) {
|
|
1241
|
+
return { name: GATE_SANDBOX_INCOMPATIBLE_GATE, reason: `${why}; the run's gate trees are copies because ${GATE_TREE_COPY_WHY}. For an npm project, set factory.run.sandbox.isolation to "container" in your user config: the gates then run in a container with its own npm ci and need no copy. A full disk or a busy file can also be the cause: free space or close the program holding the file. Then rerun ${this.resume}. ${ACK_WARNING}` };
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* After a base calibration failed in the OS sandbox on Windows opening a
|
|
1245
|
+
* package dir through the gate tree's junction (windowsJunctionReadDenied):
|
|
1246
|
+
* the tree in `checkout` is rebuilt as a copy of your node_modules
|
|
1247
|
+
* (prepare.ts GATE_TREE_COPY_WHY), and only then (L2, review-546) the run
|
|
1248
|
+
* records that its gate trees are copies from now on. The command stays in
|
|
1249
|
+
* the sandbox; the copy is the checkout's own, so the PR's code can write
|
|
1250
|
+
* only that. True when switched; false (the caller keeps its park) when the
|
|
1251
|
+
* run copies already or is container-isolated; else the park naming the
|
|
1252
|
+
* rebuild error (a busy file, a full disk, over the bounds), with the linked
|
|
1253
|
+
* tree put back where possible and the run left linking (fail closed).
|
|
1254
|
+
*/
|
|
1255
|
+
switchToGateTreeCopy(checkout) {
|
|
1256
|
+
if (this.state.gateTreeCopy || this.containerIsolated())
|
|
1257
|
+
return false;
|
|
1258
|
+
let failed;
|
|
1259
|
+
try {
|
|
1260
|
+
unlinkNodeModules(this.o.root, checkout);
|
|
1261
|
+
failed = this.linkGateTree(checkout, undefined, true);
|
|
1262
|
+
}
|
|
1263
|
+
catch (error) {
|
|
1264
|
+
failed = `the node_modules tree of ${checkout} could not be removed to be rebuilt as a copy (${oneLine(errText(error), 300)})`;
|
|
1265
|
+
}
|
|
1266
|
+
if (failed) {
|
|
1267
|
+
this.o.warn?.(`omg factory run: ${failed}`);
|
|
1268
|
+
// Back to the linked tree the run had (best effort: a tree still half there is left alone, and the run parks anyway).
|
|
1269
|
+
try {
|
|
1270
|
+
unlinkNodeModules(this.o.root, checkout);
|
|
1271
|
+
this.linkGateTree(checkout, undefined, false);
|
|
1272
|
+
}
|
|
1273
|
+
catch (error) {
|
|
1274
|
+
this.o.warn?.(`omg factory run: could not link the node_modules tree of ${checkout} again (${oneLine(errText(error), 300)})`);
|
|
1275
|
+
}
|
|
1276
|
+
return this.treeCopyPark(failed);
|
|
1277
|
+
}
|
|
1278
|
+
const note = `the gate's node_modules trees are copies of yours from now on, not links: ${GATE_TREE_COPY_WHY}`;
|
|
1279
|
+
this.o.warn?.(`omg factory run: ${note}`);
|
|
1280
|
+
this.save((x) => ({ ...x, gateTreeCopy: true, history: [...x.history, { at: this.iso(), from: x.phase, to: x.phase, note }] }));
|
|
1281
|
+
return true;
|
|
1161
1282
|
}
|
|
1162
1283
|
/**
|
|
1163
1284
|
* A checkout kept after a failed discard gets its node_modules tree back
|
|
@@ -1168,7 +1289,9 @@ class FactoryEngine {
|
|
|
1168
1289
|
if (this.containerIsolated())
|
|
1169
1290
|
return;
|
|
1170
1291
|
try {
|
|
1171
|
-
this.linkGateTree(path);
|
|
1292
|
+
const failed = this.linkGateTree(path);
|
|
1293
|
+
if (failed)
|
|
1294
|
+
this.o.warn?.(`omg factory run: ${failed}`);
|
|
1172
1295
|
}
|
|
1173
1296
|
catch (error) {
|
|
1174
1297
|
this.o.warn?.(`omg factory run: could not link the node_modules tree of the kept prepare checkout ${path} again (${oneLine(errText(error), 300)})`);
|
|
@@ -1350,8 +1473,8 @@ class FactoryEngine {
|
|
|
1350
1473
|
return null;
|
|
1351
1474
|
const rule = lockfileUnchanged(p.repo, baseSha, head, p.ctx);
|
|
1352
1475
|
if (rule.policy === 'junction') {
|
|
1353
|
-
this.linkGateTree(path, baseSha);
|
|
1354
|
-
return null;
|
|
1476
|
+
const failed = this.linkGateTree(path, baseSha);
|
|
1477
|
+
return failed ? this.treeCopyPark(failed) : null;
|
|
1355
1478
|
}
|
|
1356
1479
|
const what = rule.lockfiles.length === 0 ? 'the base has no lockfile' : `the PR changes ${rule.changed.join(', ')}`;
|
|
1357
1480
|
let mode;
|
|
@@ -1512,6 +1635,20 @@ class FactoryEngine {
|
|
|
1512
1635
|
return { exitCode: 1, phase: 'failed', state: existing, message: `the factory run state for ${this.what} fails its integrity check (edited outside omg factory run); the run is failed and is not resumed` };
|
|
1513
1636
|
}
|
|
1514
1637
|
if (existing && TERMINAL_FACTORY_PHASES.includes(existing.phase)) {
|
|
1638
|
+
// A cancelled or failed run whose PR a human merged afterwards: recorded as merged (human-merged.ts).
|
|
1639
|
+
if (humanMergeCandidate(existing) && !forgeResumeProblem(existing, this.o.forge?.config.kind ?? 'github', this.o.forge?.config.repo.url)) {
|
|
1640
|
+
this.state = existing;
|
|
1641
|
+
try {
|
|
1642
|
+
const healed = this.humanMergedFirst(existing);
|
|
1643
|
+
if (healed)
|
|
1644
|
+
return healed;
|
|
1645
|
+
}
|
|
1646
|
+
catch (error) {
|
|
1647
|
+
if (error instanceof StateTamperedError)
|
|
1648
|
+
return this.onTampered(error);
|
|
1649
|
+
throw error;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1515
1652
|
let final = existing;
|
|
1516
1653
|
// A crash after the terminal save and before its tracker write: write that stage once now.
|
|
1517
1654
|
if (this.sync && existing.trackerStage !== trackerStageOf(existing) && !forgeResumeProblem(existing, this.o.forge?.config.kind ?? 'github', this.o.forge?.config.repo.url)) {
|
|
@@ -1594,6 +1731,12 @@ class FactoryEngine {
|
|
|
1594
1731
|
}
|
|
1595
1732
|
else {
|
|
1596
1733
|
this.state = existing;
|
|
1734
|
+
// A parked run whose PR a human merged: recorded as merged before any lane resumes (prepare, gates and merge read the PR first anyway).
|
|
1735
|
+
if (humanMergeCandidate(existing) && !['prepare', 'gates', 'merge'].includes(existing.phase)) {
|
|
1736
|
+
const healed = this.humanMergedFirst(existing);
|
|
1737
|
+
if (healed)
|
|
1738
|
+
return healed;
|
|
1739
|
+
}
|
|
1597
1740
|
// A human looked at the gate; what they changed in the repo is the new baseline.
|
|
1598
1741
|
if (existing.gate)
|
|
1599
1742
|
this.ledger.setRecheck(undefined);
|
|
@@ -1644,6 +1787,44 @@ class FactoryEngine {
|
|
|
1644
1787
|
}
|
|
1645
1788
|
return this.loop();
|
|
1646
1789
|
}
|
|
1790
|
+
/**
|
|
1791
|
+
* A stopped run with a PR (human-merged.ts): the PR is read before anything resumes. Merged: the run is recorded
|
|
1792
|
+
* merged (ship follows) and finishes, no lane starts. Closed unmerged: the run stops with a message, unchanged.
|
|
1793
|
+
* Open, or a failed read (never taken as merged): null, the run goes on as before.
|
|
1794
|
+
*/
|
|
1795
|
+
humanMergedFirst(existing) {
|
|
1796
|
+
const pr = existing.pr;
|
|
1797
|
+
const untrusted = laneTrustProblem(existing);
|
|
1798
|
+
if (untrusted) {
|
|
1799
|
+
this.o.warn?.(`omg factory run: not checked for a human merge: ${untrusted}`);
|
|
1800
|
+
return null;
|
|
1801
|
+
}
|
|
1802
|
+
let state;
|
|
1803
|
+
try {
|
|
1804
|
+
state = this.forge ? forgePrStateReader(this.forge, this.exec, this.o.root, this.o.forge?.config.repo.url)(existing).state : String(this.prHeadState(pr).state);
|
|
1805
|
+
}
|
|
1806
|
+
catch (error) {
|
|
1807
|
+
this.o.warn?.(`omg factory run: PR #${pr} could not be read to check for a human merge: ${errText(error)}`);
|
|
1808
|
+
return null;
|
|
1809
|
+
}
|
|
1810
|
+
if (state === 'MERGED') {
|
|
1811
|
+
this.save((x) => markMergedByHuman(x, this.iso()));
|
|
1812
|
+
if (this.readShip(pr))
|
|
1813
|
+
this.writeShip(pr, (cur) => (canTransition(cur.phase, 'merged') ? transition(cur, 'merged', `merged on ${this.forgeName} by a human after the factory run stopped`, this.iso()) : cur));
|
|
1814
|
+
this.progress.emit('merged', 'done', `PR #${pr} merged by a human`, this.fields());
|
|
1815
|
+
return this.loop();
|
|
1816
|
+
}
|
|
1817
|
+
// A cancelled or failed run already stops; only a parked run would resume.
|
|
1818
|
+
if (state !== 'CLOSED' || !existing.gate)
|
|
1819
|
+
return null;
|
|
1820
|
+
return {
|
|
1821
|
+
exitCode: EXIT_AWAITING_HUMAN,
|
|
1822
|
+
phase: existing.phase,
|
|
1823
|
+
state: existing,
|
|
1824
|
+
gate: existing.gate,
|
|
1825
|
+
message: `PR #${pr} of the factory run for ${this.what} was closed without merging, so the run (parked at awaiting-human: ${existing.gate.name}) was not resumed and no lane started. Reopen the PR and rerun ${this.resume}, or ${cancelCommand(this.key)}`,
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1647
1828
|
/** Resume rules: a human gate is re-evaluated, a takeover is noted (running lanes are settled by settleLost). */
|
|
1648
1829
|
resumed(s, tookOver) {
|
|
1649
1830
|
const at = this.iso();
|
|
@@ -1756,7 +1937,7 @@ class FactoryEngine {
|
|
|
1756
1937
|
const parked = setGate({
|
|
1757
1938
|
...s,
|
|
1758
1939
|
elapsedMs: s.elapsedMs + this.tick(),
|
|
1759
|
-
lanes: s.lanes.map((l) => (stopped.has(l.id) ? { ...l, status: 'cancelled', endedAt: at, usage: stopped.get(l.id), note: 'cancelled: engine state tampered' } : l)),
|
|
1940
|
+
lanes: s.lanes.map((l) => (stopped.has(l.id) ? { ...l, status: 'cancelled', endedAt: at, usage: stopped.get(l.id), note: 'cancelled: engine state tampered', tamperCheck: 'skipped' } : l)),
|
|
1760
1941
|
}, 'state-tampered', reason, at);
|
|
1761
1942
|
try {
|
|
1762
1943
|
const { sealed, content } = overwriteFactoryState(this.o.root, this.key, parked);
|
|
@@ -1988,7 +2169,8 @@ class FactoryEngine {
|
|
|
1988
2169
|
cancelRequested: true,
|
|
1989
2170
|
// A confirmed stop replaces a stale "not confirmed" note (the wall-time path leaves one on a running lane).
|
|
1990
2171
|
lanes: s.lanes.map((l) => (l.status === 'running' ? {
|
|
1991
|
-
|
|
2172
|
+
// No compare runs here (the baselines were dropped above): the lane's tamper check is skipped.
|
|
2173
|
+
...l, status: 'cancelled', endedAt: at, tamperCheck: 'skipped', ...(usage.has(l.id) ? { usage: usage.get(l.id) } : {}),
|
|
1992
2174
|
...(unconfirmed.has(l.id)
|
|
1993
2175
|
? { note: 'cancelled; the cancel was not confirmed, so the lane may still run', stopUnconfirmed: true }
|
|
1994
2176
|
: { stopUnconfirmed: false, ...(l.note && /not confirmed|may still run/.test(l.note) ? { note: 'cancelled; the stop was confirmed' } : {}) }),
|
|
@@ -3209,6 +3391,16 @@ class FactoryEngine {
|
|
|
3209
3391
|
}
|
|
3210
3392
|
if (s.prepareChecks === undefined)
|
|
3211
3393
|
this.save((x) => ({ ...x, prepareChecks: checksNow }));
|
|
3394
|
+
// ship.prepare.build is sealed the same way: what runs, and the outputs the merge rule accepts, never change mid-run.
|
|
3395
|
+
const pb = this.gateConfig(view).config.prepareBuild;
|
|
3396
|
+
const buildNow = pb ? { command: [...pb.command], outputs: [...pb.outputs] } : 'none';
|
|
3397
|
+
const buildText = (b) => (b === 'none' ? 'unset' : JSON.stringify(b));
|
|
3398
|
+
if (s.prepareBuild !== undefined && JSON.stringify(s.prepareBuild) !== JSON.stringify(buildNow)) {
|
|
3399
|
+
this.gate('prepare-checks', `ship.prepare.build is now ${buildText(buildNow)}, but this run recorded ${buildText(s.prepareBuild)}; restore it, or cancel the run (omg factory run cancel) and start a new one`);
|
|
3400
|
+
return;
|
|
3401
|
+
}
|
|
3402
|
+
if (s.prepareBuild === undefined)
|
|
3403
|
+
this.save((x) => ({ ...x, prepareBuild: buildNow }));
|
|
3212
3404
|
if (await this.recheckFailed('before prepare'))
|
|
3213
3405
|
return;
|
|
3214
3406
|
this.discardCheckout();
|
|
@@ -3272,7 +3464,12 @@ class FactoryEngine {
|
|
|
3272
3464
|
}
|
|
3273
3465
|
else if (!this.gatesSandbox(this.gateConfig(view)).container) {
|
|
3274
3466
|
// isolation "container" (C1, review-499): no link to your node_modules in a checkout the container's writes come back to.
|
|
3275
|
-
this.linkGateTree(path, view.baseRefOid);
|
|
3467
|
+
const failed = this.linkGateTree(path, view.baseRefOid);
|
|
3468
|
+
if (failed) {
|
|
3469
|
+
const park = this.treeCopyPark(failed);
|
|
3470
|
+
this.gate(park.name, park.reason);
|
|
3471
|
+
return;
|
|
3472
|
+
}
|
|
3276
3473
|
}
|
|
3277
3474
|
// The checkout's gitfile before any PR code ran: compared after each check, and its git dir named to engine git from then on.
|
|
3278
3475
|
const gitLink = checkoutGitLink(path);
|
|
@@ -3282,18 +3479,20 @@ class FactoryEngine {
|
|
|
3282
3479
|
throw new FactoryStepError(`the new prepare checkout ${path} names the git dir ${gitLink.gitDir}, not the admin dir ${recorded.adminDir} its git links were recorded with`);
|
|
3283
3480
|
// Configured checks are resolved without a shell (never a .cmd/.bat); every check runs per factory.run.sandbox.gates (prepareCheck).
|
|
3284
3481
|
const commands = configured?.map((argv) => ({ argv, ...resolveLocalGateArgv(argv, { cwd: path, subject: 'the prepare check', configKey: 'ship.prepare.checks' }) }));
|
|
3482
|
+
// ship.prepare.build (sealed above): the same trusted block, run like a configured check; only its outputs are committed.
|
|
3483
|
+
const build = buildNow === 'none' ? undefined : { argv: buildNow.command, outputs: buildNow.outputs, ...resolveLocalGateArgv(buildNow.command, { cwd: path, subject: 'the prepare build', configKey: 'ship.prepare.build' }) };
|
|
3285
3484
|
const gates = this.gatesSandbox(this.gateConfig(view));
|
|
3286
3485
|
const ran = { modes: new Set(), acked: false, park: undefined };
|
|
3287
3486
|
let result;
|
|
3288
3487
|
let checkoutHead;
|
|
3289
3488
|
try {
|
|
3290
|
-
result = await runPrepareAsync({ exec: priv ? priv.exec() : this.exec, cwd: path, base: s.base, branch, reviewedSha: head, baseSha: view.baseRefOid, repoUrl: s.repoUrl, remote: runRemote(s), push: false, commands, ...(priv ? { prefetchedBase: true } : {}) }, (c) => this.prepareCheck(c, { head, path, commonGitDir: common, baseSha: view.baseRefOid, gates, ran, gitLink: { hash: gitLink.hash, gitDir: gitLink.gitDir } }));
|
|
3489
|
+
result = await runPrepareAsync({ exec: priv ? priv.exec() : this.exec, cwd: path, base: s.base, branch, reviewedSha: head, baseSha: view.baseRefOid, repoUrl: s.repoUrl, remote: runRemote(s), push: false, commands, ...(build ? { build } : {}), ...(priv ? { prefetchedBase: true } : {}) }, (c) => this.prepareCheck(c, { head, path, commonGitDir: common, baseSha: view.baseRefOid, gates, ran, gitLink: { hash: gitLink.hash, gitDir: gitLink.gitDir } }));
|
|
3291
3490
|
// A changed gitfile parks before any further engine git reads the checkout.
|
|
3292
3491
|
if (ran.park?.name === 'lane-tampered') {
|
|
3293
3492
|
this.gate(ran.park.name, ran.park.reason, ran.park.detail);
|
|
3294
3493
|
return;
|
|
3295
3494
|
}
|
|
3296
|
-
if (ran.modes.has('ack') || ran.modes.has('unsandboxed')) {
|
|
3495
|
+
if (ran.modes.has('ack') || ran.modes.has('unsandboxed') || ran.modes.has('git-transport')) {
|
|
3297
3496
|
const mine = await this.importReady(() => this.userRepoProblems(userBefore, { name: `refs/remotes/${runRemote(s)}/${s.base}`, sha: view.baseRefOid }));
|
|
3298
3497
|
if (mine.length > 0) {
|
|
3299
3498
|
// As on the shared layout: your repository's changes are quarantined and hold (review-483 I.2).
|
|
@@ -3312,7 +3511,7 @@ class FactoryEngine {
|
|
|
3312
3511
|
}
|
|
3313
3512
|
const fetched = result.steps.some((st) => st.name === 'fetch' && st.status === 'ok');
|
|
3314
3513
|
// From here the PR's diff (review, protected paths) is against the base prepare merged (on GitHub its live tip, liveBase).
|
|
3315
|
-
const sandboxNote = ran.modes.size > 0 ? [{ at: this.iso(), from: s.phase, to: s.phase, note: `prepare checks on ${head.slice(0, 12)} ran ${[...ran.modes].map((m) => (m === 'enforced' ? 'in the OS sandbox' : m === 'enforced-readable' ? `in the OS sandbox (${CREDENTIAL_FILES_READABLE_NOTE})` : `unsandboxed (${m})`)).join(' and ')}` }] : [];
|
|
3514
|
+
const sandboxNote = ran.modes.size > 0 ? [{ at: this.iso(), from: s.phase, to: s.phase, note: `prepare checks on ${head.slice(0, 12)} ran ${[...ran.modes].map((m) => (m === 'enforced' ? 'in the OS sandbox' : m === 'enforced-readable' ? `in the OS sandbox (${CREDENTIAL_FILES_READABLE_NOTE})` : m === 'git-transport-container' ? 'in the gate container (Windows git-transport fallback)' : `unsandboxed (${m})`)).join(' and ')}` }] : [];
|
|
3316
3515
|
const sandboxed = ran.modes.has('enforced') || ran.modes.has('enforced-readable');
|
|
3317
3516
|
this.save((x) => ({ ...x, checkoutHead, ...(sandboxed ? { sandboxedPrepareHead: checkoutHead } : {}), ...(fetched ? { baseSha: view.baseRefOid } : {}), history: [...x.history, ...sandboxNote] }));
|
|
3318
3517
|
// The accepted head's code ran unsandboxed: publishPrepared carries the ack to the prepared head once it holds only the engine's own commits.
|
|
@@ -3363,12 +3562,22 @@ class FactoryEngine {
|
|
|
3363
3562
|
if (this.gatesModeCache && this.gatesModeCache.commit === commit)
|
|
3364
3563
|
return this.gatesModeCache;
|
|
3365
3564
|
let user = this.o.gateSandboxUserConfig;
|
|
3565
|
+
// M1 (review-532): "strict" lives in the user config, so a config that cannot be read never allows the fallback.
|
|
3566
|
+
let userConfigUnreadable = false;
|
|
3366
3567
|
if (user === undefined) {
|
|
3367
3568
|
try {
|
|
3368
3569
|
user = userConfigLayers().trustedUser;
|
|
3369
3570
|
}
|
|
3370
3571
|
catch {
|
|
3371
3572
|
user = null;
|
|
3573
|
+
userConfigUnreadable = true;
|
|
3574
|
+
}
|
|
3575
|
+
// M1 (review-532b): the loader turns a read or parse error into null, so a file there that gives no object is unreadable.
|
|
3576
|
+
if (!userConfigUnreadable && (user === null || typeof user !== 'object' || Array.isArray(user))) {
|
|
3577
|
+
try {
|
|
3578
|
+
userConfigUnreadable = existsSync(trustedUserConfigPath());
|
|
3579
|
+
}
|
|
3580
|
+
catch { /* no resolvable home: no trusted user layer */ }
|
|
3372
3581
|
}
|
|
3373
3582
|
}
|
|
3374
3583
|
let resolved;
|
|
@@ -3379,7 +3588,11 @@ class FactoryEngine {
|
|
|
3379
3588
|
const isolation = resolveGateIsolation({ user, base });
|
|
3380
3589
|
if (isolation.ignoredBase.length > 0)
|
|
3381
3590
|
this.o.warn?.(`omg factory run: ignoring ${isolation.ignoredBase.join(' and ')} in the base .copilot/omg.jsonc: where the PR's code runs is set in your user config only`);
|
|
3382
|
-
|
|
3591
|
+
// factory.run.sandbox.windowsGitTransport: the user config only, like isolation.
|
|
3592
|
+
const transport = resolveWindowsGitTransport({ user, base });
|
|
3593
|
+
if (transport.ignoredBase)
|
|
3594
|
+
this.o.warn?.('omg factory run: ignoring factory.run.sandbox.windowsGitTransport in the base .copilot/omg.jsonc: whether the PR\'s code may run outside the OS sandbox is set in your user config only');
|
|
3595
|
+
resolved = { ...resolveGatesSandboxMode({ user, base, env: process.env }), requireDeniedPaths: resolveRequireDeniedPaths({ user, base }).require, ...(isolation.container ? { container: isolation.container } : {}), gitTransport: { mode: transport.mode, container: transport.container, ...(userConfigUnreadable ? { userConfigUnreadable: true } : {}) } };
|
|
3383
3596
|
// L3 (review-499): "ack" (or the kill switch) means the OS sandbox is not used; with the container the PR's code
|
|
3384
3597
|
// still runs there, never plainly on your host after an ack.
|
|
3385
3598
|
if (resolved.container && resolved.mode === 'ack')
|
|
@@ -3456,8 +3669,115 @@ class FactoryEngine {
|
|
|
3456
3669
|
return `${what} on ${head.slice(0, 12)} did not run: factory.run.sandbox.isolation is "container" and the gate container is not available (${why}). The head is not judged: no pass, no FAILURE, no ci-fix lane, and it never falls back to the Copilot sandbox. Fix that, then rerun ${this.resume}`;
|
|
3457
3670
|
}
|
|
3458
3671
|
/** Where a sandboxed command runs, for parks and notes: the gate container (isolation "container") or the OS sandbox. */
|
|
3459
|
-
sandboxName() {
|
|
3460
|
-
return
|
|
3672
|
+
sandboxName(container = this.gatesModeCache?.container) {
|
|
3673
|
+
return container ? `the gate container (${container.runtime} ${container.image})` : 'the OS sandbox';
|
|
3674
|
+
}
|
|
3675
|
+
get gatePlatform() {
|
|
3676
|
+
return this.o.gitTransportHost?.platform ?? process.platform;
|
|
3677
|
+
}
|
|
3678
|
+
/**
|
|
3679
|
+
* Whether Git for Windows' sh.exe fails to start in the OS sandbox with
|
|
3680
|
+
* STATUS_DLL_INIT_FAILED: one turnless sandbox command in an empty dir,
|
|
3681
|
+
* once per invocation. False when there is no Git for Windows shell or the
|
|
3682
|
+
* probe gives no verdict, so the fallback never rests on a guess.
|
|
3683
|
+
*/
|
|
3684
|
+
msysBlocked(commonGitDir) {
|
|
3685
|
+
this.msysProbe ??= (async () => {
|
|
3686
|
+
const sh = this.o.gitTransportHost ? this.o.gitTransportHost.shell() : gitForWindowsShell(process.env);
|
|
3687
|
+
if (!sh || !existsSync(sh))
|
|
3688
|
+
return false;
|
|
3689
|
+
const jobRoot = this.gateJobRoot();
|
|
3690
|
+
mkdirSync(jobRoot, { recursive: true });
|
|
3691
|
+
const dir = mkdtempSync(join(jobRoot, 'msys-probe-'));
|
|
3692
|
+
try {
|
|
3693
|
+
const r = await this.sandboxRun({ purpose: 'calibrate', argv: [sh, '-c', 'exit 0'], exe: sh, args: ['-c', 'exit 0'], cwd: dir, commonGitDir, timeoutMs: 120_000 });
|
|
3694
|
+
return r.ran && MSYS_DLL_INIT_FAILED.includes(r.status);
|
|
3695
|
+
}
|
|
3696
|
+
catch {
|
|
3697
|
+
return false;
|
|
3698
|
+
}
|
|
3699
|
+
finally {
|
|
3700
|
+
try {
|
|
3701
|
+
rmSync(dir, { recursive: true, force: true });
|
|
3702
|
+
}
|
|
3703
|
+
catch { /* best effort */ }
|
|
3704
|
+
}
|
|
3705
|
+
})();
|
|
3706
|
+
return this.msysProbe;
|
|
3707
|
+
}
|
|
3708
|
+
/**
|
|
3709
|
+
* The Windows git-transport fallback for a check whose base calibration
|
|
3710
|
+
* failed in the OS sandbox with git's transport error (calibrateGate's
|
|
3711
|
+
* `gitTransport`): the container to try first (factory.run.sandbox
|
|
3712
|
+
* .container, an image with git), or null when the run keeps the park:
|
|
3713
|
+
* factory.run.sandbox.windowsGitTransport "strict", or the probe does not
|
|
3714
|
+
* show MSYS2 failing to start in the sandbox (the cause is another one).
|
|
3715
|
+
*/
|
|
3716
|
+
async gitTransportFallback(commonGitDir) {
|
|
3717
|
+
const settings = this.gatesModeCache?.gitTransport;
|
|
3718
|
+
if (!settings || settings.mode === 'strict' || this.gatesModeCache?.container || this.gatePlatform !== 'win32')
|
|
3719
|
+
return null;
|
|
3720
|
+
if (settings.userConfigUnreadable) {
|
|
3721
|
+
this.o.warn?.('omg factory run: your user config could not be read, so the Windows git-transport fallback stays off (factory.run.sandbox.windowsGitTransport may be "strict" there); the check parks');
|
|
3722
|
+
return null;
|
|
3723
|
+
}
|
|
3724
|
+
if (!(await this.msysBlocked(commonGitDir)))
|
|
3725
|
+
return null;
|
|
3726
|
+
// M4 (review-532): the image id before the first container run, so a stored container calibration is found by it.
|
|
3727
|
+
if (!this.containerImageId && this.o.gateImageId) {
|
|
3728
|
+
try {
|
|
3729
|
+
this.containerImageId = await this.o.gateImageId(settings.container);
|
|
3730
|
+
}
|
|
3731
|
+
catch { /* learnt from the first container run */ }
|
|
3732
|
+
}
|
|
3733
|
+
return settings.container;
|
|
3734
|
+
}
|
|
3735
|
+
/**
|
|
3736
|
+
* The sealed-state key of a base calibration: the base and argv, plus the
|
|
3737
|
+
* gate container (by image id once known) or a plain run.
|
|
3738
|
+
*/
|
|
3739
|
+
calibrationKey(baseSha, argv, where) {
|
|
3740
|
+
const container = where === 'plain' ? undefined : this.gatesModeCache?.container ?? where;
|
|
3741
|
+
// The OS sandbox with the copied gate tree (switchToGateTreeCopy) is a calibration of its own: the linked one's failure does not hold.
|
|
3742
|
+
const copied = !container && where !== 'plain' && this.state.gateTreeCopy ? '\0tree-copy' : '';
|
|
3743
|
+
return createHash('sha256').update(`${baseSha}\0${JSON.stringify(argv)}${container ? `\0container\0${container.runtime}\0${this.containerImageId ?? container.image}` : ''}${where === 'plain' ? '\0plain' : ''}${copied}`).digest('hex');
|
|
3744
|
+
}
|
|
3745
|
+
/**
|
|
3746
|
+
* The base failed in the fallback's container before, for this exact image
|
|
3747
|
+
* id, with a verdict (not a timeout: N1, review-532b): the head's container
|
|
3748
|
+
* run is skipped. Not a base that kept a per-test report there (L1,
|
|
3749
|
+
* review-550): the head's run in the container is judged per test.
|
|
3750
|
+
*/
|
|
3751
|
+
containerFailedOnBase(c, baseSha, container) {
|
|
3752
|
+
if (!this.containerImageId)
|
|
3753
|
+
return false;
|
|
3754
|
+
const cal = this.state.gateCalibration?.[this.calibrationKey(baseSha, c.argv, container)];
|
|
3755
|
+
return cal !== undefined && !cal.ok && !cal.timedOut && !cal.tests;
|
|
3756
|
+
}
|
|
3757
|
+
/**
|
|
3758
|
+
* The PR's code ran without any sandbox on this host in this run (M1,
|
|
3759
|
+
* review-550): gates "unsandboxed", an --allow-unsandboxed-gates ack, a
|
|
3760
|
+
* write lane run without the enforced sandbox, or the git-transport
|
|
3761
|
+
* fallback's plain run. A plain base calibration made from then on shares
|
|
3762
|
+
* the host (the root's node_modules, the repo's git config) with it.
|
|
3763
|
+
*/
|
|
3764
|
+
plainHeadCodeRan() {
|
|
3765
|
+
const s = this.state;
|
|
3766
|
+
return s.plainHeadRan === true || s.gitTransportPlainHead !== undefined || s.unsandboxedGatesAck !== undefined || s.unsandboxedAck !== undefined;
|
|
3767
|
+
}
|
|
3768
|
+
/** Recorded (sealed) before the PR's code runs without any sandbox. */
|
|
3769
|
+
notePlainHeadRan() {
|
|
3770
|
+
if (!this.state.plainHeadRan)
|
|
3771
|
+
this.save((x) => ({ ...x, plainHeadRan: true }));
|
|
3772
|
+
}
|
|
3773
|
+
/** The loud note of a check the Windows git-transport fallback runs outside the OS sandbox: a warning, a history note, one PR note per head. */
|
|
3774
|
+
noteGitTransportFallback(head, what, how, container) {
|
|
3775
|
+
const where = how === 'container' ? `in ${this.sandboxName(container)}` : 'WITHOUT any sandbox, as your user (not in the gate container)';
|
|
3776
|
+
const text = `${what} on ${head.slice(0, 12)} ran ${where}: its base fails in the OS sandbox on Windows because git clone, fetch and push need Git for Windows' sh.exe, which cannot start there (known gap; factory.run.sandbox.windowsGitTransport "strict" in your user config parks instead)`;
|
|
3777
|
+
this.o.warn?.(`omg factory run: ${text}`);
|
|
3778
|
+
// M2 (review-532): a plain run of the PR's code is never auto-merged (autoMergeVerdict), like an --allow-* ack.
|
|
3779
|
+
this.save((x) => ({ ...x, ...(how === 'unsandboxed' ? { gitTransportPlainHead: head } : {}), history: [...x.history, { at: this.iso(), from: x.phase, to: x.phase, note: text.slice(0, 400) }] }));
|
|
3780
|
+
this.commentOnce('pr', `git-transport-${how}@${head.slice(0, 12)}`, 'sandbox', `**Sandbox: Windows git-transport fallback.** ${text}.\n`);
|
|
3461
3781
|
}
|
|
3462
3782
|
/** The park after the command ran in the sandbox without a verdict: no ack offer, no pass, no failure. `why` is fixed text (sandbox-exec.ts). */
|
|
3463
3783
|
gateNoVerdictReason(head, what, why) {
|
|
@@ -3472,10 +3792,13 @@ class FactoryEngine {
|
|
|
3472
3792
|
prepareCheckLabel(c) {
|
|
3473
3793
|
if (c.kind === 'configured')
|
|
3474
3794
|
return `the prepare check \`${c.argv.join(' ')}\``;
|
|
3795
|
+
if (c.kind === 'build')
|
|
3796
|
+
return `the prepare build \`${c.argv.join(' ')}\``;
|
|
3475
3797
|
return c.kind === 'inventory' ? 'the inventory generator' : `the built-in prepare check ${c.step}`;
|
|
3476
3798
|
}
|
|
3477
3799
|
/** gates "unsandboxed": a warning every time and one PR note per head. */
|
|
3478
3800
|
noteUnsandboxedGates(head, what) {
|
|
3801
|
+
this.notePlainHeadRan();
|
|
3479
3802
|
const source = this.gatesModeCache?.source ?? 'config';
|
|
3480
3803
|
this.o.warn?.(`omg factory run: ${what} on ${head.slice(0, 12)} runs WITHOUT the OS sandbox (factory.run.sandbox.gates "unsandboxed", ${source})`);
|
|
3481
3804
|
this.commentOnce('pr', `gates-unsandboxed@${head.slice(0, 12)}`, 'sandbox', `**Sandbox: gates unsandboxed.** ${what} on ${head.slice(0, 12)} ran the PR's own code without the OS sandbox (\`factory.run.sandbox.gates: "unsandboxed"\`, ${source}).\n`);
|
|
@@ -3521,11 +3844,13 @@ class FactoryEngine {
|
|
|
3521
3844
|
}));
|
|
3522
3845
|
// One mechanism: the admin dir recorded at `worktree add` (recordWorktreeGitLinks), the same one host git reads through.
|
|
3523
3846
|
this.checkoutGitPin = { workTree: path, gitDir: worktreeGitDirArgs(path)[1] };
|
|
3524
|
-
|
|
3847
|
+
// 'git-transport': the Windows git-transport fallback without a container (noted by the caller).
|
|
3848
|
+
const plain = async (how, extraArgs = []) => {
|
|
3525
3849
|
if (how === 'unsandboxed')
|
|
3526
3850
|
this.noteUnsandboxedGates(head, label);
|
|
3527
|
-
else
|
|
3851
|
+
else if (how === 'ack')
|
|
3528
3852
|
ran.acked = true;
|
|
3853
|
+
this.notePlainHeadRan();
|
|
3529
3854
|
ran.modes.add(how);
|
|
3530
3855
|
// The orphans of an unsandboxed check (Windows does not reparent them) are recorded and killed after it, as the local gate's.
|
|
3531
3856
|
const procs = join(this.gateJobRoot(), 'prepare-procs', `${head}.json`);
|
|
@@ -3534,7 +3859,7 @@ class FactoryEngine {
|
|
|
3534
3859
|
await reapGateProcs(procs).catch(() => undefined);
|
|
3535
3860
|
let r;
|
|
3536
3861
|
try {
|
|
3537
|
-
r = await (this.o.localGate ?? defaultLocalGateRunner)([c.exe, ...c.args], path, PREPARE_CHECK_TIMEOUT_MS, createGateProcTracker(procs, Date.now(), undefined, (m) => this.o.warn?.(`omg factory run: ${m}`)));
|
|
3862
|
+
r = await (this.o.localGate ?? defaultLocalGateRunner)([c.exe, ...c.args, ...extraArgs], path, PREPARE_CHECK_TIMEOUT_MS, createGateProcTracker(procs, Date.now(), undefined, (m) => this.o.warn?.(`omg factory run: ${m}`)));
|
|
3538
3863
|
}
|
|
3539
3864
|
finally {
|
|
3540
3865
|
await reapGateProcs(procs).catch(() => undefined);
|
|
@@ -3556,7 +3881,7 @@ class FactoryEngine {
|
|
|
3556
3881
|
// lane gets the check "prepare lint" (or "prepare tests") with this fixed text as its detail and can rename
|
|
3557
3882
|
// the file. Never the --allow-unsandboxed-gates offer, and decided before any sandbox call for this part.
|
|
3558
3883
|
// Configured commands are trusted config and keep their own refusal path below.
|
|
3559
|
-
if (c.kind === 'built-in' && (c.args[0] === VITEST_SCRIPT || c.args[0] === ESLINT_SCRIPT) && sandboxCommandTooLong(process.platform, c.argv, path)) {
|
|
3884
|
+
if (c.kind === 'built-in' && (c.args[0] === VITEST_SCRIPT || c.args[0] === ESLINT_SCRIPT) && sandboxCommandTooLong(process.platform, [...c.argv, ...sizingReportArgs(c, path)], path)) {
|
|
3560
3885
|
return { status: 1, stdout: '', stderr: BUILT_IN_FILE_NAME_TOO_LONG };
|
|
3561
3886
|
}
|
|
3562
3887
|
// A node_modules link the PR's code re-pointed is never granted to the sandbox (review-483 M4).
|
|
@@ -3567,9 +3892,24 @@ class FactoryEngine {
|
|
|
3567
3892
|
// Still inside checkoutGitPin: engine git reads the checkout's HEAD (prepare's merge or inventory commit) through its recorded git dir.
|
|
3568
3893
|
const priv = this.privateRun();
|
|
3569
3894
|
const checkedOut = () => (priv ? priv.gitOk(['rev-parse', 'HEAD'], 'reading the prepare checkout', path) : this.run(['rev-parse', 'HEAD'], 'git', undefined, path));
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3895
|
+
// The built-in vitest check writes a JSON report (in the OS sandbox or the gate container), so a failure is judged
|
|
3896
|
+
// per test against the base (test-delta.ts).
|
|
3897
|
+
const report = this.o.gateSandbox && isBuiltInVitest(c) ? vitestReportPath(path) : undefined;
|
|
3898
|
+
let headTests = null;
|
|
3899
|
+
let r;
|
|
3900
|
+
try {
|
|
3901
|
+
r = this.o.gateSandbox
|
|
3902
|
+
? await this.withGitView(checkedOut, label, (view) => this.sandboxRun({ purpose: 'prepare', argv: c.argv, exe: c.exe, args: report ? [...c.args, ...vitestReportArgs(report)] : c.args, cwd: path, commonGitDir: at.commonGitDir, timeoutMs: PREPARE_CHECK_TIMEOUT_MS, ...(at.gates.requireDeniedPaths ? { requireDeniedPaths: true } : {}), ...(report ? { reportFile: report } : {}), ...view }))
|
|
3903
|
+
: { ran: false, reason: 'no OS sandbox runner was given to the engine' };
|
|
3904
|
+
}
|
|
3905
|
+
finally {
|
|
3906
|
+
// Read and removed right away, even when the run threw (L4, review-548): the file is not the PR's, and no
|
|
3907
|
+
// later check (or prepare's untracked-file refusal) sees it.
|
|
3908
|
+
if (report)
|
|
3909
|
+
headTests = readVitestReport(report, path);
|
|
3910
|
+
}
|
|
3911
|
+
if (report)
|
|
3912
|
+
headTests = runReport(r, headTests);
|
|
3573
3913
|
const t = tampered();
|
|
3574
3914
|
if (t)
|
|
3575
3915
|
return t;
|
|
@@ -3584,6 +3924,101 @@ class FactoryEngine {
|
|
|
3584
3924
|
if (r.status === 0 && !r.timedOut)
|
|
3585
3925
|
return { status: 0, stdout: redactGateOutput(r.output), stderr: '' };
|
|
3586
3926
|
const park = await this.calibrateGate(c, at.baseSha, at.commonGitDir, PREPARE_CHECK_TIMEOUT_MS, label, head);
|
|
3927
|
+
// The base failed opening a package dir through the gate tree's junction (esbuild on Windows): the same check
|
|
3928
|
+
// again, still in the sandbox, on a copied tree; its failure then counts only against a base that passes there.
|
|
3929
|
+
if (park?.junctionRead) {
|
|
3930
|
+
const switched = this.switchToGateTreeCopy(path);
|
|
3931
|
+
if (switched === true)
|
|
3932
|
+
return this.prepareCheck(c, at);
|
|
3933
|
+
if (switched)
|
|
3934
|
+
return stop(switched);
|
|
3935
|
+
}
|
|
3936
|
+
// The built-in vitest check, judged per test: a failure that fails on the base too is not counted.
|
|
3937
|
+
if (park && report && !park.gitTransport && !park.junctionRead && !r.timedOut) {
|
|
3938
|
+
const judged = this.judgeTestDelta(park, headTests, head, label, at.baseSha, r.status, r.output, this.sandboxName());
|
|
3939
|
+
if (judged)
|
|
3940
|
+
return judged;
|
|
3941
|
+
}
|
|
3942
|
+
// The base cannot run in the OS sandbox on Windows (git transport): the gate container, else plainly, never a park by default.
|
|
3943
|
+
const fallback = park?.gitTransport ? await this.gitTransportFallback(at.commonGitDir) : null;
|
|
3944
|
+
if (fallback) {
|
|
3945
|
+
if (c.kind === 'build') {
|
|
3946
|
+
// #529: prepare commits what the build writes, and the gate container is Linux: the build runs on your host.
|
|
3947
|
+
this.o.warn?.(`omg factory run: the Windows git-transport fallback skips the gate container for ${label}: prepare commits what a build writes, so it runs on your host`);
|
|
3948
|
+
}
|
|
3949
|
+
else if (this.containerFailedOnBase(c, at.baseSha, fallback)) {
|
|
3950
|
+
// M4 (review-532): the base failed in this exact image before; the head's container run would only fail too.
|
|
3951
|
+
this.o.warn?.(`omg factory run: the Windows git-transport fallback skips the gate container for ${label}: it failed there on the base ${at.baseSha.slice(0, 12)} before (image ${this.containerImageId})`);
|
|
3952
|
+
}
|
|
3953
|
+
else {
|
|
3954
|
+
const freport = isBuiltInVitest(c) ? vitestReportPath(path) : undefined;
|
|
3955
|
+
let fTests = null;
|
|
3956
|
+
let fr;
|
|
3957
|
+
try {
|
|
3958
|
+
fr = await this.withGitView(checkedOut, label, (view) => this.sandboxRun({ purpose: 'prepare', argv: c.argv, exe: c.exe, args: freport ? [...c.args, ...vitestReportArgs(freport)] : c.args, cwd: path, commonGitDir: at.commonGitDir, timeoutMs: PREPARE_CHECK_TIMEOUT_MS, ...(freport ? { reportFile: freport } : {}), ...view }, fallback), true);
|
|
3959
|
+
}
|
|
3960
|
+
finally {
|
|
3961
|
+
// A passing run's copy back brings the file into the checkout: removed right away, as the OS sandbox's.
|
|
3962
|
+
if (freport)
|
|
3963
|
+
fTests = readVitestReport(freport, path);
|
|
3964
|
+
}
|
|
3965
|
+
if (freport)
|
|
3966
|
+
fTests = runReport(fr, fTests);
|
|
3967
|
+
const ft = tampered();
|
|
3968
|
+
if (ft)
|
|
3969
|
+
return ft;
|
|
3970
|
+
if (fr.ran) {
|
|
3971
|
+
const passed = fr.status === 0 && !fr.timedOut;
|
|
3972
|
+
// A failure there counts only when the base passes in the same container; a base that fails there too
|
|
3973
|
+
// (the project cannot install or run in it) leaves the plain run.
|
|
3974
|
+
const cpark = passed ? null : await this.calibrateGate(c, at.baseSha, at.commonGitDir, PREPARE_CHECK_TIMEOUT_MS, label, head, fallback);
|
|
3975
|
+
// The built-in vitest check, judged per test against the base's run in the same container.
|
|
3976
|
+
const judged = cpark && freport && !fr.timedOut ? this.judgeTestDelta(cpark, fTests, head, label, at.baseSha, fr.status, fr.output, this.sandboxName(fallback)) : null;
|
|
3977
|
+
if (!cpark || judged) {
|
|
3978
|
+
// L2 (review-532): noted only when the container's verdict is the one used.
|
|
3979
|
+
this.noteGitTransportFallback(head, label, 'container', fallback);
|
|
3980
|
+
ran.modes.add('git-transport-container');
|
|
3981
|
+
return judged ?? { status: passed ? 0 : fr.timedOut ? 124 : fr.status, stdout: redactGateOutput(fr.output), stderr: '' };
|
|
3982
|
+
}
|
|
3983
|
+
this.o.warn?.(`omg factory run: the Windows git-transport fallback cannot use the gate container for ${label}: it fails there on the base too`);
|
|
3984
|
+
}
|
|
3985
|
+
else if (fr.started) {
|
|
3986
|
+
return stop({ name: GATE_NO_VERDICT_GATE, reason: this.gateNoVerdictReason(head, label, fr.reason) });
|
|
3987
|
+
}
|
|
3988
|
+
else {
|
|
3989
|
+
this.o.warn?.(`omg factory run: the Windows git-transport fallback could not use the gate container: ${fr.reason}`);
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
const preport = isBuiltInVitest(c) ? vitestReportPath(path) : undefined;
|
|
3993
|
+
// M1 (review-550): the base's plain run shares this host with the head's (the root's node_modules, the repo's
|
|
3994
|
+
// git config), so a base calibrated after the PR's code ran plainly may fail exactly the head's broken tests.
|
|
3995
|
+
// The built-in vitest check calibrates its plain base first, while no plain head of this run has run yet.
|
|
3996
|
+
if (preport && !this.plainHeadCodeRan())
|
|
3997
|
+
await this.calibrateGate(c, at.baseSha, at.commonGitDir, PREPARE_CHECK_TIMEOUT_MS, label, head, 'plain');
|
|
3998
|
+
this.noteGitTransportFallback(head, label, 'unsandboxed', fallback);
|
|
3999
|
+
let pTests = null;
|
|
4000
|
+
let pr;
|
|
4001
|
+
try {
|
|
4002
|
+
pr = await plain('git-transport', preport ? vitestReportArgs(preport) : []);
|
|
4003
|
+
}
|
|
4004
|
+
finally {
|
|
4005
|
+
if (preport)
|
|
4006
|
+
pTests = readVitestReport(preport, path);
|
|
4007
|
+
}
|
|
4008
|
+
if (pr.notStarted !== undefined || pr.status === 0)
|
|
4009
|
+
return pr;
|
|
4010
|
+
// L1 (review-532): a plain failure counts only when the trusted base passes plainly too.
|
|
4011
|
+
const ppark = await this.calibrateGate(c, at.baseSha, at.commonGitDir, PREPARE_CHECK_TIMEOUT_MS, label, head, 'plain');
|
|
4012
|
+
// The built-in vitest check, judged per test against the base's plain run, only one made before any plain head
|
|
4013
|
+
// of this run ran (M1, review-550); a later one keeps today's park.
|
|
4014
|
+
const pjudged = ppark && preport && ppark.beforePlainHead ? this.judgeTestDelta(ppark, pTests, head, label, at.baseSha, pr.status, `${pr.stdout}\n${pr.stderr}`, 'a plain run (no sandbox)') : null;
|
|
4015
|
+
if (pjudged)
|
|
4016
|
+
return pjudged;
|
|
4017
|
+
if (ppark && preport && ppark.baseTests && !ppark.beforePlainHead) {
|
|
4018
|
+
return stop({ ...ppark, reason: `Not compared test by test: the base ran plainly after the PR's code had run plainly on this host in this run, so its failures may be the PR's doing. ${ppark.reason}` });
|
|
4019
|
+
}
|
|
4020
|
+
return ppark ? stop(ppark) : pr;
|
|
4021
|
+
}
|
|
3587
4022
|
if (park)
|
|
3588
4023
|
return stop(park);
|
|
3589
4024
|
return { status: r.timedOut ? 124 : r.status, stdout: redactGateOutput(r.output), stderr: '' };
|
|
@@ -3596,7 +4031,7 @@ class FactoryEngine {
|
|
|
3596
4031
|
// An earlier check of this head already ran the PR's code in the sandbox: a start failure now may be its doing.
|
|
3597
4032
|
// Only a configured command (trusted config) refused for its own shape or length keeps the ack offer; a
|
|
3598
4033
|
// built-in's argv holds the PR's file names, so its refusal parks here too.
|
|
3599
|
-
const ownShape = r.refused === true && c.kind === 'configured';
|
|
4034
|
+
const ownShape = r.refused === true && (c.kind === 'configured' || c.kind === 'build');
|
|
3600
4035
|
// This invocation's checks, or an earlier invocation's prepare or gate on this head (sealed state), ran its code.
|
|
3601
4036
|
const codeRan = ran.modes.has('enforced') || ran.modes.has('enforced-readable') || this.state.sandboxedPrepareHead === head || this.state.sandboxedGateHead === head;
|
|
3602
4037
|
if (!ownShape && codeRan && !this.gatesAccepted(head)) {
|
|
@@ -3608,6 +4043,41 @@ class FactoryEngine {
|
|
|
3608
4043
|
return plain('ack');
|
|
3609
4044
|
return stop({ name: GATES_UNSANDBOXED_GATE, reason: this.gatesUnsandboxedReason(head, label, why) });
|
|
3610
4045
|
}
|
|
4046
|
+
/**
|
|
4047
|
+
* The built-in vitest check failed on `head` and on the base in the same
|
|
4048
|
+
* place (`place`: the OS sandbox, the gate container, or a plain run of
|
|
4049
|
+
* the Windows git-transport fallback; the base's calibration there is the
|
|
4050
|
+
* one in `park`): judged per test (test-delta.ts). Null keeps today's park (no base
|
|
4051
|
+
* or head report, nothing passes on the base, or the head failed outside
|
|
4052
|
+
* any test). Else a FAILURE that names the tests failing on the head only
|
|
4053
|
+
* (the ci-fix lane gets them), or a pass; either way the tests that fail
|
|
4054
|
+
* on the base too are listed in a warning, a history note and one PR note
|
|
4055
|
+
* per head. Their names come from the trusted base's report. A pass that
|
|
4056
|
+
* excused any test is recorded (testDeltaExcusedHead): such a head is never
|
|
4057
|
+
* auto-merged (L3, review-548), since an excused test may now fail for a
|
|
4058
|
+
* new reason.
|
|
4059
|
+
*/
|
|
4060
|
+
judgeTestDelta(park, headTests, head, label, baseSha, status, output, place) {
|
|
4061
|
+
const v = testDeltaVerdict(park.baseTests, headTests, headRunSignals(status, output), park.baseOutput ?? []);
|
|
4062
|
+
if (v.kind === 'park')
|
|
4063
|
+
return null;
|
|
4064
|
+
const list = (ids) => `${ids.slice(0, 10).map((id) => visibleLine(testIdText(id))).join('; ')}${ids.length > 10 ? `; and ${ids.length - 10} more` : ''}`;
|
|
4065
|
+
if (v.excused.length > 0) {
|
|
4066
|
+
const text = `${label} on ${head.slice(0, 12)}: ${v.excused.length} test(s) fail in ${place} on the base ${baseSha.slice(0, 12)} too and were not counted: ${list(v.excused)}`;
|
|
4067
|
+
this.o.warn?.(`omg factory run: ${text}`);
|
|
4068
|
+
this.save((x) => ({ ...x, history: [...x.history, { at: this.iso(), from: x.phase, to: x.phase, note: text.slice(0, 400) }] }));
|
|
4069
|
+
this.commentOnce('pr', `base-test-failures@${head.slice(0, 12)}`, 'sandbox', `**Sandbox: tests that fail on the base too.** ${text}.\n`);
|
|
4070
|
+
}
|
|
4071
|
+
if (v.kind === 'pass') {
|
|
4072
|
+
if (this.state.testDeltaExcusedHead !== head)
|
|
4073
|
+
this.save((x) => ({ ...x, testDeltaExcusedHead: head }));
|
|
4074
|
+
return { status: 0, stdout: redactGateOutput(output), stderr: '' };
|
|
4075
|
+
}
|
|
4076
|
+
// The head's own test names (the PR's output): only in the failure's output, which stays local detail (H1). Last,
|
|
4077
|
+
// so prepare's output tail keeps it.
|
|
4078
|
+
const counted = `${v.counted.length} test(s) fail on ${head.slice(0, 12)} that did not fail on the base ${baseSha.slice(0, 12)} (new tests count): ${list(v.counted)}`;
|
|
4079
|
+
return { status: status === 0 ? 1 : status, stdout: redactGateOutput(output), stderr: redactGateOutput(counted) };
|
|
4080
|
+
}
|
|
3611
4081
|
/**
|
|
3612
4082
|
* After `what` failed in the sandbox on `head`: run the same command in the
|
|
3613
4083
|
* sandbox on a plain copy of the trusted base tree (once per base sha and
|
|
@@ -3615,28 +4085,50 @@ class FactoryEngine {
|
|
|
3615
4085
|
* retried once per invocation, after the human changed the config). Null
|
|
3616
4086
|
* when the base passes (the failure is the PR's: a ci-fix lane may start),
|
|
3617
4087
|
* else the gate-sandbox-incompatible park: the command fails in the sandbox
|
|
3618
|
-
* on the base itself, or its calibration could not run.
|
|
4088
|
+
* on the base itself, or its calibration could not run. `gitTransport`:
|
|
4089
|
+
* the base failed in the OS sandbox with git's transport error on Windows
|
|
4090
|
+
* (the caller decides on the fallback). `where`: calibrate in the Windows
|
|
4091
|
+
* git-transport fallback's container instead (a stored failure there is
|
|
4092
|
+
* not retried while the image id is known and unchanged), or plainly
|
|
4093
|
+
* without any sandbox ('plain': the trusted base's code, after a plain
|
|
4094
|
+
* failure of the head, or before the head's plain run for the built-in
|
|
4095
|
+
* vitest check; `beforePlainHead` when no plain head of this run had run
|
|
4096
|
+
* yet, M1 review-550).
|
|
3619
4097
|
*/
|
|
3620
|
-
async calibrateGate(c, baseSha, commonGitDir, timeoutMs, what, head) {
|
|
4098
|
+
async calibrateGate(c, baseSha, commonGitDir, timeoutMs, what, head, where) {
|
|
3621
4099
|
// A calibration holds for the isolation it ran in: the gate container's (and its image, by id once a run reported it)
|
|
3622
|
-
// is keyed apart from the OS sandbox's.
|
|
3623
|
-
const
|
|
3624
|
-
const
|
|
4100
|
+
// is keyed apart from the OS sandbox's and a plain run's.
|
|
4101
|
+
const plainRun = where === 'plain';
|
|
4102
|
+
const container = plainRun ? undefined : this.gatesModeCache?.container ?? where;
|
|
4103
|
+
const key = this.calibrationKey(baseSha, c.argv, where);
|
|
4104
|
+
// M4 (review-532): the fallback container's stored failure for a known image id holds; a new image is a new key.
|
|
4105
|
+
// N1 (review-532b): only a failing verdict holds; a timed-out base run is retried like any other.
|
|
4106
|
+
const placeName = plainRun ? 'a plain run (no sandbox)' : this.sandboxName(container);
|
|
3625
4107
|
let cal = this.state.gateCalibration?.[key];
|
|
3626
|
-
|
|
4108
|
+
const sticky = where !== undefined && !plainRun && !this.gatesModeCache?.container && !!this.containerImageId && !cal?.timedOut;
|
|
4109
|
+
if (!cal || (!cal.ok && !sticky && !this.recalibrated.has(key))) {
|
|
3627
4110
|
this.recalibrated.add(key);
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
4111
|
+
// M1 (review-550): read before the run, which is the base's own code.
|
|
4112
|
+
const beforePlainHead = plainRun && !this.plainHeadCodeRan();
|
|
4113
|
+
const ran = await this.runOnBase(c, baseSha, commonGitDir, timeoutMs, where);
|
|
4114
|
+
if ('notStarted' in ran) {
|
|
4115
|
+
return { name: GATE_SANDBOX_INCOMPATIBLE_GATE, reason: `${what} failed in ${placeName} on ${head.slice(0, 12)}, and its calibration on the base ${baseSha.slice(0, 12)} could not run (${ran.notStarted}); the failure is not counted (no ci-fix lane). Fix the cause, then rerun ${this.resume}. ${ACK_WARNING}` };
|
|
3631
4116
|
}
|
|
4117
|
+
const out = beforePlainHead ? { ...ran, beforePlainHead: true } : ran;
|
|
3632
4118
|
cal = out;
|
|
3633
|
-
this.save((x) => ({ ...x, gateCalibration: { ...(x.gateCalibration ?? {}), [key]: out }, history: [...x.history, { at: this.iso(), from: x.phase, to: x.phase, note: `calibrated ${what.slice(0, 120)} in ${
|
|
4119
|
+
this.save((x) => ({ ...x, gateCalibration: { ...(x.gateCalibration ?? {}), [key]: out }, history: [...x.history, { at: this.iso(), from: x.phase, to: x.phase, note: `calibrated ${what.slice(0, 120)} in ${placeName} on the base ${baseSha.slice(0, 12)}: ${out.ok ? 'passes' : 'fails'}` }] }));
|
|
3634
4120
|
}
|
|
3635
4121
|
if (cal.ok)
|
|
3636
4122
|
return null;
|
|
4123
|
+
const advice = plainRun ? `It fails on the base without any sandbox too, so the check itself is broken on the base: fix it on ${this.state.base ?? 'the base'}` : container ? CONTAINER_INCOMPATIBLE_ADVICE : cal.gitTransport ? GIT_TRANSPORT_SANDBOX_ADVICE : sandboxIncompatibleAdvice(cal.tail);
|
|
3637
4124
|
return {
|
|
3638
4125
|
name: GATE_SANDBOX_INCOMPATIBLE_GATE,
|
|
3639
|
-
reason: `${what} fails in ${
|
|
4126
|
+
reason: `${what} fails in ${placeName} on the base ${baseSha.slice(0, 12)} itself, so its failure on ${head.slice(0, 12)} is not counted (no ci-fix lane). ${advice}, then rerun ${this.resume}. ${ACK_WARNING}${cal.tail ? `; base output tail: ${cal.tail.slice(-1_500)}` : ''}`,
|
|
4127
|
+
...(!container && !plainRun && cal.gitTransport ? { gitTransport: true } : {}),
|
|
4128
|
+
...(!container && !plainRun && cal.junctionRead ? { junctionRead: true } : {}),
|
|
4129
|
+
// The base's report from this place only (the key holds the place): the caller judges a head run from the same one.
|
|
4130
|
+
...(cal.tests ? { baseTests: cal.tests, baseOutput: vitestOutputFailures(cal.tail ?? '') } : {}),
|
|
4131
|
+
...(plainRun && cal.beforePlainHead ? { beforePlainHead: true } : {}),
|
|
3640
4132
|
};
|
|
3641
4133
|
}
|
|
3642
4134
|
/**
|
|
@@ -3644,8 +4136,13 @@ class FactoryEngine {
|
|
|
3644
4136
|
* read-tree` into a private index and `checkout-index --prefix` into a
|
|
3645
4137
|
* fresh dir under the gate job root (no worktree, branch or ref is made),
|
|
3646
4138
|
* the root's node_modules linked in, removed after (the link first).
|
|
4139
|
+
* `gitTransport`: it failed in the OS sandbox on Windows with git's
|
|
4140
|
+
* transport error anywhere in the output (the tail kept may not show it).
|
|
3647
4141
|
*/
|
|
3648
|
-
async runOnBase(c, baseSha, commonGitDir, timeoutMs) {
|
|
4142
|
+
async runOnBase(c, baseSha, commonGitDir, timeoutMs, where) {
|
|
4143
|
+
const plainRun = where === 'plain';
|
|
4144
|
+
const fallbackContainer = plainRun ? undefined : where;
|
|
4145
|
+
const container = plainRun ? undefined : this.gatesModeCache?.container ?? fallbackContainer;
|
|
3649
4146
|
if (!this.o.gateSandbox)
|
|
3650
4147
|
return { notStarted: 'no OS sandbox runner was given to the engine' };
|
|
3651
4148
|
if (!HEX40.test(baseSha))
|
|
@@ -3661,17 +4158,48 @@ class FactoryEngine {
|
|
|
3661
4158
|
// The export has no git: a one-commit view of the base at <dir>/.git, removed with the dir (git-view.ts).
|
|
3662
4159
|
const gitView = this.makeGitView(dir, baseSha, this.hostViewSource(), 'the base calibration');
|
|
3663
4160
|
// isolation "container": the container installs its own; your node_modules is never linked in (C1, review-499).
|
|
3664
|
-
if (!
|
|
4161
|
+
if (!container) {
|
|
3665
4162
|
// A workspace layout the gate does not support (Yarn PnP, a nested git repository, over the bounds) parks here, named.
|
|
3666
|
-
|
|
4163
|
+
// The OS sandbox's copied tree once the run switched (switchToGateTreeCopy); a plain run keeps the links.
|
|
4164
|
+
const layout = linkNodeModules(this.o.root, dir, this.o.warn, this.baseWorkspaces(baseSha), !plainRun && this.state.gateTreeCopy === true);
|
|
3667
4165
|
if (layout)
|
|
3668
4166
|
return { notStarted: visibleLine(layout) };
|
|
3669
4167
|
}
|
|
3670
|
-
|
|
4168
|
+
// The built-in vitest check: a JSON report per test, which the head's failures in the same place are judged against
|
|
4169
|
+
// (test-delta.ts): from the run dir (the OS sandbox, a plain run) or the gate container's result.
|
|
4170
|
+
const report = isBuiltInVitest(c) ? vitestReportPath(dir) : undefined;
|
|
4171
|
+
const args = calibrationArgs(c, dir);
|
|
4172
|
+
// Only a failing base's report is kept (a passing base counts every head failure), and only one the sealed state can hold.
|
|
4173
|
+
const kept = (ok, timedOut, tests) => (!ok && !timedOut && tests && tests.failed.length + tests.brokenFiles.length <= BASE_FAILURES_MAX ? { tests } : {});
|
|
4174
|
+
if (plainRun) {
|
|
4175
|
+
// The trusted base's own code, plainly (gateEnv), its orphans recorded and killed as a plain prepare check's.
|
|
4176
|
+
const procs = join(this.gateJobRoot(), 'prepare-procs', `base-${baseSha}.json`);
|
|
4177
|
+
mkdirSync(dirname(procs), { recursive: true });
|
|
4178
|
+
let p;
|
|
4179
|
+
let ptests = null;
|
|
4180
|
+
try {
|
|
4181
|
+
p = await (this.o.localGate ?? defaultLocalGateRunner)([c.exe, ...args, ...(report ? vitestReportArgs(report) : [])], dir, timeoutMs, createGateProcTracker(procs, Date.now(), undefined, (m) => this.o.warn?.(`omg factory run: ${m}`)));
|
|
4182
|
+
}
|
|
4183
|
+
finally {
|
|
4184
|
+
await reapGateProcs(procs).catch(() => undefined);
|
|
4185
|
+
if (report)
|
|
4186
|
+
ptests = readVitestReport(report, dir);
|
|
4187
|
+
}
|
|
4188
|
+
if (p.startError !== undefined)
|
|
4189
|
+
return { notStarted: oneLine(p.startError, 300) };
|
|
4190
|
+
const ptail = redactGateOutput(`${p.stdout}${p.stderr}`).trim().slice(-2_000);
|
|
4191
|
+
const pok = p.status === 0 && !p.timedOut;
|
|
4192
|
+
return { ok: pok, ...(ptail ? { tail: ptail } : {}), ...(p.timedOut ? { timedOut: true } : {}), ...kept(pok, p.timedOut, ptests) };
|
|
4193
|
+
}
|
|
4194
|
+
const r = await this.sandboxRun({ purpose: 'calibrate', argv: c.argv, exe: c.exe, args: report ? [...args, ...vitestReportArgs(report)] : args, cwd: dir, commonGitDir, timeoutMs, ...(this.gatesModeCache?.requireDeniedPaths ? { requireDeniedPaths: true } : {}), ...(gitView ? { gitView } : {}), ...(report ? { reportFile: report } : {}) }, fallbackContainer);
|
|
4195
|
+
const tests = report ? runReport(r, readVitestReport(report, dir)) : null;
|
|
3671
4196
|
if (!r.ran)
|
|
3672
4197
|
return { notStarted: r.reason };
|
|
3673
4198
|
const tail = r.output.trim().slice(-2_000);
|
|
3674
|
-
|
|
4199
|
+
const ok = r.status === 0 && !r.timedOut;
|
|
4200
|
+
const junctionRead = !ok && !container && !this.state.gateTreeCopy && windowsJunctionReadDenied(r.output, this.gatePlatform);
|
|
4201
|
+
const keep = kept(ok, r.timedOut, tests);
|
|
4202
|
+
return { ok, ...(tail ? { tail } : {}), ...(r.timedOut ? { timedOut: true } : {}), ...(!ok && !container && windowsGitTransportFailure(r.output, this.gatePlatform) ? { gitTransport: true } : {}), ...(junctionRead ? { junctionRead: true } : {}), ...keep };
|
|
3675
4203
|
}
|
|
3676
4204
|
catch (error) {
|
|
3677
4205
|
return { notStarted: errText(error).slice(0, 300) };
|
|
@@ -4117,6 +4645,87 @@ class FactoryEngine {
|
|
|
4117
4645
|
: await this.calibrateGate({ argv: gate, exe: target.exe, args: target.args }, base, common, timeoutMinutes * 60_000, `the local gate \`${gate.join(' ')}\``, head);
|
|
4118
4646
|
if (!park)
|
|
4119
4647
|
return true;
|
|
4648
|
+
// The base failed opening a package dir through the gate tree's junction (esbuild on Windows): the gate again, still
|
|
4649
|
+
// in the sandbox, on a copied tree (its FAILURE record goes, so the head is judged by that run).
|
|
4650
|
+
if (park.junctionRead) {
|
|
4651
|
+
const switched = this.switchToGateTreeCopy(checkout);
|
|
4652
|
+
if (switched === true) {
|
|
4653
|
+
rmSync(localCheckRecordPath(stateDir, this.o.root, head), { force: true });
|
|
4654
|
+
return this.ensureLocalGate(head);
|
|
4655
|
+
}
|
|
4656
|
+
if (switched) {
|
|
4657
|
+
this.gate(switched.name, switched.reason);
|
|
4658
|
+
return false;
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
// The base cannot run in the OS sandbox on Windows (git transport): the gate container, else plainly, never a park by default.
|
|
4662
|
+
const fallback = 'gitTransport' in park && park.gitTransport ? await this.gitTransportFallback(common) : null;
|
|
4663
|
+
if (fallback && base && !('missing' in target)) {
|
|
4664
|
+
const what = `the local gate \`${gate.join(' ')}\``;
|
|
4665
|
+
const gateCal = { argv: gate, exe: target.exe, args: target.args };
|
|
4666
|
+
// M4 (review-532): the base failed in this exact image before; the head's container run would only fail too.
|
|
4667
|
+
const skipContainer = this.containerFailedOnBase(gateCal, base, fallback);
|
|
4668
|
+
let fo = null;
|
|
4669
|
+
let containerWhy = `it failed there on the base ${base.slice(0, 12)} before (image ${this.containerImageId})`;
|
|
4670
|
+
if (!skipContainer) {
|
|
4671
|
+
fo = await runLocalGate({ ...input, mode: 'enforced', sandbox: { run: (req) => this.withGitView(() => head, 'the local gate', (view) => this.sandboxRun({ ...req, ...view }, fallback), true), commonGitDir: common, requireDeniedPaths: false } });
|
|
4672
|
+
if (checkoutGitLink(checkout).hash !== linkBefore)
|
|
4673
|
+
return this.gateTamperedByGate(head, checkout, stateDir);
|
|
4674
|
+
if (!fo.started && fo.noVerdict) {
|
|
4675
|
+
this.gate(GATE_NO_VERDICT_GATE, this.gateNoVerdictReason(head, what, fo.reason));
|
|
4676
|
+
return false;
|
|
4677
|
+
}
|
|
4678
|
+
// A failure in the container counts only when the base passes in the same container; a base that fails there
|
|
4679
|
+
// too (the project cannot install or run in it) leaves the plain run, as a container that does not start does.
|
|
4680
|
+
const cpark = fo.started && fo.record.state === 'FAILURE'
|
|
4681
|
+
? await this.calibrateGate(gateCal, base, common, timeoutMinutes * 60_000, what, head, fallback)
|
|
4682
|
+
: null;
|
|
4683
|
+
if (!fo.started)
|
|
4684
|
+
containerWhy = fo.reason;
|
|
4685
|
+
else if (cpark)
|
|
4686
|
+
containerWhy = 'it fails there on the base too';
|
|
4687
|
+
else
|
|
4688
|
+
containerWhy = '';
|
|
4689
|
+
}
|
|
4690
|
+
const how = fo && fo.started && !containerWhy ? 'container' : 'unsandboxed';
|
|
4691
|
+
if (how === 'container') {
|
|
4692
|
+
// L2 (review-532): noted only when the container's verdict is the one used.
|
|
4693
|
+
this.noteGitTransportFallback(head, what, 'container', fallback);
|
|
4694
|
+
}
|
|
4695
|
+
else {
|
|
4696
|
+
this.o.warn?.(`omg factory run: the Windows git-transport fallback cannot use the gate container for ${what}: ${containerWhy}`);
|
|
4697
|
+
this.noteGitTransportFallback(head, what, 'unsandboxed', fallback);
|
|
4698
|
+
fo = await runLocalGate({ ...input, mode: 'unsandboxed' });
|
|
4699
|
+
if (checkoutGitLink(checkout).hash !== linkBefore)
|
|
4700
|
+
return this.gateTamperedByGate(head, checkout, stateDir);
|
|
4701
|
+
}
|
|
4702
|
+
if (!fo || !fo.started) {
|
|
4703
|
+
this.gate('gates', `the local gate could not start: ${fo?.reason ?? 'no result'}; fix factory.forge.local.gate, then rerun ${this.resume}`);
|
|
4704
|
+
return false;
|
|
4705
|
+
}
|
|
4706
|
+
if (how === 'unsandboxed') {
|
|
4707
|
+
const mine = await this.importReady(() => this.userRepoProblems(userBefore));
|
|
4708
|
+
if (mine.length > 0) {
|
|
4709
|
+
const quarantined = this.userQuarantine(userBefore, 'lane-tampered', mine);
|
|
4710
|
+
this.gate('lane-tampered', `the local gate (the PR's own code) ran without the OS sandbox and changed your repository's git state, so its verdict is not used; inspect your repository, then rerun ${this.resume}: ${mine.slice(0, 5).join('; ')}${quarantined}`);
|
|
4711
|
+
return false;
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
if (await this.recheckFailed('after the local gate'))
|
|
4715
|
+
return false;
|
|
4716
|
+
const rec = fo.record;
|
|
4717
|
+
if (how === 'unsandboxed' && rec.state === 'FAILURE') {
|
|
4718
|
+
// L1 (review-532): a plain failure counts only when the trusted base passes plainly too.
|
|
4719
|
+
const ppark = await this.calibrateGate(gateCal, base, common, timeoutMinutes * 60_000, what, head, 'plain');
|
|
4720
|
+
if (ppark) {
|
|
4721
|
+
rmSync(localCheckRecordPath(stateDir, this.o.root, head), { force: true });
|
|
4722
|
+
this.gate(ppark.name, ppark.reason);
|
|
4723
|
+
return false;
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
this.save((x) => ({ ...x, history: [...x.history, { at: this.iso(), from: x.phase, to: x.phase, note: `local gate ${rec.state} on ${head.slice(0, 12)} (exit ${rec.exitCode}, Windows git-transport fallback: ${how === 'container' ? this.sandboxName(fallback) : 'unsandboxed'})` }] }));
|
|
4727
|
+
return true;
|
|
4728
|
+
}
|
|
4120
4729
|
// The FAILURE record would start a ci-fix lane on the next read: the head is judged again after the human's fix.
|
|
4121
4730
|
rmSync(localCheckRecordPath(stateDir, this.o.root, head), { force: true });
|
|
4122
4731
|
this.gate(park.name, park.reason);
|
|
@@ -4142,6 +4751,55 @@ class FactoryEngine {
|
|
|
4142
4751
|
},
|
|
4143
4752
|
};
|
|
4144
4753
|
}
|
|
4754
|
+
/**
|
|
4755
|
+
* True only when the forge says the PR CONFLICTS with its base for exactly
|
|
4756
|
+
* the pushed head (a conflicting PR runs no CI, so its gates never settle).
|
|
4757
|
+
* Unknown is read again MERGEABILITY_READS times (GitHub computes it
|
|
4758
|
+
* lazily); still unknown, a failed read or an answer for another head is
|
|
4759
|
+
* false: the gates go on as before, never a re-prepare on a guess.
|
|
4760
|
+
*/
|
|
4761
|
+
async prConflicts(pr, head) {
|
|
4762
|
+
const read = this.forge?.reviews.mergeability?.bind(this.forge.reviews);
|
|
4763
|
+
if (this.forge && !read)
|
|
4764
|
+
return false;
|
|
4765
|
+
for (let i = 0; i < MERGEABILITY_READS; i += 1) {
|
|
4766
|
+
if (i > 0)
|
|
4767
|
+
await (this.o.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))))(MERGEABILITY_WAIT_MS);
|
|
4768
|
+
let m;
|
|
4769
|
+
try {
|
|
4770
|
+
m = read ? read(pr) : this.gh((exec, cwd) => ghPrMergeability(exec, pr, cwd));
|
|
4771
|
+
}
|
|
4772
|
+
catch (error) {
|
|
4773
|
+
if (error instanceof FactorySafetyError)
|
|
4774
|
+
throw error;
|
|
4775
|
+
return false;
|
|
4776
|
+
}
|
|
4777
|
+
if (m.state === 'mergeable')
|
|
4778
|
+
return false;
|
|
4779
|
+
if (m.state === 'conflicting' && m.headRefOid === head)
|
|
4780
|
+
return true;
|
|
4781
|
+
}
|
|
4782
|
+
return false;
|
|
4783
|
+
}
|
|
4784
|
+
/**
|
|
4785
|
+
* The PR conflicts with its base after the base moved: back to prepare,
|
|
4786
|
+
* which merges the base again (inventory and build housekeeping, else the
|
|
4787
|
+
* conflict-fix lane with its own cap). Bounded per run by
|
|
4788
|
+
* MAX_CONFLICT_REPREPARES, so a base that keeps moving cannot loop.
|
|
4789
|
+
*/
|
|
4790
|
+
reprepareConflict(pr, head) {
|
|
4791
|
+
const count = (this.state.conflictReprepares ?? 0) + 1;
|
|
4792
|
+
if (count > MAX_CONFLICT_REPREPARES) {
|
|
4793
|
+
this.gate('merge-conflicts', `PR #${pr} conflicts with ${this.state.base} at ${head.slice(0, 12)} again after ${MAX_CONFLICT_REPREPARES} re-prepares in this run (the base keeps moving, or the merge does not hold); merge ${this.state.base} into ${this.state.branch} by hand and push, then rerun ${this.resume}`);
|
|
4794
|
+
return;
|
|
4795
|
+
}
|
|
4796
|
+
const note = `the PR conflicts with ${this.state.base} after it moved; preparing again (${count} of ${MAX_CONFLICT_REPREPARES})`;
|
|
4797
|
+
this.writeShip(pr, (cur) => (cur && canTransition(cur.phase, 'prepare') ? transition(cur, 'prepare', note, this.iso()) : cur));
|
|
4798
|
+
this.save((x) => {
|
|
4799
|
+
const { prepared: _p, ...rest } = x;
|
|
4800
|
+
return moveTo({ ...rest, conflictReprepares: count }, 'prepare', note, this.iso());
|
|
4801
|
+
});
|
|
4802
|
+
}
|
|
4145
4803
|
/** The gates driver on the pushed head; green moves ship to ready and the run to merge. */
|
|
4146
4804
|
async gates() {
|
|
4147
4805
|
const { pr, head } = this.state;
|
|
@@ -4159,6 +4817,9 @@ class FactoryEngine {
|
|
|
4159
4817
|
}
|
|
4160
4818
|
if (ship.phase !== 'gates')
|
|
4161
4819
|
throw new FactoryStepError(`ship state for PR #${pr} is ${ship.phase}, not gates`);
|
|
4820
|
+
// A PR that conflicts with its moved base gets no CI run: prepare merges the base again instead of waiting.
|
|
4821
|
+
if (await this.prConflicts(pr, head))
|
|
4822
|
+
return this.reprepareConflict(pr, head);
|
|
4162
4823
|
const { config, known } = this.gateConfig(view);
|
|
4163
4824
|
const fields = () => ({ ...this.fields() });
|
|
4164
4825
|
const local = this.forge?.kind === 'local';
|
|
@@ -4219,6 +4880,9 @@ class FactoryEngine {
|
|
|
4219
4880
|
return;
|
|
4220
4881
|
}
|
|
4221
4882
|
case 'missing-checks':
|
|
4883
|
+
// The base may have moved under the PR while the gates waited: a conflict, not a missing check.
|
|
4884
|
+
if (await this.prConflicts(pr, head))
|
|
4885
|
+
return this.reprepareConflict(pr, head);
|
|
4222
4886
|
this.gate('missing-checks', `${missingCheckHint(out.missing, config)}; every other check completed at ${at} and nothing new reported for the settle window, so the gates stop waiting; fix it, then rerun ${this.resume}`);
|
|
4223
4887
|
return;
|
|
4224
4888
|
case 'failed': {
|
|
@@ -4228,13 +4892,15 @@ class FactoryEngine {
|
|
|
4228
4892
|
return;
|
|
4229
4893
|
}
|
|
4230
4894
|
case 'flaky':
|
|
4231
|
-
this.gate('ci-flaky', `known-flaky failures at ${at} are out of rerun budget (${out.report.failed.join(', ')}); rerun the failed jobs by hand`);
|
|
4895
|
+
this.gate('ci-flaky', `known-flaky failures at ${at} are out of rerun budget (${out.report.failed.map(checkName).join(', ')}); rerun the failed jobs by hand`);
|
|
4232
4896
|
return;
|
|
4233
4897
|
case 'no-workflows':
|
|
4898
|
+
if (await this.prConflicts(pr, head))
|
|
4899
|
+
return this.reprepareConflict(pr, head);
|
|
4234
4900
|
this.gate('no-workflows', `${out.report.noHeadChecks ? `${noHeadChecksText(out.report.noHeadChecks)} (head ${at})` : `no checks and no workflow runs exist for ${at}`}; push the branch with a token that triggers workflows (or enable Actions), or close and reopen PR #${pr}${out.report.noHeadChecks ? `; to stop instead: ${cancelCommand(this.key)}` : ''}`);
|
|
4235
4901
|
return;
|
|
4236
4902
|
case 'timeout':
|
|
4237
|
-
this.gate('gates-timeout', `gates did not settle within factory.run.gatesTimeoutMinutes ${Math.round(this.o.limits.gatesTimeoutMs / 60_000)} at ${at}${out.report ? ` (pending: ${out.report.pending.join(', ') || 'none'})` : ''}; rerun ${this.resume} to wait again, or ${cancelCommand(this.key)}`);
|
|
4903
|
+
this.gate('gates-timeout', `gates did not settle within factory.run.gatesTimeoutMinutes ${Math.round(this.o.limits.gatesTimeoutMs / 60_000)} at ${at}${out.report ? ` (pending: ${out.report.pending.map(checkName).join(', ') || 'none'})` : ''}; rerun ${this.resume} to wait again, or ${cancelCommand(this.key)}`);
|
|
4238
4904
|
return;
|
|
4239
4905
|
case 'head-moved':
|
|
4240
4906
|
this.gate('head-moved-externally', `PR #${pr} head is ${out.headRefOid.slice(0, 12)}, the engine pushed ${at}`);
|
|
@@ -4271,7 +4937,10 @@ class FactoryEngine {
|
|
|
4271
4937
|
throw new FactoryStepError(`ship state for PR #${pr} is ${ship.phase}, not ready`);
|
|
4272
4938
|
if (this.humanReviewParked(pr, head, ship))
|
|
4273
4939
|
return;
|
|
4274
|
-
const { config, known } = this.gateConfig(view);
|
|
4940
|
+
const { config: loaded, known } = this.gateConfig(view);
|
|
4941
|
+
// The merge rule accepts the build outputs this run sealed at prepare, not whatever the base says now.
|
|
4942
|
+
const sealedBuild = this.state.prepareBuild;
|
|
4943
|
+
const config = { ...loaded, prepareBuild: sealedBuild && sealedBuild !== 'none' ? sealedBuild : undefined };
|
|
4275
4944
|
const decision = mergeDecision(this.exec, this.o.root, ship, view, config, known, this.forge, this.gateReads(view));
|
|
4276
4945
|
if (!decision.ok && decision.reasons.some((r) => r.startsWith('gates are '))) {
|
|
4277
4946
|
// The merge rule's one-shot read and watchGates can disagree (a check flapping); bounded per run, across reruns.
|
|
@@ -4425,6 +5094,8 @@ class FactoryEngine {
|
|
|
4425
5094
|
...(this.state.unsandboxedGatesAck ? { unsandboxedGatesAck: this.state.unsandboxedGatesAck } : {}),
|
|
4426
5095
|
...(this.state.gateChangeApproved ? { gateChangeApproved: this.state.gateChangeApproved } : {}),
|
|
4427
5096
|
...(pending?.secretAck ? { secretAck: pending.secretAck } : {}),
|
|
5097
|
+
...(this.state.gitTransportPlainHead ? { gitTransportPlainHead: this.state.gitTransportPlainHead } : {}),
|
|
5098
|
+
...(this.state.testDeltaExcusedHead ? { testDeltaExcusedHead: this.state.testDeltaExcusedHead } : {}),
|
|
4428
5099
|
},
|
|
4429
5100
|
decision,
|
|
4430
5101
|
requiredChecks: config.requiredChecks,
|
|
@@ -5185,6 +5856,7 @@ class FactoryEngine {
|
|
|
5185
5856
|
let note;
|
|
5186
5857
|
let usage = capUsage(maxCredits);
|
|
5187
5858
|
let tampered = false;
|
|
5859
|
+
let tamperCheck = 'skipped';
|
|
5188
5860
|
let userTamper;
|
|
5189
5861
|
try {
|
|
5190
5862
|
const c = await this.o.lanes.cancel(remoteId);
|
|
@@ -5193,6 +5865,7 @@ class FactoryEngine {
|
|
|
5193
5865
|
settleHeal(usage.credits);
|
|
5194
5866
|
const { problems, after } = await this.importReady(() => this.laneProblems(kind, before, c.result, startRef, laneId), !laneSandboxEnforced(c.result.sandbox));
|
|
5195
5867
|
tampered = problems.length > 0;
|
|
5868
|
+
tamperCheck = tampered ? 'problems' : 'clean';
|
|
5196
5869
|
// Review-483b L-c: the private layout routes a change found in YOUR repository through laneTampered (quarantine + hold), as runLane does.
|
|
5197
5870
|
if (this.privateRun() && problems.some(isUserRepoProblem))
|
|
5198
5871
|
userTamper = { problems, ...(after ? { after } : {}), ...(this.laneUserBefore(laneId, c.result.sandbox) ? { userBase: this.laneUserBefore(laneId, c.result.sandbox) } : {}) };
|
|
@@ -5209,7 +5882,7 @@ class FactoryEngine {
|
|
|
5209
5882
|
note = `cancelled; the cancel failed (${errText(error)}), so the tamper check was skipped`;
|
|
5210
5883
|
}
|
|
5211
5884
|
this.ledger.dropBaseline(laneId);
|
|
5212
|
-
this.updateLane(laneId, { status: 'cancelled', endedAt: this.iso(), usage, note, ...(tampered && kind === 'review' ? { verdict: 'invalid' } : {}) });
|
|
5885
|
+
this.updateLane(laneId, { status: 'cancelled', endedAt: this.iso(), usage, note, tamperCheck, ...(tampered && kind === 'review' ? { verdict: 'invalid' } : {}) });
|
|
5213
5886
|
if (tampered)
|
|
5214
5887
|
this.o.warn?.(`omg factory run: lane ${laneId} ${note}`);
|
|
5215
5888
|
// The quarantine and hold come before the cancel finishes (the cancel flag still ends the run at the next step).
|
|
@@ -5331,6 +6004,20 @@ class FactoryEngine {
|
|
|
5331
6004
|
this.updateLane(id, { jobId: remoteId });
|
|
5332
6005
|
this.progress.emit(`lane-${kind}`, 'start', `lane ${id} cap ${cap.cap} AI credits`, { ...this.fields(), lane: id, job: remoteId });
|
|
5333
6006
|
const begun = this.clock();
|
|
6007
|
+
// No-progress timeout (factory.run.laneIdleMinutes): progress is a new lastEventAt from the backend, timed on the
|
|
6008
|
+
// engine's clock. A backend that cannot tell (lastEventAt absent) is bounded by the wall-time limit only.
|
|
6009
|
+
let progressAt = begun;
|
|
6010
|
+
let lastEventAt = null;
|
|
6011
|
+
let stalled = false;
|
|
6012
|
+
const stopLane = async () => {
|
|
6013
|
+
try {
|
|
6014
|
+
const c = await this.o.lanes.cancel(remoteId);
|
|
6015
|
+
return isTerminalLaneState(c.result.state) ? c.result : null;
|
|
6016
|
+
}
|
|
6017
|
+
catch {
|
|
6018
|
+
return null; /* not confirmed */
|
|
6019
|
+
}
|
|
6020
|
+
};
|
|
5334
6021
|
let result;
|
|
5335
6022
|
for (;;) {
|
|
5336
6023
|
const s = this.reload();
|
|
@@ -5352,14 +6039,35 @@ class FactoryEngine {
|
|
|
5352
6039
|
this.updateLane(id, { process: { pid: proc.pid, identity: proc.identity } });
|
|
5353
6040
|
if (isTerminalLaneState(result.state))
|
|
5354
6041
|
break;
|
|
5355
|
-
if (
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
6042
|
+
if (isNewerEvent(result.lastEventAt, lastEventAt)) {
|
|
6043
|
+
lastEventAt = result.lastEventAt;
|
|
6044
|
+
progressAt = this.clock();
|
|
6045
|
+
// Persisted for `omg factory run status`, at most once a minute (every event would rewrite the state).
|
|
6046
|
+
const stored = this.state.lanes.find((l) => l.id === id)?.lastEventAt;
|
|
6047
|
+
if (!stored || Date.parse(lastEventAt) - Date.parse(stored) >= HEARTBEAT_MIN_MS)
|
|
6048
|
+
this.updateLane(id, { lastEventAt });
|
|
6049
|
+
}
|
|
6050
|
+
if (result.lastEventAt !== undefined && this.clock() - progressAt > this.o.limits.laneIdleMs) {
|
|
6051
|
+
const quiet = `no session event (tool call, message or usage) for ${Math.round(this.o.limits.laneIdleMs / 60_000)} min (last event ${lastEventAt ?? `none since its start at ${startedAt}`})`;
|
|
6052
|
+
const confirmed = await stopLane();
|
|
6053
|
+
if (!confirmed) {
|
|
6054
|
+
this.updateLane(id, { note: `stalled: ${quiet}; its cancel was not confirmed` });
|
|
6055
|
+
this.gate('lane-unconfirmed', `lane ${id} (${remoteId}) stalled: ${quiet}, and its cancel was not confirmed; it may still run, so its tamper check cannot be trusted yet. Stop the job, then rerun ${this.resume}`);
|
|
6056
|
+
return { kind: 'stopped' };
|
|
5361
6057
|
}
|
|
5362
|
-
|
|
6058
|
+
// The lane finished between our poll and the cancel, with a session event after the last one we saw: a normal
|
|
6059
|
+
// completion (the tamper check and accept path below still run). Any doubt stays a stall.
|
|
6060
|
+
if (confirmed.state === 'completed' && isNewerEvent(confirmed.lastEventAt, lastEventAt)) {
|
|
6061
|
+
result = confirmed;
|
|
6062
|
+
break;
|
|
6063
|
+
}
|
|
6064
|
+
// Fail closed: a stalled lane is a failed lane (nothing is committed or pushed), with the normal fresh retry.
|
|
6065
|
+
result = { ...confirmed, state: 'failed', error: `stalled: ${quiet}` };
|
|
6066
|
+
stalled = true;
|
|
6067
|
+
break;
|
|
6068
|
+
}
|
|
6069
|
+
if (this.clock() - begun > this.o.limits.laneTimeoutMs + LANE_GRACE_MS) {
|
|
6070
|
+
const confirmed = await stopLane();
|
|
5363
6071
|
if (!confirmed) {
|
|
5364
6072
|
// The lane may still run: its after-snapshot would race it. Leave it running for the next rerun to settle.
|
|
5365
6073
|
this.updateLane(id, { note: 'engine wall-time limit passed; its cancel was not confirmed' });
|
|
@@ -5369,11 +6077,11 @@ class FactoryEngine {
|
|
|
5369
6077
|
result = { ...confirmed, state: 'timeout', error: `engine wall-time limit ${Math.round(this.o.limits.laneTimeoutMs / 60_000)} min passed` };
|
|
5370
6078
|
break;
|
|
5371
6079
|
}
|
|
5372
|
-
this.progress.heartbeat(`lane-${kind}`, `lane ${id} ${result.state}`, { ...this.fields(), lane: id, job: remoteId });
|
|
6080
|
+
this.progress.heartbeat(`lane-${kind}`, `lane ${id} ${result.state}${result.lastEventAt !== undefined ? `, last event ${lastEventAt ?? 'none yet'}` : ''}`, { ...this.fields(), lane: id, job: remoteId });
|
|
5373
6081
|
}
|
|
5374
6082
|
const usage = usageOf(result);
|
|
5375
6083
|
settleHeal(usage.credits);
|
|
5376
|
-
const status = result.state === 'completed' ? 'completed' : result.state === 'cancelled' ? 'cancelled' : 'failed';
|
|
6084
|
+
const status = stalled ? 'stalled' : result.state === 'completed' ? 'completed' : result.state === 'cancelled' ? 'cancelled' : 'failed';
|
|
5377
6085
|
this.updateLane(id, {
|
|
5378
6086
|
status,
|
|
5379
6087
|
usage,
|
|
@@ -5386,7 +6094,7 @@ class FactoryEngine {
|
|
|
5386
6094
|
});
|
|
5387
6095
|
if (status === 'completed')
|
|
5388
6096
|
this.save((x) => ({ ...x, lostStreak: { ...x.lostStreak, [kind]: 0 } }));
|
|
5389
|
-
this.progress.emit(`lane-${kind}`, status === 'completed' ? 'ok' : 'fail', `lane ${id} ${result.state}, ${usage.credits.toFixed(2)} AI credits`, { ...this.fields(), lane: id, job: remoteId });
|
|
6097
|
+
this.progress.emit(`lane-${kind}`, status === 'completed' ? 'ok' : 'fail', `lane ${id} ${stalled ? 'stalled' : result.state}, ${usage.credits.toFixed(2)} AI credits`, { ...this.fields(), lane: id, job: remoteId });
|
|
5390
6098
|
// Mandatory tamper check around every lane, whatever its outcome.
|
|
5391
6099
|
let checked;
|
|
5392
6100
|
try {
|
|
@@ -5406,6 +6114,9 @@ class FactoryEngine {
|
|
|
5406
6114
|
await this.laneTampered(id, kind, problems, before, after, userBase);
|
|
5407
6115
|
return { kind: 'stopped' };
|
|
5408
6116
|
}
|
|
6117
|
+
// A lane that ended cancelled on its own passed the same compare: its tamper check is clean (human-merged.ts reads it).
|
|
6118
|
+
if (status === 'cancelled')
|
|
6119
|
+
this.updateLane(id, { tamperCheck: 'clean' });
|
|
5409
6120
|
this.ledger.setRecheck({ laneId: id, kind, snapshot: after });
|
|
5410
6121
|
return { kind: 'done', result, lane: this.state.lanes.find((l) => l.id === id), after };
|
|
5411
6122
|
}
|