@miraland-labs/conduit-bridge 0.16.135 → 0.16.137

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.
@@ -210,7 +210,7 @@ export async function captureVerificationFailure(input) {
210
210
  // shown to be the same bug.
211
211
  const text = boundedFailureDetail(command, result.stdout.trim() ? result.stdout.trim().split("\n") : [], result.stderr.trim() ? result.stderr.trim().split("\n") : [], result.code, DIAGNOSIS_DETAIL_MAX_CHARS);
212
212
  if (text.trim())
213
- return text;
213
+ return { command, detail: text };
214
214
  }
215
215
  // Every bounded command passed (or none could start): agent failed for another reason.
216
216
  return null;
@@ -456,6 +456,18 @@ export function detectGateRanNothing(command, stdout, stderr, code) {
456
456
  }
457
457
  return null;
458
458
  }
459
+ /**
460
+ * A declared gate that ran and failed. Carries the command as a field so the verification signal
461
+ * can name the gate without reading it back out of this error's text.
462
+ */
463
+ export class VerificationFailedError extends Error {
464
+ command;
465
+ constructor(command, detail) {
466
+ super(`Agent report: Verification failed (${command}): ${detail}`);
467
+ this.name = "VerificationFailedError";
468
+ this.command = command;
469
+ }
470
+ }
459
471
  /**
460
472
  * A declared gate that ran no tests, or that only printed its own usage text: a misconfigured gate,
461
473
  * not a failed one. Carries the typed fields `execution.ts` needs to emit the T1 signal — the
@@ -520,7 +532,7 @@ export async function ensureTestEvidence(input) {
520
532
  elided: detail.includes("omitted"),
521
533
  ends_with_exit: detail.trimEnd().endsWith(`exit ${result.code}`),
522
534
  }));
523
- throw new Error(`Agent report: Verification failed (${command}): ${detail}`);
535
+ throw new VerificationFailedError(command, detail);
524
536
  }
525
537
  // Empty exit-0 is not proof — a no-op recipe (`@true`) must not clear required_evidence: test.
526
538
  if (stdoutLines.length === 0 && stderrLines.length === 0) {
package/dist/execution.js CHANGED
@@ -26,7 +26,7 @@ import { ensureLandCommit } from "./ensure-land-commit.js";
26
26
  import { AGENT_NO_LAND_COMMIT_PREFIX, AgentNoLandCommitError, agentNoLandCommitMessage, requiresLandCommit } from "./land-contract.js";
27
27
  import { agentClaimsRepositoryWork, claimsVsGitMismatch, isLandTreeEmpty, reportClaimsRepositoryWork, } from "./land-git-reality.js";
28
28
  const execFileAsync = promisify(execFile);
29
- import { boundedTail, captureVerificationFailure, detectGateRanNothing, ensureTestEvidence, needsTestEvidence, runBoundedVerificationCommand, verificationEvidenceCommands, VerificationGateRanNothingError } from "./ensure-test-evidence.js";
29
+ import { boundedTail, captureVerificationFailure, detectGateRanNothing, ensureTestEvidence, needsTestEvidence, runBoundedVerificationCommand, verificationEvidenceCommands, VerificationFailedError, VerificationGateRanNothingError } from "./ensure-test-evidence.js";
30
30
  import { ensureChangeEvidence } from "./ensure-change-evidence.js";
31
31
  import { ensureDemonstrationEvidence } from "./ensure-demonstration-evidence.js";
32
32
  import { ensureNormativeEvidence } from "./ensure-normative-evidence.js";
@@ -472,8 +472,8 @@ export function parseDiagnosticRepairBrief(text) {
472
472
  return parsed.data;
473
473
  }
474
474
  /**
475
- * The gate command inside the witness line Bridge itself wrote. Mirrored as
476
- * VERIFICATION_GATE_PATTERN in src/conductor/repair.ts.
475
+ * The gate command inside the witness line, for the diagnosis prompt. Repair names the gate from
476
+ * the typed signal; this pattern stays until that prompt moves.
477
477
  */
478
478
  const VERIFICATION_GATE_PATTERN = /Verification failed \(([^)]+)\)/;
479
479
  /** Prompt for Option C: IDE-depth understanding in the retained tree, with write authority absent. */
