@bridge_gpt/mcp-server 0.2.70 → 0.2.71
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/agent-launchers/claude-executor-adapter.js +10 -1
- package/build/agent-registry.js +5 -5
- package/build/agents.generated.js +11 -1
- package/build/bounded-wait.js +9 -1
- package/build/bridge-permissions.js +13 -5
- package/build/commands.generated.js +3 -3
- package/build/conductor/bridge-api-client.js +260 -2
- package/build/conductor/command-drift-production.js +7 -2
- package/build/conductor/doctor.js +9 -3
- package/build/conductor/epic-implementer-cli.js +4 -0
- package/build/conductor/gate-discovery.js +524 -10
- package/build/conductor/gate-settings-review.js +451 -0
- package/build/conductor/launch-need-probes.js +16 -11
- package/build/conductor/launch-plan.js +145 -0
- package/build/conductor/precheck-timings.js +14 -0
- package/build/conductor/preview-observations.js +10 -0
- package/build/conductor/readiness-sections.js +4 -1
- package/build/conductor/recovery-cli.js +59 -2
- package/build/conductor/recovery-operations.js +45 -2
- package/build/docs.generated.js +1 -1
- package/build/drive-epic.js +188 -45
- package/build/epic-ci-workflow-drift.js +71 -23
- package/build/epic-ci-workflow-install.js +83 -26
- package/build/epic-ci-workflow-v1.js +132 -0
- package/build/epic-ci-workflow.js +174 -13
- package/build/epic-implementer-bin.js +18 -18
- package/build/executor/ci-rerun-job.js +220 -14
- package/build/executor/env.js +207 -3
- package/build/executor/gate-qualification-job.js +20 -5
- package/build/executor/job-runner.js +112 -11
- package/build/executor/likely-tests.js +6 -1
- package/build/executor/preflight.js +5 -0
- package/build/executor/process-containment.js +18 -0
- package/build/executor/prompt-spec.js +72 -13
- package/build/executor/reconcile-overlap-job.js +6 -1
- package/build/executor/worker-command.js +136 -1
- package/build/executor/worker-database.js +30 -11
- package/build/executor/worker-resources.js +12 -1
- package/build/executor/worker-verification-guidance.js +29 -0
- package/build/index.js +221 -165
- package/build/install-bridge-conductor-gate.js +195 -14
- package/build/install-bridge-conductor-setup.js +20 -6
- package/build/install-bridge-conductor.js +355 -37
- package/build/install-bridge.js +1 -1
- package/build/merge-workflow-install.js +20 -0
- package/build/pipelines.generated.js +2 -2
- package/build/plan-execution-ledger.js +23 -8
- package/build/plane/plane-freshness.js +6 -2
- package/build/plane/preflight.js +19 -0
- package/build/printed-remedy-commands.js +8 -1
- package/build/readme.generated.js +1 -1
- package/build/repository-toolchains.js +581 -0
- package/build/setup-epic.js +24 -7
- package/build/test-command-detection.js +58 -21
- package/build/ticket-delivery-artifacts.js +7 -0
- package/build/ticket-delivery-enrollment.js +67 -4
- package/build/version.generated.js +3 -3
- package/docs/EPIC-IMPLEMENTER.md +38 -0
- package/docs/epic-implementer/getting-started.md +58 -2
- package/package.json +2 -2
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
import { ConductorBridgeApiError, GATE_PROFILE_CAPABILITY_TOKEN, enqueueConductorGateQualification, fetchConductorGateCheckHistory, fetchConductorGateProfile, fetchConductorGateQualificationJob, probeConductorGateProfileCapability, putConductorGateProfile, putEpicBranchCiDecision, } from "./conductor/bridge-api-client.js";
|
|
43
43
|
import { applyApprovalExemption, assessApprovalExemptionScope, buildEpicBranchCiEvidence, exemptionManualSteps, inspectEpicBranchWorkflowCoverage, readEpicBranchRulesViaGh, } from "./conductor/epic-branch-ci-inspection.js";
|
|
44
44
|
import { describeEvidence, discoverGate, LOCAL_COMMAND_TIMEOUT_SECONDS, } from "./conductor/gate-discovery.js";
|
|
45
|
+
import { describeSettingsEdit, hasSettingsToReview, hintEqual, renderSettingsReview, reviewDiscoveredSettings, settingsMatchStored, terminalSafe, workerEnvEqual, } from "./conductor/gate-settings-review.js";
|
|
45
46
|
import { PRINTED_EXECUTOR_INSTALL_SERVICE_COMMAND, PRINTED_EXECUTOR_ID_INSTRUCTION, PRINTED_QUALIFY_GATE_COMMAND, PRINTED_REPO_WIDE_EXECUTOR_COMMAND, } from "./printed-remedy-commands.js";
|
|
46
47
|
export function emptyConductorGateFlags() {
|
|
47
48
|
return {
|
|
@@ -261,7 +262,7 @@ function sameCommand(a, b) {
|
|
|
261
262
|
a.argv.every((w, i) => w === b.argv[i]));
|
|
262
263
|
}
|
|
263
264
|
/** Whether `desired` is exactly what `stored` already holds (no write needed). */
|
|
264
|
-
export function gateMatchesStored(desired, stored) {
|
|
265
|
+
export function gateMatchesStored(desired, stored, storedProfile) {
|
|
265
266
|
const sameGuard = desired.migrationGuard === null
|
|
266
267
|
? stored.migrationGuard === null
|
|
267
268
|
: stored.migrationGuard !== null &&
|
|
@@ -277,7 +278,16 @@ export function gateMatchesStored(desired, stored) {
|
|
|
277
278
|
desired.localCommands.length === stored.localCommands.length &&
|
|
278
279
|
desired.localCommands.every((c, i) => sameCommand(c, stored.localCommands[i])) &&
|
|
279
280
|
sameGuard &&
|
|
280
|
-
sameCustomized
|
|
281
|
+
sameCustomized &&
|
|
282
|
+
// BAPI-1520: omitted settings and per-check hints resolve against what is stored.
|
|
283
|
+
settingsMatchStored(settingsOf(desired), storedProfile ?? null));
|
|
284
|
+
}
|
|
285
|
+
/** The settings edit a desired gate carries; empty when it carries none. */
|
|
286
|
+
function settingsOf(desired) {
|
|
287
|
+
return {
|
|
288
|
+
...(desired.workerEnv !== undefined ? { workerEnv: desired.workerEnv } : {}),
|
|
289
|
+
...(desired.reproduce !== undefined ? { reproduce: desired.reproduce } : {}),
|
|
290
|
+
};
|
|
281
291
|
}
|
|
282
292
|
/** Human descriptions of every member `next` removes from `prior`. */
|
|
283
293
|
export function gateRemovals(prior, next) {
|
|
@@ -299,14 +309,29 @@ export function gateRemovals(prior, next) {
|
|
|
299
309
|
return removed;
|
|
300
310
|
}
|
|
301
311
|
/** The PUT body for a confirm of `desired` against the revision the server reported. */
|
|
302
|
-
export function confirmRequestFor(desired, expectedRevision) {
|
|
312
|
+
export function confirmRequestFor(desired, expectedRevision, stored) {
|
|
303
313
|
const guard = desired.migrationGuard === null ? null : { kind: desired.migrationGuard.kind, id: desired.migrationGuard.name };
|
|
314
|
+
// BAPI-1520: a setting is sent only when it effectively changes what is stored.
|
|
315
|
+
// An unchanged hint is omitted (the server keeps it); `reproduce: null` is sent
|
|
316
|
+
// only to remove a hint that is actually stored.
|
|
317
|
+
const providerChecks = desired.providerChecks.map((name) => {
|
|
318
|
+
const edit = desired.reproduce?.get(name);
|
|
319
|
+
if (edit === undefined)
|
|
320
|
+
return { name };
|
|
321
|
+
const current = stored?.reproduction_hints?.get(name) ?? null;
|
|
322
|
+
if (edit === null)
|
|
323
|
+
return current !== null ? { name, reproduce: null } : { name };
|
|
324
|
+
if (current !== null && hintEqual(edit, current))
|
|
325
|
+
return { name };
|
|
326
|
+
return { name, reproduce: { argv: [...edit.argv], timeout_seconds: edit.timeout_seconds } };
|
|
327
|
+
});
|
|
328
|
+
const sendWorkerEnv = desired.workerEnv !== undefined && !workerEnvEqual(desired.workerEnv, stored?.worker_env);
|
|
304
329
|
return {
|
|
305
330
|
action: "confirm",
|
|
306
331
|
confirm: true,
|
|
307
332
|
expected_revision: expectedRevision,
|
|
308
333
|
kind: desired.kind,
|
|
309
|
-
provider_checks:
|
|
334
|
+
provider_checks: providerChecks,
|
|
310
335
|
local_commands: desired.localCommands.map((c) => ({
|
|
311
336
|
name: c.name,
|
|
312
337
|
argv: [...c.argv],
|
|
@@ -314,6 +339,9 @@ export function confirmRequestFor(desired, expectedRevision) {
|
|
|
314
339
|
})),
|
|
315
340
|
migration_guard: guard,
|
|
316
341
|
...(desired.customizedCommands !== undefined ? { customized_commands: desired.customizedCommands } : {}),
|
|
342
|
+
...(sendWorkerEnv && desired.workerEnv !== undefined
|
|
343
|
+
? { worker_env: desired.workerEnv.map((e) => ({ ...e })) }
|
|
344
|
+
: {}),
|
|
317
345
|
};
|
|
318
346
|
}
|
|
319
347
|
function resolveLocalCommand(flag, proposal) {
|
|
@@ -548,6 +576,13 @@ export function renderGateComparison(io, current, desired, removals) {
|
|
|
548
576
|
io.log(" Proposed gate:");
|
|
549
577
|
for (const line of describeGate(desired))
|
|
550
578
|
io.log(line);
|
|
579
|
+
// BAPI-1520: names only here; values were shown once, in the interactive review.
|
|
580
|
+
const settingsLines = describeSettingsEdit(settingsOf(desired), current.profile);
|
|
581
|
+
if (settingsLines.length > 0) {
|
|
582
|
+
io.log(" CI settings to store with this gate (names only; hint-only settings never gate a merge):");
|
|
583
|
+
for (const line of settingsLines)
|
|
584
|
+
io.log(line);
|
|
585
|
+
}
|
|
551
586
|
if (removals.length > 0) {
|
|
552
587
|
io.log(` ⚠ This REMOVES ${removals.length} member(s) from the confirmed gate: ${removals.join("; ")}.`);
|
|
553
588
|
io.log(" Unattended runs then merge with fewer checks.");
|
|
@@ -585,6 +620,12 @@ export async function runGateDiscovery(io, access, gateDeps) {
|
|
|
585
620
|
history: { status: "not_queried" },
|
|
586
621
|
proposed: { kind: "none", providerChecks: [], localCommandIds: [] },
|
|
587
622
|
noCandidates: true,
|
|
623
|
+
workerEnvCandidates: [],
|
|
624
|
+
workerEnvConflicts: [],
|
|
625
|
+
workerEnvSkipped: [],
|
|
626
|
+
workerEnvOverflow: 0,
|
|
627
|
+
reproductionHints: [],
|
|
628
|
+
reproductionHintsSkipped: [],
|
|
588
629
|
};
|
|
589
630
|
}
|
|
590
631
|
return discoverGate({ fs, lookupHistory: historyLookupFor(io, access) });
|
|
@@ -668,6 +709,29 @@ async function editProposalInteractively(io, proposal, numbered, gateDeps) {
|
|
|
668
709
|
}
|
|
669
710
|
return desired;
|
|
670
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* BAPI-1520 — the interactive review of discovered CI settings, folded into a
|
|
714
|
+
* desired gate. Runs only in a terminal and never under `--dry-run`, so a run
|
|
715
|
+
* without explicit, interactive confirmation sends neither new setting. Nothing
|
|
716
|
+
* is shown or asked when there is nothing stored and nothing proposed.
|
|
717
|
+
*
|
|
718
|
+
* Returns the desired gate carrying the owner's decisions (settings the owner
|
|
719
|
+
* left alone stay `undefined`, so they are omitted from the write) and whether
|
|
720
|
+
* any setting changed.
|
|
721
|
+
*/
|
|
722
|
+
async function reviewSettingsInto(io, proposal, current, desired) {
|
|
723
|
+
const prompt = io.promptLine;
|
|
724
|
+
if (!prompt || !hasSettingsToReview(proposal, current.profile, desired.providerChecks)) {
|
|
725
|
+
return { desired, changed: false };
|
|
726
|
+
}
|
|
727
|
+
const edit = await reviewDiscoveredSettings({ log: io.log, promptLine: prompt }, proposal, current.profile, desired.providerChecks);
|
|
728
|
+
const merged = {
|
|
729
|
+
...desired,
|
|
730
|
+
...(edit.workerEnv !== undefined ? { workerEnv: edit.workerEnv } : {}),
|
|
731
|
+
...(edit.reproduce !== undefined ? { reproduce: edit.reproduce } : {}),
|
|
732
|
+
};
|
|
733
|
+
return { desired: merged, changed: !settingsMatchStored(edit, current.profile) };
|
|
734
|
+
}
|
|
671
735
|
/**
|
|
672
736
|
* Decide the repository gate for this run (BEFORE any write).
|
|
673
737
|
*
|
|
@@ -705,15 +769,33 @@ export async function resolveConductorGate(io, access, flags, gateDeps, options)
|
|
|
705
769
|
io.errorLog("Nothing was written.");
|
|
706
770
|
return { kind: "exit", code: 1 };
|
|
707
771
|
}
|
|
708
|
-
|
|
772
|
+
let desired = built.desired;
|
|
773
|
+
// BAPI-1520: in a terminal, review the discovered CI settings before the
|
|
774
|
+
// comparison. A non-interactive run, and a dry run, send neither new setting.
|
|
775
|
+
let settingsChanged = false;
|
|
776
|
+
if (io.promptLine && !options.dryRun) {
|
|
777
|
+
const reviewProposal = proposal ?? (await runGateDiscovery(io, access, gateDeps));
|
|
778
|
+
const reviewed = await reviewSettingsInto(io, reviewProposal, current, desired);
|
|
779
|
+
desired = reviewed.desired;
|
|
780
|
+
settingsChanged = reviewed.changed;
|
|
781
|
+
}
|
|
709
782
|
const removals = gateRemovals(currentDesired, desired);
|
|
710
|
-
const unchanged = current.source === "stored" &&
|
|
783
|
+
const unchanged = current.source === "stored" &&
|
|
784
|
+
currentDesired !== null &&
|
|
785
|
+
gateMatchesStored(desired, currentDesired, current.profile);
|
|
711
786
|
io.log(" Gate flags supplied: they are your explicit gate input.");
|
|
712
787
|
renderGateComparison(io, current, desired, removals);
|
|
713
788
|
if (unchanged) {
|
|
714
789
|
io.log(" The confirmed gate already matches — no gate write is needed.");
|
|
715
790
|
return { kind: "plan", plan: { current, desired: currentDesired, write: null, removals: [], origin: "stored" } };
|
|
716
791
|
}
|
|
792
|
+
if (settingsChanged && !options.dryRun) {
|
|
793
|
+
const ok = await ask(io, "Store these CI settings with the gate? [y/N]: ");
|
|
794
|
+
if (!ok) {
|
|
795
|
+
io.errorLog("CI settings not confirmed — nothing was written, and the stored gate is unchanged.");
|
|
796
|
+
return { kind: "exit", code: 1 };
|
|
797
|
+
}
|
|
798
|
+
}
|
|
717
799
|
if (removals.length > 0 && !flags.confirmGate && !options.dryRun) {
|
|
718
800
|
const ok = await ask(io, "Confirm this gate, including the removals above? [y/N]: ");
|
|
719
801
|
if (!ok) {
|
|
@@ -724,7 +806,13 @@ export async function resolveConductorGate(io, access, flags, gateDeps, options)
|
|
|
724
806
|
}
|
|
725
807
|
return {
|
|
726
808
|
kind: "plan",
|
|
727
|
-
plan: {
|
|
809
|
+
plan: {
|
|
810
|
+
current,
|
|
811
|
+
desired,
|
|
812
|
+
write: confirmRequestFor(desired, current.revision, current.profile),
|
|
813
|
+
removals,
|
|
814
|
+
origin: "flags",
|
|
815
|
+
},
|
|
728
816
|
};
|
|
729
817
|
}
|
|
730
818
|
if (options.ensureProviderCheck !== undefined) {
|
|
@@ -741,6 +829,10 @@ export async function resolveConductorGate(io, access, flags, gateDeps, options)
|
|
|
741
829
|
const proposal = await runGateDiscovery(io, access, gateDeps);
|
|
742
830
|
const numbered = renderGateProposal(io, proposal);
|
|
743
831
|
if (options.dryRun) {
|
|
832
|
+
// BAPI-1520: a read-only preview. Values are shown only in a terminal.
|
|
833
|
+
if (hasSettingsToReview(proposal, current.profile, proposal.proposed.providerChecks)) {
|
|
834
|
+
renderSettingsReview(io, proposal, current.profile, proposal.proposed.providerChecks, io.promptLine !== undefined);
|
|
835
|
+
}
|
|
744
836
|
io.log(" Dry run — a real run asks you to confirm or edit this proposal. Nothing was stored.");
|
|
745
837
|
return { kind: "unconfirmed-preview", current };
|
|
746
838
|
}
|
|
@@ -751,11 +843,13 @@ export async function resolveConductorGate(io, access, flags, gateDeps, options)
|
|
|
751
843
|
"or --gate-none). Nothing was written.");
|
|
752
844
|
return { kind: "exit", code: 1 };
|
|
753
845
|
}
|
|
754
|
-
const
|
|
755
|
-
if (
|
|
846
|
+
const chosen = await editProposalInteractively(io, proposal, numbered, gateDeps);
|
|
847
|
+
if (chosen === null) {
|
|
756
848
|
io.errorLog("No gate was chosen. Nothing was written.");
|
|
757
849
|
return { kind: "exit", code: 1 };
|
|
758
850
|
}
|
|
851
|
+
// BAPI-1520: worker variables and reproduction hints, decided one at a time.
|
|
852
|
+
const { desired } = await reviewSettingsInto(io, proposal, current, chosen);
|
|
759
853
|
renderGateComparison(io, current, desired, []);
|
|
760
854
|
const confirmed = await ask(io, "Store this repository gate? [y/N]: ");
|
|
761
855
|
if (!confirmed) {
|
|
@@ -764,7 +858,13 @@ export async function resolveConductorGate(io, access, flags, gateDeps, options)
|
|
|
764
858
|
}
|
|
765
859
|
return {
|
|
766
860
|
kind: "plan",
|
|
767
|
-
plan: {
|
|
861
|
+
plan: {
|
|
862
|
+
current,
|
|
863
|
+
desired,
|
|
864
|
+
write: confirmRequestFor(desired, current.revision, current.profile),
|
|
865
|
+
removals: [],
|
|
866
|
+
origin: "interactive",
|
|
867
|
+
},
|
|
768
868
|
};
|
|
769
869
|
}
|
|
770
870
|
/** BAPI-1461 — `desired` with `check` added as a provider member (kept when present). */
|
|
@@ -822,7 +922,13 @@ async function ensureProviderCheckPlan(io, access, current, currentDesired, chec
|
|
|
822
922
|
}
|
|
823
923
|
return {
|
|
824
924
|
kind: "plan",
|
|
825
|
-
plan: {
|
|
925
|
+
plan: {
|
|
926
|
+
current,
|
|
927
|
+
desired,
|
|
928
|
+
write: confirmRequestFor(desired, current.revision, current.profile),
|
|
929
|
+
removals: [],
|
|
930
|
+
origin: "stored",
|
|
931
|
+
},
|
|
826
932
|
};
|
|
827
933
|
}
|
|
828
934
|
const proposal = await runGateDiscovery(io, access, gateDeps);
|
|
@@ -831,7 +937,13 @@ async function ensureProviderCheckPlan(io, access, current, currentDesired, chec
|
|
|
831
937
|
renderGateComparison(io, current, desired, []);
|
|
832
938
|
return {
|
|
833
939
|
kind: "plan",
|
|
834
|
-
plan: {
|
|
940
|
+
plan: {
|
|
941
|
+
current,
|
|
942
|
+
desired,
|
|
943
|
+
write: confirmRequestFor(desired, current.revision, current.profile),
|
|
944
|
+
removals: [],
|
|
945
|
+
origin: "interactive",
|
|
946
|
+
},
|
|
835
947
|
};
|
|
836
948
|
}
|
|
837
949
|
const GATE_WRITE_REFUSAL_TEXT = Object.freeze({
|
|
@@ -845,7 +957,32 @@ const GATE_WRITE_REFUSAL_TEXT = Object.freeze({
|
|
|
845
957
|
timeout: "the Bridge API did not answer in time.",
|
|
846
958
|
server: "the Bridge API reported an internal error.",
|
|
847
959
|
rejected: "the Bridge API rejected the request.",
|
|
960
|
+
"extension-unsupported": "this server is older than the installer and cannot store worker variables or reproduction hints.",
|
|
961
|
+
});
|
|
962
|
+
/** Plain-language text for each closed `worker_env` refusal reason (BAPI-1520). */
|
|
963
|
+
const WORKER_ENV_REASON_TEXT = Object.freeze({
|
|
964
|
+
worker_env_reserved_name: "is reserved by Bridge and cannot be a worker variable. Remove it, then confirm again; " +
|
|
965
|
+
"nothing was removed or retried automatically.",
|
|
966
|
+
worker_env_secret_name: "looks secret. Drop it, or confirm its committed-literal assertion individually, then confirm again.",
|
|
967
|
+
worker_env_duplicate: "appears more than once. Keep one entry, then confirm again.",
|
|
848
968
|
});
|
|
969
|
+
/** The request without BAPI-1520's extension fields, and the NAMES it dropped. */
|
|
970
|
+
function withoutExtensions(request) {
|
|
971
|
+
const workerEnvNames = (request.worker_env ?? []).map((e) => e.name);
|
|
972
|
+
const hintChecks = (request.provider_checks ?? [])
|
|
973
|
+
.filter((c) => c.reproduce !== undefined)
|
|
974
|
+
.map((c) => c.name);
|
|
975
|
+
const { worker_env: _dropped, ...rest } = request;
|
|
976
|
+
void _dropped;
|
|
977
|
+
return {
|
|
978
|
+
request: {
|
|
979
|
+
...rest,
|
|
980
|
+
...(request.provider_checks ? { provider_checks: request.provider_checks.map((c) => ({ name: c.name })) } : {}),
|
|
981
|
+
},
|
|
982
|
+
workerEnvNames,
|
|
983
|
+
hintChecks,
|
|
984
|
+
};
|
|
985
|
+
}
|
|
849
986
|
/**
|
|
850
987
|
* Send the plan's PUT. On a refusal, print the reason and the PRIOR gate as
|
|
851
988
|
* what is in force (property 4) and return null.
|
|
@@ -858,12 +995,41 @@ export async function storeConductorGate(io, access, plan) {
|
|
|
858
995
|
if (plan.current.source === "stored" &&
|
|
859
996
|
plan.current.confirmed &&
|
|
860
997
|
plan.current.profile !== null &&
|
|
861
|
-
gateMatchesStored(plan.desired, desiredFromStored(plan.current.profile))) {
|
|
998
|
+
gateMatchesStored(plan.desired, desiredFromStored(plan.current.profile), plan.current.profile)) {
|
|
862
999
|
return plan.current;
|
|
863
1000
|
}
|
|
864
|
-
|
|
1001
|
+
let outcome = await putConductorGateProfile(access, plan.write, io.postJson);
|
|
1002
|
+
// BAPI-1520: an older server rejects exactly the extension fields it does not
|
|
1003
|
+
// know. Retry ONCE without them, keep everything else the owner approved, and
|
|
1004
|
+
// report what was not stored by name.
|
|
1005
|
+
let unsaved = null;
|
|
1006
|
+
if (!outcome.ok && outcome.refusal === "extension-unsupported") {
|
|
1007
|
+
const stripped = withoutExtensions(plan.write);
|
|
1008
|
+
unsaved = { workerEnvNames: stripped.workerEnvNames, hintChecks: stripped.hintChecks };
|
|
1009
|
+
const storedDesired = plan.current.profile !== null ? desiredFromStored(plan.current.profile) : null;
|
|
1010
|
+
const membersUnchanged = plan.current.source === "stored" &&
|
|
1011
|
+
storedDesired !== null &&
|
|
1012
|
+
gateMatchesStored({ ...plan.desired, workerEnv: undefined, reproduce: undefined }, storedDesired);
|
|
1013
|
+
if (membersUnchanged) {
|
|
1014
|
+
reportUnsavedSettings(io, unsaved);
|
|
1015
|
+
io.log(" The gate itself already matched, so nothing was written.");
|
|
1016
|
+
return plan.current;
|
|
1017
|
+
}
|
|
1018
|
+
outcome = await putConductorGateProfile(access, stripped.request, io.postJson);
|
|
1019
|
+
}
|
|
865
1020
|
if (!outcome.ok) {
|
|
866
1021
|
io.errorLog(`Repository gate not stored (${outcome.refusal}): ${GATE_WRITE_REFUSAL_TEXT[outcome.refusal]}`);
|
|
1022
|
+
const reason = outcome.detail?.reason;
|
|
1023
|
+
if (outcome.refusal === "validation" && reason !== undefined) {
|
|
1024
|
+
const name = outcome.detail?.name !== undefined ? ` ${terminalSafe(outcome.detail.name)}` : "";
|
|
1025
|
+
io.errorLog(` Worker variable${name} ${WORKER_ENV_REASON_TEXT[reason] ?? "was refused."} (${reason})`);
|
|
1026
|
+
}
|
|
1027
|
+
else if (outcome.refusal === "validation" && outcome.detail?.field === "provider_checks") {
|
|
1028
|
+
io.errorLog(" A reproduction hint was refused. Correct or remove it, then confirm again.");
|
|
1029
|
+
}
|
|
1030
|
+
else if (outcome.refusal === "validation" && outcome.detail?.field === "worker_env") {
|
|
1031
|
+
io.errorLog(" A worker variable was refused. Correct it, then confirm again; nothing was truncated or written.");
|
|
1032
|
+
}
|
|
867
1033
|
io.errorLog(` Nothing was written. ${describeStoredHeading(plan.current)}`);
|
|
868
1034
|
if (plan.current.confirmed && plan.current.profile !== null) {
|
|
869
1035
|
for (const line of describeGate(desiredFromStored(plan.current.profile)))
|
|
@@ -872,8 +1038,23 @@ export async function storeConductorGate(io, access, plan) {
|
|
|
872
1038
|
return null;
|
|
873
1039
|
}
|
|
874
1040
|
io.log(` stored repository gate: ${outcome.profile.profile?.kind ?? "none"} (revision ${outcome.profile.revision})`);
|
|
1041
|
+
if (unsaved !== null)
|
|
1042
|
+
reportUnsavedSettings(io, unsaved);
|
|
875
1043
|
return outcome.profile;
|
|
876
1044
|
}
|
|
1045
|
+
/** BAPI-1520 — name the settings an older server could not store. Never a value. */
|
|
1046
|
+
function reportUnsavedSettings(io, unsaved) {
|
|
1047
|
+
if (unsaved.workerEnvNames.length === 0 && unsaved.hintChecks.length === 0)
|
|
1048
|
+
return;
|
|
1049
|
+
io.log(" ⚠ Partly stored: this server is older than the installer and cannot store these settings.");
|
|
1050
|
+
if (unsaved.workerEnvNames.length > 0) {
|
|
1051
|
+
io.log(` Not stored — worker variables: ${unsaved.workerEnvNames.map(terminalSafe).join(", ")}`);
|
|
1052
|
+
}
|
|
1053
|
+
if (unsaved.hintChecks.length > 0) {
|
|
1054
|
+
io.log(` Not stored — reproduction hints for: ${unsaved.hintChecks.map(terminalSafe).join(", ")}`);
|
|
1055
|
+
}
|
|
1056
|
+
io.log(" Upgrade the Bridge API deployment, then re-run to store them.");
|
|
1057
|
+
}
|
|
877
1058
|
// ---------------------------------------------------------------------------
|
|
878
1059
|
// Qualification (property 5)
|
|
879
1060
|
// ---------------------------------------------------------------------------
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { READINESS_PREREQUISITE_BY_ID, READINESS_PREREQUISITE_CATALOG, } from "./readiness-prerequisites.generated.js";
|
|
21
21
|
import { READINESS_PREREQUISITE_FIXES } from "./printed-remedy-commands.js";
|
|
22
22
|
import { githubSignInRemedy } from "./github-sign-in.js";
|
|
23
|
-
import {
|
|
23
|
+
import { EPIC_CI_WORKFLOW_ALL_MANAGED_BRANCHES } from "./epic-ci-workflow-install.js";
|
|
24
24
|
import { MCP_PACKAGE_NAME } from "./mcp-identity.js";
|
|
25
25
|
/** The catalog ids setup reports, named once. */
|
|
26
26
|
export const SETUP_ITEM_IDS = Object.freeze({
|
|
@@ -228,11 +228,17 @@ function projectMergeCredential(state) {
|
|
|
228
228
|
return local(id, "unknown", true, "the merge token could not be checked right now; re-run setup later");
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
+
/** The two fixes that write the stored test command. */
|
|
232
|
+
export function isTestCommandFix(fix) {
|
|
233
|
+
return fix === "save_test_command" || fix === "replace_test_command";
|
|
234
|
+
}
|
|
231
235
|
/**
|
|
232
236
|
* Pick the permitted fixes for the unmet items, in the order they must run.
|
|
233
237
|
*
|
|
234
238
|
* Pure. Dependencies are explicit:
|
|
235
239
|
* - a missing stored command blocks the workflow PR (it is built from it);
|
|
240
|
+
* - an explicit replacement is planned first and, like a save, can make the
|
|
241
|
+
* workflow PR possible or necessary once its read-back is confirmed;
|
|
236
242
|
* - a GitHub sign-in that is not ready blocks GitHub-dependent fixes (the
|
|
237
243
|
* setup PR), never the Bridge or local ones;
|
|
238
244
|
* - an unresolved repository identity blocks the stored merge token.
|
|
@@ -242,9 +248,15 @@ function projectMergeCredential(state) {
|
|
|
242
248
|
export function planSetupFixes(evidence, context) {
|
|
243
249
|
const fixes = [];
|
|
244
250
|
const githubReady = evidence.githubSignIn === "signed_in";
|
|
245
|
-
|
|
251
|
+
// An explicit request outranks the interactive one; the interactive save is
|
|
252
|
+
// kept only for a command that is KNOWN to be missing.
|
|
253
|
+
if (context.replaceTestCommandRequested === true)
|
|
254
|
+
fixes.push("replace_test_command");
|
|
255
|
+
else if (evidence.testCommand.state === "missing")
|
|
246
256
|
fixes.push("save_test_command");
|
|
247
|
-
|
|
257
|
+
// Either command fix is a potential dependency of the workflow fix; whether
|
|
258
|
+
// the workflow is then installed depends on the read-back being confirmed.
|
|
259
|
+
const commandAvailable = evidence.testCommand.state === "stored" || fixes.some(isTestCommandFix);
|
|
248
260
|
if (githubReady &&
|
|
249
261
|
commandAvailable &&
|
|
250
262
|
(evidence.workflow.state === "needs_pr" || evidence.workflow.state === "needs_command")) {
|
|
@@ -263,12 +275,14 @@ export function planSetupFixes(evidence, context) {
|
|
|
263
275
|
const SHA_RE = /^[0-9a-f]{40}$/;
|
|
264
276
|
/**
|
|
265
277
|
* Read the managed setup pull request's state through `gh`. Read-only; any
|
|
266
|
-
* unreadable answer is `unknown`, never `none`.
|
|
267
|
-
*
|
|
278
|
+
* unreadable answer is `unknown`, never `none`. It looks at the current managed
|
|
279
|
+
* branches AND the branches earlier published renderer versions used (BAPI-1536),
|
|
280
|
+
* so a version-1 pull request that is still open is seen, not missed. An open PR
|
|
281
|
+
* wins; otherwise the most recently merged one; otherwise a closed, unmerged one.
|
|
268
282
|
*/
|
|
269
283
|
export async function readSetupPullRequest(runGh, repository) {
|
|
270
284
|
const rows = [];
|
|
271
|
-
for (const branch of
|
|
285
|
+
for (const branch of EPIC_CI_WORKFLOW_ALL_MANAGED_BRANCHES) {
|
|
272
286
|
let result;
|
|
273
287
|
try {
|
|
274
288
|
result = await runGh([
|