@bridge_gpt/mcp-server 0.2.72 → 0.2.73
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 +3 -0
- package/build/agents.generated.js +6 -6
- package/build/bridge-permissions.js +27 -0
- package/build/ci-system-detection.js +50 -0
- package/build/ci-trigger-adapters.js +631 -0
- package/build/ci-trigger-install.js +106 -0
- package/build/codex-launcher-pin.js +33 -2
- package/build/codex-skill-adapter.js +3 -1
- package/build/command-host.js +33 -0
- package/build/commands.generated.js +7 -6
- package/build/conductor/bridge-api-client.js +842 -35
- package/build/conductor/bring-up-facts.js +18 -5
- package/build/conductor/command-drift-production.js +42 -17
- package/build/conductor/command-drift.js +47 -0
- package/build/conductor/declare-blocked.js +554 -0
- package/build/conductor/doctor.js +106 -21
- package/build/conductor/driver-commands.js +141 -0
- package/build/conductor/driver-guard.js +277 -0
- package/build/conductor/driver-lapse.js +321 -0
- package/build/conductor/driver-register.js +176 -0
- package/build/conductor/driver-release.js +174 -0
- package/build/conductor/driver-session-state.js +315 -0
- package/build/conductor/epic-branch-ci-inspection.js +222 -29
- package/build/conductor/epic-implementer-cli.js +166 -15
- package/build/conductor/epic-server-database.js +162 -0
- package/build/conductor/epic-server-guidance.js +278 -0
- package/build/conductor/epic-server-journal.js +239 -0
- package/build/conductor/epic-server-processes.js +324 -0
- package/build/conductor/epic-server-recipe.js +397 -0
- package/build/conductor/epic-server-runtime.js +1207 -0
- package/build/conductor/epic-server-sfcc.js +107 -0
- package/build/conductor/epic-server-state.js +427 -0
- package/build/conductor/epic-server.js +594 -0
- package/build/conductor/gate-discovery.js +150 -5
- package/build/conductor/gate-settings-review.js +224 -4
- package/build/conductor/launch-need-probes.js +6 -53
- package/build/conductor/launch-plan.js +313 -156
- package/build/conductor/prerequisite-inputs.js +879 -45
- package/build/conductor/readiness-assessment.js +16 -1
- package/build/conductor/readiness-cli.js +20 -9
- package/build/conductor/readiness-prerequisites.js +28 -9
- package/build/conductor/readiness-sections.js +133 -126
- package/build/conductor/readiness.js +1 -1
- package/build/conductor/recovery-cli.js +13 -2
- package/build/conductor/tools.js +6 -5
- package/build/conductor/wait-run-attention.js +2 -2
- package/build/conductor/wait-run-cli.js +208 -22
- package/build/conductor/worker-database-doctor-inspector.js +33 -2
- package/build/conductor/worker-setup-tally.js +27 -0
- package/build/credential-store.js +71 -1
- package/build/dependency-install-declarations.js +55 -0
- package/build/docs.generated.js +2 -2
- package/build/doctor.js +54 -3
- package/build/drive-epic-help.js +21 -2
- package/build/drive-epic.js +1811 -351
- package/build/engine-paths.js +20 -0
- package/build/epic-branch-ci-summary.js +140 -0
- package/build/epic-capability-statement.js +107 -0
- package/build/epic-ci-workflow-drift.js +30 -15
- package/build/epic-ci-workflow-install.js +110 -42
- package/build/epic-ci-workflow-v2.js +274 -0
- package/build/epic-ci-workflow.js +38 -12
- package/build/epic-implementer-bin.js +2101 -44
- package/build/epic-launch-context.js +607 -0
- package/build/epic-server-record.js +273 -0
- package/build/epic-shared/bridge-client.js +11 -3
- package/build/escalation-reachability.js +43 -0
- package/build/executor/ci-fix-test-runs.js +334 -0
- package/build/executor/completion-contract.js +8 -1
- package/build/executor/env.js +59 -22
- package/build/executor/epic-server-context.js +141 -0
- package/build/executor/gate-qualification-job.js +127 -26
- package/build/executor/http-client.js +52 -5
- package/build/executor/job-runner.js +423 -69
- package/build/executor/observation.js +8 -0
- package/build/executor/pre-pr-checks.js +363 -0
- package/build/executor/prompt-spec.js +114 -2
- package/build/executor/reconcile-overlap-job.js +5 -3
- package/build/executor/required-work-diagnostics.js +4 -2
- package/build/executor/required-work-ledger.js +936 -38
- package/build/executor/results.js +58 -0
- package/build/executor/terminal-mutation.js +8 -0
- package/build/executor/worker-command.js +72 -3
- package/build/executor/worker-database-config.js +281 -0
- package/build/executor/worker-database-target.js +16 -12
- package/build/executor/worker-database.js +320 -101
- package/build/executor/worker-finalization.js +7 -1
- package/build/executor/worker-resources.js +25 -3
- package/build/executor/worker-verification-guidance.js +18 -3
- package/build/executor/worktree.js +20 -1
- package/build/executor-launch.js +54 -2
- package/build/generated-assets-catalog.js +2 -2
- package/build/index.js +664 -335
- package/build/init.js +26 -11
- package/build/install-bridge-conductor-answers.js +465 -0
- package/build/install-bridge-conductor-apply.js +259 -0
- package/build/install-bridge-conductor-assessment.js +895 -0
- package/build/install-bridge-conductor-compact.js +161 -0
- package/build/install-bridge-conductor-contracts.js +63 -0
- package/build/install-bridge-conductor-gate.js +1197 -196
- package/build/install-bridge-conductor-setup.js +535 -79
- package/build/install-bridge-conductor.js +2885 -560
- package/build/install-bridge.js +199 -21
- package/build/install-maintenance.js +26 -3
- package/build/launcher-config-inspection.js +162 -1
- package/build/mcp-grant-candidates.js +767 -0
- package/build/mcp-grant-doctor.js +63 -0
- package/build/mcp-grant.js +288 -0
- package/build/mcp-host-targets.js +8 -0
- package/build/mcp-identity.js +23 -0
- package/build/mcp-invoke.js +126 -13
- package/build/mcp-presets.js +107 -0
- package/build/mcp-provisioning.js +134 -2
- package/build/mcp-registration-doctor.js +31 -2
- package/build/mcp-server-invocation.js +6 -1
- package/build/merge-workflow-install.js +234 -109
- package/build/pipelines.generated.js +5 -5
- package/build/plan-discovery.js +97 -4
- package/build/plan-execution-ledger.js +100 -7
- package/build/plan-generation-io.js +262 -0
- package/build/plan-generation.js +424 -0
- package/build/plane/build-freshness.js +6 -1
- package/build/plane/cli.js +75 -9
- package/build/plane/plane-freshness.js +17 -0
- package/build/plane/preflight.js +50 -10
- package/build/plane/shutdown.js +19 -0
- package/build/plane/terminal-run-cleanup.js +18 -4
- package/build/printed-remedy-commands.js +206 -12
- package/build/readiness-check.js +77 -0
- package/build/readiness-prerequisites.generated.js +122 -14
- package/build/readme.generated.js +1 -1
- package/build/repository-state-paths.js +38 -0
- package/build/run-unit-tests-launcher.js +8 -1
- package/build/setup-epic.js +1190 -196
- package/build/setup-progress.js +44 -0
- package/build/setup-question.js +122 -4
- package/build/third-party-mcp-targets.js +30 -0
- package/build/ticket-delivery-enrollment.js +9 -0
- package/build/upgrade-cli.js +85 -2
- package/build/v2-readiness-requirements.js +28 -1
- package/build/version.generated.js +3 -3
- package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
- package/docs/epic-implementer/getting-started.md +3 -1
- package/docs/epic-implementer/self-hosting.md +14 -1
- package/package.json +2 -2
|
@@ -37,10 +37,25 @@ export const readinessAssessmentSchema = z.strictObject({ version: z.literal(1),
|
|
|
37
37
|
&& C.coverage.every(c => identities.includes(`${c.scope}:${c.id}`))
|
|
38
38
|
&& a.records.every(r => r.impact === (r.id === 'server.parse-progress' ? 'advisory' : 'mandatory'));
|
|
39
39
|
});
|
|
40
|
+
/**
|
|
41
|
+
* BAPI-1602 — assessment rows an OLDER server may still send after this build
|
|
42
|
+
* retired them. They are removed, and only they, BEFORE schema and coverage
|
|
43
|
+
* validation, so one retired row cannot make the whole assessment unavailable.
|
|
44
|
+
* Every other record keeps strict coverage validation.
|
|
45
|
+
*/
|
|
46
|
+
const RETIRED_ASSESSMENT_IDS = ['server.test-command'];
|
|
47
|
+
function withoutRetiredAssessmentRecords(assessment) {
|
|
48
|
+
if (typeof assessment !== 'object' || assessment === null || Array.isArray(assessment))
|
|
49
|
+
return assessment;
|
|
50
|
+
const records = assessment.records;
|
|
51
|
+
if (!Array.isArray(records))
|
|
52
|
+
return assessment;
|
|
53
|
+
return { ...assessment, records: records.filter(r => !(typeof r === 'object' && r !== null && RETIRED_ASSESSMENT_IDS.includes(r.id))) };
|
|
54
|
+
}
|
|
40
55
|
export function parseAssessmentNegotiation(body) {
|
|
41
56
|
if (!Object.hasOwn(body, 'assessment'))
|
|
42
57
|
return { status: 'unsupported' };
|
|
43
|
-
const result = readinessAssessmentSchema.safeParse(body.assessment);
|
|
58
|
+
const result = readinessAssessmentSchema.safeParse(withoutRetiredAssessmentRecords(body.assessment));
|
|
44
59
|
return result.success ? { status: 'available', assessment: result.data } : { status: 'unavailable' };
|
|
45
60
|
}
|
|
46
61
|
export function composeReadinessAssessment(negotiation, local = []) {
|
|
@@ -45,6 +45,8 @@ import { claudeReviewWorkflowPath } from "../claude-review-workflow.js";
|
|
|
45
45
|
import { runDefaultPlanePreflight } from "../plane/cli.js";
|
|
46
46
|
import { planeNotApplicableForTarget } from "../plane/endpoint.js";
|
|
47
47
|
import { resolvePlaneServerEndpoint } from "../plane/member-roster.js";
|
|
48
|
+
import { classifyBridgeCheckout, } from "../plane/preflight.js";
|
|
49
|
+
import { createPlaneFsDeps } from "../plane/defaults.js";
|
|
48
50
|
/** Fixed notice emitted to stderr when a source could not be collected. */
|
|
49
51
|
export const READINESS_COLLECTION_NOTICE = "one or more readiness sources could not be collected; the affected prerequisites are reported as warnings.";
|
|
50
52
|
/** Usage text for `epic-implementer readiness`. */
|
|
@@ -159,14 +161,7 @@ export async function resolveReadinessReviewPolicySource(access, fetchImpl) {
|
|
|
159
161
|
return "verdict_protocol";
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
|
-
|
|
163
|
-
* Build the production report for `repoRoot`.
|
|
164
|
-
*
|
|
165
|
-
* Every seam is a real, READ-ONLY one: the install doctor's own GET, the
|
|
166
|
-
* epic-implementer doctor's local inspections, and the same plane preflight
|
|
167
|
-
* `plane up` and `drive-epic` run. Nothing is re-implemented here.
|
|
168
|
-
*/
|
|
169
|
-
async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
164
|
+
export async function collectProductionReport(repoRoot, env, baseUrl, epicRunId, seams = {}) {
|
|
170
165
|
const { reportEnv, resolverEnv } = readinessEndpointEnvironments(env, baseUrl);
|
|
171
166
|
const accessResult = baseUrl === undefined
|
|
172
167
|
? await resolveConductorBridgeApiAccess({ env: reportEnv, cwd: repoRoot })
|
|
@@ -185,6 +180,20 @@ async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
|
185
180
|
});
|
|
186
181
|
}
|
|
187
182
|
const access = accessResult.ok ? accessResult.access : null;
|
|
183
|
+
// BAPI-1595 — Bridge-only plane checks (the repository root, the migration head,
|
|
184
|
+
// the executor build) apply to a Bridge checkout. The shared classifier
|
|
185
|
+
// decides: only a checkout with all four markers proven absent is skipped, and
|
|
186
|
+
// an unreadable one stays distinct from that, so its checks still run.
|
|
187
|
+
let applicability = "unknown";
|
|
188
|
+
if (planeNotApplicable === null) {
|
|
189
|
+
try {
|
|
190
|
+
applicability = await (seams.classifyCheckout ??
|
|
191
|
+
((root) => classifyBridgeCheckout(root, createPlaneFsDeps())))(repoRoot);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
applicability = "unknown";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
188
197
|
// Legacy rows retain their confirmed repository default. Version-1
|
|
189
198
|
// applicability is carried independently by the negotiated assessment.
|
|
190
199
|
const reviewPolicySource = await resolveReadinessReviewPolicySource(access);
|
|
@@ -228,7 +237,9 @@ async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
|
228
237
|
// are skipped without any probe.
|
|
229
238
|
...(planeNotApplicable === null
|
|
230
239
|
? {
|
|
231
|
-
runPlanePreflight: () =>
|
|
240
|
+
runPlanePreflight: () => seams.runPlanePreflight !== undefined
|
|
241
|
+
? seams.runPlanePreflight(repoRoot, reportEnv, applicability)
|
|
242
|
+
: runDefaultPlanePreflight(repoRoot, reportEnv, applicability),
|
|
232
243
|
// BAPI-1397 (F4): only for an applicable local plane.
|
|
233
244
|
...(epicRunId !== undefined ? { epicRunId } : {}),
|
|
234
245
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Canonical merging and bounded rendering; provider details never become public text. */
|
|
2
2
|
import { READINESS_PREREQUISITE_BY_ID, READINESS_LEGACY_IDS, READINESS_PREREQUISITE_CATALOG } from '../readiness-prerequisites.generated.js';
|
|
3
|
-
import {
|
|
3
|
+
import { resolveReadinessRemedy } from '../printed-remedy-commands.js';
|
|
4
4
|
import { createReadinessCheckSafely } from '../readiness-check.js';
|
|
5
5
|
export function mergeReadinessPrerequisites(checks, server = []) {
|
|
6
6
|
const rows = new Map();
|
|
@@ -14,15 +14,31 @@ export function mergeReadinessPrerequisites(checks, server = []) {
|
|
|
14
14
|
const unknown = check.status === 'warn' || (check.status === 'fail' && /unknown|unread|unavailable|could not|unreported|unreachable/i.test(check.detail ?? ''));
|
|
15
15
|
const status = check.status === 'pass' ? 'met' : check.status === 'skip' ? 'not_applicable' : unknown ? 'unknown' : 'not_met';
|
|
16
16
|
const impact = status === 'met' || status === 'not_applicable' ? 'info' : unknown || check.blocking !== true ? 'warning' : descriptor.impact;
|
|
17
|
-
|
|
17
|
+
// BAPI-1635: a known unmet check gets its per-ID remedy; only an unreadable one retries.
|
|
18
|
+
const fix = impact === 'info' ? '' : resolveReadinessRemedy({ id, state: status, scope: descriptor.scope });
|
|
18
19
|
const item = { ...descriptor, check_status: status, impact, fix };
|
|
19
20
|
const previous = rows.get(id);
|
|
20
21
|
if (!previous || previous.check_status === 'met')
|
|
21
22
|
rows.set(id, item);
|
|
22
23
|
}
|
|
23
|
-
for
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// A server row stays authoritative for status, impact, scope, and order. Only its
|
|
25
|
+
// blank fix is filled, by prerequisite ID, so a wire-compatible empty fix still
|
|
26
|
+
// shows the remedy for the state the server reported.
|
|
27
|
+
for (const item of server) {
|
|
28
|
+
// A blank fix on an unmet row is filled by ID: a known state gets its per-ID remedy, and only an
|
|
29
|
+
// unknown one gets the retry. Status, impact, scope and a non-blank fix are never touched.
|
|
30
|
+
const blankUnmet = item.fix === '' && (item.check_status === 'not_met' || item.check_status === 'unknown');
|
|
31
|
+
rows.set(item.id, blankUnmet && READINESS_PREREQUISITE_BY_ID.has(item.id)
|
|
32
|
+
? { ...item, fix: resolveReadinessRemedy({ id: item.id, state: item.check_status === 'unknown' ? 'unknown' : 'not_met', scope: item.scope, impact: item.impact }) }
|
|
33
|
+
: item);
|
|
34
|
+
}
|
|
35
|
+
// BAPI-1602 — a row this build no longer lists (an older server's retired row)
|
|
36
|
+
// is shown after the catalog rows with the server's own text, never dropped.
|
|
37
|
+
const known = new Set(READINESS_PREREQUISITE_CATALOG.map(d => d.id));
|
|
38
|
+
return [
|
|
39
|
+
...READINESS_PREREQUISITE_CATALOG.flatMap(d => rows.has(d.id) ? [rows.get(d.id)] : []),
|
|
40
|
+
...[...rows.values()].filter(row => !known.has(row.id)),
|
|
41
|
+
];
|
|
26
42
|
}
|
|
27
43
|
export function prerequisiteChecks(items) {
|
|
28
44
|
return items.map(p => createReadinessCheckSafely({ id: p.id, source: 'server', label: p.label,
|
|
@@ -55,8 +71,11 @@ export function formatReadinessAssessment(assessment, options = {}) {
|
|
|
55
71
|
const render = (record) => {
|
|
56
72
|
const evidence = `${label(record.id)} [${record.scope}${record.inspected_sha ? ` @ ${record.inspected_sha}` : '; revision unknown'}]: ${record.applicability === 'policy_inapplicable' ? `policy-inapplicable (${record.basis})` : `${record.observed_state}; ${record.applicability} (${record.basis})`}`;
|
|
57
73
|
lines.push(` ${evidence}`);
|
|
58
|
-
if (!options.initial && record.blocking_effect !== 'none')
|
|
59
|
-
|
|
74
|
+
if (!options.initial && record.blocking_effect !== 'none') {
|
|
75
|
+
const question = assessmentRemedyQuestion(record.remedy, [evidence]);
|
|
76
|
+
const override = options.remedyTextForRecord?.(record);
|
|
77
|
+
lines.push(renderSetupQuestion(override === undefined ? question : { ...question, purpose: override }));
|
|
78
|
+
}
|
|
60
79
|
};
|
|
61
80
|
if (options.initial) {
|
|
62
81
|
lines.push('Current observations; setup work is in progress.');
|
|
@@ -66,12 +85,12 @@ export function formatReadinessAssessment(assessment, options = {}) {
|
|
|
66
85
|
if (g.blockers.length || g.localBlockers.length) {
|
|
67
86
|
lines.push('Mandatory blockers');
|
|
68
87
|
g.blockers.forEach(render);
|
|
69
|
-
g.localBlockers.forEach(f => lines.push(` ${f.id}: ${f.observed_state}. Sign in or resolve this local fact, or defer and leave it unresolved; then rerun setup.`));
|
|
88
|
+
g.localBlockers.forEach(f => lines.push(f.remedy ? ` ${f.id}: ${f.observed_state}. ${f.remedy}` : ` ${f.id}: ${f.observed_state}. Sign in or resolve this local fact, or defer and leave it unresolved; then rerun setup.`));
|
|
70
89
|
}
|
|
71
90
|
if (g.unresolved.length || g.localUnresolved.length) {
|
|
72
91
|
lines.push('Unresolved mandatory evidence');
|
|
73
92
|
g.unresolved.forEach(render);
|
|
74
|
-
g.localUnresolved.forEach(f => lines.push(` ${f.id}: ${f.observed_state}. Retry this local observation, or defer and keep readiness unconfirmed.`));
|
|
93
|
+
g.localUnresolved.forEach(f => lines.push(f.remedy ? ` ${f.id}: ${f.observed_state}. ${f.remedy}` : ` ${f.id}: ${f.observed_state}. Retry this local observation, or defer and keep readiness unconfirmed.`));
|
|
75
94
|
}
|
|
76
95
|
const rest = assessment.records.filter(r => r.blocking_effect === 'none' && (options.all || r.applicability === 'policy_inapplicable' || r.id === 'server.parse-progress'));
|
|
77
96
|
if (rest.length) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { sanitizeHarnessCoverage } from "../executor/harness-coverage.js";
|
|
2
1
|
import { READINESS_PREREQUISITE_BY_ID } from "../readiness-prerequisites.generated.js";
|
|
3
2
|
/**
|
|
4
3
|
* The shared epic-implementer readiness SECTION layer (BAPI-1055).
|
|
@@ -223,13 +222,104 @@ const GATE_PROFILE_KIND_LABELS = {
|
|
|
223
222
|
mixed: "Mixed",
|
|
224
223
|
none: "None",
|
|
225
224
|
};
|
|
225
|
+
const GATE_CONSEQUENCE_BY_KIND = Object.freeze({
|
|
226
|
+
provider: "every check must have actually reported on this repository before an unattended run is admitted",
|
|
227
|
+
local: "the executor runs these commands before each auto-merge; they must pass once under the executor " +
|
|
228
|
+
"(qualification) before an unattended run is admitted",
|
|
229
|
+
mixed: "BOTH legs gate every merge: each provider check must report green AND each local command must pass",
|
|
230
|
+
});
|
|
231
|
+
/**
|
|
232
|
+
* The `none` gate's merge consequence, tied to the server's stamp rules in
|
|
233
|
+
* `api/library/db/epic_runs.py` (first-approval gate stamping):
|
|
234
|
+
*
|
|
235
|
+
* - `keeps_auto_merge` is true only for an UNATTENDED run whose policy names a
|
|
236
|
+
* feature (epic) branch, that is not a `repository_policy` review run, and that
|
|
237
|
+
* REQUESTED auto-merge. It then keeps that auto-merge with no required-check
|
|
238
|
+
* protection (reason `epic_branch_auto_merge_kept`); the final merge into the
|
|
239
|
+
* base branch is still human-gated.
|
|
240
|
+
* - Any other `none` run is downgraded and records
|
|
241
|
+
* `STAMP_REASON_NONE_PROFILE_MERGE_APPROVAL` (`none_profile_requires_merge_approval`):
|
|
242
|
+
* each child merge waits for approval.
|
|
243
|
+
* - A feature-branch `repository_policy` run is the one further case: it keeps its
|
|
244
|
+
* declared auto-merge too (`repository_policy_auto_merge_kept_without_ci`),
|
|
245
|
+
* merging under the repository's own rules.
|
|
246
|
+
*
|
|
247
|
+
* It is never claimed that every `none` run waits for approval, and the review
|
|
248
|
+
* mode alone is never used to infer which clause applies. The sentence is kept
|
|
249
|
+
* short on purpose: a readiness row's detail is capped at 400 characters, and a
|
|
250
|
+
* longer line would be cut off in the middle of these conditions. (The base-branch
|
|
251
|
+
* merge staying human-gated is stated in the server's own stamp message instead.)
|
|
252
|
+
*
|
|
253
|
+
* BAPI-1657: the wording is plain for the owner. It names no internal policy
|
|
254
|
+
* token, and the full no-checks readiness row must stay at or below 400 characters
|
|
255
|
+
* (watched-check and epic-branch CI clauses, when present, are appended after it).
|
|
256
|
+
*/
|
|
257
|
+
const NONE_GATE_CONSEQUENCE = "no required checks: an unattended epic-branch run that asked for auto-merge merges without check " +
|
|
258
|
+
"protection; a feature-branch run merges under the repository's own rules; every other run waits " +
|
|
259
|
+
"for owner approval before each child merge";
|
|
260
|
+
const WATCHED_CHECK_CONSEQUENCE = "watched checks are reported, not required: a completed red watched check can stop a merge, while a " +
|
|
261
|
+
"missing or unfinished one only warns";
|
|
262
|
+
/**
|
|
263
|
+
* The epic-branch CI consequence, from SERVER facts only. A reason is worded by
|
|
264
|
+
* what the server's producer proves for it, and three different situations stay
|
|
265
|
+
* apart: no trigger coverage (a recorded reason), a declined CI wait (the owner's
|
|
266
|
+
* decision), and unknown coverage (the install could not tell). Nothing here reads
|
|
267
|
+
* a workflow file; a local-only gate alone never claims that no workflow runs.
|
|
268
|
+
*/
|
|
269
|
+
function epicBranchCiConsequence(facts) {
|
|
270
|
+
const parts = [];
|
|
271
|
+
for (const reason of facts.no_ci_reasons) {
|
|
272
|
+
switch (reason) {
|
|
273
|
+
case "gate_profile_none":
|
|
274
|
+
parts.push("the server reports that no CI check gates child merges on the epic branch");
|
|
275
|
+
break;
|
|
276
|
+
case "gate_profile_local_only":
|
|
277
|
+
parts.push("the gate is local-only, so on a feature-branch run Bridge requires no provider check on epic-branch PRs");
|
|
278
|
+
break;
|
|
279
|
+
case "triggers_do_not_cover_epic":
|
|
280
|
+
parts.push("the evidence recorded at install says no pull_request trigger covers epic/**, so CI may not run on epic-branch PRs");
|
|
281
|
+
break;
|
|
282
|
+
default:
|
|
283
|
+
parts.push("the server reported an epic-branch CI reason this CLI does not recognize");
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (facts.decision === "decline") {
|
|
287
|
+
parts.push("you declined epic-branch CI, so child merges do not wait for CI checks on the epic branch");
|
|
288
|
+
}
|
|
289
|
+
if (facts.evidence !== null &&
|
|
290
|
+
facts.evidence.workflow_triggers_cover_epic === null &&
|
|
291
|
+
!facts.no_ci_reasons.includes("triggers_do_not_cover_epic")) {
|
|
292
|
+
parts.push("whether a pull_request trigger covers epic/** could not be told at install");
|
|
293
|
+
}
|
|
294
|
+
return parts.length === 0 ? null : `epic-branch CI: ${parts.join("; ")}`;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* BAPI-1637 — the ONE owner of gate-consequence wording, shared by readiness and
|
|
298
|
+
* the setup transcript so the two cannot word the same stored gate apart. Pure: it
|
|
299
|
+
* performs no I/O and reads no workflow. `ciFacts` is the readiness response's
|
|
300
|
+
* `epic_branch_ci` block; without it the line is gate-only, and no negative CI
|
|
301
|
+
* fact is invented. Returns one line, or `""` for a gate of unknown kind.
|
|
302
|
+
*/
|
|
303
|
+
export function describeGateConsequence(gate, ciFacts) {
|
|
304
|
+
if (gate.kind === null)
|
|
305
|
+
return "";
|
|
306
|
+
const parts = [gate.kind === "none" ? NONE_GATE_CONSEQUENCE : GATE_CONSEQUENCE_BY_KIND[gate.kind]];
|
|
307
|
+
if (gate.hasWatchedChecks)
|
|
308
|
+
parts.push(WATCHED_CHECK_CONSEQUENCE);
|
|
309
|
+
if (ciFacts !== undefined && ciFacts !== null) {
|
|
310
|
+
const ci = epicBranchCiConsequence(ciFacts);
|
|
311
|
+
if (ci !== null)
|
|
312
|
+
parts.push(ci);
|
|
313
|
+
}
|
|
314
|
+
return parts.join("; ");
|
|
315
|
+
}
|
|
226
316
|
/**
|
|
227
317
|
* One line describing a gate profile: kind, source, confirmation, revision,
|
|
228
318
|
* members, migration guard, and qualification state. Shared with the install
|
|
229
319
|
* doctor's section so the two surfaces cannot word the same profile apart.
|
|
230
320
|
* Only validated names are interpolated; everything else is a closed token.
|
|
231
321
|
*/
|
|
232
|
-
export function describeGateProfile(profile) {
|
|
322
|
+
export function describeGateProfile(profile, ciFacts) {
|
|
233
323
|
const kind = profile.kind === null ? "Unknown" : GATE_PROFILE_KIND_LABELS[profile.kind] ?? "Unknown";
|
|
234
324
|
const source = profile.source === "legacy"
|
|
235
325
|
? "legacy: pre-profile done-gate checks treated as a confirmed provider profile"
|
|
@@ -237,10 +327,16 @@ export function describeGateProfile(profile) {
|
|
|
237
327
|
const parts = [
|
|
238
328
|
`${kind} gate profile (${source}, ${profile.confirmed ? "confirmed" : "unconfirmed"}, revision ${profile.revision})`,
|
|
239
329
|
];
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
330
|
+
// BAPI-1606: required and watched provider checks are named separately. A
|
|
331
|
+
// watched check is reported but never required, so it is not gate coverage.
|
|
332
|
+
const describeCheck = (c) => `${quotedSubject(c.name, "")} ${c.outcome === "evidence_unavailable" ? "unavailable" : c.outcome ?? "unknown"}`;
|
|
333
|
+
const requiredChecks = profile.provider_checks.filter((c) => c.watched !== true);
|
|
334
|
+
const watchedChecks = profile.provider_checks.filter((c) => c.watched === true);
|
|
335
|
+
if (requiredChecks.length > 0) {
|
|
336
|
+
parts.push(`provider checks: ${requiredChecks.map(describeCheck).join(", ")}`);
|
|
337
|
+
}
|
|
338
|
+
if (watchedChecks.length > 0) {
|
|
339
|
+
parts.push(`watched checks (reported, not required): ${watchedChecks.map(describeCheck).join(", ")}`);
|
|
244
340
|
}
|
|
245
341
|
if (profile.local_commands.length > 0) {
|
|
246
342
|
parts.push(`local commands: ${profile.local_commands.map((c) => quotedSubject(c.name, "")).join(", ")}`);
|
|
@@ -252,9 +348,10 @@ export function describeGateProfile(profile) {
|
|
|
252
348
|
: `migration guard: ${profile.migration_guard.kind}${profile.migration_guard.name === null ? "" : ` ${quotedSubject(profile.migration_guard.name, "")}`}`);
|
|
253
349
|
if (profile.qualification_state !== null)
|
|
254
350
|
parts.push(`qualification: ${profile.qualification_state}`);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
351
|
+
// BAPI-1637: the consequence wording lives in one place, shared with setup.
|
|
352
|
+
const consequence = describeGateConsequence({ kind: profile.kind, hasWatchedChecks: watchedChecks.length > 0 }, ciFacts);
|
|
353
|
+
if (consequence !== "")
|
|
354
|
+
parts.push(consequence);
|
|
258
355
|
return parts.join("; ");
|
|
259
356
|
}
|
|
260
357
|
/** Fixed copy for a known warning code. Only the validated name is interpolated. */
|
|
@@ -264,6 +361,10 @@ export function describeGateProfileWarning(code, name) {
|
|
|
264
361
|
return `the check ${quotedSubject(name, "named in the gate profile")} has not been seen on an epic branch yet — this does not hold a launch`;
|
|
265
362
|
case "epic_branch_search_unavailable":
|
|
266
363
|
return "Bridge could not search epic branches for the gate-profile checks — this does not hold a launch";
|
|
364
|
+
case "watched_check_not_seen":
|
|
365
|
+
return `the watched check ${quotedSubject(name, "named in the gate profile")} has not been seen in recent history yet — a watched check is advisory, so this does not hold a launch`;
|
|
366
|
+
case "watched_check_evidence_unavailable":
|
|
367
|
+
return `Bridge could not read the history of the watched check ${quotedSubject(name, "named in the gate profile")} — a watched check is advisory, so this does not hold a launch`;
|
|
267
368
|
default:
|
|
268
369
|
return "the gate profile reported a warning this CLI does not recognize — this does not hold a launch";
|
|
269
370
|
}
|
|
@@ -272,6 +373,9 @@ export function describeGateProfileWarning(code, name) {
|
|
|
272
373
|
const GATE_PROFILE_WARNING_SECTION_IDS = {
|
|
273
374
|
provider_check_not_seen_on_epic_branches: "supervisor-gate-profile-epic-branch-unseen",
|
|
274
375
|
epic_branch_search_unavailable: "supervisor-gate-profile-epic-branch-search",
|
|
376
|
+
// BAPI-1606: warn-only watched-check rows, routed into the same warning section.
|
|
377
|
+
watched_check_not_seen: "supervisor-gate-profile-watched-unseen",
|
|
378
|
+
watched_check_evidence_unavailable: "supervisor-gate-profile-watched-evidence",
|
|
275
379
|
};
|
|
276
380
|
/**
|
|
277
381
|
* BAPI-1390 — the gate-profile section plus its warn-only rows. Emitted ONLY
|
|
@@ -281,7 +385,7 @@ const GATE_PROFILE_WARNING_SECTION_IDS = {
|
|
|
281
385
|
* not hold a launch, one section per known code (names joined) plus one
|
|
282
386
|
* generic section for codes this client does not recognize.
|
|
283
387
|
*/
|
|
284
|
-
export function gateProfileSections(profile) {
|
|
388
|
+
export function gateProfileSections(profile, epicBranchCi) {
|
|
285
389
|
if (profile === undefined)
|
|
286
390
|
return [];
|
|
287
391
|
if (profile === null) {
|
|
@@ -295,7 +399,7 @@ export function gateProfileSections(profile) {
|
|
|
295
399
|
},
|
|
296
400
|
];
|
|
297
401
|
}
|
|
298
|
-
const detail = describeGateProfile(profile);
|
|
402
|
+
const detail = describeGateProfile(profile, epicBranchCi);
|
|
299
403
|
const held = profile.read_failed ||
|
|
300
404
|
profile.stored_malformed ||
|
|
301
405
|
profile.verdict === "denied" ||
|
|
@@ -649,7 +753,7 @@ export function supervisorSection(readiness) {
|
|
|
649
753
|
}
|
|
650
754
|
}
|
|
651
755
|
// BAPI-1390 — nothing at all when the server did not report a profile.
|
|
652
|
-
sections.push(...gateProfileSections(readiness.gate_profile));
|
|
756
|
+
sections.push(...gateProfileSections(readiness.gate_profile, readiness.epic_branch_ci));
|
|
653
757
|
return sections;
|
|
654
758
|
}
|
|
655
759
|
export function githubCredentialsSection(readiness) {
|
|
@@ -1364,12 +1468,19 @@ export async function inspectWorkflowLocalPresence(readWorkflowFile) {
|
|
|
1364
1468
|
return code === "ENOENT" ? "absent" : "unreadable";
|
|
1365
1469
|
}
|
|
1366
1470
|
}
|
|
1471
|
+
/**
|
|
1472
|
+
* The worker-database rows a launch shows (BAPI-1594): the worker role and the
|
|
1473
|
+
* `bridgeapi` boundary. The inventory, harness, offline-Alembic and
|
|
1474
|
+
* "unverifiable" rows are `doctor`'s alone — a launch neither runs their probes
|
|
1475
|
+
* nor shows their rows.
|
|
1476
|
+
*/
|
|
1477
|
+
export const WORKER_DATABASE_LAUNCH_ROW_IDS = ["worker-db-role", "worker-db-boundary"];
|
|
1367
1478
|
/**
|
|
1368
1479
|
* BAPI-1496 — project the advisory worker-database doctor section into launch
|
|
1369
1480
|
* readiness rows.
|
|
1370
1481
|
*
|
|
1371
|
-
* Only non-healthy rows are projected: each becomes a `warn`
|
|
1372
|
-
* `blocking: false`, its existing `worker-db-*` id, fixed label and fixed
|
|
1482
|
+
* Only non-healthy role and boundary rows are projected: each becomes a `warn`
|
|
1483
|
+
* with `blocking: false`, its existing `worker-db-*` id, fixed label and fixed
|
|
1373
1484
|
* detail, and the BAPI-1479 runbook as its remedy. A healthy row adds nothing,
|
|
1374
1485
|
* so a healthy inspection leaves a launch's rows exactly as they were. PURE:
|
|
1375
1486
|
* it reads an already-collected section and never probes, and it can never
|
|
@@ -1378,6 +1489,7 @@ export async function inspectWorkflowLocalPresence(readWorkflowFile) {
|
|
|
1378
1489
|
*/
|
|
1379
1490
|
export function workerDatabaseReadinessChecks(section) {
|
|
1380
1491
|
return section.rows
|
|
1492
|
+
.filter((row) => WORKER_DATABASE_LAUNCH_ROW_IDS.includes(row.id))
|
|
1381
1493
|
.filter((row) => row.state !== "healthy")
|
|
1382
1494
|
.map((row) => ({
|
|
1383
1495
|
id: row.id,
|
|
@@ -1389,28 +1501,20 @@ export function workerDatabaseReadinessChecks(section) {
|
|
|
1389
1501
|
// Some doctor details already lead with their state ("unknown — …").
|
|
1390
1502
|
detail: row.detail.startsWith(`${row.state} — `) ? row.detail : `${row.state} — ${row.detail}`,
|
|
1391
1503
|
remediation: `${row.owner}: see ${WORKER_DATABASE_DOCTOR_RUNBOOK_SECTION}`,
|
|
1392
|
-
...(row.id === "worker-db-harness" && sanitizeHarnessCoverage(row.harness_coverage)
|
|
1393
|
-
? { harness_coverage: sanitizeHarnessCoverage(row.harness_coverage) } : {}),
|
|
1394
|
-
// Typed owner metadata rides on the harness row only, never on another row.
|
|
1395
|
-
...(row.id === "worker-db-harness" && row.owner_roles !== undefined && row.owner_roles.length > 0
|
|
1396
|
-
? { owner_roles: row.owner_roles, owner_role_total: row.owner_role_total ?? row.owner_roles.length }
|
|
1397
|
-
: {}),
|
|
1398
1504
|
}));
|
|
1399
1505
|
}
|
|
1400
1506
|
// ---------------------------------------------------------------------------
|
|
1401
1507
|
// BAPI-1506 — launch needs: human-only needs asked about before a run exists
|
|
1402
1508
|
// ---------------------------------------------------------------------------
|
|
1403
1509
|
/**
|
|
1404
|
-
* The closed set of
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1510
|
+
* The closed set of launch needs a create preview checks. BAPI-1596 removed the
|
|
1511
|
+
* usage-reset and epic-branch-behind-base needs: neither is harm, and a launch
|
|
1512
|
+
* neither produces nor shows them. The three that remain are evidence only.
|
|
1407
1513
|
*/
|
|
1408
1514
|
export const LAUNCH_NEEDS = [
|
|
1409
1515
|
"worker_db_role",
|
|
1410
1516
|
"self_hosted_runner",
|
|
1411
1517
|
"host_power",
|
|
1412
|
-
"usage_reset_after_run",
|
|
1413
|
-
"epic_branch_behind_base",
|
|
1414
1518
|
];
|
|
1415
1519
|
/** `present` = the need exists; `absent` = no need; `unverifiable` = could not tell. */
|
|
1416
1520
|
export const LAUNCH_NEED_STATES = ["present", "absent", "unverifiable", "not_applicable"];
|
|
@@ -1419,15 +1523,11 @@ export const LAUNCH_NEED_ROW_IDS = Object.freeze({
|
|
|
1419
1523
|
worker_db_role: "worker-db-role",
|
|
1420
1524
|
self_hosted_runner: "self-hosted-runner",
|
|
1421
1525
|
host_power: "host-sleep",
|
|
1422
|
-
usage_reset_after_run: "usage-reset-after-run",
|
|
1423
|
-
epic_branch_behind_base: "epic-branch-behind-base",
|
|
1424
1526
|
});
|
|
1425
1527
|
const LAUNCH_NEED_LABELS = Object.freeze({
|
|
1426
1528
|
worker_db_role: "Worker DB role",
|
|
1427
1529
|
self_hosted_runner: "Self-hosted runner for required checks",
|
|
1428
1530
|
host_power: "Host sleep",
|
|
1429
|
-
usage_reset_after_run: "Usage reset after the run",
|
|
1430
|
-
epic_branch_behind_base: "Epic branch behind base",
|
|
1431
1531
|
});
|
|
1432
1532
|
/** Each need's one-line remedy: the exit for its launch question. */
|
|
1433
1533
|
export const LAUNCH_NEED_REMEDIES = Object.freeze({
|
|
@@ -1435,11 +1535,7 @@ export const LAUNCH_NEED_REMEDIES = Object.freeze({
|
|
|
1435
1535
|
self_hosted_runner: "Start the self-hosted runner for the required checks (the machine that runs your CI jobs), " +
|
|
1436
1536
|
"then run /drive-epic-run again.",
|
|
1437
1537
|
host_power: PLANE_SLEEP_REMEDY,
|
|
1438
|
-
usage_reset_after_run: "Wait for the usage window to reset, or launch fewer tickets, then run /drive-epic-run again.",
|
|
1439
|
-
epic_branch_behind_base: "Integration's `sync_base` merges the base into the epic branch; no action is needed.",
|
|
1440
1538
|
});
|
|
1441
|
-
/** The estimate of one ticket's share of a run, for the usage row's likely end. */
|
|
1442
|
-
export const LAUNCH_USAGE_PER_TICKET_MINUTES = 120;
|
|
1443
1539
|
const LAUNCH_NEED_STATUS = Object.freeze({
|
|
1444
1540
|
present: "warn",
|
|
1445
1541
|
absent: "pass",
|
|
@@ -1450,8 +1546,7 @@ const LAUNCH_NEED_STATUS = Object.freeze({
|
|
|
1450
1546
|
* Build one launch-need row. The status follows the state (`present` and
|
|
1451
1547
|
* `unverifiable` warn, `absent` passes, `not_applicable` skips), `blocking` is
|
|
1452
1548
|
* always `false`, and every `present` and `unverifiable` row carries the need's
|
|
1453
|
-
* remedy. `asked` is `true` for
|
|
1454
|
-
* information-only branch row. `detail` must be fixed prose plus bounded counts
|
|
1549
|
+
* remedy. `asked` is `true` for every remaining need. `detail` must be fixed prose plus bounded counts
|
|
1455
1550
|
* or normalized times — never subprocess output, a path, a URL or a credential.
|
|
1456
1551
|
*/
|
|
1457
1552
|
export function buildLaunchNeedRow(need, state, detail, overrides = {}) {
|
|
@@ -1463,15 +1558,15 @@ export function buildLaunchNeedRow(need, state, detail, overrides = {}) {
|
|
|
1463
1558
|
blocking: false,
|
|
1464
1559
|
...(detail !== undefined && detail !== "" ? { detail } : {}),
|
|
1465
1560
|
...(needsRemedy ? { remedy: LAUNCH_NEED_REMEDIES[need] } : {}),
|
|
1466
|
-
launch_need: { need, state, asked:
|
|
1561
|
+
launch_need: { need, state, asked: true },
|
|
1467
1562
|
};
|
|
1468
1563
|
}
|
|
1469
1564
|
// --- Worker DB role (local only; reuses BAPI-1496's doctor row) --------------
|
|
1470
1565
|
/**
|
|
1471
1566
|
* The `worker-db-role` launch-need state from an already-collected doctor
|
|
1472
1567
|
* section. `null` section = the inspection did not run (no inspector);
|
|
1473
|
-
* a section without the role row = the inspection failed (
|
|
1474
|
-
*
|
|
1568
|
+
* a section without the role row = the inspection failed (a failed launch
|
|
1569
|
+
* inspection supplies no rows at all, and the role stays unverifiable). `healthy` → absent; `unsafe` (including
|
|
1475
1570
|
* `role_missing`) → present; `unknown` → unverifiable.
|
|
1476
1571
|
*/
|
|
1477
1572
|
export function workerDbRoleLaunchState(section) {
|
|
@@ -1568,94 +1663,6 @@ export function buildHostPowerLaunchRow(fact) {
|
|
|
1568
1663
|
return buildLaunchNeedRow("host_power", "unverifiable", `unverifiable — ${HOST_POWER_UNVERIFIABLE_DETAIL[fact.reason] ?? HOST_POWER_UNVERIFIABLE_DETAIL.probe_failed}`);
|
|
1569
1664
|
}
|
|
1570
1665
|
}
|
|
1571
|
-
// --- Usage resets after the run's likely end ---------------------------------
|
|
1572
|
-
/** The warning-state rule the producer applies (`executor/observation.ts`). */
|
|
1573
|
-
const LAUNCH_USAGE_WARNING_PERCENT = 75;
|
|
1574
|
-
/** Fixed wording for "no stored advisory": information, not a fault. */
|
|
1575
|
-
export const LAUNCH_USAGE_NO_ADVISORY_DETAIL = "No usage warning is stored for this repository. Usage was below the warning threshold, or retention removed the record.";
|
|
1576
|
-
function isoSeconds(ms) {
|
|
1577
|
-
return new Date(ms).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* The usage launch-need row.
|
|
1581
|
-
*
|
|
1582
|
-
* The likely end is an ESTIMATE: `now + child_count × LAUNCH_USAGE_PER_TICKET_MINUTES`.
|
|
1583
|
-
* `present` = a warning-state advisory (utilization ≥ 75% or status not exactly
|
|
1584
|
-
* `allowed`) whose reset falls after the likely end. `absent` = an advisory not
|
|
1585
|
-
* in its warning state, or one that resets at or before the likely end.
|
|
1586
|
-
* Everything that cannot be decided — no reset, an unparseable reset, a
|
|
1587
|
-
* malformed or unavailable read, no child count, or no stored advisory at all —
|
|
1588
|
-
* is `unverifiable` and only warns.
|
|
1589
|
-
*/
|
|
1590
|
-
export function buildUsageResetAfterRunLaunchRow(input) {
|
|
1591
|
-
const { advisory, childCount, nowMs } = input;
|
|
1592
|
-
const unverifiable = (why) => buildLaunchNeedRow("usage_reset_after_run", "unverifiable", `unverifiable — ${why}`);
|
|
1593
|
-
if (advisory.state === "unavailable")
|
|
1594
|
-
return unverifiable("the stored usage advisory could not be read");
|
|
1595
|
-
if (advisory.state === "absent")
|
|
1596
|
-
return unverifiable("the stored usage advisory is malformed");
|
|
1597
|
-
if (advisory.state === "below_warning_threshold") {
|
|
1598
|
-
return buildLaunchNeedRow("usage_reset_after_run", "unverifiable", LAUNCH_USAGE_NO_ADVISORY_DETAIL);
|
|
1599
|
-
}
|
|
1600
|
-
const percent = advisory.utilization_percent;
|
|
1601
|
-
const warning = (typeof percent === "number" && percent >= LAUNCH_USAGE_WARNING_PERCENT) || advisory.status !== "allowed";
|
|
1602
|
-
const observed = [];
|
|
1603
|
-
if (advisory.observed_at !== null) {
|
|
1604
|
-
const observedMs = Date.parse(advisory.observed_at);
|
|
1605
|
-
if (Number.isFinite(observedMs))
|
|
1606
|
-
observed.push(`observed ${isoSeconds(observedMs)}`);
|
|
1607
|
-
}
|
|
1608
|
-
if (advisory.stale === true)
|
|
1609
|
-
observed.push("stale");
|
|
1610
|
-
const observedNote = observed.length > 0 ? ` (${observed.join(", ")})` : "";
|
|
1611
|
-
const percentText = typeof percent === "number" ? `${percent}%` : "unknown";
|
|
1612
|
-
if (!warning) {
|
|
1613
|
-
return buildLaunchNeedRow("usage_reset_after_run", "absent", `absent — the last observed usage (${percentText}) is not in its warning state${observedNote}`);
|
|
1614
|
-
}
|
|
1615
|
-
if (childCount === null ||
|
|
1616
|
-
typeof childCount !== "number" ||
|
|
1617
|
-
!Number.isSafeInteger(childCount) ||
|
|
1618
|
-
childCount <= 0 ||
|
|
1619
|
-
!Number.isFinite(nowMs)) {
|
|
1620
|
-
return unverifiable(`the run's ticket count is unknown, so its likely end cannot be estimated${observedNote}`);
|
|
1621
|
-
}
|
|
1622
|
-
const likelyEndMs = nowMs + childCount * LAUNCH_USAGE_PER_TICKET_MINUTES * 60_000;
|
|
1623
|
-
if (!Number.isFinite(likelyEndMs) || !Number.isFinite(new Date(likelyEndMs).getTime())) {
|
|
1624
|
-
return unverifiable("the run's likely end cannot be estimated");
|
|
1625
|
-
}
|
|
1626
|
-
const estimate = `estimated likely end ${isoSeconds(likelyEndMs)} ` +
|
|
1627
|
-
`(now + ${childCount} × ${LAUNCH_USAGE_PER_TICKET_MINUTES} minutes)`;
|
|
1628
|
-
const resetMs = advisory.resets_at !== null ? Date.parse(advisory.resets_at) : Number.NaN;
|
|
1629
|
-
if (!Number.isFinite(resetMs)) {
|
|
1630
|
-
return unverifiable(`the last observed usage (${percentText}) is in its warning state but has no usable reset time; ${estimate}${observedNote}`);
|
|
1631
|
-
}
|
|
1632
|
-
if (resetMs > likelyEndMs) {
|
|
1633
|
-
return buildLaunchNeedRow("usage_reset_after_run", "present", `present — the last observed usage (${percentText}) is in its warning state and resets ${isoSeconds(resetMs)}, ` +
|
|
1634
|
-
`after the ${estimate}${observedNote}`);
|
|
1635
|
-
}
|
|
1636
|
-
return buildLaunchNeedRow("usage_reset_after_run", "absent", `absent — the last observed usage (${percentText}) resets ${isoSeconds(resetMs)}, at or before the ${estimate}${observedNote}`);
|
|
1637
|
-
}
|
|
1638
|
-
const BRANCH_NOT_APPLICABLE_DETAIL = Object.freeze({
|
|
1639
|
-
no_epic_branch: "not applicable — this run targets the base branch directly",
|
|
1640
|
-
branch_not_on_origin: "not applicable — the epic branch does not exist on origin yet; it will be cut fresh",
|
|
1641
|
-
});
|
|
1642
|
-
const BRANCH_UNVERIFIABLE_DETAIL = Object.freeze({
|
|
1643
|
-
no_base_branch: "the base branch the epic branch is cut from is unknown",
|
|
1644
|
-
invalid_branch_name: "a branch name failed validation",
|
|
1645
|
-
git_failed: "git could not compare the epic branch with its base",
|
|
1646
|
-
});
|
|
1647
|
-
export function buildEpicBranchBehindBaseLaunchRow(fact) {
|
|
1648
|
-
switch (fact.state) {
|
|
1649
|
-
case "present":
|
|
1650
|
-
return buildLaunchNeedRow("epic_branch_behind_base", "present", `present — the epic branch is ${fact.behind} commit(s) behind its base (information only)`);
|
|
1651
|
-
case "absent":
|
|
1652
|
-
return buildLaunchNeedRow("epic_branch_behind_base", "absent", "absent — the epic branch is not behind its base");
|
|
1653
|
-
case "not_applicable":
|
|
1654
|
-
return buildLaunchNeedRow("epic_branch_behind_base", "not_applicable", BRANCH_NOT_APPLICABLE_DETAIL[fact.reason] ?? BRANCH_NOT_APPLICABLE_DETAIL.no_epic_branch);
|
|
1655
|
-
default:
|
|
1656
|
-
return buildLaunchNeedRow("epic_branch_behind_base", "unverifiable", `unverifiable — ${BRANCH_UNVERIFIABLE_DETAIL[fact.reason] ?? BRANCH_UNVERIFIABLE_DETAIL.git_failed}`);
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
1666
|
/** Explicit assessment explanations alongside the unchanged legacy sections. */
|
|
1660
1667
|
export function assessmentWorkflowExplanations(readiness) {
|
|
1661
1668
|
return readiness.assessment?.records.filter(r => r.scope === 'default_branch' || r.scope === 'indexed_commit')
|
|
@@ -541,7 +541,7 @@ export function gateProfileChecks(readiness) {
|
|
|
541
541
|
}),
|
|
542
542
|
];
|
|
543
543
|
}
|
|
544
|
-
const detail = describeGateProfile(profile);
|
|
544
|
+
const detail = describeGateProfile(profile, readiness.epic_branch_ci);
|
|
545
545
|
let row;
|
|
546
546
|
if (profile.read_failed || profile.stored_malformed) {
|
|
547
547
|
row = createReadinessCheckSafely({
|
|
@@ -194,7 +194,7 @@ function parseTicketRecoveryArgs(argv) {
|
|
|
194
194
|
*/
|
|
195
195
|
async function resolveRecoveryAccess(json) {
|
|
196
196
|
const { resolveConductorBridgeApiAccess } = await import("./bridge-api-client.js");
|
|
197
|
-
const result = await resolveConductorBridgeApiAccess();
|
|
197
|
+
const result = await resolveConductorBridgeApiAccess({ followEpicLaunchProfile: true });
|
|
198
198
|
if (!result.ok) {
|
|
199
199
|
if (json) {
|
|
200
200
|
console.log(JSON.stringify({ ok: false, kind: "unauthorized", error: result.error }));
|
|
@@ -2756,6 +2756,17 @@ export function formatEscalateError(error) {
|
|
|
2756
2756
|
export async function runEscalateCommand(argv, deps = {}) {
|
|
2757
2757
|
// Captured before parsing can throw, so a malformed command line still answers
|
|
2758
2758
|
// in the format the caller asked for.
|
|
2759
|
+
// BAPI-1642: the driver guard's detached lapse FYI. Exactly
|
|
2760
|
+
// `--lapse-record <path>`; it composes its own fixed request from the
|
|
2761
|
+
// guard-owned record and never takes free text from argv.
|
|
2762
|
+
if (argv[0] === "--lapse-record") {
|
|
2763
|
+
if (argv.length !== 2) {
|
|
2764
|
+
console.error("Error: --lapse-record takes exactly one path and no other flag.");
|
|
2765
|
+
return 1;
|
|
2766
|
+
}
|
|
2767
|
+
const { runLapseRecord } = await import("./driver-lapse.js");
|
|
2768
|
+
return runLapseRecord(argv[1]);
|
|
2769
|
+
}
|
|
2759
2770
|
const json = argv.includes("--json");
|
|
2760
2771
|
const fail = (document) => {
|
|
2761
2772
|
if (json)
|
|
@@ -2783,7 +2794,7 @@ export async function runEscalateCommand(argv, deps = {}) {
|
|
|
2783
2794
|
}
|
|
2784
2795
|
const resolveAccess = deps.resolveAccess ?? (async () => {
|
|
2785
2796
|
const { resolveConductorBridgeApiAccess } = await import("./bridge-api-client.js");
|
|
2786
|
-
const resolved = await resolveConductorBridgeApiAccess();
|
|
2797
|
+
const resolved = await resolveConductorBridgeApiAccess({ followEpicLaunchProfile: true });
|
|
2787
2798
|
return resolved.ok ? resolved.access : null;
|
|
2788
2799
|
});
|
|
2789
2800
|
const access = await resolveAccess();
|
package/build/conductor/tools.js
CHANGED
|
@@ -19,8 +19,9 @@ function jsonResult(value) {
|
|
|
19
19
|
return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* BAPI-1557: compact (unindented) JSON, used
|
|
23
|
-
* other conductor tool keeps {@link jsonResult}'s
|
|
22
|
+
* BAPI-1557: compact (unindented) JSON, used by `get_epic_snapshot`; BAPI-1649
|
|
23
|
+
* adds `explain_run`. Every other conductor tool keeps {@link jsonResult}'s
|
|
24
|
+
* pretty output.
|
|
24
25
|
*/
|
|
25
26
|
function compactJsonResult(value) {
|
|
26
27
|
return { content: [{ type: "text", text: JSON.stringify(value) }] };
|
|
@@ -126,7 +127,7 @@ function registerExplainRunTool(registerTool) {
|
|
|
126
127
|
include_run: z
|
|
127
128
|
.boolean()
|
|
128
129
|
.optional()
|
|
129
|
-
.describe("With ticket_key:
|
|
130
|
+
.describe("With ticket_key: return full run summary, lists."),
|
|
130
131
|
},
|
|
131
132
|
}, withConductorToolErrorHandling(async (args) => {
|
|
132
133
|
const epicRunId = args.epic_run_id;
|
|
@@ -138,7 +139,7 @@ function registerExplainRunTool(registerTool) {
|
|
|
138
139
|
throw new ConductorValidationError(accessResult.error);
|
|
139
140
|
}
|
|
140
141
|
try {
|
|
141
|
-
return
|
|
142
|
+
return compactJsonResult(await fetchExplainRun(accessResult.access, epicRunId, ticketKey, undefined, includeRun !== undefined ? { include_run: includeRun } : {}));
|
|
142
143
|
}
|
|
143
144
|
catch (error) {
|
|
144
145
|
if (error instanceof ConductorBridgeApiError && error.status === 404) {
|
|
@@ -146,7 +147,7 @@ function registerExplainRunTool(registerTool) {
|
|
|
146
147
|
// exists but has no such ticket" — the server distinguishes them and
|
|
147
148
|
// collapsing both to one envelope would throw that away. No server
|
|
148
149
|
// detail is echoed either way.
|
|
149
|
-
return
|
|
150
|
+
return compactJsonResult({ status: "unknown", scope });
|
|
150
151
|
}
|
|
151
152
|
throw error;
|
|
152
153
|
}
|