Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

fix(relay): finish interrupted canary receipts before fresh probes [H5]

Corey Olson5028cc6a916d
diff --git a/src/relay-canary-probe.js b/src/relay-canary-probe.js
index 1346158b..b97c5399 100644
--- a/src/relay-canary-probe.js
+++ b/src/relay-canary-probe.js
@@ -87,7 +87,7 @@ export async function probeRelayCanary(root, { agentId, deadlineMs = 5000, io =
throw new Refused('RELAY_CANARY_CONFIG', 'configure a positive bounded canary deadline');
}
timer = setTimeout(() => controller.abort(), deadlineMs);
- const state = relayMachineContext(root);
+ let state = relayMachineContext(root);
if (!state || state.unlinking || state.environment) {
throw new Refused('RELAY_OFF', 'link this dedicated canary board through the person before probing it');
}
@@ -95,7 +95,7 @@ export async function probeRelayCanary(root, { agentId, deadlineMs = 5000, io =
if (!actor || actor.agent_lane === 'coordinator') {
throw new Refused('NOT_JOINED', 'join an ordinary noncoordinator seat on the dedicated canary board');
}
- const previousSequence = state.sequence;
+ let previousSequence = state.sequence;
if (!Number.isSafeInteger(previousSequence) || previousSequence < 0) {
throw new Refused('RELAY_STORAGE', 'restore the canary link sequence before probing it');
}
@@ -118,6 +118,19 @@ export async function probeRelayCanary(root, { agentId, deadlineMs = 5000, io =
if (signed.session?.kind !== 'board' || signed.session.agent !== agentId) {
throw new Refused('RELAY_ACTOR', 'the canary sign-in does not belong to its configured seat');
}
+ const interrupted = state.pending?.move ?? state.recovered?.move;
+ if (interrupted) {
+ const prior = interrupted.args?.[0];
+ if (interrupted.operation !== 'shout' || interrupted.actor !== agentId || prior?.from !== agentId
+ || prior.to !== 'coordinator' || !/^Relay canary [a-f0-9-]{36}$/u.test(prior.text ?? '')) {
+ throw new Refused('RELAY_RETRY_PENDING', 'finish the interrupted ordinary command before probing this canary board');
+ }
+ // Receive the original outcome through normal replay; this is not the fresh probe's health evidence.
+ remaining();
+ await relayOperation(root, interrupted.operation, interrupted.args, probeIo);
+ state = relayMachineContext(root);
+ previousSequence = state.sequence;
+ }
const text = 'Relay canary ' + randomUUID();
let verified;
/** Inspect each durable acknowledgement once, before legitimate checkpoint compaction. */
diff --git a/test/relay-canary.test.js b/test/relay-canary.test.js
index 29898bdb..61d5552c 100644
--- a/test/relay-canary.test.js
+++ b/test/relay-canary.test.js
@@ -94,7 +94,7 @@ test('a failed round trip alerts within two minutes and names the failed step [H
assert.equal(result.ok, false, 'the canary reports the deliberately failed fresh pull');
assert.equal(result.step, 'pull', 'the failure is attributed to the fresh event pull, not setup or seat registration');
} else {
- assert.equal(result.ok, true, 'a normal authenticated sealed round trip establishes the healthy baseline and recovery');
+ assert.equal(result.ok, true, `a normal authenticated sealed round trip establishes the healthy baseline and recovery: ${JSON.stringify(result)}`);
assert.equal(result.step, 'complete');
}
return result;