@bridge_gpt/mcp-server 0.2.75 → 0.2.76
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/README.md +5 -5
- package/build/agents.generated.js +4 -4
- package/build/codex-auto-recovery.js +25 -7
- package/build/commands.generated.js +6 -6
- package/build/conductor/bridge-api-client.js +141 -6
- package/build/conductor/declare-blocked.js +4 -0
- package/build/conductor/driver-pass.js +8 -0
- package/build/conductor/epic-implementer-cli.js +4 -3
- package/build/conductor/epic-server-journal.js +13 -0
- package/build/conductor/epic-server-recipe.js +15 -5
- package/build/conductor/epic-server-runtime.js +163 -45
- package/build/conductor/epic-server.js +13 -6
- package/build/conductor/install-doctor.js +30 -2
- package/build/conductor/local-merge.js +54 -12
- package/build/conductor/pr-ci-producer.js +12 -3
- package/build/conductor/readiness-sections.js +46 -13
- package/build/conductor/readiness.js +3 -40
- package/build/conductor/recovery-cli.js +12 -12
- package/build/conductor/repository-workflow-remedy.js +147 -7
- package/build/conductor/ui-readiness.js +224 -0
- package/build/conductor/wait-run-attention.js +9 -4
- package/build/conductor/wait-run-cli.js +9 -2
- package/build/docs.generated.js +2 -2
- package/build/drive-epic.js +402 -27
- package/build/epic-implementer-bin.js +62 -42
- package/build/epic-launch-context.js +8 -1
- package/build/epic-shared/cut-protocol.js +55 -3
- package/build/executor/failure-reason-codes.js +2 -0
- package/build/executor/integration-job.js +56 -2
- package/build/executor/job-runner.js +4 -1
- package/build/executor/merge-job.js +45 -1
- package/build/executor/permissions.js +187 -2
- package/build/executor/provider-checks.js +28 -5
- package/build/executor/reconcile-overlap-job.js +70 -17
- package/build/executor/required-work-ledger.js +7 -2
- package/build/executor/resume-pre-spawn.js +32 -8
- package/build/executor/runner.js +26 -4
- package/build/executor/worktree.js +12 -1
- package/build/index.js +376 -434
- package/build/init.js +16 -0
- package/build/install-bridge-conductor-answers.js +4 -0
- package/build/install-bridge-conductor-apply.js +10 -0
- package/build/install-bridge-conductor-assessment.js +71 -0
- package/build/install-bridge-conductor-contracts.js +9 -1
- package/build/install-bridge-conductor-setup.js +103 -3
- package/build/install-bridge-conductor.js +437 -93
- package/build/mcp-host-config.js +54 -37
- package/build/phase-context-git-probe.js +16 -0
- package/build/pipelines.generated.js +9 -9
- package/build/plan-execution-ledger.js +27 -0
- package/build/plane/plane-freshness.js +43 -26
- package/build/printed-remedy-commands.js +8 -0
- package/build/readme.generated.js +1 -1
- package/build/secret-redaction.js +3 -0
- package/build/setup-epic.js +41 -8
- package/build/test-support/create-preview-world.js +232 -0
- package/build/ticket-delivery.js +65 -0
- package/build/v2-readiness-requirements.js +8 -3
- package/build/version.generated.js +3 -3
- package/build/worktree-core.js +51 -7
- package/docs/EPIC-IMPLEMENTER.md +79 -0
- package/docs/epic-implementer/getting-started.md +1 -1
- package/package.json +1 -1
- package/pipelines/implement-ticket.json +2 -2
|
@@ -52,6 +52,7 @@ import { classifyMergeTree } from "./merge-tree-classifier.js";
|
|
|
52
52
|
import { RECONCILE_OVERLAP_PAYLOAD_SCHEMA_VERSION, } from "./reconcile-overlap-types.js";
|
|
53
53
|
import { runRequiredVerificationCommands } from "./required-verification.js";
|
|
54
54
|
import { validateWorkerFinalization } from "./worker-finalization.js";
|
|
55
|
+
import { captureExecutorMergeIndex, executorAllowedTreePathspecs, stageExecutorAllowedTree, unstageExecutorExcludedPaths, } from "./permissions.js";
|
|
55
56
|
import { payloadWorkerDatabaseConfigOption } from "./worker-database-config.js";
|
|
56
57
|
export const RECONCILE_OVERLAP_JOB_TYPE = "reconcile_overlap";
|
|
57
58
|
/** Result-envelope bounds, mirrored from the server's result model. */
|
|
@@ -81,17 +82,6 @@ const CI_WAIT_POLL_INTERVAL_MS = 30_000;
|
|
|
81
82
|
/** Finalization settling: GitHub updates a PR's head a moment after the push. */
|
|
82
83
|
const FINALIZATION_ATTEMPTS = 6;
|
|
83
84
|
const FINALIZATION_RETRY_DELAY_MS = 2_000;
|
|
84
|
-
/**
|
|
85
|
-
* Paths the wrapper never stages: the executor's own per-worktree artifacts. They
|
|
86
|
-
* are also excluded through `.git/info/exclude`, but a foreign repository's
|
|
87
|
-
* `.gitignore` may not name `.mcp.json`, so the pathspec is the second line.
|
|
88
|
-
*/
|
|
89
|
-
const WRAPPER_STAGE_EXCLUDES = [
|
|
90
|
-
":(exclude).conductor",
|
|
91
|
-
":(exclude).mcp.json",
|
|
92
|
-
":(exclude).cursor/mcp.json",
|
|
93
|
-
":(exclude).claude/settings.local.json",
|
|
94
|
-
];
|
|
95
85
|
const SHA_RE = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
|
|
96
86
|
class PayloadError extends Error {
|
|
97
87
|
}
|
|
@@ -365,6 +355,9 @@ export function createReconcileOverlapDriver(job, payload, seams) {
|
|
|
365
355
|
failingCommandNames: [],
|
|
366
356
|
editedReasons: new Map(),
|
|
367
357
|
};
|
|
358
|
+
// BAPI-1732: the protected-path index state of THIS attempt's conflicted merge.
|
|
359
|
+
// `null` means "not captured", which is different from a captured empty snapshot.
|
|
360
|
+
let mergeSnapshot = null;
|
|
368
361
|
const commands = verificationCommandUnion(payload.child, payload.peer);
|
|
369
362
|
// BAPI-1521: the root payload's declaration, with presence kept (absent for an
|
|
370
363
|
// older payload, which keeps the compatibility constants).
|
|
@@ -543,15 +536,35 @@ export function createReconcileOverlapDriver(job, payload, seams) {
|
|
|
543
536
|
}
|
|
544
537
|
return runs;
|
|
545
538
|
};
|
|
539
|
+
/** The shared staging scope: the whole tree minus the executor's protected paths. */
|
|
540
|
+
const stageScope = () => executorAllowedTreePathspecs();
|
|
541
|
+
/**
|
|
542
|
+
* Run a shared index-protection helper through the abort- and budget-aware git
|
|
543
|
+
* wrapper. A cancellation propagates unchanged; any other failure is `false`.
|
|
544
|
+
*/
|
|
545
|
+
const protectIndex = async (ctx, run) => {
|
|
546
|
+
try {
|
|
547
|
+
await run((args) => git(ctx, args));
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
catch (err) {
|
|
551
|
+
if (err instanceof ReconcileOverlapAborted)
|
|
552
|
+
throw err;
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
};
|
|
546
556
|
const commitStaged = async (ctx, message) => {
|
|
547
557
|
const r = await git(ctx, ["commit", "--no-verify", "--no-edit", "-m", message]);
|
|
548
558
|
if (r.exitCode !== 0)
|
|
549
559
|
return null;
|
|
550
560
|
return revParse(ctx, "HEAD");
|
|
551
561
|
};
|
|
562
|
+
/** `true` when changes are staged, `false` when none, `null` when the check failed. */
|
|
552
563
|
const stagedChanges = async (ctx) => {
|
|
553
564
|
const r = await git(ctx, ["diff", "--cached", "--quiet"]);
|
|
554
|
-
|
|
565
|
+
if (r.exitCode === 0)
|
|
566
|
+
return false;
|
|
567
|
+
return r.exitCode === 1 ? true : null;
|
|
555
568
|
};
|
|
556
569
|
/** Read both remote heads immediately before the push. */
|
|
557
570
|
const readRemoteHeads = async (ctx) => {
|
|
@@ -590,7 +603,7 @@ export function createReconcileOverlapDriver(job, payload, seams) {
|
|
|
590
603
|
while (ctx.remainingMs() > CI_WAIT_MARGIN_MS && !ctx.signal.aborted) {
|
|
591
604
|
let response;
|
|
592
605
|
try {
|
|
593
|
-
response = await seams.pollProviderChecks(sha);
|
|
606
|
+
response = await seams.pollProviderChecks(sha, payload.requiredChecks);
|
|
594
607
|
}
|
|
595
608
|
catch (err) {
|
|
596
609
|
if (err instanceof ProviderChecksUnobservable)
|
|
@@ -755,6 +768,20 @@ export function createReconcileOverlapDriver(job, payload, seams) {
|
|
|
755
768
|
return finish(fail(ReconcileOverlapMergeFailed, "merged", "the merge did not record the required epic commit"));
|
|
756
769
|
}
|
|
757
770
|
if (classification.kind === "conflicted") {
|
|
771
|
+
mergeSnapshot = null;
|
|
772
|
+
let captured = null;
|
|
773
|
+
try {
|
|
774
|
+
captured = await captureExecutorMergeIndex((args) => git(ctx, args));
|
|
775
|
+
}
|
|
776
|
+
catch (err) {
|
|
777
|
+
if (err instanceof ReconcileOverlapAborted)
|
|
778
|
+
throw err;
|
|
779
|
+
}
|
|
780
|
+
if (captured === null) {
|
|
781
|
+
await resetToChildHead(ctx);
|
|
782
|
+
return finish(fail(ReconcileOverlapMergeFailed, "merged", "the merge's protected index state could not be captured"));
|
|
783
|
+
}
|
|
784
|
+
mergeSnapshot = captured;
|
|
758
785
|
facts.mode = "conflicted";
|
|
759
786
|
facts.workerInvoked = true;
|
|
760
787
|
facts.preWorkerHead = payload.childHead;
|
|
@@ -787,7 +814,7 @@ export function createReconcileOverlapDriver(job, payload, seams) {
|
|
|
787
814
|
await writeReport(ctx, conflictReport(failing));
|
|
788
815
|
// `.conductor/` holds the executor's own report for the worker; it is not a
|
|
789
816
|
// change to the candidate.
|
|
790
|
-
const status = await git(ctx, ["status", "--porcelain", "--",
|
|
817
|
+
const status = await git(ctx, ["status", "--porcelain", "--", ...stageScope()]);
|
|
791
818
|
if (status.exitCode !== 0 || status.stdout.trim().length > 0) {
|
|
792
819
|
await resetToChildHead(ctx);
|
|
793
820
|
return finish(fail(ReconcileOverlapMergeFailed, "checked", "the worktree was not clean at the merge commit"));
|
|
@@ -822,7 +849,20 @@ export function createReconcileOverlapDriver(job, payload, seams) {
|
|
|
822
849
|
// Stage ONLY the resolved conflict paths: the merge commit is the
|
|
823
850
|
// conflict resolution, and any other repair becomes its own commit.
|
|
824
851
|
if (conflictPaths.length > 0) {
|
|
825
|
-
|
|
852
|
+
// `-f`: a conflicted protected path is tracked and unmerged, but `info/exclude`
|
|
853
|
+
// also names it, and Git refuses an ignored path without it.
|
|
854
|
+
const staged = await git(ctx, ["add", "-A", "-f", "--", ...conflictPaths]);
|
|
855
|
+
if (staged.exitCode !== 0) {
|
|
856
|
+
await resetToChildHead(ctx);
|
|
857
|
+
return fail(ReconcileOverlapMergeFailed, "worker-completed", "the resolved conflict paths could not be staged");
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
// BAPI-1732: undo anything the worker staged in protected paths, while
|
|
861
|
+
// keeping what the merge itself put there and the worker's resolutions.
|
|
862
|
+
const snapshot = mergeSnapshot;
|
|
863
|
+
if (snapshot === null || !(await protectIndex(ctx, (gitCall) => unstageExecutorExcludedPaths(gitCall, snapshot)))) {
|
|
864
|
+
await resetToChildHead(ctx);
|
|
865
|
+
return fail(ReconcileOverlapMergeFailed, "worker-completed", "the merge's protected index state could not be restored");
|
|
826
866
|
}
|
|
827
867
|
const unmerged = await git(ctx, ["ls-files", "-u"]);
|
|
828
868
|
if (unmerged.exitCode !== 0 || unmerged.stdout.trim().length > 0) {
|
|
@@ -837,9 +877,22 @@ export function createReconcileOverlapDriver(job, payload, seams) {
|
|
|
837
877
|
facts.mergeCommitSha = mergeCommit;
|
|
838
878
|
}
|
|
839
879
|
// Any remaining worker repair: one ordinary commit ON TOP of the merge.
|
|
840
|
-
await
|
|
841
|
-
if (await
|
|
880
|
+
const repairStaged = await protectIndex(ctx, (gitCall) => stageExecutorAllowedTree(gitCall));
|
|
881
|
+
if (!repairStaged || !(await protectIndex(ctx, (gitCall) => unstageExecutorExcludedPaths(gitCall)))) {
|
|
882
|
+
await resetToChildHead(ctx);
|
|
883
|
+
return fail(ReconcileOverlapMergeFailed, "worker-completed", "the worker's repair could not be staged safely");
|
|
884
|
+
}
|
|
885
|
+
const repairChanges = await stagedChanges(ctx);
|
|
886
|
+
if (repairChanges === null) {
|
|
887
|
+
await resetToChildHead(ctx);
|
|
888
|
+
return fail(ReconcileOverlapMergeFailed, "worker-completed", "the staged repair could not be inspected");
|
|
889
|
+
}
|
|
890
|
+
if (repairChanges) {
|
|
842
891
|
const repairPaths = await git(ctx, ["diff", "--cached", "--name-only", "-z"]);
|
|
892
|
+
if (repairPaths.exitCode !== 0) {
|
|
893
|
+
await resetToChildHead(ctx);
|
|
894
|
+
return fail(ReconcileOverlapMergeFailed, "worker-completed", "the repair's paths could not be listed");
|
|
895
|
+
}
|
|
843
896
|
const repairReason = facts.failingCommandNames.length > 0
|
|
844
897
|
? `repair for failing check(s): ${facts.failingCommandNames.join(", ")}`
|
|
845
898
|
: "repair after conflict resolution";
|
|
@@ -378,7 +378,7 @@ const UNREADABLE = Symbol("unreadable");
|
|
|
378
378
|
const ROOT_KEYS = [
|
|
379
379
|
"type", "subtype", "session_id", "parent_tool_use_id", "message", "content",
|
|
380
380
|
"task_id", "tool_use_id", "status", "patch", "task_type", "is_backgrounded",
|
|
381
|
-
"owned_by_subagent", "tasks", "tool_use_result",
|
|
381
|
+
"owned_by_subagent", "tasks", "tool_use_result", "tool_result_meta",
|
|
382
382
|
];
|
|
383
383
|
const BLOCK_KEYS = [
|
|
384
384
|
"type", "id", "name", "tool_use_id", "is_error", "input", "text", "content",
|
|
@@ -608,7 +608,8 @@ function createStructuralParser() {
|
|
|
608
608
|
};
|
|
609
609
|
const endDrop = () => {
|
|
610
610
|
dropActive = false;
|
|
611
|
-
// Bounded message metadata (usage, model, id)
|
|
611
|
+
// Bounded message metadata (usage, model, id) and the recognized top-level
|
|
612
|
+
// `tool_result_meta` are charged to the unexplained budget only.
|
|
612
613
|
if (dropCount > MAX_OVERSIZE_SCALAR_CHARS && dropRec.w !== "meta") {
|
|
613
614
|
if (proj.large.length >= MAX_OVERSIZE_DROPPED_PATHS)
|
|
614
615
|
return reject();
|
|
@@ -670,6 +671,10 @@ function createStructuralParser() {
|
|
|
670
671
|
// A user event's top-level copy of the tool output; only the block's ids carry meaning.
|
|
671
672
|
if (k === "tool_use_result")
|
|
672
673
|
return drop({ w: "tur", src: "", i: 0, k }, true);
|
|
674
|
+
// BAPI-1742: bounded top-level Edit/Write completion metadata. Recognized so it
|
|
675
|
+
// is discarded, but still charged to the unexplained budget, never retained.
|
|
676
|
+
if (k === "tool_result_meta")
|
|
677
|
+
return drop({ w: "meta", src: "", i: 0, k }, false);
|
|
673
678
|
return drop({ w: "top", src: "", i: 0, k }, false);
|
|
674
679
|
case "message":
|
|
675
680
|
if (k === "content")
|
|
@@ -17,6 +17,7 @@ import { createWorktreeForTicket } from "../worktree-core.js";
|
|
|
17
17
|
import { ContinuationLineageMismatch, ContinuationWorktreeMissing, ExecutorNamedError, WorktreeLostBeforePush, } from "./job-errors.js";
|
|
18
18
|
import { assertWorktreeOnBranch, listGitWorktrees, findWorktreeByBranch, remoteBranchExists as remoteBranchExistsDefault, } from "./worktree-inspection.js";
|
|
19
19
|
import { ciFixContextError } from "./prompt-spec.js";
|
|
20
|
+
import { executorAllowedTreePathspecs, stageExecutorAllowedTree, unstageExecutorExcludedPaths, } from "./permissions.js";
|
|
20
21
|
import { fastForwardRetainedWorktreeToBoundHead } from "./worktree.js";
|
|
21
22
|
/** The canonical WIP checkpoint commit message (executor-run, deterministic). */
|
|
22
23
|
export const RESUME_WIP_COMMIT_MESSAGE = "wip: auto-checkpoint before resume";
|
|
@@ -117,19 +118,42 @@ export async function recreateResumeWorktreeFromPushedBranch(job, expectedBranch
|
|
|
117
118
|
throw new ExecutorNamedError(WorktreeLostBeforePush, row.error ?? `failed to recreate worktree for '${expectedBranch}' from origin`);
|
|
118
119
|
}
|
|
119
120
|
/**
|
|
120
|
-
* Commit any dirty state as a deterministic WIP checkpoint so the
|
|
121
|
-
* is always clean and complete.
|
|
122
|
-
*
|
|
121
|
+
* Commit any ALLOWED dirty state as a deterministic WIP checkpoint so the
|
|
122
|
+
* injected diff is always clean and complete. NEVER discards work.
|
|
123
|
+
*
|
|
124
|
+
* Executor-owned and host files (see `EXECUTOR_STAGE_EXCLUDES`) are never
|
|
125
|
+
* committed: forbidden changes an earlier worker left staged are first returned
|
|
126
|
+
* to HEAD in the index (working-tree files are untouched), and status, staging,
|
|
127
|
+
* and the commit all use the shared root-relative exclusions. A tree dirty only in
|
|
128
|
+
* excluded paths is a normal no-op, `{ committed: false }`. `committed: true` is
|
|
129
|
+
* returned only after `git commit` exits successfully. Any failed Git step throws
|
|
130
|
+
* a plain `Error`, which callers' existing catches handle.
|
|
123
131
|
*/
|
|
124
132
|
export async function autoCheckpointDirtyState(worktreePath, seams, message = RESUME_WIP_COMMIT_MESSAGE) {
|
|
125
|
-
const
|
|
133
|
+
const git = (args) => seams.runCommand("git", args, { cwd: worktreePath });
|
|
134
|
+
const fail = (step) => new Error(`checkpoint ${step} failed`);
|
|
135
|
+
const scope = executorAllowedTreePathspecs();
|
|
136
|
+
await unstageExecutorExcludedPaths(git);
|
|
137
|
+
const status = await git(["status", "--porcelain", "--", ...scope]);
|
|
138
|
+
if (status.exitCode !== 0)
|
|
139
|
+
throw fail("status");
|
|
126
140
|
if (status.stdout.trim().length === 0) {
|
|
127
141
|
return { committed: false };
|
|
128
142
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
try {
|
|
144
|
+
await stageExecutorAllowedTree(git);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
throw fail("staging");
|
|
148
|
+
}
|
|
149
|
+
const staged = await git(["diff", "--cached", "--quiet"]);
|
|
150
|
+
if (staged.exitCode === 0)
|
|
151
|
+
return { committed: false };
|
|
152
|
+
if (staged.exitCode !== 1)
|
|
153
|
+
throw fail("diff");
|
|
154
|
+
const committed = await git(["commit", "--no-verify", "-m", message]);
|
|
155
|
+
if (committed.exitCode !== 0)
|
|
156
|
+
throw fail("commit");
|
|
133
157
|
return { committed: true };
|
|
134
158
|
}
|
|
135
159
|
/** Read `git log --oneline origin/<base>..HEAD` in the worktree. */
|
package/build/executor/runner.js
CHANGED
|
@@ -440,6 +440,13 @@ export async function runExecutor(options, deps, httpClient, seams = {}) {
|
|
|
440
440
|
let lastPreflightRefusalAt = -Infinity;
|
|
441
441
|
let lastCompletionReadFailure = null;
|
|
442
442
|
let lastCompletionReadFailureAt = -Infinity;
|
|
443
|
+
// BAPI-1732: preflight warning and notice blocks each keep their own last-reported
|
|
444
|
+
// text and time, so a block that never changes logs once per interval instead of
|
|
445
|
+
// once per poll. An empty block neither logs nor clears its remembered state.
|
|
446
|
+
let lastPreflightWarnings = null;
|
|
447
|
+
let lastPreflightWarningsAt = -Infinity;
|
|
448
|
+
let lastPreflightNotices = null;
|
|
449
|
+
let lastPreflightNoticesAt = -Infinity;
|
|
443
450
|
const shouldReport = (value, previous, at) => value !== previous || deps.now() - at >= 15 * 60_000;
|
|
444
451
|
/**
|
|
445
452
|
* Is the scoped run finished? Called only between claim cycles while this
|
|
@@ -941,13 +948,28 @@ export async function runExecutor(options, deps, httpClient, seams = {}) {
|
|
|
941
948
|
// ~/.claude.json — was invisible to the operator. Emit them before the claim
|
|
942
949
|
// decision; this only logs and never changes the existing `!report.ok`
|
|
943
950
|
// claim-skipping behavior below.
|
|
944
|
-
|
|
945
|
-
|
|
951
|
+
if (report.warnings.length > 0) {
|
|
952
|
+
const block = report.warnings.join("\n");
|
|
953
|
+
if (shouldReport(block, lastPreflightWarnings, lastPreflightWarningsAt)) {
|
|
954
|
+
for (const warning of report.warnings) {
|
|
955
|
+
deps.errorLog(`executor preflight warning: ${warning}`);
|
|
956
|
+
}
|
|
957
|
+
lastPreflightWarnings = block;
|
|
958
|
+
lastPreflightWarningsAt = deps.now();
|
|
959
|
+
}
|
|
946
960
|
}
|
|
947
961
|
// BAPI-1386: informational lines (the completion-evidence advertisement) go to
|
|
948
962
|
// stderr like every other diagnostic here, never stdout.
|
|
949
|
-
|
|
950
|
-
|
|
963
|
+
const notices = report.notices ?? [];
|
|
964
|
+
if (notices.length > 0) {
|
|
965
|
+
const block = notices.join("\n");
|
|
966
|
+
if (shouldReport(block, lastPreflightNotices, lastPreflightNoticesAt)) {
|
|
967
|
+
for (const notice of notices) {
|
|
968
|
+
deps.errorLog(`executor preflight: ${notice}`);
|
|
969
|
+
}
|
|
970
|
+
lastPreflightNotices = block;
|
|
971
|
+
lastPreflightNoticesAt = deps.now();
|
|
972
|
+
}
|
|
951
973
|
}
|
|
952
974
|
if (!report.ok) {
|
|
953
975
|
cycleClaimOutcome = "preflight-refused";
|
|
@@ -126,6 +126,9 @@ function toWorktreeCoreDeps(deps) {
|
|
|
126
126
|
// stderr logger. Shared `start-tickets` callers may keep omitting this — the
|
|
127
127
|
// primitive treats an absent callback as "do not report".
|
|
128
128
|
onCleanupDiagnostic: deps.errorLog,
|
|
129
|
+
// BAPI-1742: clock and pause for the reset lock retry.
|
|
130
|
+
now: deps.now,
|
|
131
|
+
sleep: deps.sleep,
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
134
|
/** Build the command-provisioning boundary from the executor deps (BAPI-664). */
|
|
@@ -307,7 +310,13 @@ export async function ensureExecutorWorktree(job, options, deps, policy = {}) {
|
|
|
307
310
|
// Hard-reset a reused existing local branch onto the freshly fetched
|
|
308
311
|
// pushed head; a missing local branch is instead cut from `baseStartPoint`
|
|
309
312
|
// (= `origin/<branch>`) inside the primitive, so both land at origin.
|
|
310
|
-
{
|
|
313
|
+
{
|
|
314
|
+
freshenFromOrigin: policy.preparation ? expectedHeadSha : originRef,
|
|
315
|
+
...(preReset ? { preReset } : {}),
|
|
316
|
+
...(postSwitch ? { postSwitch } : {}),
|
|
317
|
+
// BAPI-1742: reset retries stop before the preparation deadline.
|
|
318
|
+
...(policy.preparation ? { lockRetryRemainingMs: policy.preparation.remainingMs } : {}),
|
|
319
|
+
});
|
|
311
320
|
if (row.status === "created" && typeof row.path === "string") {
|
|
312
321
|
return finalizeExecutorWorktree(row.path, branch, safeHead, deps, publication);
|
|
313
322
|
}
|
|
@@ -376,6 +385,8 @@ export async function ensureExecutorWorktree(job, options, deps, policy = {}) {
|
|
|
376
385
|
...(postSwitch ? { postSwitch } : {}),
|
|
377
386
|
alignExistingBranchTo: baseSha,
|
|
378
387
|
verifyHeadMatches: baseSha,
|
|
388
|
+
// BAPI-1742: reset retries stop before the preparation deadline.
|
|
389
|
+
...(policy.preparation ? { lockRetryRemainingMs: policy.preparation.remainingMs } : {}),
|
|
379
390
|
// BAPI-862: the guard is ON for this fresh-dispatch path, and this is the
|
|
380
391
|
// path finding F4 hit — a re-dispatched implement whose branch already
|
|
381
392
|
// carried the previous, successful attempt's pushed commits.
|