@bridge_gpt/mcp-server 0.2.74 → 0.2.75
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 +14 -7
- package/build/agent-launchers/prompt.js +9 -21
- package/build/agents.generated.js +2 -2
- package/build/authored-plan.js +542 -0
- package/build/bridge-permissions.js +8 -0
- package/build/commands.generated.js +5 -5
- package/build/conductor/bridge-api-client.js +666 -46
- package/build/conductor/epic-implementer-cli.js +337 -93
- package/build/conductor/gate-discovery.js +209 -9
- package/build/conductor/gate-settings-review.js +7 -11
- package/build/conductor/launch-plan.js +58 -12
- package/build/conductor/open-decision-phrases.js +50 -0
- package/build/conductor/prerequisite-inputs.js +181 -14
- package/build/connect-github-api.js +18 -0
- package/build/connect-github.js +35 -18
- package/build/docs.generated.js +2 -2
- package/build/drive-epic.js +387 -12
- package/build/epic-ci-workflow.js +3 -2
- package/build/epic-implementer-bin.js +152 -38
- package/build/epic-implementer-bundle-cli.js +61 -0
- package/build/epic-implementer-claude-hook-bin.js +1 -1
- package/build/epic-implementer-env.js +3 -4
- package/build/epic-integration-pr.js +5 -2
- package/build/executor/completion-contract.js +24 -1
- package/build/executor/gate-qualification-job.js +193 -23
- package/build/executor/gate-qualification-tests-ran.js +232 -0
- package/build/executor/job-runner.js +9 -722
- package/build/executor/job-type-wrappers.js +734 -0
- package/build/executor/preflight.js +6 -2
- package/build/executor/process-containment.js +8 -1
- package/build/executor/required-verification.js +28 -2
- package/build/executor/runner.js +4 -1
- package/build/executor/types.js +9 -0
- package/build/executor/worker-database.js +6 -1
- package/build/executor/worker-guard-hook.js +24 -2
- package/build/generated/ticket-status.js +20 -0
- package/build/index.js +391 -257
- package/build/install-bridge-conductor-answers.js +28 -1
- package/build/install-bridge-conductor-apply.js +11 -3
- package/build/install-bridge-conductor-assessment.js +114 -12
- package/build/install-bridge-conductor-compact.js +2 -0
- package/build/install-bridge-conductor-gate.js +257 -80
- package/build/install-bridge-conductor-setup.js +4 -4
- package/build/install-bridge-conductor-trial-report.js +170 -0
- package/build/install-bridge-conductor.js +303 -31
- package/build/pipelines.generated.js +7 -7
- package/build/plan-generation.js +17 -0
- package/build/printed-remedy-commands.js +54 -0
- package/build/readme.generated.js +1 -1
- package/build/repository-toolchains.js +11 -5
- package/build/scripts/saved-commands-config-field-driver.js +65 -0
- package/build/setup-epic.js +10 -1
- package/build/test-support/executor-source-files.js +1 -1
- package/build/v2-readiness-requirements.js +5 -1
- package/build/version.generated.js +3 -3
- package/build/worker-guard-hook-bin.js +2 -2
- package/docs/EPIC-IMPLEMENTER.md +4 -4
- package/docs/install/github-app.md +79 -92
- package/package.json +1 -1
- package/build/conductor/epic-reconcile.js +0 -603
- package/build/conductor/epic-runtime.js +0 -2020
- package/build/conductor/epic-state.js +0 -774
|
@@ -59,7 +59,7 @@ import path from "node:path";
|
|
|
59
59
|
import { LEGACY_EPIC_IMPLEMENTER_NODE_PATH_ENV } from "../epic-implementer-env.js";
|
|
60
60
|
import { deriveDeclaredExtras } from "./declared-extras.js";
|
|
61
61
|
import { MAX_MUST_ORDER_PATHS, canonicalMustOrderPaths, isValidMustOrderPath, } from "../dependency-install-declarations.js";
|
|
62
|
-
import { TOOLCHAIN_CONTENT_FILES, installArgvForJavaScript, installArgvForPython, resolveRepositoryToolchains, } from "../repository-toolchains.js";
|
|
62
|
+
import { TOOLCHAIN_CONTENT_FILES, UNSUPPORTED_PYTHON_MANIFESTS, installArgvForJavaScript, installArgvForPython, resolveRepositoryToolchains, } from "../repository-toolchains.js";
|
|
63
63
|
// ---------------------------------------------------------------------------
|
|
64
64
|
// Bounds and fixed vocabularies
|
|
65
65
|
// ---------------------------------------------------------------------------
|
|
@@ -1225,11 +1225,176 @@ export async function proposeWorkerDatabase(fsSeam) {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
return undefined;
|
|
1227
1227
|
}
|
|
1228
|
+
/**
|
|
1229
|
+
* BAPI-1698 — the ONE pip install discovery may propose: a checkout-local
|
|
1230
|
+
* virtual environment, recreated from scratch, then `requirements.txt` installed
|
|
1231
|
+
* into it with that environment's own interpreter. It never touches whatever
|
|
1232
|
+
* Python is first on the executor's `PATH` beyond creating the environment.
|
|
1233
|
+
*/
|
|
1234
|
+
export const PIP_BOOTSTRAP_COMMAND = "python3 -m venv --clear .venv && .venv/bin/python -m pip install -r requirements.txt";
|
|
1235
|
+
export const PIP_BOOTSTRAP_ARGV = Object.freeze(["sh", "-c", PIP_BOOTSTRAP_COMMAND]);
|
|
1236
|
+
const VENV_IGNORE_DECLARATIONS = new Set([".venv", ".venv/", "/.venv", "/.venv/"]);
|
|
1237
|
+
/** A minimal gitignore glob test for ONE path segment: `*`, `?`, and `[...]`. */
|
|
1238
|
+
function globSegmentMatches(pattern, name) {
|
|
1239
|
+
let source = "^";
|
|
1240
|
+
for (let i = 0; i < pattern.length; i += 1) {
|
|
1241
|
+
const ch = pattern[i];
|
|
1242
|
+
if (ch === "*")
|
|
1243
|
+
source += "[^/]*";
|
|
1244
|
+
else if (ch === "?")
|
|
1245
|
+
source += "[^/]";
|
|
1246
|
+
else if (ch === "[") {
|
|
1247
|
+
const end = pattern.indexOf("]", i + 1);
|
|
1248
|
+
if (end === -1)
|
|
1249
|
+
return null;
|
|
1250
|
+
const body = pattern.slice(i + 1, end).replace(/^!/, "^");
|
|
1251
|
+
if (/[\\\]]/.test(body))
|
|
1252
|
+
return null;
|
|
1253
|
+
source += `[${body}]`;
|
|
1254
|
+
i = end;
|
|
1255
|
+
}
|
|
1256
|
+
else
|
|
1257
|
+
source += ch.replace(/[.+^${}()|]/g, "\\$&");
|
|
1258
|
+
}
|
|
1259
|
+
try {
|
|
1260
|
+
return new RegExp(`${source}$`).test(name);
|
|
1261
|
+
}
|
|
1262
|
+
catch {
|
|
1263
|
+
return null;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* BAPI-1698 — whether the ROOT `.gitignore` plainly ignores `.venv`. Only the four
|
|
1268
|
+
* plain forms count. A `!` line after the declaration that could re-include the
|
|
1269
|
+
* `.venv` directory (`!.venv`, `!.*`, `!*`, `!**`...) suppresses the proposal;
|
|
1270
|
+
* a negation that cannot match it (`!README.md`) is ignored. Anything this reader
|
|
1271
|
+
* cannot interpret with certainty is `uncertain`. Global excludes are never read.
|
|
1272
|
+
*/
|
|
1273
|
+
export function gitignoreVenvCoverage(text) {
|
|
1274
|
+
let declared = false;
|
|
1275
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
1276
|
+
const line = raw.replace(/[ \t]+$/, "");
|
|
1277
|
+
if (line.length === 0 || line.startsWith("#"))
|
|
1278
|
+
continue;
|
|
1279
|
+
if (line.includes("\\")) {
|
|
1280
|
+
// An escape changes meaning in ways this reader does not model.
|
|
1281
|
+
if (declared)
|
|
1282
|
+
return "uncertain";
|
|
1283
|
+
continue;
|
|
1284
|
+
}
|
|
1285
|
+
if (VENV_IGNORE_DECLARATIONS.has(line)) {
|
|
1286
|
+
declared = true;
|
|
1287
|
+
continue;
|
|
1288
|
+
}
|
|
1289
|
+
if (!declared || !line.startsWith("!"))
|
|
1290
|
+
continue;
|
|
1291
|
+
let pattern = line.slice(1).replace(/^\//, "").replace(/\/$/, "");
|
|
1292
|
+
while (pattern.startsWith("**/"))
|
|
1293
|
+
pattern = pattern.slice(3);
|
|
1294
|
+
if (pattern.length === 0)
|
|
1295
|
+
continue;
|
|
1296
|
+
const first = pattern.split("/")[0];
|
|
1297
|
+
if (first === "**")
|
|
1298
|
+
return "negated";
|
|
1299
|
+
if (!/[*?[]/.test(first)) {
|
|
1300
|
+
if (first === ".venv")
|
|
1301
|
+
return "negated";
|
|
1302
|
+
continue;
|
|
1303
|
+
}
|
|
1304
|
+
const matches = globSegmentMatches(first, ".venv");
|
|
1305
|
+
if (matches === null)
|
|
1306
|
+
return "uncertain";
|
|
1307
|
+
if (matches)
|
|
1308
|
+
return "negated";
|
|
1309
|
+
}
|
|
1310
|
+
return declared ? "covered" : "missing";
|
|
1311
|
+
}
|
|
1312
|
+
/** BAPI-1698 — whether the isolated pip bootstrap may be proposed, and why not. */
|
|
1313
|
+
async function pipBootstrapEligibility(fsSeam, platform) {
|
|
1314
|
+
if (platform === "win32")
|
|
1315
|
+
return { ok: false, reason: "windows_host" };
|
|
1316
|
+
const text = await readBounded(fsSeam, ".gitignore");
|
|
1317
|
+
if (text === null)
|
|
1318
|
+
return { ok: false, reason: "ignore_file_missing" };
|
|
1319
|
+
switch (gitignoreVenvCoverage(text)) {
|
|
1320
|
+
case "covered":
|
|
1321
|
+
return { ok: true };
|
|
1322
|
+
case "missing":
|
|
1323
|
+
return { ok: false, reason: "ignore_declaration_missing" };
|
|
1324
|
+
case "negated":
|
|
1325
|
+
return { ok: false, reason: "ignore_negation" };
|
|
1326
|
+
default:
|
|
1327
|
+
return { ok: false, reason: "ignore_coverage_unestablished" };
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
/** Root requirement files: `requirements.txt`, `requirements-dev.txt`, `requirements_test.txt`, ... */
|
|
1331
|
+
const ROOT_REQUIREMENTS_RE = /^requirements(?:[-_.][A-Za-z0-9_.-]+)?\.txt$/;
|
|
1332
|
+
/**
|
|
1333
|
+
* BAPI-1698 — the root dependency manifests no candidate covers. Reads ONE root
|
|
1334
|
+
* listing. A manifest counts as covered when a candidate watches it, or when it
|
|
1335
|
+
* is the project file of the manager a candidate installs with (`package.json`
|
|
1336
|
+
* for JavaScript, `pyproject.toml` for uv and poetry). Advisory only.
|
|
1337
|
+
*/
|
|
1338
|
+
async function uncoveredRootManifests(fsSeam, candidates, pythonManager, hasJavaScript) {
|
|
1339
|
+
const names = (await fsSeam.listDir("")) ?? [];
|
|
1340
|
+
const covered = new Set(candidates.flatMap((c) => (c.cwd === "." ? c.lockfiles : [])));
|
|
1341
|
+
if (hasJavaScript)
|
|
1342
|
+
covered.add("package.json");
|
|
1343
|
+
if (pythonManager === "uv" || pythonManager === "poetry")
|
|
1344
|
+
covered.add("pyproject.toml");
|
|
1345
|
+
const manifests = names.filter((name) => ROOT_REQUIREMENTS_RE.test(name) ||
|
|
1346
|
+
UNSUPPORTED_PYTHON_MANIFESTS.includes(name) ||
|
|
1347
|
+
name === "package.json");
|
|
1348
|
+
return manifests.filter((name) => !covered.has(name)).sort(byCodeUnit);
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* BAPI-1698 — the plain sentences every setup surface shows for the dependency
|
|
1352
|
+
* notes, pip reason, and uncovered manifests of one discovery. One sentence per
|
|
1353
|
+
* fact, each file named once. Advisory: none of them stops setup.
|
|
1354
|
+
*/
|
|
1355
|
+
export function dependencyInstallNoteSentences(fields) {
|
|
1356
|
+
const sentences = [];
|
|
1357
|
+
for (const note of fields.dependencyInstallNotes ?? []) {
|
|
1358
|
+
if (note === "dependency_install_toolchain_unresolved") {
|
|
1359
|
+
sentences.push("The repository's toolchains could not be read with certainty, so nothing is proposed.");
|
|
1360
|
+
}
|
|
1361
|
+
else if (note === "dependency_install_pip_not_proposed") {
|
|
1362
|
+
sentences.push(`requirements.txt was found, but no install is proposed for it: ${PIP_REASON_TEXT[fields.dependencyInstallPipReason ?? "ignore_coverage_unestablished"]}. Workers and the test trial will not install it unless you add an entry.`);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
for (const file of fields.dependencyInstallUncoveredManifests ?? []) {
|
|
1366
|
+
sentences.push(`No proposed install covers ${file}. Workers and the test trial will not install what it lists unless you add an entry.`);
|
|
1367
|
+
}
|
|
1368
|
+
return sentences;
|
|
1369
|
+
}
|
|
1370
|
+
const PIP_REASON_TEXT = Object.freeze({
|
|
1371
|
+
windows_host: "the isolated .venv install is not offered on a Windows host",
|
|
1372
|
+
ignore_file_missing: "there is no readable .gitignore at the repository root, so a created .venv folder would not be ignored",
|
|
1373
|
+
ignore_declaration_missing: "the root .gitignore does not ignore .venv",
|
|
1374
|
+
ignore_negation: "a later line in the root .gitignore could bring .venv back",
|
|
1375
|
+
ignore_coverage_unestablished: "setup could not tell for certain whether the root .gitignore ignores .venv",
|
|
1376
|
+
});
|
|
1377
|
+
/**
|
|
1378
|
+
* BAPI-1698 — the same seam with ONE root listing shared by every proposer in a
|
|
1379
|
+
* discovery run (must-order paths and the uncovered-manifest scan), so adding a
|
|
1380
|
+
* reader never adds a second listing of the repository root.
|
|
1381
|
+
*/
|
|
1382
|
+
export function withSharedRootListing(fsSeam) {
|
|
1383
|
+
let root;
|
|
1384
|
+
return {
|
|
1385
|
+
readText: (relPath) => fsSeam.readText(relPath),
|
|
1386
|
+
exists: (relPath) => fsSeam.exists(relPath),
|
|
1387
|
+
listDir: (relPath) => (relPath === "" ? (root ??= fsSeam.listDir("")) : fsSeam.listDir(relPath)),
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1228
1390
|
/** BAPI-1551 — the root dependency-refresh proposals and the notes on what was left out. */
|
|
1229
1391
|
export async function proposeDependencyInstall(fsSeam,
|
|
1230
1392
|
/**
|
|
1231
1393
|
* BAPI-1677 — the learned-text snapshot extras are worked out from. Absent means no
|
|
1232
1394
|
* derivation was asked for. `null` means the text could not be read: a limitation.
|
|
1395
|
+
*
|
|
1396
|
+
* BAPI-1698 — `platform` is the executor host's platform, defaulting to
|
|
1397
|
+
* `process.platform`; the isolated pip bootstrap is never proposed on Windows.
|
|
1233
1398
|
*/
|
|
1234
1399
|
options = {}) {
|
|
1235
1400
|
let resolution;
|
|
@@ -1256,9 +1421,25 @@ options = {}) {
|
|
|
1256
1421
|
const py = resolution.toolchains.python;
|
|
1257
1422
|
let limitations = [];
|
|
1258
1423
|
let unknown = false;
|
|
1424
|
+
let pipReason;
|
|
1259
1425
|
if (py !== null) {
|
|
1260
|
-
if (py.manager === "pip")
|
|
1261
|
-
|
|
1426
|
+
if (py.manager === "pip") {
|
|
1427
|
+
// BAPI-1698 — one checkout-local `.venv` bootstrap, only when it is portable
|
|
1428
|
+
// and the root `.gitignore` plainly keeps the created folder out of git.
|
|
1429
|
+
const eligibility = await pipBootstrapEligibility(fsSeam, options.platform ?? process.platform);
|
|
1430
|
+
if (eligibility.ok) {
|
|
1431
|
+
candidates.push({
|
|
1432
|
+
cwd: ".",
|
|
1433
|
+
argv: [...PIP_BOOTSTRAP_ARGV],
|
|
1434
|
+
lockfiles: [py.dependencyFile],
|
|
1435
|
+
label: "pip (isolated .venv)",
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
else {
|
|
1439
|
+
notes.push("dependency_install_pip_not_proposed");
|
|
1440
|
+
pipReason = eligibility.reason;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1262
1443
|
else {
|
|
1263
1444
|
// The install target is resolved first: its own file, never a union across projects.
|
|
1264
1445
|
const derived = options.learned === undefined
|
|
@@ -1275,9 +1456,14 @@ options = {}) {
|
|
|
1275
1456
|
});
|
|
1276
1457
|
}
|
|
1277
1458
|
}
|
|
1459
|
+
// BAPI-1698 — name every root manifest nothing covers. Root `requirements.txt`
|
|
1460
|
+
// is already named by the pip note when it got no proposal.
|
|
1461
|
+
const uncovered = (await uncoveredRootManifests(fsSeam, candidates, py?.manager ?? null, js !== null)).filter((name) => !(pipReason !== undefined && name === "requirements.txt"));
|
|
1278
1462
|
return {
|
|
1279
1463
|
candidates,
|
|
1280
1464
|
notes,
|
|
1465
|
+
...(pipReason !== undefined ? { pipReason } : {}),
|
|
1466
|
+
...(uncovered.length > 0 ? { uncoveredManifests: uncovered } : {}),
|
|
1281
1467
|
...(limitations.length > 0 ? { limitations } : {}),
|
|
1282
1468
|
...(unknown ? { unknown: true } : {}),
|
|
1283
1469
|
};
|
|
@@ -1548,7 +1734,9 @@ async function queryHistory(lookupHistory, names) {
|
|
|
1548
1734
|
* than presenting an empty provider list as a gate.
|
|
1549
1735
|
*/
|
|
1550
1736
|
export async function discoverGate(input) {
|
|
1551
|
-
const {
|
|
1737
|
+
const { lookupHistory } = input;
|
|
1738
|
+
// BAPI-1698: one root listing for the whole run.
|
|
1739
|
+
const fsSeam = withSharedRootListing(input.fs);
|
|
1552
1740
|
const evidence = [];
|
|
1553
1741
|
const localCandidates = [];
|
|
1554
1742
|
const lookups = new LookupNames();
|
|
@@ -1591,7 +1779,10 @@ export async function discoverGate(input) {
|
|
|
1591
1779
|
const localCommandIds = providerChecks.length > 0 ? [] : validLocal.filter((c) => c.confidence === "high").map((c) => c.id);
|
|
1592
1780
|
const workerEnv = resolveWorkerEnv(extras.envObservations);
|
|
1593
1781
|
const hints = await proposeReproductionHints(fsSeam, providerChecks, extras.hintJobs);
|
|
1594
|
-
const dependencyInstall = await proposeDependencyInstall(fsSeam,
|
|
1782
|
+
const dependencyInstall = await proposeDependencyInstall(fsSeam, {
|
|
1783
|
+
...(input.learned !== undefined ? { learned: input.learned } : {}),
|
|
1784
|
+
...(input.platform !== undefined ? { platform: input.platform } : {}),
|
|
1785
|
+
});
|
|
1595
1786
|
const mustOrder = await proposeMustOrderPaths(fsSeam);
|
|
1596
1787
|
return {
|
|
1597
1788
|
providerCandidates,
|
|
@@ -1618,11 +1809,16 @@ export async function discoverGate(input) {
|
|
|
1618
1809
|
* Makes no provider-history call.
|
|
1619
1810
|
*/
|
|
1620
1811
|
export async function discoverDeclarations(input) {
|
|
1812
|
+
// BAPI-1698: one root listing for the whole run.
|
|
1813
|
+
const fsSeam = withSharedRootListing(input.fs);
|
|
1621
1814
|
const extras = { envObservations: [], hintJobs: new Map(), workflowFiles: [] };
|
|
1622
|
-
await collectWorkflows(
|
|
1623
|
-
const dependencyInstall = await proposeDependencyInstall(
|
|
1624
|
-
|
|
1625
|
-
|
|
1815
|
+
await collectWorkflows(fsSeam, [], new LookupNames(), extras);
|
|
1816
|
+
const dependencyInstall = await proposeDependencyInstall(fsSeam, {
|
|
1817
|
+
...(input.learned !== undefined ? { learned: input.learned } : {}),
|
|
1818
|
+
...(input.platform !== undefined ? { platform: input.platform } : {}),
|
|
1819
|
+
});
|
|
1820
|
+
const mustOrder = await proposeMustOrderPaths(fsSeam);
|
|
1821
|
+
return declarationFields(dependencyInstall, proposeCiDatabase(input.providerChecks, extras.workflowFiles), mustOrder, await proposeWorkerDatabase(fsSeam));
|
|
1626
1822
|
}
|
|
1627
1823
|
/**
|
|
1628
1824
|
* BAPI-1551 — the declaration fields of a proposal. Each is present only when it
|
|
@@ -1635,6 +1831,10 @@ function declarationFields(dependencyInstall, ciDatabase, mustOrder, workerDatab
|
|
|
1635
1831
|
...(dependencyInstall.candidates.length > 0 ? { dependencyInstallCandidates: dependencyInstall.candidates } : {}),
|
|
1636
1832
|
...(dependencyInstall.notes.length > 0 ? { dependencyInstallNotes: dependencyInstall.notes } : {}),
|
|
1637
1833
|
...(dependencyInstall.limitations !== undefined ? { dependencyInstallLimitations: dependencyInstall.limitations } : {}),
|
|
1834
|
+
...(dependencyInstall.pipReason !== undefined ? { dependencyInstallPipReason: dependencyInstall.pipReason } : {}),
|
|
1835
|
+
...(dependencyInstall.uncoveredManifests !== undefined
|
|
1836
|
+
? { dependencyInstallUncoveredManifests: dependencyInstall.uncoveredManifests }
|
|
1837
|
+
: {}),
|
|
1638
1838
|
...(dependencyInstall.unknown === true ? { dependencyInstallUnknown: true } : {}),
|
|
1639
1839
|
...(ciDatabase.value !== "unknown" ? { ciDatabaseProposal: ciDatabase } : {}),
|
|
1640
1840
|
...(mustOrder.candidates.length > 0 ? { mustOrderPathCandidates: mustOrder.candidates } : {}),
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* an empty `workerEnv` list is a deliberate removal of every stored variable.
|
|
39
39
|
*/
|
|
40
40
|
import { redactSecretString } from "./redaction.js";
|
|
41
|
-
import { LOCAL_COMMAND_TIMEOUT_SECONDS, } from "./gate-discovery.js";
|
|
41
|
+
import { dependencyInstallNoteSentences, LOCAL_COMMAND_TIMEOUT_SECONDS, } from "./gate-discovery.js";
|
|
42
42
|
import { CI_DATABASE_DEFAULT, MAX_DEPENDENCY_INSTALL_ENTRIES, MAX_DEPENDENCY_INSTALL_LOCKFILES, MAX_MUST_ORDER_PATHS, admitDependencyInstallDeclarations, canonicalMustOrderPaths, dependencyInstallEntryIdentity, isCiDatabase, isSafeRepoRelativePath, sameDependencyInstall, sameMustOrderPaths, } from "../dependency-install-declarations.js";
|
|
43
43
|
/** Limits that mirror `gate_profile.py` for hand-typed hints. */
|
|
44
44
|
const MAX_HINT_WORDS = 32;
|
|
@@ -263,7 +263,7 @@ export function hasDeclarationsToReview(proposal, stored) {
|
|
|
263
263
|
function hasDependencyOrCiToReview(proposal, stored) {
|
|
264
264
|
return ((stored?.dependency_install?.length ?? 0) > 0 ||
|
|
265
265
|
newDependencyProposals(proposal, stored).length > 0 ||
|
|
266
|
-
(proposal.
|
|
266
|
+
dependencyInstallNoteSentences(proposal).length > 0 ||
|
|
267
267
|
storedCiDatabase(stored) !== CI_DATABASE_DEFAULT ||
|
|
268
268
|
proposedCiDatabase(proposal) !== CI_DATABASE_DEFAULT);
|
|
269
269
|
}
|
|
@@ -421,7 +421,7 @@ export function renderSettingsReview(io, proposal, stored, providerChecks, showV
|
|
|
421
421
|
// Shown only when there is something to say, so a review without either
|
|
422
422
|
// declaration renders exactly as it did before BAPI-1551.
|
|
423
423
|
if (hasDeclarationsToReview(proposal, stored) ||
|
|
424
|
-
(proposal.
|
|
424
|
+
dependencyInstallNoteSentences(proposal).length > 0 ||
|
|
425
425
|
mustOrderOffer(proposal, stored).notOffered > 0) {
|
|
426
426
|
renderDeclarationsReview(io, proposal, stored, showValues);
|
|
427
427
|
}
|
|
@@ -452,11 +452,6 @@ const CI_DATABASE_TEXT = Object.freeze({
|
|
|
452
452
|
provided: "provided — CI provides a database",
|
|
453
453
|
unknown: "unknown — not declared",
|
|
454
454
|
});
|
|
455
|
-
const DEPENDENCY_NOTE_TEXT = Object.freeze({
|
|
456
|
-
dependency_install_pip_not_proposed: "A pip requirements file was found. It is not proposed: a bare pip install would use whatever " +
|
|
457
|
-
"Python is first on the executor's PATH, not this worktree's environment. Add an entry by hand if you need one.",
|
|
458
|
-
dependency_install_toolchain_unresolved: "The repository's toolchains could not be read with certainty, so nothing is proposed.",
|
|
459
|
-
});
|
|
460
455
|
/** One entry as a person reads it: where it runs and what it watches first, then the command. */
|
|
461
456
|
function describeDependencyEntry(entry, label, showValues) {
|
|
462
457
|
const where = entry.cwd === "." ? "repository root" : terminalSafe(entry.cwd);
|
|
@@ -512,8 +507,9 @@ function renderDependencyAndCiReview(io, proposal, stored, showValues) {
|
|
|
512
507
|
for (const line of rest)
|
|
513
508
|
io.log(line);
|
|
514
509
|
});
|
|
515
|
-
|
|
516
|
-
|
|
510
|
+
// BAPI-1698: the same sentences every setup surface shows, each fact once. Advisory only.
|
|
511
|
+
for (const sentence of dependencyInstallNoteSentences(proposal))
|
|
512
|
+
io.log(` ${plainDisplayText(sentence)}`);
|
|
517
513
|
for (const line of proposal.dependencyInstallLimitations ?? [])
|
|
518
514
|
io.log(` Could not check: ${plainDisplayText(line)}`);
|
|
519
515
|
io.log(" Each command runs in every fresh worker worktree, and again only when a file it names changes.");
|
|
@@ -728,7 +724,7 @@ async function reviewDependencyInstall(io, proposal, stored) {
|
|
|
728
724
|
const prompt = io.promptLine;
|
|
729
725
|
const storedList = (stored?.dependency_install ?? []).map(entryOf);
|
|
730
726
|
const proposals = newDependencyProposals(proposal, stored);
|
|
731
|
-
if (storedList.length === 0 && proposals.length === 0 && (proposal.
|
|
727
|
+
if (storedList.length === 0 && proposals.length === 0 && dependencyInstallNoteSentences(proposal).length === 0) {
|
|
732
728
|
return undefined;
|
|
733
729
|
}
|
|
734
730
|
const letters = [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EPIC_KEY_PATTERN } from "../drive-epic-key.js";
|
|
2
2
|
import { WORKER_DATABASE_DOCTOR_OWNER, WORKER_DATABASE_DOCTOR_RUNBOOK_SECTION } from "./doctor.js";
|
|
3
|
+
import { redactSecrets } from "../secret-redaction.js";
|
|
3
4
|
import { LAUNCH_NEED_REMEDIES, LAUNCH_NEED_ROW_IDS, LAUNCH_NEEDS } from "./readiness-sections.js";
|
|
4
5
|
export const NO_LAUNCH_PLAN_FACTS = Object.freeze({
|
|
5
6
|
prerequisites: { status: "not_collected" },
|
|
@@ -112,13 +113,16 @@ function summaryLine(preview, blocked) {
|
|
|
112
113
|
parts.push(where);
|
|
113
114
|
return `${preview.epic_key} is ready to launch: ${parts.join(", ")}.`;
|
|
114
115
|
}
|
|
115
|
-
|
|
116
|
+
/** BAPI-1704 — appended to the ready branch's launch option when open decisions exist. */
|
|
117
|
+
const OPEN_DECISION_LAUNCH_SENTENCE = "If an open decision blocks a child, the driver may settle it by council.";
|
|
118
|
+
function launchOption(number, label, local, recommended, extra) {
|
|
119
|
+
const base = local
|
|
120
|
+
? "Creates the run and starts it on your local plane."
|
|
121
|
+
: "Creates the run and starts it on the server.";
|
|
116
122
|
return {
|
|
117
123
|
number,
|
|
118
124
|
label,
|
|
119
|
-
description:
|
|
120
|
-
? "Creates the run and starts it on your local plane."
|
|
121
|
-
: "Creates the run and starts it on the server.",
|
|
125
|
+
description: extra === undefined ? base : `${base} ${extra}`,
|
|
122
126
|
duration: local ? LAUNCH_PLAN_DURATION.local : LAUNCH_PLAN_DURATION.remote,
|
|
123
127
|
recommended,
|
|
124
128
|
};
|
|
@@ -169,7 +173,8 @@ function generatedPlanItem(preview) {
|
|
|
169
173
|
const source = plan.inline ?? plan.generation;
|
|
170
174
|
if (source === undefined)
|
|
171
175
|
return null;
|
|
172
|
-
|
|
176
|
+
// BAPI-1706 — a server plan's inline nodes carry no summary; read as unusable.
|
|
177
|
+
const summary = source.summary ?? null;
|
|
173
178
|
const parts = [];
|
|
174
179
|
if (summary?.serialized_reason) {
|
|
175
180
|
parts.push(SERIALIZED_REASON_COPY[summary.serialized_reason]?.(summary.unknown_files) ?? "It runs one child at a time.");
|
|
@@ -178,6 +183,9 @@ function generatedPlanItem(preview) {
|
|
|
178
183
|
parts.push(summary.order_source === "epic_manifest"
|
|
179
184
|
? "Order and dependencies come from the epic's ordered child manifest."
|
|
180
185
|
: "Order is ascending ticket key.");
|
|
186
|
+
if (summary.order_fallback_reason === "manifest_unreadable") {
|
|
187
|
+
parts.push("The epic has an ordered child manifest section, but it could not be read, so the plan uses ascending ticket-key order.");
|
|
188
|
+
}
|
|
181
189
|
for (const entry of summary.excluded) {
|
|
182
190
|
parts.push(`Left out: ${entry.ticket_key} (${entry.reason}; the Epic Implementer cannot run an unfinished spike).`);
|
|
183
191
|
}
|
|
@@ -245,6 +253,18 @@ export function buildLaunchPlan(preview, facts = NO_LAUNCH_PLAN_FACTS) {
|
|
|
245
253
|
reason: `${entry.dependents} will stop without it. Tickets that don't depend on it keep going.${sure}`,
|
|
246
254
|
}, entry.name);
|
|
247
255
|
}
|
|
256
|
+
// BAPI-1704 — open decisions follow the missing-core items. Display text is redacted
|
|
257
|
+
// here; the raw facts stay untouched. Detail ids count from one per child.
|
|
258
|
+
const openDecisions = refusal === null && prerequisiteFacts.status === "collected" ? prerequisiteFacts.openDecisions : [];
|
|
259
|
+
const openDecisionCounts = new Map();
|
|
260
|
+
for (const entry of openDecisions) {
|
|
261
|
+
const n = (openDecisionCounts.get(entry.child) ?? 0) + 1;
|
|
262
|
+
openDecisionCounts.set(entry.child, n);
|
|
263
|
+
add("needs_choice", {
|
|
264
|
+
summary: `${entry.child} leaves a decision open: "${redactSecrets(entry.clause)}"`,
|
|
265
|
+
reason: "Settling it now avoids an overnight decision.",
|
|
266
|
+
}, `open-decision-${entry.child}-${n}`);
|
|
267
|
+
}
|
|
248
268
|
// --- worth knowing: surviving non-blocking evidence ------------------------------
|
|
249
269
|
if (refusal === null) {
|
|
250
270
|
const roleRow = presentNeed(rows, "worker_db_role");
|
|
@@ -306,16 +326,42 @@ export function buildLaunchPlan(preview, facts = NO_LAUNCH_PLAN_FACTS) {
|
|
|
306
326
|
}
|
|
307
327
|
else {
|
|
308
328
|
const missing = missingCore.length > 0;
|
|
309
|
-
|
|
310
|
-
|
|
329
|
+
const decisions = openDecisions.length > 0;
|
|
330
|
+
push(launchOption(1, missing ? "Launch now and supply it later" : "Launch now", local, !decisions, decisions ? OPEN_DECISION_LAUNCH_SENTENCE : undefined), "launch");
|
|
331
|
+
if (decisions) {
|
|
332
|
+
push(nothingOption(options.length + 1, missing ? "Stop so you can supply or settle it" : "Stop so you can settle it first", true), "create_nothing");
|
|
333
|
+
}
|
|
334
|
+
else if (missing) {
|
|
311
335
|
push(nothingOption(options.length + 1, "Stop so you can supply it", false), "create_nothing");
|
|
336
|
+
}
|
|
312
337
|
push(nothingOption(options.length + 1, "Don't launch yet", false), "create_nothing");
|
|
313
|
-
recommendation =
|
|
314
|
-
|
|
315
|
-
? "Every check that protects your code passed."
|
|
338
|
+
recommendation = !decisions
|
|
339
|
+
? "launch now."
|
|
316
340
|
: missing
|
|
317
|
-
? "
|
|
318
|
-
: "
|
|
341
|
+
? "stop so you can supply or settle it."
|
|
342
|
+
: "stop so you can settle it first.";
|
|
343
|
+
// BAPI-1694 — the positive claim is made only when nothing in the preview is unverified.
|
|
344
|
+
const partialValidation = preview.summary?.server_validation === "partial";
|
|
345
|
+
const tallyLines = Array.isArray(preview.tally_lines) ? preview.tally_lines : [];
|
|
346
|
+
const unprovenTally = tallyLines.some((line) => isObject(line) && typeof line.code === "string" && line.code.endsWith("_unproven"));
|
|
347
|
+
const unverifiableNeed = rows.some((row) => isObject(row.launch_need) && row.launch_need.state === "unverifiable");
|
|
348
|
+
const uncertain = partialValidation || unprovenTally || unverifiableNeed;
|
|
349
|
+
const tail = verdict === "ready"
|
|
350
|
+
? null
|
|
351
|
+
: decisions && missing
|
|
352
|
+
? "Some children need something you can supply later or leave a decision open."
|
|
353
|
+
: decisions
|
|
354
|
+
? "Some children leave a decision open."
|
|
355
|
+
: missing
|
|
356
|
+
? "Some children need something you can supply later."
|
|
357
|
+
: "A few things are worth knowing.";
|
|
358
|
+
reason = [
|
|
359
|
+
uncertain
|
|
360
|
+
? "Some checks returned no verifiable result; no check that protects your code failed."
|
|
361
|
+
: "Every check that protects your code passed.",
|
|
362
|
+
partialValidation ? "The server checks again when it creates the run." : null,
|
|
363
|
+
tail,
|
|
364
|
+
].filter((sentence) => sentence !== null).join(" ");
|
|
319
365
|
}
|
|
320
366
|
const plan = {
|
|
321
367
|
version: 2,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The open-decision phrase list and its pure matcher (BAPI-1704).
|
|
3
|
+
*
|
|
4
|
+
* The list is an exact, ordered, case-sensitive copy of the canonical block in
|
|
5
|
+
* `docs/bridge-ticket-authoring.md` (BAPI-1703). `tests/pytest/static/
|
|
6
|
+
* test_open_decision_phrases_parity.py` fails if the two drift. A match is an
|
|
7
|
+
* advisory signal for a person to review; it never decides anything here.
|
|
8
|
+
*/
|
|
9
|
+
/** The canonical phrases, in canonical order. Order is the tie-breaker. */
|
|
10
|
+
export const OPEN_DECISION_PHRASES = Object.freeze([
|
|
11
|
+
"must settle",
|
|
12
|
+
"settle this before",
|
|
13
|
+
"before planning",
|
|
14
|
+
"the caller must",
|
|
15
|
+
"owner confirms",
|
|
16
|
+
"owner must confirm",
|
|
17
|
+
"confirm with the owner",
|
|
18
|
+
"stop if not met",
|
|
19
|
+
"check the precondition first",
|
|
20
|
+
"TBD",
|
|
21
|
+
"to be decided",
|
|
22
|
+
]);
|
|
23
|
+
function escapeRegExp(text) {
|
|
24
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25
|
+
}
|
|
26
|
+
const PHRASE_PATTERNS = OPEN_DECISION_PHRASES.map((phrase) => ({
|
|
27
|
+
phrase,
|
|
28
|
+
// Whole-phrase boundaries at both ends: no word character may touch either end.
|
|
29
|
+
pattern: new RegExp(`(?<![\\p{L}\\p{N}_])${escapeRegExp(phrase)}(?![\\p{L}\\p{N}_])`, "iu"),
|
|
30
|
+
}));
|
|
31
|
+
/**
|
|
32
|
+
* Find the earliest open-decision phrase in one line.
|
|
33
|
+
*
|
|
34
|
+
* Matching is case-insensitive and whole-phrase. The result carries the phrase as
|
|
35
|
+
* spelled in {@link OPEN_DECISION_PHRASES} and `index`, a position usable to slice
|
|
36
|
+
* the original JavaScript string. Matches at the same position go to the phrase
|
|
37
|
+
* that comes first in the canonical list. Pure: no normalization, environment
|
|
38
|
+
* access, logging, or policy decision.
|
|
39
|
+
*/
|
|
40
|
+
export function findOpenDecisionPhrase(line) {
|
|
41
|
+
let best;
|
|
42
|
+
for (const { phrase, pattern } of PHRASE_PATTERNS) {
|
|
43
|
+
const match = pattern.exec(line);
|
|
44
|
+
if (match === null)
|
|
45
|
+
continue;
|
|
46
|
+
if (best === undefined || match.index < best.index)
|
|
47
|
+
best = { phrase, index: match.index };
|
|
48
|
+
}
|
|
49
|
+
return best;
|
|
50
|
+
}
|