@@ -1484,7 +1484,7 @@ async function runAttempt(client, config, driver, workspace, brief, taskId, watc
1484
1484
  // gate that moved instead of showing two hex strings.
1485
1485
  await client.updateAttempt(taskId, { executionFacts, verificationCommands });
1486
1486
  await client.attemptRequest(taskId, "progress", {
1487
- phase: diagnosis ? "inspecting" : "changing",
1487
+ phase: diagnosis ? "inspecting" : "agent_running",
1488
1488
  execution_facts: executionFacts,
1489
1489
  message: resuming
1490
1490
  ? `Resuming ${driver.name} after Bridge restart with proven session and worktree.`
@@ -1728,15 +1728,22 @@ async function runAttempt(client, config, driver, workspace, brief, taskId, watc
1728
1728
  // transient retry — the one verdict that would run the capped work again at the same price.
1729
1729
  const turnCapReached = result.signal?.kind === "turn_cap";
1730
1730
  const recoverVerification = grants.includes("test_run") && !subscriptionExhausted(agentMessage) && !turnCapReached;
1731
- if (recoverVerification)
1731
+ if (recoverVerification) {
1732
1732
  watchdog.phase("verification");
1733
- const verificationDetail = recoverVerification
1733
+ await client.attemptRequest(taskId, "progress", {
1734
+ phase: "verifying",
1735
+ message: "Bridge is running the project's verification commands to read the failure.",
1736
+ idempotency_key: `bridge:progress:${active.attemptId}:verify-failure`,
1737
+ });
1738
+ }
1739
+ const capturedVerification = recoverVerification
1734
1740
  ? await captureVerificationFailure({
1735
1741
  workspace: attemptWorkspace,
1736
1742
  verificationCommands: attemptBrief?.verification ?? [],
1737
1743
  acceptance: spec.acceptance ?? [],
1738
1744
  })
1739
1745
  : null;
1746
+ const verificationDetail = capturedVerification?.detail ?? null;
1740
1747
  // The vendor named the model as the cause, so the model is what the retry must change. The
1741
1748
  // model rides in the prefix: the control plane cannot read Bridge's selection any other way.
1742
1749
  const diffStat = verificationDetail && attemptWorkspace && startCommit
@@ -1771,8 +1778,8 @@ async function runAttempt(client, config, driver, workspace, brief, taskId, watc
1771
1778
  : subscriptionExhausted(agentMessage)
1772
1779
  ? { phase: "agent", witness: "vendor", kind: "quota", vendor_message: agentMessage.slice(0, 2_000) }
1773
1780
  : result.signal
1774
- ? verificationDetail
1775
- ? { ...result.signal, phase: "verification", witness: "bridge", stderr_tail: undefined, stdout_tail: undefined, ...(diffStat ? { diff_stat: diffStat } : {}) }
1781
+ ? capturedVerification
1782
+ ? { ...result.signal, phase: "verification", witness: "bridge", kind: "verification_failed", command: capturedVerification.command, stderr_tail: undefined, stdout_tail: undefined, ...(diffStat ? { diff_stat: diffStat } : {}) }
1776
1783
  : result.signal
1777
1784
  : undefined;
1778
1785
  const response = await queueTerminal(client, taskId, { action: "fail", body: {
@@ -2144,6 +2151,13 @@ async function runAttempt(client, config, driver, workspace, brief, taskId, watc
2144
2151
  ? await changedPathsSince(attemptWorkspace, deliveryBaseCommit)
2145
2152
  : null;
2146
2153
  // Mechanical test path: agent often forgets verbatim make test / npm test output.
2154
+ if (grants.includes("test_run")) {
2155
+ await client.attemptRequest(taskId, "progress", {
2156
+ phase: "verifying",
2157
+ message: "Bridge is running the project's verification commands.",
2158
+ idempotency_key: `bridge:progress:${active.attemptId}:verify`,
2159
+ });
2160
+ }
2147
2161
  report = await ensureTestEvidence({
2148
2162
  workspace: attemptWorkspace,
2149
2163
  report,
@@ -2221,7 +2235,8 @@ async function runAttempt(client, config, driver, workspace, brief, taskId, watc
2221
2235
  // the same verify-class pre-delivery failure as the driver-failed path above: preserve the
2222
2236
  // exact tree and send the witness marker that arms Conductor diagnosis. Treating it as a
2223
2237
  // delivery-envelope defect would stop before Invariant 23 ever ran.
2224
- const verificationFailed = /^Agent report: Verification failed \(/.test(message);
2238
+ // The command is the field on the throw, never a parse of this message.
2239
+ const verificationFailed = error instanceof VerificationFailedError;
2225
2240
  const diffStat = verificationFailed && attemptWorkspace
2226
2241
  ? await diffStatSince(attemptWorkspace, deliveryBaseCommit)
2227
2242
  .then((stat) => stat?.slice(0, 8_000) ?? null)
@@ -2244,6 +2259,7 @@ async function runAttempt(client, config, driver, workspace, brief, taskId, watc
2244
2259
  phase: "verification",
2245
2260
  witness: "bridge",
2246
2261
  kind: "verification_failed",
2262
+ command: error.command,
2247
2263
  ...(diffStat ? { diff_stat: diffStat } : {}),
2248
2264
  } } : {}),
2249
2265
  // A rework's own PR may already be open (ensureDeliveryPullRequest ran before this
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraland-labs/conduit-bridge",
3
- "version": "0.16.135",
3
+ "version": "0.16.137",
4
4
  "description": "Conduit Bridge CLI \u2014 join, connect, disconnect, multi-driver lanes, and run Claude Code / Codex / Cursor / OpenCode / Pi / Kiro / Antigravity / Grok Build agents for a Conduit organization",
5
5
  "type": "module",
6
6
  "bin": {