@bridge_gpt/mcp-server 0.2.71 → 0.2.72
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 +55 -17
- package/build/agent-launchers/claude-executor-adapter.js +19 -3
- package/build/agent-notes.js +171 -95
- package/build/agents.generated.js +4 -4
- package/build/bridge-permissions.js +4 -0
- package/build/bridge-worktree-inspection.js +237 -0
- package/build/check-evidence.js +6 -0
- package/build/claude-review-workflow.js +1 -1
- package/build/cli-help.js +6 -0
- package/build/codex-auto-recovery.js +126 -0
- package/build/codex-skill-adapter.js +2 -0
- package/build/commands.generated.js +5 -5
- package/build/conductor/bridge-api-client.js +518 -23
- package/build/conductor/doctor.js +84 -10
- package/build/conductor/epic-implementer-cli.js +51 -2
- package/build/conductor/gate-discovery.js +136 -10
- package/build/conductor/gate-settings-review.js +305 -5
- package/build/conductor/git-hooks-uninstall.js +112 -0
- package/build/conductor/git-hooks.js +81 -15
- package/build/conductor/guided-repair.js +10 -1
- package/build/conductor/install-doctor.js +2 -4
- package/build/conductor/launch-plan.js +42 -2
- package/build/conductor/local-merge.js +12 -1
- package/build/conductor/merge-execution-contract.js +1 -1
- package/build/conductor/merged-child-check.js +2 -1
- package/build/conductor/prerequisite-inputs.js +379 -0
- package/build/conductor/readiness-assessment.js +78 -0
- package/build/conductor/readiness-cli.js +10 -0
- package/build/conductor/readiness-prerequisites.js +53 -0
- package/build/conductor/readiness-sections.js +21 -8
- package/build/conductor/readiness.js +20 -2
- package/build/conductor/recovery-cli.js +223 -13
- package/build/conductor/recovery-operations.js +34 -4
- package/build/conductor/repair-contract.js +33 -0
- package/build/conductor/tools.js +34 -3
- package/build/conductor/wait-run-attention.js +115 -0
- package/build/conductor/wait-run-cli.js +96 -3
- package/build/conductor/worker-database-doctor-inspector.js +1 -0
- package/build/credential-store.js +25 -20
- package/build/dependency-install-declarations.js +157 -0
- package/build/docs.generated.js +4 -4
- package/build/doctor.js +37 -5
- package/build/drive-epic-help.js +2 -2
- package/build/drive-epic.js +52 -11
- package/build/epic-implementer-bin.js +118 -43
- package/build/epic-launch-profile.js +1 -1
- package/build/executor/cli.js +2 -0
- package/build/executor/completion-contract.js +16 -0
- package/build/executor/credentials.js +1 -1
- package/build/executor/delivery-observations.js +113 -0
- package/build/executor/delivery-outcome.js +30 -0
- package/build/executor/dependency-refresh-runner.js +132 -0
- package/build/executor/dependency-refresh.js +530 -0
- package/build/executor/deps.js +4 -0
- package/build/executor/env.js +67 -2
- package/build/executor/harness-coverage.js +19 -0
- package/build/executor/http-client.js +35 -1
- package/build/executor/index.js +2 -1
- package/build/executor/install-preflight.js +1 -1
- package/build/executor/job-runner.js +246 -28
- package/build/executor/likely-tests.js +94 -97
- package/build/executor/prompt-spec.js +13 -3
- package/build/executor/required-verification.js +28 -0
- package/build/executor/required-work-diagnostics.js +30 -0
- package/build/executor/required-work-ledger.js +19 -1
- package/build/executor/results.js +42 -0
- package/build/executor/service-discovery.js +42 -0
- package/build/executor/service-lifecycle.js +109 -2
- package/build/executor/service-uninstall.js +205 -0
- package/build/executor/service-unit.js +5 -3
- package/build/executor/test-clock.js +3 -0
- package/build/executor/verification-hints.js +179 -0
- package/build/executor/worker-command.js +54 -2
- package/build/executor/worker-database.js +271 -31
- package/build/executor/worker-finalization.js +65 -10
- package/build/executor/worker-guard-hook.js +10 -2
- package/build/executor/worker-verification-guidance.js +37 -2
- package/build/executor/worktree-inspection.js +42 -0
- package/build/github-sign-in.js +1 -1
- package/build/index.js +679 -278
- package/build/init.js +3 -3
- package/build/install-bridge-conductor-gate.js +236 -42
- package/build/install-bridge-conductor-setup.js +115 -26
- package/build/install-bridge-conductor.js +448 -350
- package/build/install-bridge.js +418 -123
- package/build/install-maintenance.js +104 -0
- package/build/install-reexec.js +1 -1
- package/build/local-cleanup.js +59 -0
- package/build/mcp-install-state.js +68 -2
- package/build/merge-workflow-install.js +2 -2
- package/build/package-script-semantics.js +10 -0
- package/build/pipeline-utils.js +1 -1
- package/build/pipelines.generated.js +5 -5
- package/build/plan-execution-ledger.js +148 -2
- package/build/plane/plane-freshness.js +6 -7
- package/build/plane/terminal-run-cleanup.js +5 -1
- package/build/plane/terminal-run-status.js +4 -0
- package/build/printed-remedy-commands.js +24 -4
- package/build/readiness-check.js +1 -78
- package/build/readiness-prerequisites.generated.js +199 -0
- package/build/readme.generated.js +1 -1
- package/build/repository-toolchains.js +50 -8
- package/build/setup-change-policy.js +32 -0
- package/build/setup-epic.js +2 -2
- package/build/setup-question.js +62 -0
- package/build/start-tickets.js +4 -0
- package/build/test-command-detection.js +32 -88
- package/build/test-support/notes-fs.js +40 -0
- package/build/ticket-delivery-enrollment.js +21 -8
- package/build/ticket-delivery-run-scope.js +128 -0
- package/build/version.generated.js +3 -3
- package/build/worker-guard-hook-bin.js +2 -2
- package/build/worktrees.js +105 -0
- package/docs/EPIC-IMPLEMENTER.md +5 -0
- package/docs/epic-implementer/getting-started.md +40 -15
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { composeReadinessAssessment, deriveAdvisoryVerdict } from './readiness-assessment.js';
|
|
2
|
+
import { localReadinessFacts } from './readiness.js';
|
|
1
3
|
/**
|
|
2
4
|
* The `epic-implementer readiness` command surface (BAPI-1055, AC-6).
|
|
3
5
|
*
|
|
@@ -183,6 +185,8 @@ async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
|
183
185
|
});
|
|
184
186
|
}
|
|
185
187
|
const access = accessResult.ok ? accessResult.access : null;
|
|
188
|
+
// Legacy rows retain their confirmed repository default. Version-1
|
|
189
|
+
// applicability is carried independently by the negotiated assessment.
|
|
186
190
|
const reviewPolicySource = await resolveReadinessReviewPolicySource(access);
|
|
187
191
|
return collectConductorReadinessGate({
|
|
188
192
|
// Never guessed: an unresolved identity is reported as such rather than
|
|
@@ -197,6 +201,7 @@ async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
|
197
201
|
// `verdict_protocol` whenever that cannot be established. This is a
|
|
198
202
|
// prospective assessment, not a prediction or authorization of any run.
|
|
199
203
|
reviewPolicySource,
|
|
204
|
+
assessmentVersion: 1,
|
|
200
205
|
// BAPI-1465: an explicit run id also scopes the effective-review-mode row.
|
|
201
206
|
...(epicRunId !== undefined ? { epicRunId } : {}),
|
|
202
207
|
readWorkflowFile: () => fsReadFile(claudeReviewWorkflowPath(repoRoot), "utf-8"),
|
|
@@ -255,6 +260,11 @@ export async function runConductorReadinessCommand(argv, deps = {}) {
|
|
|
255
260
|
const collect = deps.collect ??
|
|
256
261
|
((repoRoot) => collectProductionReport(repoRoot, env, parsed.baseUrl, parsed.epicRunId));
|
|
257
262
|
const report = await collect(cwd);
|
|
263
|
+
report.assessmentNegotiation ??= { status: 'unavailable' };
|
|
264
|
+
if (report.assessmentNegotiation.status === 'available') {
|
|
265
|
+
report.assessment = report.assessmentNegotiation.assessment;
|
|
266
|
+
report.advisoryVerdict = deriveAdvisoryVerdict(composeReadinessAssessment(report.assessmentNegotiation, localReadinessFacts(report.checks)));
|
|
267
|
+
}
|
|
258
268
|
// Fixed, sanitized, and stderr-only: never a credential, exception, header,
|
|
259
269
|
// body, subprocess output, or absolute path. It fires on a COLLECTION gap,
|
|
260
270
|
// not on a failed prerequisite — a report that says "a source is missing"
|
|
@@ -39,3 +39,56 @@ export function formatReadinessPrerequisites(items, options = {}) {
|
|
|
39
39
|
const state = { met: 'Met', not_met: 'Not met', unknown: "Couldn't check", not_applicable: 'Not applicable' };
|
|
40
40
|
return [verdict, ...selected.flatMap(p => [` ${p.label}: ${state[p.check_status]}`, ...(p.fix && ['not_met', 'unknown'].includes(p.check_status) ? [` ${p.fix}`] : [])])];
|
|
41
41
|
}
|
|
42
|
+
/** The explicit assessment path never derives policy from legacy text. */
|
|
43
|
+
export { composeReadinessAssessment, deriveAdvisoryVerdict } from './readiness-assessment.js';
|
|
44
|
+
import { assessmentGroups, assessmentContextLabel, deriveAdvisoryVerdict as advisoryVerdict } from './readiness-assessment.js';
|
|
45
|
+
import { assessmentRemedyQuestion } from '../printed-remedy-commands.js';
|
|
46
|
+
import { renderSetupQuestion } from '../setup-question.js';
|
|
47
|
+
export function formatReadinessAssessment(assessment, options = {}) {
|
|
48
|
+
const lines = [`Assessment: ${assessmentContextLabel(assessment)} (advisory only)`];
|
|
49
|
+
if (assessment.negotiation !== 'available')
|
|
50
|
+
lines.push(assessment.negotiation === 'unsupported'
|
|
51
|
+
? 'Version-1 assessment unsupported. Upgrade the Bridge backend or contact Bridge support; mandatory coverage remains unconfirmed.'
|
|
52
|
+
: 'Assessment unavailable. Retry readiness or contact Bridge support; mandatory coverage remains unconfirmed.');
|
|
53
|
+
const g = assessmentGroups(assessment);
|
|
54
|
+
const label = (id) => READINESS_PREREQUISITE_BY_ID.get(id)?.label ?? { 'server.canonical-index': 'Canonical index validity', 'server.parse-progress': 'Parse progress' }[id] ?? id;
|
|
55
|
+
const render = (record) => {
|
|
56
|
+
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
|
+
lines.push(` ${evidence}`);
|
|
58
|
+
if (!options.initial && record.blocking_effect !== 'none')
|
|
59
|
+
lines.push(renderSetupQuestion(assessmentRemedyQuestion(record.remedy, [evidence])));
|
|
60
|
+
};
|
|
61
|
+
if (options.initial) {
|
|
62
|
+
lines.push('Current observations; setup work is in progress.');
|
|
63
|
+
assessment.records.forEach(render);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
if (g.blockers.length || g.localBlockers.length) {
|
|
67
|
+
lines.push('Mandatory blockers');
|
|
68
|
+
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.`));
|
|
70
|
+
}
|
|
71
|
+
if (g.unresolved.length || g.localUnresolved.length) {
|
|
72
|
+
lines.push('Unresolved mandatory evidence');
|
|
73
|
+
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.`));
|
|
75
|
+
}
|
|
76
|
+
const rest = assessment.records.filter(r => r.blocking_effect === 'none' && (options.all || r.applicability === 'policy_inapplicable' || r.id === 'server.parse-progress'));
|
|
77
|
+
if (rest.length) {
|
|
78
|
+
lines.push('Evidence and diagnostic progress');
|
|
79
|
+
rest.forEach(render);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const indexed = assessment.records.find(r => r.scope === 'indexed_commit')?.inspected_sha;
|
|
83
|
+
const current = assessment.records.find(r => r.scope === 'default_branch')?.inspected_sha;
|
|
84
|
+
lines.push(indexed && current ? (indexed === current ? `Workflow observations share revision ${indexed}.` : `Workflow revision mismatch: indexed ${indexed}; default branch ${current}.`) : 'Workflow revision comparison is unknown.');
|
|
85
|
+
const diagnostics = assessment.local.filter(f => f.impact === 'advisory');
|
|
86
|
+
if (diagnostics.length)
|
|
87
|
+
lines.push('Local maintenance observations (not server proof)', ...diagnostics.map(f => ` ${f.id}: ${f.observed_state}`));
|
|
88
|
+
const optional = assessment.local.filter(f => f.impact === 'optional');
|
|
89
|
+
if (!options.initial && optional.length)
|
|
90
|
+
lines.push('Optional capability', ...optional.map(f => ` ${f.id}: ${f.observed_state}. Install a persistent executor for background work, or defer it. Launch still checks its required executor capability independently.`));
|
|
91
|
+
if (!options.initial)
|
|
92
|
+
lines.push(`${advisoryVerdict(assessment)} — ${assessmentContextLabel(assessment)}; advisory only.`);
|
|
93
|
+
return lines;
|
|
94
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sanitizeHarnessCoverage } from "../executor/harness-coverage.js";
|
|
1
2
|
import { READINESS_PREREQUISITE_BY_ID } from "../readiness-prerequisites.generated.js";
|
|
2
3
|
/**
|
|
3
4
|
* The shared epic-implementer readiness SECTION layer (BAPI-1055).
|
|
@@ -36,6 +37,7 @@ import { READINESS_PREREQUISITE_BY_ID } from "../readiness-prerequisites.generat
|
|
|
36
37
|
*/
|
|
37
38
|
import { CONSUMER_GUIDE_POINTER, PRINTED_CONNECT_GITHUB_COMMAND } from "../printed-remedy-commands.js";
|
|
38
39
|
import { MANAGED_HOOK_NAMES } from "./git-hooks.js";
|
|
40
|
+
import { posixShellQuote } from "../platform-escaping.js";
|
|
39
41
|
import { MCP_PACKAGE_NAME } from "../mcp-identity.js";
|
|
40
42
|
import { CLAUDE_REVIEW_WORKFLOW_DRIFT_REMEDIATION, summarizeClaudeReviewWorkflowDrift, } from "../claude-review-workflow-drift.js";
|
|
41
43
|
import { describeNativeLedgerAvailability, GH_ACTIONS_MERGE_AUTH_REMEDIATION, GH_ACTIONS_MERGE_SKIPPED_DETAIL, GH_ACTIONS_MERGE_UNOBSERVABLE_REMEDIATION, WORKER_DATABASE_DOCTOR_OWNER, WORKER_DATABASE_DOCTOR_RUNBOOK_SECTION, } from "./doctor.js";
|
|
@@ -48,12 +50,12 @@ export const CONDUCTOR_OPERATOR_RUNBOOK_POINTER = CONSUMER_GUIDE_POINTER;
|
|
|
48
50
|
/**
|
|
49
51
|
* Capability-matrix guidance for the executor leg.
|
|
50
52
|
*
|
|
51
|
-
* Amended by BAPI-779 (R-1): `install
|
|
53
|
+
* Amended by BAPI-779 (R-1): `install epic-implementer` can now write the unit AND
|
|
52
54
|
* start it, each behind its own consent. What did NOT change is the readiness
|
|
53
55
|
* rule — `executor_ready` still comes only from a live server observation, so
|
|
54
56
|
* neither a written unit nor a successful local start may produce that claim.
|
|
55
57
|
*/
|
|
56
|
-
export const EXECUTOR_PROVISIONING_GUIDANCE = "`install
|
|
58
|
+
export const EXECUTOR_PROVISIONING_GUIDANCE = "`install epic-implementer` writes the unit and starts it, each behind its own consent; " +
|
|
57
59
|
"readiness still comes only from a live server observation";
|
|
58
60
|
/**
|
|
59
61
|
* The `BRIDGE_MCP_PROFILE` token that makes the 8 Epic Implementer MCP tools visible.
|
|
@@ -65,22 +67,22 @@ export const EXECUTOR_PROVISIONING_GUIDANCE = "`install conductor` writes the un
|
|
|
65
67
|
export const EPIC_IMPLEMENTER_PROFILE_TOKEN = "epic_implementer";
|
|
66
68
|
/** Remediation for a host MCP config that carries no Bridge entry at all. */
|
|
67
69
|
export const CONDUCTOR_PROFILE_TOKEN_NO_ENTRY_REMEDIATION = "no supported host MCP config carries a Bridge entry — run " +
|
|
68
|
-
`\`npx ${MCP_PACKAGE_NAME} install\` to register one, then re-run \`install
|
|
70
|
+
`\`npx ${MCP_PACKAGE_NAME} install\` to register one, then re-run \`install epic-implementer\`.`;
|
|
69
71
|
/** Remediation for an entry that exists but lacks the conductor token. */
|
|
70
|
-
export const CONDUCTOR_PROFILE_TOKEN_REMEDIATION = "re-run `install
|
|
72
|
+
export const CONDUCTOR_PROFILE_TOKEN_REMEDIATION = "re-run `install epic-implementer` and accept the tool-visibility consent; the Epic Implementer " +
|
|
71
73
|
"tools become visible after the MCP client is restarted.";
|
|
72
74
|
/** Remediation surfaced whenever the managed git hooks are not usable. */
|
|
73
|
-
export const CONDUCTOR_HOOK_TARGET_REMEDIATION = "re-run `install
|
|
75
|
+
export const CONDUCTOR_HOOK_TARGET_REMEDIATION = "re-run `install epic-implementer` and accept the local-observability consent, or run " +
|
|
74
76
|
"`epic-implementer install-git-hooks` directly.";
|
|
75
77
|
/** Remediation surfaced when the ledger's native binding does not load. */
|
|
76
78
|
export const CONDUCTOR_LEDGER_LOADABILITY_REMEDIATION = "`better-sqlite3` is an optionalDependency npm silently skips on a build failure — " +
|
|
77
79
|
"reinstall it for this Node runtime to restore local Epic Implementer observability.";
|
|
78
80
|
/** Remediation surfaced whenever no healthy generated service unit is detected. */
|
|
79
|
-
export const EXECUTOR_INSTALL_SERVICE_REMEDIATION = "generate a persistent unit with `install
|
|
81
|
+
export const EXECUTOR_INSTALL_SERVICE_REMEDIATION = "generate a persistent unit with `install epic-implementer --executor-id <id> --repo-wide` or " +
|
|
80
82
|
"`executor install-service` (or run the executor by hand) — " +
|
|
81
83
|
`see ${CONDUCTOR_OPERATOR_RUNBOOK_POINTER}.`;
|
|
82
84
|
/** Remediation for a unit that exists but whose service is not running. */
|
|
83
|
-
export const EXECUTOR_SERVICE_START_REMEDIATION = "start the service (re-run `install
|
|
85
|
+
export const EXECUTOR_SERVICE_START_REMEDIATION = "start the service (re-run `install epic-implementer` and accept the start consent, or run the " +
|
|
84
86
|
`printed launchctl/systemctl command by hand) — see ${CONDUCTOR_OPERATOR_RUNBOOK_POINTER}.`;
|
|
85
87
|
// ---------------------------------------------------------------------------
|
|
86
88
|
// BAPI-1254 — the ONE required-check presentation
|
|
@@ -965,7 +967,7 @@ export function executorProvisioningSection(diagnostics) {
|
|
|
965
967
|
};
|
|
966
968
|
}
|
|
967
969
|
const unhealthy = diagnostics.units.filter((unit) => unit.warnings.length > 0 || unit.credentials.some((cred) => !cred.resolved));
|
|
968
|
-
const ids = diagnostics.units.map((unit) => unit.executorId).join(", ");
|
|
970
|
+
const ids = diagnostics.units.map((unit) => `${unit.executorId}; cleanup: npx -y ${MCP_PACKAGE_NAME} executor uninstall-service --executor-id ${posixShellQuote(unit.executorId)}`).join(", ");
|
|
969
971
|
if (unhealthy.length === 0 && diagnostics.warnings.length === 0) {
|
|
970
972
|
return {
|
|
971
973
|
...base,
|
|
@@ -1387,6 +1389,12 @@ export function workerDatabaseReadinessChecks(section) {
|
|
|
1387
1389
|
// Some doctor details already lead with their state ("unknown — …").
|
|
1388
1390
|
detail: row.detail.startsWith(`${row.state} — `) ? row.detail : `${row.state} — ${row.detail}`,
|
|
1389
1391
|
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
|
+
: {}),
|
|
1390
1398
|
}));
|
|
1391
1399
|
}
|
|
1392
1400
|
// ---------------------------------------------------------------------------
|
|
@@ -1648,3 +1656,8 @@ export function buildEpicBranchBehindBaseLaunchRow(fact) {
|
|
|
1648
1656
|
return buildLaunchNeedRow("epic_branch_behind_base", "unverifiable", `unverifiable — ${BRANCH_UNVERIFIABLE_DETAIL[fact.reason] ?? BRANCH_UNVERIFIABLE_DETAIL.git_failed}`);
|
|
1649
1657
|
}
|
|
1650
1658
|
}
|
|
1659
|
+
/** Explicit assessment explanations alongside the unchanged legacy sections. */
|
|
1660
|
+
export function assessmentWorkflowExplanations(readiness) {
|
|
1661
|
+
return readiness.assessment?.records.filter(r => r.scope === 'default_branch' || r.scope === 'indexed_commit')
|
|
1662
|
+
.map(r => `${r.id} [${r.scope} @ ${r.inspected_sha ?? 'unknown revision'}]: ${r.applicability} (${r.basis}), ${r.observed_state}`) ?? [];
|
|
1663
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { composeReadinessAssessment, deriveAdvisoryVerdict } from './readiness-assessment.js';
|
|
2
|
+
import { formatReadinessAssessment } from './readiness-prerequisites.js';
|
|
1
3
|
import { mergeReadinessPrerequisites, formatReadinessPrerequisites } from "./readiness-prerequisites.js";
|
|
2
4
|
/**
|
|
3
5
|
* The consolidated ADVISORY epic-implementer readiness gate (BAPI-1055, AC-6/AC-7).
|
|
@@ -437,7 +439,7 @@ const ADMISSION_EVIDENCE_LABELS = {
|
|
|
437
439
|
};
|
|
438
440
|
/** Who acts, in fixed prose. Never a value from the payload. */
|
|
439
441
|
const ADMISSION_OWNER_REMEDIATION = {
|
|
440
|
-
operator: "the operator re-runs guided setup (`install
|
|
442
|
+
operator: "the operator re-runs guided setup (`install epic-implementer`) and re-observes.",
|
|
441
443
|
repository_admin: "a repository administrator resolves it (unattended consent is the 'Allow unattended Epic Implementer runs' toggle on the repository's Setup page in the Bridge admin panel); setup never grants it.",
|
|
442
444
|
bridge_operations: "email info@bridgegpt.ai; this is not something an operator command can change.",
|
|
443
445
|
};
|
|
@@ -805,7 +807,7 @@ function unattendedOutcomes(readiness) {
|
|
|
805
807
|
? {
|
|
806
808
|
id: "repository-workflow-readiness",
|
|
807
809
|
status: "pass",
|
|
808
|
-
detail:
|
|
810
|
+
detail: readiness.assessment ? readiness.assessment.records.filter(r => r.scope === 'default_branch').map(r => `${r.id}: ${r.applicability} (${r.basis}); ${r.observed_state}`).join('; ') : 'the workflow sections required by effective policy are confirmed',
|
|
809
811
|
}
|
|
810
812
|
: {
|
|
811
813
|
id: "repository-workflow-readiness",
|
|
@@ -1309,6 +1311,7 @@ export async function collectConductorReadinessGate(deps) {
|
|
|
1309
1311
|
repoName: deps.repoName ?? null,
|
|
1310
1312
|
unavailableSources,
|
|
1311
1313
|
checks: validated,
|
|
1314
|
+
...(installReport?.readiness?.assessmentNegotiation ? { assessmentNegotiation: installReport.readiness.assessmentNegotiation, ...(installReport.readiness.assessment ? { assessment: installReport.readiness.assessment, advisoryVerdict: deriveAdvisoryVerdict(composeReadinessAssessment(installReport.readiness.assessmentNegotiation)) } : {}) } : {}),
|
|
1312
1315
|
prerequisites: mergeReadinessPrerequisites(validated, installReport?.readiness?.prerequisites),
|
|
1313
1316
|
is_production: installReport?.readiness?.is_production,
|
|
1314
1317
|
...(installReport?.readiness?.diagnostics ? { diagnostics: installReport.readiness.diagnostics } : {}),
|
|
@@ -1396,5 +1399,20 @@ function readinessTag(status) {
|
|
|
1396
1399
|
* hides. It computes no overall verdict, because there is none to compute.
|
|
1397
1400
|
*/
|
|
1398
1401
|
export function formatConductorReadinessGateReport(report, options = {}) {
|
|
1402
|
+
if (report.assessmentNegotiation)
|
|
1403
|
+
return formatReadinessAssessment(composeReadinessAssessment(report.assessmentNegotiation, localReadinessFacts(report.checks)), options).join('\n');
|
|
1399
1404
|
return formatReadinessPrerequisites(report.prerequisites ?? mergeReadinessPrerequisites(report.checks), { all: options.all, isProduction: report.is_production }).join('\n');
|
|
1400
1405
|
}
|
|
1406
|
+
/** Local facts cannot satisfy a server-owned prerequisite. */
|
|
1407
|
+
export function localReadinessFacts(checks) {
|
|
1408
|
+
const ids = new Map([
|
|
1409
|
+
['conductor.claude-login', 'local.claude-login'], ['conductor.gh-cli', 'local.github-login'], ['install.identity', 'local.repository-identity'],
|
|
1410
|
+
]);
|
|
1411
|
+
const facts = checks.flatMap(c => ids.has(c.id) ? [{ id: ids.get(c.id),
|
|
1412
|
+
observed_state: c.status === 'pass' ? 'confirmed' : c.status === 'fail' ? 'deficient' : 'unknown',
|
|
1413
|
+
impact: c.blocking === true ? 'mandatory' : 'advisory' }] : []);
|
|
1414
|
+
for (const c of checks.filter(c => c.id === 'conductor.install-section-executor-provisioning')) {
|
|
1415
|
+
facts.push({ id: 'local.executor-installation', observed_state: c.status === 'pass' ? 'confirmed' : 'unknown', impact: 'optional' });
|
|
1416
|
+
}
|
|
1417
|
+
return facts;
|
|
1418
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `conductor` operator recovery and repair verbs —
|
|
2
|
+
* `conductor` operator recovery and repair verbs — seventeen CLI-only commands.
|
|
3
3
|
*
|
|
4
4
|
* The four BAPI-872 recovery verbs: `stop-run`, `abandon-run`, `unpark`,
|
|
5
5
|
* `adopt-current-head-and-unpark`. The six run-addressed repair verbs: BAPI-1154's
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
* provider re-run of failed CI workflow runs: `rerun-ci`. BAPI-1494's owner
|
|
11
11
|
* decision on verification hand-offs: `resolve-handoff`. BAPI-1532's answer to a
|
|
12
12
|
* named plan failure, one forced regeneration on a chosen route: `regenerate-plan`.
|
|
13
|
+
* BAPI-1562's owner acknowledgement of the run's carried-gap list:
|
|
14
|
+
* `acknowledge-gaps`.
|
|
13
15
|
*
|
|
14
16
|
* CLI-only by design — this is an explicit ticket non-goal, not an oversight:
|
|
15
|
-
* none of these
|
|
17
|
+
* none of these seventeen command names is ever registered as an MCP tool, tool
|
|
16
18
|
* description, or generated tool-schema input (`index-static.test.ts` guards
|
|
17
19
|
* this). They exist so an operator (or `plane down`, via
|
|
18
20
|
* `recovery-operations.ts`) can recover a stuck run or ticket WITHOUT
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
import { readFile } from "node:fs/promises";
|
|
30
32
|
import { ConductorValidationError, toConductorErrorEnvelope } from "./errors.js";
|
|
31
33
|
import { nodeGithubMergeCredentialReadDeps, readLocalGithubRemote } from "./stored-merge-credential.js";
|
|
32
|
-
import { DRIVER_CONTEXT_MAX_BYTES, HANDOFF_RESOLUTION_EVIDENCE_REF_MAX_CHARS, HANDOFF_RESOLUTION_KIND_LABELS, HANDOFF_RESOLUTION_KINDS, HANDOFF_RESOLUTION_MAX_STEPS, HANDOFF_RESOLUTION_REASON_MAX_CHARS, POLICY_PATCH_MAX_BYTES, RESUME_RUN_UNCONFIRMED_MESSAGE, } from "./repair-contract.js";
|
|
34
|
+
import { DRIVER_CONTEXT_MAX_BYTES, HANDOFF_RESOLUTION_EVIDENCE_REF_MAX_CHARS, HANDOFF_RESOLUTION_KIND_LABELS, HANDOFF_RESOLUTION_KINDS, HANDOFF_RESOLUTION_MAX_STEPS, HANDOFF_RESOLUTION_REASON_MAX_CHARS, GAP_ACKNOWLEDGEMENT_REASON_MAX_CHARS, POLICY_PATCH_MAX_BYTES, RESUME_RUN_UNCONFIRMED_MESSAGE, } from "./repair-contract.js";
|
|
33
35
|
import { CONTINUATION_CI_WAITING_REASONS, continuationDispatchedJob, } from "./epic-child-continuation.js";
|
|
34
36
|
import { decodeGuidedBinding, GuidedBindingError, } from "./guided-repair.js";
|
|
35
37
|
// ---------------------------------------------------------------------------
|
|
@@ -146,7 +148,7 @@ function parseExternalRepairOperationId(values) {
|
|
|
146
148
|
return id;
|
|
147
149
|
}
|
|
148
150
|
function parseTicketRecoveryArgs(argv) {
|
|
149
|
-
const { values, bools } = tokenizeRecoveryFlags(argv, new Set([...TICKET_VALUE_FLAGS, "--reason", "--cleanup-resolution", "--external-repair"]), RECOVERY_BOOL_FLAGS);
|
|
151
|
+
const { values, bools } = tokenizeRecoveryFlags(argv, new Set([...TICKET_VALUE_FLAGS, "--reason", "--cleanup-resolution", "--external-repair", "--binding"]), RECOVERY_BOOL_FLAGS);
|
|
150
152
|
if (bools.has("--help")) {
|
|
151
153
|
return { epicRunId: "", ticketKey: "", json: bools.has("--json"), help: true };
|
|
152
154
|
}
|
|
@@ -159,6 +161,15 @@ function parseTicketRecoveryArgs(argv) {
|
|
|
159
161
|
throw new ConductorValidationError('Flag "--ticket-key" is required and must be non-empty.');
|
|
160
162
|
}
|
|
161
163
|
const externalRepairOperationId = parseExternalRepairOperationId(values);
|
|
164
|
+
let expectedRowVersion;
|
|
165
|
+
if (values.has("--binding")) {
|
|
166
|
+
const binding = decodeGuidedBinding(values.get("--binding") ?? "");
|
|
167
|
+
if (binding.verb !== "adopt-current-head-and-unpark" || binding.epicRunId !== epicRunId.trim()
|
|
168
|
+
|| binding.ticketKey !== ticketKey.trim() || binding.externalRepairOperationId !== externalRepairOperationId) {
|
|
169
|
+
throw new ConductorValidationError("The external-repair binding does not match this command.");
|
|
170
|
+
}
|
|
171
|
+
expectedRowVersion = binding.expectedRowVersion;
|
|
172
|
+
}
|
|
162
173
|
return {
|
|
163
174
|
epicRunId: epicRunId.trim(),
|
|
164
175
|
ticketKey: ticketKey.trim(),
|
|
@@ -167,6 +178,7 @@ function parseTicketRecoveryArgs(argv) {
|
|
|
167
178
|
cleanupResolution: values.get("--cleanup-resolution"),
|
|
168
179
|
} : {}),
|
|
169
180
|
...(externalRepairOperationId !== undefined ? { externalRepairOperationId } : {}),
|
|
181
|
+
...(expectedRowVersion !== undefined ? { expectedRowVersion } : {}),
|
|
170
182
|
json: bools.has("--json"),
|
|
171
183
|
help: false,
|
|
172
184
|
};
|
|
@@ -444,6 +456,7 @@ export async function runAdoptCurrentHeadAndUnparkCommand(argv) {
|
|
|
444
456
|
const result = await adoptCurrentHeadAndUnparkWithRetry(access, {
|
|
445
457
|
epicRunId: parsed.epicRunId,
|
|
446
458
|
ticketKey: parsed.ticketKey,
|
|
459
|
+
...(parsed.expectedRowVersion !== undefined ? { expectedRowVersion: parsed.expectedRowVersion } : {}),
|
|
447
460
|
...(parsed.externalRepairOperationId !== undefined
|
|
448
461
|
? { externalRepairOperationId: parsed.externalRepairOperationId }
|
|
449
462
|
: {}),
|
|
@@ -469,6 +482,12 @@ const DISPATCH_REMEDIATION_VALUE_FLAGS = new Set([
|
|
|
469
482
|
"--binding",
|
|
470
483
|
]);
|
|
471
484
|
const MERGE_CHILD_VALUE_FLAGS = new Set(["--epic-run-id", "--pr"]);
|
|
485
|
+
/**
|
|
486
|
+
* BAPI-1564 — `--carry-gaps` is a `merge-child` switch only; no other verb
|
|
487
|
+
* accepts it. It selects the server's carried-gap admission MODE and carries no
|
|
488
|
+
* head, base, branch, or SHA.
|
|
489
|
+
*/
|
|
490
|
+
const MERGE_CHILD_BOOL_FLAGS = new Set(["--json", "--help", "--carry-gaps"]);
|
|
472
491
|
/**
|
|
473
492
|
* BAPI-1333 — attach `binding` ONLY when `--binding` was given, so an unguided
|
|
474
493
|
* parse result is exactly what it was before.
|
|
@@ -511,9 +530,21 @@ export function parseDispatchRemediationArgs(argv) {
|
|
|
511
530
|
}, values);
|
|
512
531
|
}
|
|
513
532
|
export function parseMergeChildArgs(argv) {
|
|
514
|
-
|
|
533
|
+
// BAPI-1564 — the shared tokenizer reads `--flag=value` of a boolean flag as the
|
|
534
|
+
// bare flag, so `--carry-gaps=false` would SELECT the mode. Refused outright for
|
|
535
|
+
// this authority-bearing switch: it is given bare or not at all.
|
|
536
|
+
if (argv.some((token) => token.startsWith("--carry-gaps="))) {
|
|
537
|
+
throw new ConductorValidationError('Flag "--carry-gaps" takes no value; give it bare or omit it.');
|
|
538
|
+
}
|
|
539
|
+
const { values, bools } = tokenizeRecoveryFlags(argv, MERGE_CHILD_VALUE_FLAGS, MERGE_CHILD_BOOL_FLAGS);
|
|
515
540
|
if (bools.has("--help")) {
|
|
516
|
-
return {
|
|
541
|
+
return {
|
|
542
|
+
epicRunId: "",
|
|
543
|
+
prNumber: 0,
|
|
544
|
+
json: bools.has("--json"),
|
|
545
|
+
help: true,
|
|
546
|
+
carryGaps: bools.has("--carry-gaps"),
|
|
547
|
+
};
|
|
517
548
|
}
|
|
518
549
|
const epicRunId = requireFlag(values, "--epic-run-id");
|
|
519
550
|
const rawPr = requireFlag(values, "--pr");
|
|
@@ -521,7 +552,13 @@ export function parseMergeChildArgs(argv) {
|
|
|
521
552
|
if (!Number.isSafeInteger(prNumber)) {
|
|
522
553
|
throw new ConductorValidationError('Flag "--pr" must be a positive integer pull-request number.');
|
|
523
554
|
}
|
|
524
|
-
return {
|
|
555
|
+
return {
|
|
556
|
+
epicRunId,
|
|
557
|
+
prNumber,
|
|
558
|
+
json: bools.has("--json"),
|
|
559
|
+
help: false,
|
|
560
|
+
carryGaps: bools.has("--carry-gaps"),
|
|
561
|
+
};
|
|
525
562
|
}
|
|
526
563
|
/**
|
|
527
564
|
* Validate and decode a driver-context file's BYTES.
|
|
@@ -687,13 +724,31 @@ function renderRepairResult(outcome, input, json, extraLines = () => []) {
|
|
|
687
724
|
"and is not rolled back. You ran it, so you own reconciling the missing audit " +
|
|
688
725
|
"record (the server also reported it to Sentry).");
|
|
689
726
|
}
|
|
727
|
+
if (outcome.ok &&
|
|
728
|
+
input.verb === "dispatch-remediation" &&
|
|
729
|
+
outcome.result.driver_context_delivered === false) {
|
|
730
|
+
// BAPI-1550: only an EXPLICIT false warns. The dispatch itself still succeeded
|
|
731
|
+
// (a deduplicated dispatch exits 0), so this goes to stderr, never into the
|
|
732
|
+
// stdout the operator may be parsing (so it also shows in --json mode).
|
|
733
|
+
console.error("Warning: driver context was NOT delivered. A job for this ticket was already queued or " +
|
|
734
|
+
"running and continues WITHOUT it. Dispatch again with --context-file after that job " +
|
|
735
|
+
"finishes.");
|
|
736
|
+
}
|
|
690
737
|
if (json) {
|
|
691
738
|
if (outcome.ok) {
|
|
692
739
|
console.log(JSON.stringify(outcome.result));
|
|
693
740
|
return 0;
|
|
694
741
|
}
|
|
695
742
|
console.log(JSON.stringify(outcome.kind === "refused"
|
|
696
|
-
? {
|
|
743
|
+
? {
|
|
744
|
+
ok: false,
|
|
745
|
+
kind: "refused",
|
|
746
|
+
code: outcome.code,
|
|
747
|
+
message: outcome.message,
|
|
748
|
+
...(outcome.holder
|
|
749
|
+
? { holder_job_id: outcome.holder.job_id, holder_job_type: outcome.holder.job_type }
|
|
750
|
+
: {}),
|
|
751
|
+
}
|
|
697
752
|
: { ok: false, kind: "unavailable", message: input.unavailableMessage ?? outcome.message }));
|
|
698
753
|
return 1;
|
|
699
754
|
}
|
|
@@ -701,6 +756,10 @@ function renderRepairResult(outcome, input, json, extraLines = () => []) {
|
|
|
701
756
|
if (outcome.kind === "refused") {
|
|
702
757
|
console.error(`Error: ${input.verb} refused on run ${input.epicRunId} (${input.targetLabel}) — ` +
|
|
703
758
|
`${outcome.code}: ${outcome.message}`);
|
|
759
|
+
if (outcome.holder) {
|
|
760
|
+
// BAPI-1550: one secondary detail line, only for a validated pair.
|
|
761
|
+
console.error(` lane holder: job ${outcome.holder.job_id} (${outcome.holder.job_type}), queued`);
|
|
762
|
+
}
|
|
704
763
|
}
|
|
705
764
|
else if (input.unavailableMessage) {
|
|
706
765
|
console.error(`Error: ${input.verb} on run ${input.epicRunId} (${input.targetLabel}) — ` +
|
|
@@ -860,6 +919,10 @@ export async function runDispatchRemediationCommand(argv, deps = {}) {
|
|
|
860
919
|
stateLabel: "selected gate",
|
|
861
920
|
}, parsed.json, (result) => [
|
|
862
921
|
` job: ${result.job_type || "unknown"}${result.job_id !== null ? ` (job ${result.job_id})` : ""}`,
|
|
922
|
+
...(result.driver_context_delivered === true ? [" context: delivered"] : []),
|
|
923
|
+
...(typeof result.queued_behind === "number"
|
|
924
|
+
? [` queued: queued behind job ${result.queued_behind}`]
|
|
925
|
+
: []),
|
|
863
926
|
]);
|
|
864
927
|
}
|
|
865
928
|
catch (error) {
|
|
@@ -1246,8 +1309,140 @@ export async function runResolveHandoffCommand(argv) {
|
|
|
1246
1309
|
return RESOLVE_HANDOFF_EXIT_FAILED;
|
|
1247
1310
|
}
|
|
1248
1311
|
}
|
|
1312
|
+
// ---------------------------------------------------------------------------
|
|
1313
|
+
// BAPI-1562 — acknowledge-gaps
|
|
1314
|
+
// ---------------------------------------------------------------------------
|
|
1315
|
+
const ACKNOWLEDGE_GAPS_VALUE_FLAGS = new Set(["--epic-run-id", "--digest", "--reason"]);
|
|
1316
|
+
/** Exit codes: 0 acknowledged (or already acknowledged), 1 refused, stale, or failed. */
|
|
1317
|
+
export const ACKNOWLEDGE_GAPS_EXIT_OK = 0;
|
|
1318
|
+
export const ACKNOWLEDGE_GAPS_EXIT_FAILED = 1;
|
|
1319
|
+
/** What every success ends with: the second hold, and what acknowledging is not. */
|
|
1320
|
+
export const ACKNOWLEDGE_GAPS_NEXT_ACTION = "The integration PR leaves draft only when both holds are clear: this list hold and " +
|
|
1321
|
+
"the workaround-folder hold (remove any .bridge/epic-workarounds/ records in a new " +
|
|
1322
|
+
"epic-head commit). Acknowledging verified nothing, readied nothing and merged " +
|
|
1323
|
+
"nothing: review and merge the integration PR into base yourself.";
|
|
1324
|
+
const ACKNOWLEDGE_GAPS_USAGE = [
|
|
1325
|
+
"Usage: epic-implementer acknowledge-gaps --epic-run-id <RUN> --digest <CURRENT_DIGEST> --reason <TEXT> [--json]",
|
|
1326
|
+
"",
|
|
1327
|
+
"Acknowledge, once, the run's carried-gap list: every verification hand-off, carried",
|
|
1328
|
+
"gap, driver merge and out-of-engine merge the run carried forward. The integration PR",
|
|
1329
|
+
"stays in draft until the owner acknowledges the list's CURRENT digest; a new entry",
|
|
1330
|
+
"changes the digest and holds it again. Read the list on the integration PR report or",
|
|
1331
|
+
"with `epic-implementer explain-run` (carried_gap_list) and pass its digest exactly.",
|
|
1332
|
+
"",
|
|
1333
|
+
"This is the OWNER's step. The /drive-epic-run driver never runs it and workers",
|
|
1334
|
+
"cannot. The server records your verified API-key identity as the actor; you cannot",
|
|
1335
|
+
"supply one. It never marks a step verified, never readies the PR and never merges it.",
|
|
1336
|
+
"--digest is the 64-character lowercase hex list digest. --reason is at most 1000",
|
|
1337
|
+
"characters.",
|
|
1338
|
+
"",
|
|
1339
|
+
"Exit codes: 0 acknowledged (or this digest was already acknowledged); 1 refused,",
|
|
1340
|
+
"stale (the list changed), or failed.",
|
|
1341
|
+
].join("\n");
|
|
1342
|
+
export function parseAcknowledgeGapsArgs(argv) {
|
|
1343
|
+
const { values, bools } = tokenizeRecoveryFlags(argv, ACKNOWLEDGE_GAPS_VALUE_FLAGS, RECOVERY_BOOL_FLAGS);
|
|
1344
|
+
if (bools.has("--help")) {
|
|
1345
|
+
return { epicRunId: "", digest: "", reason: "", json: bools.has("--json"), help: true };
|
|
1346
|
+
}
|
|
1347
|
+
const digest = requireFlag(values, "--digest");
|
|
1348
|
+
if (!/^[0-9a-f]{64}$/.test(digest)) {
|
|
1349
|
+
throw new ConductorValidationError("--digest must be the 64-character lowercase hex list digest from the report or explain-run.");
|
|
1350
|
+
}
|
|
1351
|
+
const reason = boundedText(values, "--reason", GAP_ACKNOWLEDGEMENT_REASON_MAX_CHARS);
|
|
1352
|
+
if (!reason.trim()) {
|
|
1353
|
+
throw new ConductorValidationError('Flag "--reason" must not be blank.');
|
|
1354
|
+
}
|
|
1355
|
+
return {
|
|
1356
|
+
epicRunId: requireFlag(values, "--epic-run-id"),
|
|
1357
|
+
digest,
|
|
1358
|
+
reason,
|
|
1359
|
+
json: bools.has("--json"),
|
|
1360
|
+
help: false,
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Exported for tests: render one `acknowledge-gaps` outcome. Success goes to
|
|
1365
|
+
* stdout and every failure to stderr (`--json` included).
|
|
1366
|
+
*/
|
|
1367
|
+
export function renderAcknowledgeGapsOutcome(outcome, parsed, json) {
|
|
1368
|
+
const label = `run ${parsed.epicRunId}`;
|
|
1369
|
+
if (outcome.ok) {
|
|
1370
|
+
const result = outcome.result;
|
|
1371
|
+
if (result.committed && !result.event_recorded) {
|
|
1372
|
+
console.error(`Warning: acknowledge-gaps for ${label} COMMITTED, but its operator_verb_applied ` +
|
|
1373
|
+
"audit event was not recorded. The acknowledgement stands; a replay will not write again.");
|
|
1374
|
+
}
|
|
1375
|
+
if (json) {
|
|
1376
|
+
console.log(JSON.stringify(result));
|
|
1377
|
+
return ACKNOWLEDGE_GAPS_EXIT_OK;
|
|
1378
|
+
}
|
|
1379
|
+
const lines = [
|
|
1380
|
+
result.committed
|
|
1381
|
+
? `acknowledge-gaps — ${label}: list acknowledged (${result.entry_count} entries)`
|
|
1382
|
+
: `acknowledge-gaps — ${label}: this digest was already acknowledged; nothing was written`,
|
|
1383
|
+
` digest: ${result.digest}`,
|
|
1384
|
+
` event recorded: ${result.committed ? String(result.event_recorded) : "not applicable (replay)"}`,
|
|
1385
|
+
` next action: ${ACKNOWLEDGE_GAPS_NEXT_ACTION}`,
|
|
1386
|
+
];
|
|
1387
|
+
console.log(lines.join("\n"));
|
|
1388
|
+
return ACKNOWLEDGE_GAPS_EXIT_OK;
|
|
1389
|
+
}
|
|
1390
|
+
if (outcome.kind === "refused") {
|
|
1391
|
+
if (json) {
|
|
1392
|
+
console.error(JSON.stringify({
|
|
1393
|
+
ok: false,
|
|
1394
|
+
outcome: "refused",
|
|
1395
|
+
code: outcome.code,
|
|
1396
|
+
message: outcome.message,
|
|
1397
|
+
nothing_written: true,
|
|
1398
|
+
}));
|
|
1399
|
+
}
|
|
1400
|
+
else if (outcome.code === "GAP_DIGEST_STALE") {
|
|
1401
|
+
console.error(`Refused: acknowledge-gaps for ${label} — GAP_DIGEST_STALE: the list changed since ` +
|
|
1402
|
+
"you read it. Nothing was written. Re-read the integration PR report or " +
|
|
1403
|
+
"`epic-implementer explain-run` (carried_gap_list) and acknowledge the new digest.");
|
|
1404
|
+
}
|
|
1405
|
+
else {
|
|
1406
|
+
console.error(`Refused: acknowledge-gaps for ${label} — ${outcome.code}: ${outcome.message} ` +
|
|
1407
|
+
"Nothing was written.");
|
|
1408
|
+
}
|
|
1409
|
+
return ACKNOWLEDGE_GAPS_EXIT_FAILED;
|
|
1410
|
+
}
|
|
1411
|
+
if (json) {
|
|
1412
|
+
console.error(JSON.stringify({ ok: false, outcome: "unavailable", message: outcome.message }));
|
|
1413
|
+
}
|
|
1414
|
+
else {
|
|
1415
|
+
console.error(`Failed: acknowledge-gaps for ${label} — ${outcome.message}. The outcome is uncertain: ` +
|
|
1416
|
+
"it is safe to run the same command again with the same digest (a repeat writes " +
|
|
1417
|
+
"nothing if it was already recorded).");
|
|
1418
|
+
}
|
|
1419
|
+
return ACKNOWLEDGE_GAPS_EXIT_FAILED;
|
|
1420
|
+
}
|
|
1421
|
+
export async function runAcknowledgeGapsCommand(argv) {
|
|
1422
|
+
try {
|
|
1423
|
+
const parsed = parseAcknowledgeGapsArgs(argv);
|
|
1424
|
+
if (parsed.help) {
|
|
1425
|
+
console.log(ACKNOWLEDGE_GAPS_USAGE);
|
|
1426
|
+
return 0;
|
|
1427
|
+
}
|
|
1428
|
+
const access = await resolveRecoveryAccess(parsed.json);
|
|
1429
|
+
if (!access)
|
|
1430
|
+
return ACKNOWLEDGE_GAPS_EXIT_FAILED;
|
|
1431
|
+
const { acknowledgeGapsRepair } = await import("./recovery-operations.js");
|
|
1432
|
+
const outcome = await acknowledgeGapsRepair(access, {
|
|
1433
|
+
epicRunId: parsed.epicRunId,
|
|
1434
|
+
digest: parsed.digest,
|
|
1435
|
+
reason: parsed.reason,
|
|
1436
|
+
});
|
|
1437
|
+
return renderAcknowledgeGapsOutcome(outcome, parsed, parsed.json);
|
|
1438
|
+
}
|
|
1439
|
+
catch (error) {
|
|
1440
|
+
console.error(`Error: ${toConductorErrorEnvelope(error).message}`);
|
|
1441
|
+
return ACKNOWLEDGE_GAPS_EXIT_FAILED;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1249
1444
|
const MERGE_CHILD_USAGE = [
|
|
1250
|
-
"Usage: epic-implementer merge-child --epic-run-id <id> --pr <number> [--json]",
|
|
1445
|
+
"Usage: epic-implementer merge-child --epic-run-id <id> --pr <number> [--carry-gaps] [--json]",
|
|
1251
1446
|
"",
|
|
1252
1447
|
"Merge the run's child pull request through the shared merge service. You give",
|
|
1253
1448
|
"ONLY the PR number: the server finds the one ticket in the run bound to it",
|
|
@@ -1259,6 +1454,15 @@ const MERGE_CHILD_USAGE = [
|
|
|
1259
1454
|
"When the repository merges locally (the default), your own `gh` performs the",
|
|
1260
1455
|
"merge — run this from inside the repository's checkout, with `gh auth status`",
|
|
1261
1456
|
"passing.",
|
|
1457
|
+
"",
|
|
1458
|
+
"--carry-gaps Merge a PARKED, green child whose only readiness blockers are",
|
|
1459
|
+
" carried verification gaps. It merges only into this run's own",
|
|
1460
|
+
" epic/<KEY> branch, after server checks: gap authority, run",
|
|
1461
|
+
" membership, the epic-branch base, the exact run-produced head,",
|
|
1462
|
+
" green required CI, mergeability, and review. It never merges into",
|
|
1463
|
+
" the default branch or the integration PR. The server records a",
|
|
1464
|
+
" driver-merge admission first; the carried gaps are listed on the",
|
|
1465
|
+
" integration PR for the owner.",
|
|
1262
1466
|
].join("\n");
|
|
1263
1467
|
export async function runMergeChildCommand(argv) {
|
|
1264
1468
|
try {
|
|
@@ -1273,7 +1477,12 @@ export async function runMergeChildCommand(argv) {
|
|
|
1273
1477
|
const { mergeChildRepair } = await import("./recovery-operations.js");
|
|
1274
1478
|
// BAPI-1461: this verb runs in the person's own session, so a merge token
|
|
1275
1479
|
// stored once for this repository is the last rung after the env keys.
|
|
1276
|
-
const outcome = await mergeChildRepair(access, {
|
|
1480
|
+
const outcome = await mergeChildRepair(access, {
|
|
1481
|
+
epicRunId: parsed.epicRunId,
|
|
1482
|
+
prNumber: parsed.prNumber,
|
|
1483
|
+
// BAPI-1564 — the key is sent only when the operator gave the flag.
|
|
1484
|
+
...(parsed.carryGaps ? { carryGaps: true } : {}),
|
|
1485
|
+
}, {
|
|
1277
1486
|
storedMergeCredential: {
|
|
1278
1487
|
allowStoredEntry: true,
|
|
1279
1488
|
localRemote: await readLocalGithubRemote(process.cwd()),
|
|
@@ -1614,8 +1823,9 @@ const CONTINUE_CHILD_USAGE = [
|
|
|
1614
1823
|
"approves a new head or episode); continuation-receipt looks the receipt up.",
|
|
1615
1824
|
"Never accepts a version counter or a park generation.",
|
|
1616
1825
|
"",
|
|
1617
|
-
"--context-file
|
|
1618
|
-
"
|
|
1826
|
+
"--context-file: driver context for the continuation's worker, delivered as quoted,",
|
|
1827
|
+
"untrusted operational context appended to the worker prompt. For a CI-repair",
|
|
1828
|
+
"continuation it is sent beside --reason (never merged into it). It must be non-empty UTF-8",
|
|
1619
1829
|
`text of at most DRIVER_CONTEXT_MAX_BYTES (${DRIVER_CONTEXT_MAX_BYTES} bytes); it is`,
|
|
1620
1830
|
"rejected, never truncated, and is never printed, logged, or echoed. A re-run of",
|
|
1621
1831
|
"a pending request must pass the same file. A server that does not support it",
|
|
@@ -1738,7 +1948,7 @@ const CI_ROUTE_GUIDANCE = {
|
|
|
1738
1948
|
"(rerun-ci). No repair was dispatched.",
|
|
1739
1949
|
ci_route_hold: "CI routing is holding; no widened repair was dispatched. Re-read the run state " +
|
|
1740
1950
|
"(explain-run) before choosing another action.",
|
|
1741
|
-
driver_context_not_supported: "--context-file
|
|
1951
|
+
driver_context_not_supported: "This continuation cannot carry --context-file into a worker prompt. Drop --context-file " +
|
|
1742
1952
|
"and re-run with --reason only. Nothing was written.",
|
|
1743
1953
|
};
|
|
1744
1954
|
/** Exported for tests: render a `continue-child` result. Returns the exit code. */
|