@bridge_gpt/mcp-server 0.2.73 → 0.2.74
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 +12 -0
- package/build/agents.generated.js +3 -3
- package/build/bridge-config.js +7 -1
- package/build/bridge-permissions.js +3 -0
- package/build/command-provisioning.js +4 -3
- package/build/commands.generated.js +5 -5
- package/build/conductor/bridge-api-client.js +26 -1
- package/build/conductor/command-drift.js +1 -1
- package/build/conductor/declared-extras.js +335 -0
- package/build/conductor/doctor.js +2 -0
- package/build/conductor/driver-pass-output.js +104 -0
- package/build/conductor/driver-pass.js +571 -0
- package/build/conductor/epic-branch-ci-inspection.js +61 -16
- package/build/conductor/epic-implementer-cli.js +33 -0
- package/build/conductor/epic-server-sfcc-upload.js +1567 -0
- package/build/conductor/epic-server-sfcc.js +58 -80
- package/build/conductor/epic-server.js +57 -4
- package/build/conductor/gate-discovery.js +46 -6
- package/build/conductor/gate-settings-review.js +51 -14
- package/build/credential-delivery.js +280 -0
- package/build/credential-launch-safety.js +142 -0
- package/build/credential-materialization.js +91 -16
- package/build/credential-references-node-deps.js +29 -0
- package/build/credential-references.js +1394 -0
- package/build/credential-references.test-fixtures.js +211 -0
- package/build/credential-scan-conventions.js +145 -0
- package/build/credential-scan.js +517 -0
- package/build/credential-store.js +50 -0
- package/build/credentials-cli.js +252 -3
- package/build/dependency-install-declarations.js +47 -1
- package/build/docs.generated.js +8 -1
- package/build/doctor.js +41 -0
- package/build/drive-epic.js +297 -37
- package/build/epic-branch-ci-summary.js +18 -1
- package/build/epic-capability-statement.js +71 -3
- package/build/epic-ci-workflow-drift.js +52 -13
- package/build/epic-ci-workflow-install.js +31 -6
- package/build/epic-ci-workflow-v3.js +273 -0
- package/build/epic-ci-workflow.js +128 -7
- package/build/epic-implementer-bin.js +161 -70
- package/build/epic-launch-context.js +102 -7
- package/build/epic-server-record.js +30 -15
- package/build/executor/credential-delivery-step.js +168 -0
- package/build/executor/deps.js +3 -1
- package/build/executor/env.js +39 -1
- package/build/executor/epic-server-context.js +23 -7
- package/build/executor/guarded-fast-forward-push.js +13 -8
- package/build/executor/job-runner.js +159 -17
- package/build/executor/permissions.js +85 -3
- package/build/executor/prompt-spec.js +37 -3
- package/build/executor-launch.js +4 -2
- package/build/git-exclude-lock.js +187 -0
- package/build/index.js +398 -269
- package/build/install-bridge-conductor-answers.js +84 -21
- package/build/install-bridge-conductor-apply.js +30 -1
- package/build/install-bridge-conductor-assessment.js +375 -48
- package/build/install-bridge-conductor-compact.js +27 -2
- package/build/install-bridge-conductor-contracts.js +10 -1
- package/build/install-bridge-conductor-gate.js +124 -11
- package/build/install-bridge-conductor-setup.js +46 -8
- package/build/install-bridge-conductor.js +625 -113
- package/build/install-bridge.js +88 -11
- package/build/install-doctor.js +38 -8
- package/build/install-sfcc-detection.js +120 -0
- package/build/install-sfcc-setup.js +185 -0
- package/build/mcp-grant-candidates.js +108 -96
- package/build/mcp-invoke.js +168 -4
- package/build/mcp-provisioning.js +21 -4
- package/build/mcp-server-invocation.js +13 -0
- package/build/merge-workflow-install.js +9 -1
- package/build/pipelines.generated.js +2 -1
- package/build/plane/status.js +8 -2
- package/build/printed-remedy-commands.js +5 -0
- package/build/project-root.js +40 -0
- package/build/readme.generated.js +1 -1
- package/build/repository-state-paths.js +5 -2
- package/build/repository-toolchains.js +6 -3
- package/build/setup-epic.js +116 -15
- package/build/sfcc/credentials.js +3 -2
- package/build/sfcc/hostname.js +98 -2
- package/build/sfcc/tool-wrapper.js +6 -95
- package/build/start-tickets.js +193 -29
- package/build/test-support/executor-source-files.js +200 -0
- package/build/testing-config-client.js +25 -2
- package/build/third-party-mcp-targets.js +35 -4
- package/build/version.generated.js +3 -3
- package/build/with-credentials.js +208 -0
- package/build/worktree-credential-delivery.js +340 -0
- package/package.json +1 -1
|
@@ -34,19 +34,21 @@ import { createProductionCiRerunDeps, runCiRerunJob, } from "./ci-rerun-job.js";
|
|
|
34
34
|
import { createProductionGateQualificationDeps, runGateQualificationJob, GATE_QUALIFICATION_FAILED, GATE_QUALIFICATION_INTERRUPTED, } from "./gate-qualification-job.js";
|
|
35
35
|
import { createObservationState } from "./observation.js";
|
|
36
36
|
import { getWorktreeMcpRegistrationTargets, normalizeWorktreePathForRegistration, provisionMcpRegistrationForWorktree, } from "../mcp-provisioning.js";
|
|
37
|
+
import { hasBridgeConsumer, legacyReferenceBackedTargets } from "../credential-delivery.js";
|
|
38
|
+
import { credentialNoticeLines, formatCredentialAuditLines, prepareExecutorCredentialDelivery, readExecutorCredentialApprovals, } from "./credential-delivery-step.js";
|
|
37
39
|
import { resolveExecutorAgentAdapter } from "../agent-launchers/executor-adapter-registry.js";
|
|
38
40
|
import { redactAdapterDiagnostic } from "../agent-launchers/executor-adapter.js";
|
|
39
41
|
import { resolveExecutorAgentId } from "./agent-identity.js";
|
|
40
42
|
import { closeStdinBounded, createProcessTerminationController, runProcessWithTimeout, writeStdinBounded, } from "./process.js";
|
|
41
43
|
import { buildNotLaunchedEnvelope, claimRequiresCleanupReport, claimRequiresCompletionEvidence, COMPLETION_CONTRACT_MARKER_VALUES, isCoveredJobType, MAX_EVENT_BYTES, runtimeMatchesSupported, successRefusalReason, unresolvedRequiredTasks, verificationVerdictFromFacts, } from "./completion-contract.js";
|
|
42
|
-
import { COMPLETION_CAUSE_ERROR_KINDS, EOF_DRAIN_BOUND_MS, STDIN_CLOSE_GRACE_MS, finalizationFacts, finalizationObligations, planCompletionAllowance, readCompletionBinding, readDeclaredChecks, readOptionalWatchers, readRequiredVerification, renderApprovedVerificationGuidance, } from "./completion-supervision.js";
|
|
44
|
+
import { COMPLETION_CAUSE_ERROR_KINDS, EOF_DRAIN_BOUND_MS, FINALIZATION_RESERVE_MS, REPORT_RESERVE_MS, STDIN_CLOSE_GRACE_MS, finalizationFacts, finalizationObligations, planCompletionAllowance, readCompletionBinding, readDeclaredChecks, readOptionalWatchers, readRequiredVerification, renderApprovedVerificationGuidance, } from "./completion-supervision.js";
|
|
43
45
|
import { compareFinalArtifact, createRequiredVerificationRunner, createSupervisedCommandLauncher, observeFinalArtifact, OWNERSHIP_POLL_MS, preCheckArtifactState, toCompletionCheckFact, } from "./required-verification.js";
|
|
44
46
|
import { createClosureSupervisor, createRequiredWorkLedger } from "./required-work-ledger.js";
|
|
45
47
|
import { COMPLETION_WINDOW_CLOSED_ON_LIVE_AGENT, requiredWorkKindTokens, } from "./required-work-diagnostics.js";
|
|
46
48
|
import { buildCleanupVerdict, CLEANUP_RESIDUALS_NOT_COVERED, createDefaultOwnershipRecordFs, createDescendantTracker, createMacProcessInspector, createOwnershipToken, hostIdentityDigest, ownershipTokenDigest, removeOwnershipRecord, runOwnedProcessSweep, withExecutorJobId, withOwnershipTag, writeOwnershipRecord, } from "./process-containment.js";
|
|
47
49
|
import { resolveCompletionEvidenceCapability } from "../agent-launchers/executor-adapter.js";
|
|
48
50
|
import { autoCheckpointDirtyState, PRIOR_ATTEMPT_WIP_COMMIT_MESSAGE, prepareResumeSpawn, prepareRetainedContinuationWorktree, readContinuationBinding, verifyContinuationHeadLineage, } from "./resume-pre-spawn.js";
|
|
49
|
-
import { buildEpicWorkaroundWorkerInstruction, buildEpicCapabilityStatementWorkerInstruction, buildEpicServerWorkerInstruction, ciFixContextError, readCiFixDispatchContext, renderPromptSpecPrompt, } from "./prompt-spec.js";
|
|
51
|
+
import { buildEpicWorkaroundWorkerInstruction, buildCredentialNoticeWorkerInstruction, buildEpicCapabilityStatementWorkerInstruction, buildEpicServerWorkerInstruction, ciFixContextError, readCiFixDispatchContext, renderPromptSpecPrompt, } from "./prompt-spec.js";
|
|
50
52
|
import { createDefaultEpicServerContextDeps, readEpicServerWorkerContext, withEpicServerEnv, } from "./epic-server-context.js";
|
|
51
53
|
/** BAPI-1399: the job type whose worker implements ticket requirements from scratch. */
|
|
52
54
|
const WORKAROUND_CONTRACT_JOB_TYPES = new Set(["implement"]);
|
|
@@ -306,7 +308,7 @@ function buildJobLogRegistryDeps(deps) {
|
|
|
306
308
|
* only correct value is the one the caller threads down from the validated
|
|
307
309
|
* runtime configuration.
|
|
308
310
|
*/
|
|
309
|
-
function buildExecutorMcpProvisioningDeps(deps, bridgeApiBaseUrl, trustedRepoName) {
|
|
311
|
+
function buildExecutorMcpProvisioningDeps(deps, bridgeApiBaseUrl, trustedRepoName, reference) {
|
|
310
312
|
return {
|
|
311
313
|
readFile: deps.readFile,
|
|
312
314
|
writeFile: deps.writeFile,
|
|
@@ -320,6 +322,9 @@ function buildExecutorMcpProvisioningDeps(deps, bridgeApiBaseUrl, trustedRepoNam
|
|
|
320
322
|
env: deps.env.XDG_CONFIG_HOME !== undefined ? { XDG_CONFIG_HOME: deps.env.XDG_CONFIG_HOME } : {},
|
|
321
323
|
homedir: deps.homedir,
|
|
322
324
|
...(trustedRepoName !== undefined ? { trustedRepoName } : {}),
|
|
325
|
+
// BAPI-1647: names-only reference inputs for the legacy (no-grant) path.
|
|
326
|
+
...(reference?.credentialReferenceTargets ? { credentialReferenceTargets: reference.credentialReferenceTargets } : {}),
|
|
327
|
+
...(reference?.bapiReferenceRepo !== undefined ? { bapiReferenceRepo: reference.bapiReferenceRepo } : {}),
|
|
323
328
|
};
|
|
324
329
|
}
|
|
325
330
|
/**
|
|
@@ -407,8 +412,16 @@ async function reportWorkerLogSessionInvariant(tee, deps) {
|
|
|
407
412
|
deps.errorLog(formatWorkerLogSessionInvariantWarning(sessions.length));
|
|
408
413
|
}
|
|
409
414
|
}
|
|
410
|
-
async function provisionMcpForPreparedSpawn(job, branch, worktreePath, deps, seams, bridgeApiBaseUrl) {
|
|
415
|
+
async function provisionMcpForPreparedSpawn(job, branch, worktreePath, deps, seams, bridgeApiBaseUrl, credentialApprovals) {
|
|
411
416
|
const provision = seams.provisionMcp ?? provisionMcpRegistrationForWorktree;
|
|
417
|
+
// BAPI-1647: from the one names-only record read made for this start.
|
|
418
|
+
const credentialMetadata = credentialApprovals?.state === "ok" ? credentialApprovals.metadata : null;
|
|
419
|
+
const reference = credentialMetadata
|
|
420
|
+
? {
|
|
421
|
+
credentialReferenceTargets: (manifest) => legacyReferenceBackedTargets(credentialMetadata, manifest.mcp),
|
|
422
|
+
...(hasBridgeConsumer(credentialMetadata) ? { bapiReferenceRepo: job.repo_name } : {}),
|
|
423
|
+
}
|
|
424
|
+
: {};
|
|
412
425
|
const row = {
|
|
413
426
|
key: job.ticket_key ?? String(job.id),
|
|
414
427
|
branch,
|
|
@@ -419,7 +432,7 @@ async function provisionMcpForPreparedSpawn(job, branch, worktreePath, deps, sea
|
|
|
419
432
|
// BAPI-1545: the claimed job's `repo_name` comes from the server's claim
|
|
420
433
|
// response, never from a worktree file, so it is the trusted identity the
|
|
421
434
|
// grant is selected by.
|
|
422
|
-
const result = await provision(row, buildExecutorMcpProvisioningDeps(deps, bridgeApiBaseUrl, job.repo_name));
|
|
435
|
+
const result = await provision(row, buildExecutorMcpProvisioningDeps(deps, bridgeApiBaseUrl, job.repo_name, reference));
|
|
423
436
|
for (const warning of result.warnings ?? []) {
|
|
424
437
|
deps.errorLog(`MCP provisioning warning: ${warning}`);
|
|
425
438
|
}
|
|
@@ -1692,7 +1705,7 @@ async function reportDriverPhaseInterruption(phase, ctx) {
|
|
|
1692
1705
|
if (phase.kind === "server_stop") {
|
|
1693
1706
|
await ctx.httpClient.fail(ctx.job, {
|
|
1694
1707
|
error_kind: "ServerStopRequested",
|
|
1695
|
-
error_message: "the server
|
|
1708
|
+
error_message: "the server asked this job to stop (its run stopped, or its gate moved on); the reconciliation was stopped",
|
|
1696
1709
|
classification: "killed",
|
|
1697
1710
|
telemetry: ctx.observation.snapshot(),
|
|
1698
1711
|
});
|
|
@@ -2430,7 +2443,7 @@ async function superviseFocusedRebaseWait(params) {
|
|
|
2430
2443
|
await params.finalizeRegistry();
|
|
2431
2444
|
await httpClient.fail(job, {
|
|
2432
2445
|
error_kind: "ServerStopRequested",
|
|
2433
|
-
error_message: "the server
|
|
2446
|
+
error_message: "the server asked this job to stop (its run stopped, or its gate moved on); the focused rebase wait was stopped",
|
|
2434
2447
|
classification: "killed",
|
|
2435
2448
|
telemetry: observation.snapshot(),
|
|
2436
2449
|
});
|
|
@@ -2644,6 +2657,7 @@ async function runSpawnJob(job, httpClient, options, deps, ownership, observatio
|
|
|
2644
2657
|
* seams gets the real operation, matching the worktree-lock fallback direction.
|
|
2645
2658
|
*/
|
|
2646
2659
|
function excludeProvisioningDeps(deps) {
|
|
2660
|
+
const lock = executorExcludeLockDeps(deps);
|
|
2647
2661
|
return {
|
|
2648
2662
|
readFile: deps.readFile,
|
|
2649
2663
|
writeFile: deps.writeFile,
|
|
@@ -2651,6 +2665,36 @@ function excludeProvisioningDeps(deps) {
|
|
|
2651
2665
|
stat: deps.stat ?? ((filePath) => fsStat(filePath)),
|
|
2652
2666
|
rename: deps.rename ?? ((from, to) => fsRename(from, to)),
|
|
2653
2667
|
removeFile: deps.removeFile ?? ((filePath) => rm(filePath, { force: true })),
|
|
2668
|
+
...(lock ? { excludeLock: lock } : {}),
|
|
2669
|
+
};
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* BAPI-1647: the cross-process exclude lock, built from the executor's OWN
|
|
2673
|
+
* injected filesystem and clock (exclusive create, remove, mkdir, realpath,
|
|
2674
|
+
* mtime, sleep), so the lock never opens a file handle the runner did not hand
|
|
2675
|
+
* it. Absent when the deps cannot create a file exclusively.
|
|
2676
|
+
*/
|
|
2677
|
+
function executorExcludeLockDeps(deps) {
|
|
2678
|
+
const createExclusive = deps.writeFileExclusive;
|
|
2679
|
+
const remove = deps.removeFile;
|
|
2680
|
+
if (!createExclusive || !remove)
|
|
2681
|
+
return undefined;
|
|
2682
|
+
return {
|
|
2683
|
+
open: async (p) => {
|
|
2684
|
+
await createExclusive(p, "");
|
|
2685
|
+
return { close: async () => undefined };
|
|
2686
|
+
},
|
|
2687
|
+
unlink: (p) => remove(p),
|
|
2688
|
+
mkdir: (p, o) => deps.mkdir(p, o),
|
|
2689
|
+
realpath: deps.realpath ?? (async (p) => path.resolve(p)),
|
|
2690
|
+
mtimeMs: async (p) => {
|
|
2691
|
+
const mtime = deps.statMtimeMs ? await deps.statMtimeMs(p) : null;
|
|
2692
|
+
if (mtime === null)
|
|
2693
|
+
throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });
|
|
2694
|
+
return mtime;
|
|
2695
|
+
},
|
|
2696
|
+
now: deps.now,
|
|
2697
|
+
sleep: deps.sleep,
|
|
2654
2698
|
};
|
|
2655
2699
|
}
|
|
2656
2700
|
async function runReservedSpawnJob(job, httpClient, options, deps, ownership, observation, seams, control,
|
|
@@ -3150,7 +3194,7 @@ async function prepareDependencyRefresh(params) {
|
|
|
3150
3194
|
if (phase.kind === "server_stop") {
|
|
3151
3195
|
await params.httpClient.fail(job, {
|
|
3152
3196
|
error_kind: "ServerStopRequested",
|
|
3153
|
-
error_message: "the server
|
|
3197
|
+
error_message: "the server asked this job to stop (its run stopped, or its gate moved on) before the worker started",
|
|
3154
3198
|
classification: "killed",
|
|
3155
3199
|
telemetry: params.observation.snapshot(),
|
|
3156
3200
|
});
|
|
@@ -3328,7 +3372,7 @@ async function prepareWorkerResources(params) {
|
|
|
3328
3372
|
if (phase.kind === "server_stop") {
|
|
3329
3373
|
await params.httpClient.fail(job, {
|
|
3330
3374
|
error_kind: "ServerStopRequested",
|
|
3331
|
-
error_message: "the server
|
|
3375
|
+
error_message: "the server asked this job to stop (its run stopped, or its gate moved on) before the worker started",
|
|
3332
3376
|
classification: "killed",
|
|
3333
3377
|
telemetry: params.observation.snapshot(),
|
|
3334
3378
|
});
|
|
@@ -3389,12 +3433,19 @@ export const fileSystemExecutableCheck = (candidate, options) => {
|
|
|
3389
3433
|
function retainedHeadPublisher(params) {
|
|
3390
3434
|
return async () => {
|
|
3391
3435
|
const { job, branch, worktreePath, prep, deps, ownership, observation, remainingMs } = params;
|
|
3392
|
-
|
|
3436
|
+
const createStartSha = prep.comparisonSha ?? prep.expectedHeadSha;
|
|
3437
|
+
const createOnly = !prep.publicationBaseline && params.allowCreateOnly === true && prep.publicationRemoteAbsent === true;
|
|
3438
|
+
if (!prep.publicationBaseline && !createOnly)
|
|
3439
|
+
return { status: "refused", reason: "invalid_input" };
|
|
3440
|
+
if (createOnly && !createStartSha)
|
|
3393
3441
|
return { status: "refused", reason: "invalid_input" };
|
|
3394
3442
|
const phase = await superviseDriverPhase({ job, httpClient: params.httpClient, options: params.options, deps, ownership, observation, control: params.control,
|
|
3395
3443
|
timeoutSeconds: Math.max(1, Math.ceil(remainingMs() / 1000)), collectTelemetry: async () => ({}),
|
|
3396
3444
|
run: async (signal) => {
|
|
3397
|
-
const result = await guardedFastForwardPush({ branch,
|
|
3445
|
+
const result = await guardedFastForwardPush({ branch,
|
|
3446
|
+
...(createOnly ? { expectedOriginSha: null, createOnly: { startSha: createStartSha } }
|
|
3447
|
+
: { expectedOriginSha: prep.publicationBaseline }),
|
|
3448
|
+
...(params.candidateSha !== undefined ? { candidateSha: params.candidateSha } : {}),
|
|
3398
3449
|
worktreePath, runCommand: deps.runCommand, env: deps.env, remainingMs, signal,
|
|
3399
3450
|
mayMutate: () => !ownership.abandoned && !signal.aborted });
|
|
3400
3451
|
if (result.status === "published")
|
|
@@ -3527,6 +3578,10 @@ async function runPreparedSpawn(params) {
|
|
|
3527
3578
|
if (remote.exitCode === 0 && fields.length === 2 && fields[1] === `refs/heads/${branch}` && /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(fields[0])) {
|
|
3528
3579
|
prep.publicationBaseline = isRecoveryJobType(job.job_type) ? prep.expectedHeadSha : fields[0];
|
|
3529
3580
|
}
|
|
3581
|
+
else if (remote.exitCode === 2 && remote.stdout.trim() === "") {
|
|
3582
|
+
// Confirmed absence. Any other failed or odd read stays unknown, never absence.
|
|
3583
|
+
prep.publicationRemoteAbsent = true;
|
|
3584
|
+
}
|
|
3530
3585
|
}
|
|
3531
3586
|
catch { /* no eligible lease baseline */ }
|
|
3532
3587
|
}
|
|
@@ -3683,6 +3738,19 @@ async function runPreparedSpawn(params) {
|
|
|
3683
3738
|
// unchanged and deliberately still fail-OPEN: a provisioning hiccup shrinks
|
|
3684
3739
|
// safety margin but must not kill a job. Refusing to CLAIM on unenforced deny
|
|
3685
3740
|
// remains a separate, fatal preflight concern.
|
|
3741
|
+
// --- Referenced credentials: names-only read (fail-open, BAPI-1647) --
|
|
3742
|
+
// Keyed on the claimed job's `repo_name` (the server's claim response, the
|
|
3743
|
+
// same trusted identity the MCP grant uses), read fresh at every worker start.
|
|
3744
|
+
// It supplies the restricted source paths for the deny layer below and the
|
|
3745
|
+
// reference inputs for MCP provisioning. Never fails the job.
|
|
3746
|
+
const credentialEnvDeps = {
|
|
3747
|
+
env: deps.env,
|
|
3748
|
+
homedir: deps.homedir,
|
|
3749
|
+
platform: deps.platform,
|
|
3750
|
+
readFile: deps.readFile,
|
|
3751
|
+
runCommand: (file, args, opts) => deps.runCommand(file, args, opts),
|
|
3752
|
+
};
|
|
3753
|
+
const credentialApprovals = await readExecutorCredentialApprovals(job.repo_name, credentialEnvDeps, seams.credentialReferences);
|
|
3686
3754
|
const denyCapability = adapter.denyEnforcement;
|
|
3687
3755
|
const correctionWork = isRemainingWork(job.job_type, job.payload);
|
|
3688
3756
|
let correctionDenyInstalled = false;
|
|
@@ -3703,6 +3771,10 @@ async function runPreparedSpawn(params) {
|
|
|
3703
3771
|
workerBranch: branch,
|
|
3704
3772
|
...(correctionWork ? { correctionIntentVersion: 1 } : {}),
|
|
3705
3773
|
workerGuardHookBinPath: correctionHookBinPath,
|
|
3774
|
+
// BAPI-1647: one exact Read deny rule per restricted credential source.
|
|
3775
|
+
...(credentialApprovals.restrictedSourcePaths.length > 0
|
|
3776
|
+
? { restrictedSourcePaths: credentialApprovals.restrictedSourcePaths }
|
|
3777
|
+
: {}),
|
|
3706
3778
|
});
|
|
3707
3779
|
// Log on WARNING PRESENCE, not on `!ok` (BAPI-815/R2). The git-exclude
|
|
3708
3780
|
// hygiene step can degrade without failing the deny layer — present-but-
|
|
@@ -3756,7 +3828,7 @@ async function runPreparedSpawn(params) {
|
|
|
3756
3828
|
// BAPI-727: the validated endpoint travels from executor bootstrap through the
|
|
3757
3829
|
// runtime options to the generated registration, so the worker's MCP server
|
|
3758
3830
|
// targets the same Bridge API this executor claimed the job from.
|
|
3759
|
-
const grantRegistration = await provisionMcpForPreparedSpawn(job, branch, worktreePath, deps, seams, options.resolvedBaseUrl);
|
|
3831
|
+
const grantRegistration = await provisionMcpForPreparedSpawn(job, branch, worktreePath, deps, seams, options.resolvedBaseUrl, credentialApprovals.approvals);
|
|
3760
3832
|
// --- Required Bridge MCP registration (FAIL-CLOSED) -------------------
|
|
3761
3833
|
// Provisioning itself stays fail-OPEN: a skipped or malformed Tier-2 target is
|
|
3762
3834
|
// a warning, and every valid worktree-provisioned server is kept. The REQUIRED
|
|
@@ -3807,6 +3879,16 @@ async function runPreparedSpawn(params) {
|
|
|
3807
3879
|
return { status: "failed", reason: "required_mcp_registration" };
|
|
3808
3880
|
}
|
|
3809
3881
|
const mcpContract = registration.contract;
|
|
3882
|
+
// --- Referenced credentials: file links + sandbox variables (BAPI-1647) --
|
|
3883
|
+
// After MCP provisioning and its verification, and before the final `.env*`
|
|
3884
|
+
// strip below, which is unchanged (child 1 refuses `.env` sources and
|
|
3885
|
+
// destinations, so the two never meet). Files are linked through the shared
|
|
3886
|
+
// reconciled, exclusion-first delivery; variables stay in memory until the env
|
|
3887
|
+
// builder admits them. Every problem is a names-only notice: the job is never
|
|
3888
|
+
// failed or parked because of a credential.
|
|
3889
|
+
const credentialPrep = await prepareExecutorCredentialDelivery(job.repo_name, worktreePath, credentialApprovals.approvals, credentialEnvDeps, seams.credentialReferences);
|
|
3890
|
+
const credentialNotice = buildCredentialNoticeWorkerInstruction(credentialNoticeLines(credentialPrep));
|
|
3891
|
+
let credentialAdmission = null;
|
|
3810
3892
|
// --- Worker log tee + watch registry + viewer tab (BAPI-535 §8) ------
|
|
3811
3893
|
// BAPI-1330: ONE attempt identity — the server's job id and attempt number
|
|
3812
3894
|
// plus a claim id minted here — names this attempt's log file, its registry
|
|
@@ -4123,6 +4205,17 @@ async function runPreparedSpawn(params) {
|
|
|
4123
4205
|
// job type. Absent keeps the legacy compatibility constants; a present
|
|
4124
4206
|
// value, even `[]` or a malformed one, replaces them.
|
|
4125
4207
|
...payloadWorkerEnvOption(job.payload),
|
|
4208
|
+
// BAPI-1647 — approved sandbox credential variables, resolved above in this
|
|
4209
|
+
// process. Present only when there are any, so every other job's
|
|
4210
|
+
// environment is byte-identical.
|
|
4211
|
+
...(Object.keys(credentialPrep.declaredCredentialEnv).length > 0
|
|
4212
|
+
? {
|
|
4213
|
+
declaredCredentialEnv: credentialPrep.declaredCredentialEnv,
|
|
4214
|
+
onDeclaredCredentialEnv: (outcome) => {
|
|
4215
|
+
credentialAdmission = outcome;
|
|
4216
|
+
},
|
|
4217
|
+
}
|
|
4218
|
+
: {}),
|
|
4126
4219
|
parentEnv: deps.env,
|
|
4127
4220
|
};
|
|
4128
4221
|
// The PATH the worker will receive: the launcher directory (when provisioned)
|
|
@@ -4161,10 +4254,23 @@ async function runPreparedSpawn(params) {
|
|
|
4161
4254
|
const prePrChecks = job.job_type === "implement"
|
|
4162
4255
|
? renderPrePrChecks(validatePrePrCheckDeclarations(payloadPrePrChecksOption(job.payload), deps.errorLog))
|
|
4163
4256
|
: "";
|
|
4257
|
+
// BAPI-1647: the credential notice follows the job prompt; LOCAL
|
|
4258
|
+
// ENVIRONMENT LIMITS stays last. No notice renders nothing.
|
|
4164
4259
|
spawnShape = invocation.value.buildSpawnShape({
|
|
4165
|
-
prompt: [prompt, required, prePrChecks, limits].filter((section) => section.length > 0).join("\n\n"),
|
|
4260
|
+
prompt: [prompt, credentialNotice, required, prePrChecks, limits].filter((section) => section.length > 0).join("\n\n"),
|
|
4166
4261
|
...shapeInput,
|
|
4167
4262
|
});
|
|
4263
|
+
// BAPI-1647: names-only audit in the executor's local per-job log. Never
|
|
4264
|
+
// the job row and never the server.
|
|
4265
|
+
try {
|
|
4266
|
+
const admission = credentialAdmission;
|
|
4267
|
+
for (const line of formatCredentialAuditLines(job.id, credentialPrep, admission?.admitted ?? null, admission?.dropped ?? [])) {
|
|
4268
|
+
deps.errorLog(line);
|
|
4269
|
+
}
|
|
4270
|
+
}
|
|
4271
|
+
catch {
|
|
4272
|
+
/* audit is supplemental */
|
|
4273
|
+
}
|
|
4168
4274
|
// BAPI-1546: the trusted browser target (and run id for turns), injected AFTER
|
|
4169
4275
|
// the environment builder ran, like the job tag. `disabled` leaves the shape untouched.
|
|
4170
4276
|
if (epicServerContext.kind !== "disabled" && spawnShape.env) {
|
|
@@ -4527,7 +4633,7 @@ async function runPreparedSpawn(params) {
|
|
|
4527
4633
|
await driver.abandon(driverBaseContext);
|
|
4528
4634
|
await httpClient.fail(job, {
|
|
4529
4635
|
error_kind: "ServerStopRequested",
|
|
4530
|
-
error_message: "the server
|
|
4636
|
+
error_message: "the server asked this job to stop (its run stopped, or its gate moved on); the owned worker was terminated",
|
|
4531
4637
|
classification: "killed",
|
|
4532
4638
|
...commitResidue(finalTelemetry),
|
|
4533
4639
|
telemetry: observation.snapshot(),
|
|
@@ -5292,7 +5398,7 @@ async function runCoveredAttempt(params) {
|
|
|
5292
5398
|
if (beat.kind === "server_stop") {
|
|
5293
5399
|
// Report first, then mark the claim abandoned, exactly as the post-spawn
|
|
5294
5400
|
// server-stop path does: an abandoned claim skips the terminal report.
|
|
5295
|
-
const stopped = await notLaunched("the server
|
|
5401
|
+
const stopped = await notLaunched("the server asked this job to stop (its run stopped, or its gate moved on) before the worker launched");
|
|
5296
5402
|
ownership.abandoned = true;
|
|
5297
5403
|
ownership.abandonReason = "server_stop";
|
|
5298
5404
|
return stopped.status === "failed" ? { status: "abandoned", reason: "server_stop" } : stopped;
|
|
@@ -5707,7 +5813,7 @@ async function runCoveredAttempt(params) {
|
|
|
5707
5813
|
// outlives the worker, so a lost claim or a server stop can arrive during
|
|
5708
5814
|
// cleanup, verification or finalization, and must still win over a report
|
|
5709
5815
|
// built from those phases.
|
|
5710
|
-
const strongerOutcome = async () => {
|
|
5816
|
+
const strongerOutcome = async (serverStopTelemetry) => {
|
|
5711
5817
|
if (ownership.abandoned) {
|
|
5712
5818
|
await finalizeRegistry();
|
|
5713
5819
|
return finish({ status: "abandoned", reason: ownership.abandonReason });
|
|
@@ -5716,8 +5822,9 @@ async function runCoveredAttempt(params) {
|
|
|
5716
5822
|
if (hbNow?.kind === "server_stop") {
|
|
5717
5823
|
const result = await failWith({
|
|
5718
5824
|
error_kind: "ServerStopRequested",
|
|
5719
|
-
error_message: "the server
|
|
5825
|
+
error_message: "the server asked this job to stop (its run stopped, or its gate moved on); the owned worker was terminated",
|
|
5720
5826
|
classification: "killed",
|
|
5827
|
+
...(serverStopTelemetry ? { telemetry: serverStopTelemetry } : {}),
|
|
5721
5828
|
}, { ...unverifiedEnvelope(), end_cause: "server_stop" });
|
|
5722
5829
|
ownership.abandoned = true;
|
|
5723
5830
|
ownership.abandonReason = "server_stop";
|
|
@@ -5749,6 +5856,40 @@ async function runCoveredAttempt(params) {
|
|
|
5749
5856
|
errorLog: deps.errorLog,
|
|
5750
5857
|
});
|
|
5751
5858
|
}
|
|
5859
|
+
// Covered-timeout publication: a worker that timed out may still have committed
|
|
5860
|
+
// useful work. Publish the exact reported head, but only when every fact below
|
|
5861
|
+
// holds, and never let the outcome change: the timeout failure is still reported.
|
|
5862
|
+
let timeoutPublication;
|
|
5863
|
+
if (procResult.classification === "timeout" && isCoveredJobType(job.job_type)) {
|
|
5864
|
+
const ownershipHeld = () => !ownership.abandoned && heartbeatOutcome?.kind !== "server_stop";
|
|
5865
|
+
const baseline = prep.publicationBaseline ??
|
|
5866
|
+
(prep.publicationRemoteAbsent === true ? (prep.comparisonSha ?? prep.expectedHeadSha) : undefined);
|
|
5867
|
+
// One fixed deadline: a fresh allowance must not be re-derived on each read.
|
|
5868
|
+
const publicationDeadlineAtMs = Math.min(deps.now() + FINALIZATION_RESERVE_MS, plan.deadlineAtMs - REPORT_RESERVE_MS);
|
|
5869
|
+
const publicationRemainingMs = () => Math.max(0, publicationDeadlineAtMs - deps.now());
|
|
5870
|
+
if (!ownershipHeld())
|
|
5871
|
+
timeoutPublication = "ownership_abandoned";
|
|
5872
|
+
else if (cleanup.verdict !== "confirmed" || cleanup.survivors !== 0)
|
|
5873
|
+
timeoutPublication = "cleanup_not_confirmed";
|
|
5874
|
+
else if (finalHeadSha === null || finalHeadSha === baseline)
|
|
5875
|
+
timeoutPublication = "nothing_to_publish";
|
|
5876
|
+
else if (publicationRemainingMs() <= 0)
|
|
5877
|
+
timeoutPublication = "no_time_left";
|
|
5878
|
+
else {
|
|
5879
|
+
// The publisher supervises its own phase; the expired worker signal is never passed.
|
|
5880
|
+
const outcome = await retainedHeadPublisher({
|
|
5881
|
+
job, branch, worktreePath, prep, deps, ownership, observation, httpClient, options: jobOptions, control,
|
|
5882
|
+
remainingMs: publicationRemainingMs, candidateSha: finalHeadSha, allowCreateOnly: true,
|
|
5883
|
+
})();
|
|
5884
|
+
if (outcome.status === "refused") {
|
|
5885
|
+
timeoutPublication = outcome.reason !== "timeout" && publicationRemainingMs() <= 0 ? "no_time_left" : outcome.reason;
|
|
5886
|
+
}
|
|
5887
|
+
}
|
|
5888
|
+
// Supervision may have found a server stop or abandoned ownership meanwhile.
|
|
5889
|
+
const stronger = await strongerOutcome(timeoutPublication === "ownership_abandoned" ? { timeout_publication: "ownership_abandoned" } : undefined);
|
|
5890
|
+
if (stronger)
|
|
5891
|
+
return stronger;
|
|
5892
|
+
}
|
|
5752
5893
|
const authDetection = adapter.authFailureDetection;
|
|
5753
5894
|
const authFailure = authDetection?.supported === true && authDetection.value.classify(procResult.stdoutExcerpt).notAuthenticated;
|
|
5754
5895
|
const capacityEvidence = authFailure
|
|
@@ -5767,6 +5908,7 @@ async function runCoveredAttempt(params) {
|
|
|
5767
5908
|
: `worker exited (${procResult.classification}, exit_code=${procResult.exitCode})`,
|
|
5768
5909
|
classification: toWireClassification(procResult.classification),
|
|
5769
5910
|
...observedExitCode(procResult.exitCode),
|
|
5911
|
+
...(timeoutPublication !== undefined ? { telemetry: { timeout_publication: timeoutPublication } } : {}),
|
|
5770
5912
|
}, envelope, capacityEvidence !== undefined ? { capacity_evidence: capacityEvidence } : {}));
|
|
5771
5913
|
}
|
|
5772
5914
|
// --- Phase 3: independent declared checks (BAPI-1302, D4c) ---------------------
|
|
@@ -37,7 +37,39 @@
|
|
|
37
37
|
*/
|
|
38
38
|
import { randomUUID } from "node:crypto";
|
|
39
39
|
import path from "node:path";
|
|
40
|
+
import { acquireExcludeLock } from "../git-exclude-lock.js";
|
|
40
41
|
import { mergeClaudeSettingsWithAutoMemoryDisabled, mergeClaudeSettingsWithCommandHook, provisionClaudeSettingsForWorktree, DEFAULT_PRE_TOOL_USE_MATCHER, } from "../claude-settings.js";
|
|
42
|
+
/**
|
|
43
|
+
* BAPI-1647: one exact `Read(<path>)` rule per distinct restricted source path,
|
|
44
|
+
* in first-seen order. A path with a control character, or that is not
|
|
45
|
+
* absolute, is skipped (child 1 already refuses both in the record).
|
|
46
|
+
*
|
|
47
|
+
* A POSIX absolute path also gets the `Read(/<path>)` form (two leading
|
|
48
|
+
* slashes): Claude Code's permission grammar reads a single leading `/` as
|
|
49
|
+
* relative to the settings file and `//` as the filesystem root, so the second
|
|
50
|
+
* form is the one that is certain to match the real file. The first form is the
|
|
51
|
+
* one the ticket and `doctor` name, and it matches this module's existing
|
|
52
|
+
* `Read(/etc/shadow)` convention.
|
|
53
|
+
*/
|
|
54
|
+
export function restrictedSourceDenyRules(paths) {
|
|
55
|
+
if (!paths || paths.length === 0)
|
|
56
|
+
return [];
|
|
57
|
+
const rules = [];
|
|
58
|
+
const seen = new Set();
|
|
59
|
+
for (const p of paths) {
|
|
60
|
+
if (typeof p !== "string" || p.length === 0 || /[\u0000-\u001f\u007f]/.test(p))
|
|
61
|
+
continue;
|
|
62
|
+
if (!path.posix.isAbsolute(p) && !path.win32.isAbsolute(p))
|
|
63
|
+
continue;
|
|
64
|
+
if (seen.has(p))
|
|
65
|
+
continue;
|
|
66
|
+
seen.add(p);
|
|
67
|
+
rules.push(`Read(${p})`);
|
|
68
|
+
if (path.posix.isAbsolute(p) && !p.startsWith("//"))
|
|
69
|
+
rules.push(`Read(/${p})`);
|
|
70
|
+
}
|
|
71
|
+
return rules;
|
|
72
|
+
}
|
|
41
73
|
/**
|
|
42
74
|
* The stable executor deny rules. Grammar mirrors the deny-enforcement probe's
|
|
43
75
|
* `Bash(<cmd>:<args-glob>)` / `Read(<path-glob>)` form. Covers: reads under
|
|
@@ -115,6 +147,9 @@ export function executorDenyRules(inputs) {
|
|
|
115
147
|
"Bash(docker:push*)",
|
|
116
148
|
"Bash(git push:*mcp-server/v*)",
|
|
117
149
|
"Bash(npm:publish*)",
|
|
150
|
+
// BAPI-1647 — restricted credential sources, appended after the stable list
|
|
151
|
+
// so a job with none gets exactly the list above.
|
|
152
|
+
...restrictedSourceDenyRules(inputs.restrictedSourcePaths),
|
|
118
153
|
];
|
|
119
154
|
}
|
|
120
155
|
/**
|
|
@@ -226,16 +261,46 @@ function asObject(value) {
|
|
|
226
261
|
* replaced.
|
|
227
262
|
*/
|
|
228
263
|
export function mergeExecutorDenySettings(existing, inputs) {
|
|
264
|
+
return mergeDenyRules(existing, executorDenyRules(inputs));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Append `rules` to `permissions.deny`, keeping every existing setting and deny
|
|
268
|
+
* entry in place and adding only rules not already present (idempotent).
|
|
269
|
+
* Shared by the executor merge and BAPI-1647's restricted-read-only merge.
|
|
270
|
+
*/
|
|
271
|
+
export function mergeDenyRules(existing, rules) {
|
|
229
272
|
const permissions = { ...asObject(existing.permissions) };
|
|
230
273
|
const existingDeny = Array.isArray(permissions.deny) ? permissions.deny : [];
|
|
231
274
|
const merged = [...existingDeny];
|
|
232
|
-
for (const rule of
|
|
275
|
+
for (const rule of rules) {
|
|
233
276
|
if (!merged.includes(rule))
|
|
234
277
|
merged.push(rule);
|
|
235
278
|
}
|
|
236
279
|
permissions.deny = merged;
|
|
237
280
|
return { ...existing, permissions };
|
|
238
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* BAPI-1647: merge ONLY the restricted-source `Read(<path>)` rules into a
|
|
284
|
+
* worktree's `.claude/settings.local.json`, for `start-tickets` worktrees, which
|
|
285
|
+
* must not receive the executor's command restrictions. Uses the same
|
|
286
|
+
* malformed-safe write as the executor deny layer: a malformed file is never
|
|
287
|
+
* clobbered, unrelated settings and MCP trust entries are kept, and every
|
|
288
|
+
* failure is an advisory warning, never a stop.
|
|
289
|
+
*/
|
|
290
|
+
export async function provisionRestrictedReadDenyRules(worktreePath, restrictedSourcePaths, deps) {
|
|
291
|
+
const rules = restrictedSourceDenyRules(restrictedSourcePaths);
|
|
292
|
+
if (rules.length === 0)
|
|
293
|
+
return { ok: true };
|
|
294
|
+
try {
|
|
295
|
+
const result = await provisionClaudeSettingsForWorktree(worktreePath, (existing) => mergeDenyRules(existing, rules), deps);
|
|
296
|
+
if (result.ok)
|
|
297
|
+
return { ok: true };
|
|
298
|
+
return { ok: false, warning: "restricted credential read rules were not written: the worktree Claude settings could not be updated" };
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
return { ok: false, warning: "restricted credential read rules were not written: the worktree Claude settings could not be updated" };
|
|
302
|
+
}
|
|
303
|
+
}
|
|
239
304
|
/**
|
|
240
305
|
* The exact line appended to the worktree's `.git/info/exclude` so a worker's
|
|
241
306
|
* `git add -A` cannot commit the executor-owned settings file.
|
|
@@ -447,8 +512,15 @@ export async function resolveWorktreeSettingsExclude(worktreePath, deps) {
|
|
|
447
512
|
* the same `info/` directory and renamed into place; no lockfile is used, and
|
|
448
513
|
* nothing is published when no canonical line is missing. Competing executor
|
|
449
514
|
* writers add the same canonical entries, so fresh reads plus atomic publication
|
|
450
|
-
* prevent torn files and executor-created duplicates.
|
|
451
|
-
*
|
|
515
|
+
* prevent torn files and executor-created duplicates. Since BAPI-1647 the whole
|
|
516
|
+
* read-modify-write also runs inside the cross-process exclude lock
|
|
517
|
+
* (`git-exclude-lock.ts`), keyed on the canonical exclude path and shared with
|
|
518
|
+
* every other Bridge exclude writer, so concurrent launches in two worktrees of
|
|
519
|
+
* one repository cannot drop each other's lines. A fresh read alone did not
|
|
520
|
+
* prevent that lost update. The lock is best effort here: when it cannot be had,
|
|
521
|
+
* the publication proceeds exactly as before, so this function's outcome never
|
|
522
|
+
* changes because of it. It does not serialize against unrelated external
|
|
523
|
+
* editors.
|
|
452
524
|
*
|
|
453
525
|
* Warnings are bounded to a failure category plus the affected worktree path.
|
|
454
526
|
* They never carry `.git` contents, exception text, environment values, or
|
|
@@ -466,6 +538,9 @@ export async function provisionWorktreeSettingsExclude(worktreePath, deps) {
|
|
|
466
538
|
}
|
|
467
539
|
const { excludePath, infoDir } = resolved;
|
|
468
540
|
let tempPath;
|
|
541
|
+
// Only when the caller supplies its lock boundary: the executor's injected
|
|
542
|
+
// filesystem is the single I/O boundary its tests fake.
|
|
543
|
+
const lock = deps.excludeLock ? await acquireExcludeLock(excludePath, deps.excludeLock) : null;
|
|
469
544
|
try {
|
|
470
545
|
await deps.mkdir(infoDir, { recursive: true });
|
|
471
546
|
let existing = "";
|
|
@@ -510,6 +585,10 @@ export async function provisionWorktreeSettingsExclude(worktreePath, deps) {
|
|
|
510
585
|
warning: excludeWarning(worktreePath, "the exclude file could not be written"),
|
|
511
586
|
};
|
|
512
587
|
}
|
|
588
|
+
finally {
|
|
589
|
+
if (lock?.ok)
|
|
590
|
+
await lock.release();
|
|
591
|
+
}
|
|
513
592
|
}
|
|
514
593
|
/**
|
|
515
594
|
* Provision the executor deny layer into `<worktree>/.claude/settings.local.json`,
|
|
@@ -528,6 +607,9 @@ export async function provisionExecutorDenyLayer(worktreePath, options, deps) {
|
|
|
528
607
|
baseBranch: options.baseBranch,
|
|
529
608
|
worktreePath,
|
|
530
609
|
homedir: deps.homedir(),
|
|
610
|
+
...(options.restrictedSourcePaths && options.restrictedSourcePaths.length > 0
|
|
611
|
+
? { restrictedSourcePaths: options.restrictedSourcePaths }
|
|
612
|
+
: {}),
|
|
531
613
|
};
|
|
532
614
|
// BAPI-1397 (F7): the deny list the worktree will actually carry — the executor
|
|
533
615
|
// rules plus any operator-authored entries already in the file. Captured from
|
|
@@ -24,7 +24,7 @@ import { WORKER_BACKGROUND_WORK_RULE } from "./required-work-diagnostics.js";
|
|
|
24
24
|
import { validateEpicCapabilityStatement } from "../epic-capability-statement.js";
|
|
25
25
|
import { epicServerAcquireCommandSeconds } from "./epic-server-context.js";
|
|
26
26
|
import { EPIC_SERVER_DEFAULT_TIMING } from "../conductor/epic-server-recipe.js";
|
|
27
|
-
import { buildSfccWorkerPolicyText } from "../conductor/epic-server-sfcc.js";
|
|
27
|
+
import { buildSfccUploadWorkerText, buildSfccWorkerPolicyText, SFCC_UPLOAD_WORKER_COMMAND_SECONDS, } from "../conductor/epic-server-sfcc.js";
|
|
28
28
|
/**
|
|
29
29
|
* BAPI-1546: the epic-server turn paragraph, a SEPARATE builder so the
|
|
30
30
|
* workaround contract ({@link buildEpicWorkaroundWorkerInstruction}) stays
|
|
@@ -51,7 +51,8 @@ export function buildEpicServerWorkerInstruction(context, ticketKey) {
|
|
|
51
51
|
if (context.kind === "disabled")
|
|
52
52
|
return null;
|
|
53
53
|
if (context.kind === "sfcc") {
|
|
54
|
-
const
|
|
54
|
+
const sfccTicket = ticketKey && /^[A-Z][A-Z0-9_]{0,19}-\d{1,9}$/.test(ticketKey) ? ticketKey : "<TICKET>";
|
|
55
|
+
const sfcc = buildSfccWorkerPolicyText(context.origin, sfccTicket, SFCC_UPLOAD_WORKER_COMMAND_SECONDS);
|
|
55
56
|
return /[;'"\r\n]/.test(sfcc) ? null : sfcc;
|
|
56
57
|
}
|
|
57
58
|
const ticket = ticketKey && /^[A-Z][A-Z0-9_]{0,19}-\d{1,9}$/.test(ticketKey) ? ticketKey : "<TICKET>";
|
|
@@ -83,6 +84,12 @@ export function buildEpicServerWorkerInstruction(context, ticketKey) {
|
|
|
83
84
|
"launcher on your PATH. If it is granted, follow the turn rules. " + turnRules + " Otherwise its output is the " +
|
|
84
85
|
"observation. " + handoff;
|
|
85
86
|
}
|
|
87
|
+
if (context.sfccUpload === true) {
|
|
88
|
+
// The same upload sentences as the SFCC text, then the turn rules apply as above.
|
|
89
|
+
line =
|
|
90
|
+
line + " This run also approved a sandbox code version. " + buildSfccUploadWorkerText(ticket, SFCC_UPLOAD_WORKER_COMMAND_SECONDS) +
|
|
91
|
+
" Run the upload before you acquire the turn, and acquire the turn again for any repeated check.";
|
|
92
|
+
}
|
|
86
93
|
return /[;'"\r\n]/.test(line) ? null : line;
|
|
87
94
|
}
|
|
88
95
|
/**
|
|
@@ -183,7 +190,18 @@ export function buildEpicWorkaroundWorkerInstruction(ticketKey, handoffEnabled)
|
|
|
183
190
|
"workaround: guard exactly the deferred behavior (for example, check for a missing setting and skip " +
|
|
184
191
|
"only that feature), keep the core path working, and write " + record + " naming the requirement, " +
|
|
185
192
|
"the guarded substitute you delivered, and the step a human must still take. Commit that record on " +
|
|
186
|
-
"this ticket branch with git add -f " + record + ".
|
|
193
|
+
"this ticket branch with git add -f " + record + ". " +
|
|
194
|
+
"Minor-gap disposition, for this Epic Implementer run only: when you deliver a guarded substitute " +
|
|
195
|
+
"for a minor gap, record that plan step as executed, not escalated. Its evidence must say that the " +
|
|
196
|
+
"substitute, not the original requirement, was delivered, and name the substitute, the workaround " +
|
|
197
|
+
"record, and the owner action still owed and when. A missing future value is a minor gap only when " +
|
|
198
|
+
"it is informational at this hand-off, such as a release version named in docs or a PR description " +
|
|
199
|
+
"that is set at publish, and a clearly marked placeholder keeps the essential behavior and every " +
|
|
200
|
+
"safety and correctness guarantee. A value that runtime behavior or safe operation needs is not " +
|
|
201
|
+
"minor just because a person supplies it later. Needing information from an outside action is not " +
|
|
202
|
+
"taking that action. This rule overrides the general escalation and disposition instructions only " +
|
|
203
|
+
"for these substitutions. Never mark unfinished core work executed to unblock delivery. " +
|
|
204
|
+
"For a core gap, never write a workaround or a " +
|
|
187
205
|
"record: leave the required work unfinished so the run parks this ticket for a human. Planned " +
|
|
188
206
|
"hand-offs: if a running app or database, a toolchain version, or live credentials are needed only " +
|
|
189
207
|
"to verify an acceptance criterion and not to implement it safely, that is a planned hand-off and " +
|
|
@@ -907,3 +925,19 @@ export async function renderPromptSpecPrompt(job, context) {
|
|
|
907
925
|
(!context.deferComparisonGuidance && job.job_type === "ci_fix"
|
|
908
926
|
? "\n\n" + renderWorkerTimeBudgetGuidance(context.timeoutSeconds) : "");
|
|
909
927
|
}
|
|
928
|
+
/**
|
|
929
|
+
* BAPI-1647: one line naming the referenced credentials this worker did NOT
|
|
930
|
+
* receive, using child 1's closed status vocabulary (`source_missing`,
|
|
931
|
+
* `unreadable`, `parse_error`, `key_missing`) and the delivery outcomes. Names
|
|
932
|
+
* only — the caller formats each notice through `credential-delivery.ts`, which
|
|
933
|
+
* never carries a value, a path, or exception text. Returns "" when nothing is
|
|
934
|
+
* missing, so the prompt stays byte-identical.
|
|
935
|
+
*/
|
|
936
|
+
export function buildCredentialNoticeWorkerInstruction(noticeLines) {
|
|
937
|
+
if (noticeLines.length === 0)
|
|
938
|
+
return "";
|
|
939
|
+
return ("Credential notice: some approved credentials were not provided to this worker. " +
|
|
940
|
+
noticeLines.join("; ") +
|
|
941
|
+
". Work without them; do not search for, recreate, or ask for their values. If a step truly needs one, " +
|
|
942
|
+
"follow the workaround contract.");
|
|
943
|
+
}
|
package/build/executor-launch.js
CHANGED
|
@@ -51,7 +51,7 @@ import path from "node:path";
|
|
|
51
51
|
import { LOCAL_MERGE_CREDENTIAL_ENV_KEYS, } from "./conductor/merge-credential.js";
|
|
52
52
|
import { shellQuote } from "./epic-launch-profile.js";
|
|
53
53
|
import { isValidExecutorEpicRunId } from "./executor/claim-scope.js";
|
|
54
|
-
import {
|
|
54
|
+
import { ensureGitInfoExcludedSerialized } from "./git-exclude-lock.js";
|
|
55
55
|
import { createPlaneExecFile, createPlaneProcessDeps, probeAutomationHealth, resolvePackageEntrypoint, } from "./plane/defaults.js";
|
|
56
56
|
import { buildPlaneRedactor } from "./plane/supervisor.js";
|
|
57
57
|
/** Directory, relative to the Git top level, holding every launcher file. */
|
|
@@ -151,7 +151,9 @@ export function createDefaultRunExecutorLaunchDeps() {
|
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
|
-
ensureIgnored: (repoRoot) =>
|
|
154
|
+
ensureIgnored: (repoRoot) =>
|
|
155
|
+
// BAPI-1647: serialized with every other Bridge exclude writer.
|
|
156
|
+
ensureGitInfoExcludedSerialized(repoRoot, RUN_EXECUTOR_IGNORE_ENTRY, {
|
|
155
157
|
readFile: (filePath) => readFile(filePath, "utf-8"),
|
|
156
158
|
writeFile: async (filePath, data) => {
|
|
157
159
|
const handle = await open(filePath, "w");
|