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): bind canary pulls to the acknowledged nonce [H5,H17]

Corey Olsondf511c0dc9c7
diff --git a/src/relay-canary-probe.js b/src/relay-canary-probe.js
index 8ba304c6..ba677cc6 100644
--- a/src/relay-canary-probe.js
+++ b/src/relay-canary-probe.js
@@ -99,8 +99,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');
}
- let previousSequence = state.sequence;
- if (!Number.isSafeInteger(previousSequence) || previousSequence < 0) {
+ if (!Number.isSafeInteger(state.sequence) || state.sequence < 0) {
throw new Refused('RELAY_STORAGE', 'restore the canary link sequence before probing it');
}
const probeIo = Object.create(io);
@@ -133,7 +132,6 @@ export async function probeRelayCanary(root, { agentId, deadlineMs = 5000, io =
remaining();
await relayOperation(root, interrupted.operation, interrupted.args, probeIo);
state = relayMachineContext(root);
- previousSequence = state.sequence;
}
const text = 'Relay canary ' + randomUUID();
let verified;
@@ -143,7 +141,11 @@ export async function probeRelayCanary(root, { agentId, deadlineMs = 5000, io =
moveId = recordedId; sequence = recordedSequence;
verified = (async () => {
remaining(); step = 'pull';
- const pulled = await request(transport, '/api/v1/boards/' + state.board + '/events?after=' + previousSequence,
+ if (!Number.isSafeInteger(recordedSequence) || recordedSequence < 1) {
+ throw new Refused('RELAY_RESPONSE', 'the canary acknowledgement has no positive native receipt sequence');
+ }
+ // Ordinary replay already caught up peer checkpoints; only the acknowledged nonce must remain in this fresh pull.
+ const pulled = await request(transport, '/api/v1/boards/' + state.board + '/events?after=' + (recordedSequence - 1),
{ signal: controller.signal }, probeIo);
relayVersion = pulled.version;
await verifyReturnedMove(root, state, pulled, { moveId, sequence, agentId, text,
diff --git a/src/relay.js b/src/relay.js
index 24ee4d64..0b502cfc 100644
--- a/src/relay.js
+++ b/src/relay.js
@@ -1200,7 +1200,7 @@ export async function relayOperation(root, operation, args, io, command, applyLo
if (!receipt) throw new Refused('RELAY_RESPONSE', 'the acknowledged operation has no replay receipt; fetch a consistent relay snapshot');
if (!receipt.outcome.error) {
onRecorded?.();
- await io.onRelayMoveRecorded?.({ moveId: move.id, sequence: state.sequence });
+ await io.onRelayMoveRecorded?.({ moveId: move.id, sequence: receipt.sequence });
if (!io.relayCanary) recordClientHealth(root, true, null, Date.now() - roundTripStarted);
}
delete state.recovered;