@bridge_gpt/mcp-server 0.2.75 → 0.2.77
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 +8 -6
- package/build/agents.generated.js +5 -5
- package/build/cli-dispatch.js +333 -0
- package/build/codex-auto-recovery.js +25 -7
- package/build/commands.generated.js +8 -8
- package/build/conductor/bridge-api-client.js +193 -13
- package/build/conductor/declare-blocked.js +146 -7
- package/build/conductor/driver-pass.js +8 -0
- package/build/conductor/driver-register.js +8 -2
- package/build/conductor/epic-implementer-cli.js +15 -10
- package/build/conductor/epic-server-journal.js +52 -22
- 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/launch-plan.js +28 -7
- package/build/conductor/local-merge.js +55 -13
- package/build/conductor/pr-ci-producer.js +12 -3
- package/build/conductor/readiness-prerequisites.js +89 -2
- package/build/conductor/readiness-sections.js +46 -13
- package/build/conductor/readiness.js +3 -40
- package/build/conductor/recovery-cli.js +14 -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 +67 -4
- package/build/doctor.js +97 -1
- package/build/drive-epic.js +625 -33
- package/build/engine-paths.js +10 -0
- package/build/epic-coherence-input-cli.js +105 -10
- package/build/epic-coherence-input.js +877 -4
- package/build/epic-coherence-input.test-fixtures.js +117 -0
- package/build/epic-implementer-bin.js +947 -120
- package/build/epic-implementer-env.js +2 -2
- package/build/epic-launch-context.js +8 -1
- package/build/epic-shared/cut-protocol.js +55 -3
- package/build/executor/completion-contract.js +14 -1
- package/build/executor/failure-reason-codes.js +2 -0
- package/build/executor/guarded-fast-forward-push.js +25 -2
- package/build/executor/integration-job.js +56 -2
- package/build/executor/job-runner.js +87 -28
- package/build/executor/likely-tests.js +78 -6
- package/build/executor/merge-job.js +45 -1
- package/build/executor/permissions.js +187 -2
- package/build/executor/provider-checks.js +101 -5
- package/build/executor/rebase-finalization.js +29 -27
- package/build/executor/reconcile-overlap-job.js +70 -17
- package/build/executor/rename-aside.js +265 -0
- package/build/executor/required-work-ledger.js +89 -6
- package/build/executor/resume-pre-spawn.js +32 -8
- package/build/executor/runner.js +26 -4
- package/build/executor/types.js +121 -0
- package/build/executor/worktree.js +39 -2
- package/build/index.js +2500 -495
- 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 +84 -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 +440 -812
- package/build/install-bridge.js +4 -11
- package/build/language-catalog.generated.js +2649 -0
- package/build/mcp-host-config.js +54 -37
- package/build/phase-context-git-probe.js +16 -0
- package/build/pipelines.generated.js +47 -19
- package/build/plan-execution-ledger.js +35 -0
- package/build/plan-generation.js +34 -0
- package/build/plane/build-freshness.js +6 -0
- package/build/plane/cli.js +12 -5
- package/build/plane/plane-freshness.js +43 -26
- package/build/printed-remedy-commands.js +17 -0
- package/build/readiness-prerequisites.generated.js +28 -0
- package/build/readme.generated.js +1 -1
- package/build/run-unit-tests-launcher.js +3 -1
- package/build/secret-redaction.js +3 -0
- package/build/server.js +7946 -0
- package/build/setup-epic.js +41 -8
- package/build/start-tickets-prereqs.js +3 -6
- package/build/test-support/console-guard.js +30 -0
- package/build/test-support/create-preview-world.js +232 -0
- package/build/test-support/module-imports.js +155 -0
- package/build/test-support/server-client.js +96 -0
- package/build/test-support/stdio-server.js +146 -0
- package/build/ticket-delivery.js +65 -0
- package/build/v2-readiness-requirements.js +39 -5
- package/build/version.generated.js +3 -3
- package/build/worktree-core.js +51 -7
- package/docs/EPIC-IMPLEMENTER.md +150 -2
- package/docs/epic-implementer/getting-started.md +5 -1
- package/package.json +3 -3
- package/pipelines/implement-ticket.json +2 -2
- package/pipelines/learn-repository.json +19 -1
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";
|
package/build/executor/types.js
CHANGED
|
@@ -227,3 +227,124 @@ export const INTEGRATION_ACTION_OUTCOMES = [
|
|
|
227
227
|
"indeterminate",
|
|
228
228
|
"failed",
|
|
229
229
|
];
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
// BAPI-1781 — leftover-branch rename-aside: server plan and executor confirmation
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
/** The payload key the reconciler stamps on a fresh `implement`/`spec_review` job. */
|
|
234
|
+
export const RENAME_ASIDE_PLAN_PAYLOAD_KEY = "worktree_rename_aside_plan";
|
|
235
|
+
/** The completion result key the executor uses for its confirmation. */
|
|
236
|
+
export const RENAME_ASIDE_RESULT_KEY = "rename_aside";
|
|
237
|
+
/** The exact confirmation keys, in the order both languages declare them. */
|
|
238
|
+
export const RENAME_ASIDE_KEYS = ["old_branch", "backup_name", "old_run_id", "short_sha"];
|
|
239
|
+
const RENAME_ASIDE_SHORT_SHA_RE = /^[0-9a-f]{12}$/;
|
|
240
|
+
const RENAME_ASIDE_FULL_SHA_RE = /^[0-9a-f]{40}$/;
|
|
241
|
+
const RENAME_ASIDE_IDENTITY_MAX_CHARS = 255;
|
|
242
|
+
const RENAME_ASIDE_PLAN_KEYS = [
|
|
243
|
+
"branch", "owning_run_id", "owning_run_status", "live_job_read", "open_pr_read",
|
|
244
|
+
"old_tip_sha", "short_sha", "backup_name", "eligible",
|
|
245
|
+
];
|
|
246
|
+
function isPlainObject(value) {
|
|
247
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
248
|
+
}
|
|
249
|
+
function hasExactKeys(value, keys) {
|
|
250
|
+
const own = Object.keys(value);
|
|
251
|
+
return own.length === keys.length && keys.every((key) => Object.prototype.hasOwnProperty.call(value, key));
|
|
252
|
+
}
|
|
253
|
+
/** A non-empty, bounded identity with no whitespace or control characters. */
|
|
254
|
+
function isRenameAsideIdentity(value) {
|
|
255
|
+
if (typeof value !== "string" || value.length === 0 || value.length > RENAME_ASIDE_IDENTITY_MAX_CHARS)
|
|
256
|
+
return false;
|
|
257
|
+
for (const ch of value) {
|
|
258
|
+
const code = ch.codePointAt(0);
|
|
259
|
+
if (code < 0x20 || code === 0x7f || /\s/.test(ch))
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
/** Runtime check of a confirmation object: exactly the four keys, each well formed. */
|
|
265
|
+
export function isRenameAside(value) {
|
|
266
|
+
if (!isPlainObject(value) || !hasExactKeys(value, RENAME_ASIDE_KEYS))
|
|
267
|
+
return false;
|
|
268
|
+
return (isRenameAsideIdentity(value.old_branch) &&
|
|
269
|
+
isRenameAsideIdentity(value.backup_name) &&
|
|
270
|
+
isRenameAsideIdentity(value.old_run_id) &&
|
|
271
|
+
typeof value.short_sha === "string" &&
|
|
272
|
+
RENAME_ASIDE_SHORT_SHA_RE.test(value.short_sha));
|
|
273
|
+
}
|
|
274
|
+
/** The backup name the server derives: `<branch>-<old_run_id>-<old_tip_sha[:12]>`. */
|
|
275
|
+
export function deriveRenameAsideBackupName(branch, oldRunId, oldTipSha) {
|
|
276
|
+
return `${branch}-${oldRunId}-${oldTipSha.slice(0, 12)}`;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Validate the server's plan at the payload boundary. Returns `null` for an
|
|
280
|
+
* absent or malformed plan, or one bound to a different branch than the job's
|
|
281
|
+
* claimed branch. A valid plan may still be ineligible: uncertainty is kept, never
|
|
282
|
+
* converted into authority. When the plan names an owner, the old SHA, its
|
|
283
|
+
* 12-character prefix, and the derived backup name must all agree exactly.
|
|
284
|
+
*/
|
|
285
|
+
export function parseRenameAsidePlan(raw, claimedBranch) {
|
|
286
|
+
if (!isPlainObject(raw) || !hasExactKeys(raw, RENAME_ASIDE_PLAN_KEYS))
|
|
287
|
+
return null;
|
|
288
|
+
const { branch, owning_run_id, owning_run_status, live_job_read, open_pr_read, old_tip_sha, short_sha, backup_name, eligible } = raw;
|
|
289
|
+
if (!isRenameAsideIdentity(branch) || branch !== claimedBranch)
|
|
290
|
+
return null;
|
|
291
|
+
if (owning_run_id !== null && !isRenameAsideIdentity(owning_run_id))
|
|
292
|
+
return null;
|
|
293
|
+
if (owning_run_status !== "done" && owning_run_status !== "abandoned" && owning_run_status !== "other" && owning_run_status !== "unknown")
|
|
294
|
+
return null;
|
|
295
|
+
if (typeof eligible !== "boolean")
|
|
296
|
+
return null;
|
|
297
|
+
if (!isPlainObject(live_job_read) || !hasExactKeys(live_job_read, ["outcome", "live_job"]))
|
|
298
|
+
return null;
|
|
299
|
+
if (live_job_read.outcome !== "ok" && live_job_read.outcome !== "failed")
|
|
300
|
+
return null;
|
|
301
|
+
if (live_job_read.live_job !== null && typeof live_job_read.live_job !== "boolean")
|
|
302
|
+
return null;
|
|
303
|
+
if (!isPlainObject(open_pr_read) || !hasExactKeys(open_pr_read, ["outcome", "open_count"]))
|
|
304
|
+
return null;
|
|
305
|
+
if (open_pr_read.outcome !== "ok" && open_pr_read.outcome !== "failed" && open_pr_read.outcome !== "unknown")
|
|
306
|
+
return null;
|
|
307
|
+
const count = open_pr_read.open_count;
|
|
308
|
+
if (count !== null && (typeof count !== "number" || !Number.isInteger(count) || count < 0))
|
|
309
|
+
return null;
|
|
310
|
+
if (old_tip_sha !== null && (typeof old_tip_sha !== "string" || !RENAME_ASIDE_FULL_SHA_RE.test(old_tip_sha)))
|
|
311
|
+
return null;
|
|
312
|
+
if (short_sha !== null && (typeof short_sha !== "string" || !RENAME_ASIDE_SHORT_SHA_RE.test(short_sha)))
|
|
313
|
+
return null;
|
|
314
|
+
if (backup_name !== null && !isRenameAsideIdentity(backup_name))
|
|
315
|
+
return null;
|
|
316
|
+
// Identity fields travel together, and must agree with each other exactly.
|
|
317
|
+
const identity = [owning_run_id, old_tip_sha, short_sha, backup_name];
|
|
318
|
+
const present = identity.filter((value) => value !== null).length;
|
|
319
|
+
if (present !== 0 && present !== identity.length)
|
|
320
|
+
return null;
|
|
321
|
+
if (present === identity.length) {
|
|
322
|
+
if (short_sha !== old_tip_sha.slice(0, 12))
|
|
323
|
+
return null;
|
|
324
|
+
if (backup_name !== deriveRenameAsideBackupName(branch, owning_run_id, old_tip_sha))
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
branch,
|
|
329
|
+
owning_run_id: owning_run_id,
|
|
330
|
+
owning_run_status,
|
|
331
|
+
live_job_read: { outcome: live_job_read.outcome, live_job: live_job_read.live_job },
|
|
332
|
+
open_pr_read: { outcome: open_pr_read.outcome, open_count: count },
|
|
333
|
+
old_tip_sha: old_tip_sha,
|
|
334
|
+
short_sha: short_sha,
|
|
335
|
+
backup_name: backup_name,
|
|
336
|
+
eligible,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* True only when every server-observed fact positively authorizes a rename-aside:
|
|
341
|
+
* an ended owner, a successful live-job read showing none, a successful provider
|
|
342
|
+
* read showing zero open PRs, and a complete identity. `eligible` is ignored.
|
|
343
|
+
*/
|
|
344
|
+
export function renameAsidePlanAuthorizes(plan) {
|
|
345
|
+
return ((plan.owning_run_status === "done" || plan.owning_run_status === "abandoned") &&
|
|
346
|
+
plan.live_job_read.outcome === "ok" && plan.live_job_read.live_job === false &&
|
|
347
|
+
plan.open_pr_read.outcome === "ok" && plan.open_pr_read.open_count === 0 &&
|
|
348
|
+
plan.owning_run_id !== null && plan.old_tip_sha !== null &&
|
|
349
|
+
plan.short_sha !== null && plan.backup_name !== null);
|
|
350
|
+
}
|
|
@@ -15,6 +15,7 @@ import { branchExists, createWorktreeForTicket, isAncestor, provePriorHeadLineag
|
|
|
15
15
|
import { findWorktreeByBranch, listGitWorktrees, parseGitWorktreePorcelain } from "./worktree-inspection.js";
|
|
16
16
|
import { buildExecutorWorktreeLockPath, parseExecutorWorktreeLock } from "./worktree-lock.js";
|
|
17
17
|
import { provisionCommandsForWorktree } from "../command-provisioning.js";
|
|
18
|
+
import { renameAsideLeftoverBranch } from "./rename-aside.js";
|
|
18
19
|
/**
|
|
19
20
|
* Resolve the branch for a real spawn job: `expected_branch` wins; else
|
|
20
21
|
* `feature/<ticket_key>`; else a structured contract failure.
|
|
@@ -32,6 +33,8 @@ export function resolveExecutorBranch(job) {
|
|
|
32
33
|
return { ok: true, branch: `feature/${ticketKey}` };
|
|
33
34
|
return { ok: false, error: "no branch could be resolved (no expected_branch and no ticket_key)" };
|
|
34
35
|
}
|
|
36
|
+
/** BAPI-1781: the job types that run the stale-branch guard and may rename aside. */
|
|
37
|
+
const RENAME_ASIDE_JOB_TYPES = new Set(["implement", "spec_review"]);
|
|
35
38
|
/** Configure only this branch; inherited routing must already be safe. */
|
|
36
39
|
export async function configureExecutorBranch(worktreePath, branch, deps) {
|
|
37
40
|
const failure = "executor push routing could not be confirmed";
|
|
@@ -126,6 +129,9 @@ function toWorktreeCoreDeps(deps) {
|
|
|
126
129
|
// stderr logger. Shared `start-tickets` callers may keep omitting this — the
|
|
127
130
|
// primitive treats an absent callback as "do not report".
|
|
128
131
|
onCleanupDiagnostic: deps.errorLog,
|
|
132
|
+
// BAPI-1742: clock and pause for the reset lock retry.
|
|
133
|
+
now: deps.now,
|
|
134
|
+
sleep: deps.sleep,
|
|
129
135
|
};
|
|
130
136
|
}
|
|
131
137
|
/** Build the command-provisioning boundary from the executor deps (BAPI-664). */
|
|
@@ -307,7 +313,13 @@ export async function ensureExecutorWorktree(job, options, deps, policy = {}) {
|
|
|
307
313
|
// Hard-reset a reused existing local branch onto the freshly fetched
|
|
308
314
|
// pushed head; a missing local branch is instead cut from `baseStartPoint`
|
|
309
315
|
// (= `origin/<branch>`) inside the primitive, so both land at origin.
|
|
310
|
-
{
|
|
316
|
+
{
|
|
317
|
+
freshenFromOrigin: policy.preparation ? expectedHeadSha : originRef,
|
|
318
|
+
...(preReset ? { preReset } : {}),
|
|
319
|
+
...(postSwitch ? { postSwitch } : {}),
|
|
320
|
+
// BAPI-1742: reset retries stop before the preparation deadline.
|
|
321
|
+
...(policy.preparation ? { lockRetryRemainingMs: policy.preparation.remainingMs } : {}),
|
|
322
|
+
});
|
|
311
323
|
if (row.status === "created" && typeof row.path === "string") {
|
|
312
324
|
return finalizeExecutorWorktree(row.path, branch, safeHead, deps, publication);
|
|
313
325
|
}
|
|
@@ -372,10 +384,34 @@ export async function ensureExecutorWorktree(job, options, deps, policy = {}) {
|
|
|
372
384
|
}
|
|
373
385
|
return ensurePriorAttemptWorktree(key, branch, prior.head, baseSha, options, deps, postSwitch);
|
|
374
386
|
}
|
|
387
|
+
// BAPI-1781: a leftover branch from an ENDED earlier run is renamed aside —
|
|
388
|
+
// backup first, never deleted — only when every server fact and the local and
|
|
389
|
+
// origin tips positively allow it. Otherwise nothing changes and the guard below
|
|
390
|
+
// refuses exactly as before. A failure after eligibility is a setup refusal.
|
|
391
|
+
let renameAside;
|
|
392
|
+
if (policy.renameAsidePlan &&
|
|
393
|
+
typeof job.job_type === "string" &&
|
|
394
|
+
RENAME_ASIDE_JOB_TYPES.has(job.job_type)) {
|
|
395
|
+
const renamed = await renameAsideLeftoverBranch({
|
|
396
|
+
branch,
|
|
397
|
+
plan: policy.renameAsidePlan,
|
|
398
|
+
baseSha,
|
|
399
|
+
deps,
|
|
400
|
+
coreDeps: toWorktreeCoreDeps(deps),
|
|
401
|
+
...(policy.preparation ? { mayMutate: policy.preparation.mayMutate } : {}),
|
|
402
|
+
});
|
|
403
|
+
if (renamed.kind === "refused") {
|
|
404
|
+
return { ok: false, error: renamed.error, failureKind: "setup_refused" };
|
|
405
|
+
}
|
|
406
|
+
if (renamed.kind === "renamed")
|
|
407
|
+
renameAside = renamed.confirmation;
|
|
408
|
+
}
|
|
375
409
|
const row = await createWorktreeForTicket(toWorktreeCoreDeps(deps), key, { [key]: branch }, options.worktrunkBinary, baseSha, guardStaleWorktree, {
|
|
376
410
|
...(postSwitch ? { postSwitch } : {}),
|
|
377
411
|
alignExistingBranchTo: baseSha,
|
|
378
412
|
verifyHeadMatches: baseSha,
|
|
413
|
+
// BAPI-1742: reset retries stop before the preparation deadline.
|
|
414
|
+
...(policy.preparation ? { lockRetryRemainingMs: policy.preparation.remainingMs } : {}),
|
|
379
415
|
// BAPI-862: the guard is ON for this fresh-dispatch path, and this is the
|
|
380
416
|
// path finding F4 hit — a re-dispatched implement whose branch already
|
|
381
417
|
// carried the previous, successful attempt's pushed commits.
|
|
@@ -385,7 +421,8 @@ export async function ensureExecutorWorktree(job, options, deps, policy = {}) {
|
|
|
385
421
|
// BAPI-731: `baseSha` is already the pinned immutable commit this fresh
|
|
386
422
|
// worktree was cut from and verified against (`verifyHeadMatches`), so it is
|
|
387
423
|
// the expectation — no extra resolution needed.
|
|
388
|
-
|
|
424
|
+
const finalized = await finalizeExecutorWorktree(row.path, branch, baseSha, deps);
|
|
425
|
+
return finalized.ok && renameAside ? { ...finalized, renameAside } : finalized;
|
|
389
426
|
}
|
|
390
427
|
return {
|
|
391
428
|
ok: false,
|