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): retain snapshot size diagnostics [H16,H5,B26]

Corey Olsonf63f80969e66
diff --git a/src/cli.js b/src/cli.js
index be1d99c7..b7c9f6cf 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -1598,7 +1598,7 @@ function readCommands(io, { first, second, rest, values }) {
io.say('board is clean');
return 0;
}
- for (const problem of problems) if (problem.code !== 'RELAY_CHECKPOINT_REFUSED') io.say(`problem: ${problem.message}; repair: ${problem.next}`);
+ for (const problem of problems) if (problem !== checkpointProblem) io.say(`problem: ${problem.message}; repair: ${problem.next}`);
return 1;
},
inbox: () => {
@@ -2796,6 +2796,7 @@ async function runMain(argv, streams) {
try {
parsed = parseCommandArgs(argv);
const command = parsed.positionals[0];
+ io.relayJson = Boolean(parsed.values.json);
io.relayCommand = { cliOperation: command === 'done' ? 'submit' : command, cwd: resolve(io.cwd),
positionals: parsed.positionals.slice(1),
values: Object.fromEntries(Object.keys(parsed.values).filter(key => key !== 'json').sort().map(key => [key, parsed.values[key]])) };
diff --git a/src/relay.js b/src/relay.js
index 67783d99..77fabdd6 100644
--- a/src/relay.js
+++ b/src/relay.js
@@ -233,7 +233,7 @@ function checkpointProblem(state) {
const message = `relay checkpoint refused for ${state.board}: ${code} ${reason}`
+ (size ? '; ' + formatSnapshotLimit(size) : '')
+ '; moves still sync in order; a fresh checkpoint goes up on the next change; if it keeps failing, ' + next;
- return { code: 'RELAY_CHECKPOINT_REFUSED', message, next };
+ return { code: size ? 'RELAY_SNAPSHOT_LIMIT' : 'RELAY_CHECKPOINT_REFUSED', message, next };
}
/** Project the current checkpoint repair for doctor without making another network request. */
@@ -248,7 +248,9 @@ function reportCheckpointRefusal(state, io) {
if (!boards) { boards = new Set(); CHECKPOINT_NOTICES.set(io, boards); }
if (boards.has(state.board)) return;
boards.add(state.board);
- io.err('pullboard: ' + checkpointProblem(state).message);
+ const line = 'pullboard: ' + checkpointProblem(state).message;
+ if (['status', 'doctor'].includes(io.relayCommand?.cliOperation) && io.relayJson === false) io.say(line);
+ else io.err(line);
}
/** Name the safe next step for the saved permanent refusal. */
diff --git a/test/relay-stuck-upload.test.js b/test/relay-stuck-upload.test.js
index b7077499..a3069ea7 100644
--- a/test/relay-stuck-upload.test.js
+++ b/test/relay-stuck-upload.test.js
@@ -483,6 +483,22 @@ test('a refused later checkpoint names its repair once on every native agent com
assert.match(finding.next, /npm i -g pullboard.*relay off.*relay on --all/u);
}
}
+ for (const command of ['status', 'doctor']) {
+ const text = await box.script(`
+ const { main } = await import(${JSON.stringify(box.mainURL)});
+ let stdout = '', stderr = '';
+ const code = await main([${JSON.stringify(command)}], {
+ cwd: process.cwd(), stdout: { write(value) { stdout += value; } }, stderr: { write(value) { stderr += value; } },
+ });
+ console.log(JSON.stringify({ code, stdout, stderr }));
+ `);
+ assert.equal(text.code, 0);
+ const lines = (text.document.stdout + text.document.stderr).split('\n').filter(line => line.includes('relay checkpoint refused for '));
+ assert.equal(lines.length, 1, command + ' text mode also prints only one actionable upload line');
+ assert.match(text.document.stdout, /relay checkpoint refused for /u, 'text readers preserve their existing stdout diagnostic');
+ assert.match(lines[0], /npm i -g pullboard.*relay off.*relay on --all/u);
+ assert.doesNotMatch(text.document.stderr, /relay checkpoint refused for /u);
+ }
const refused = JSON.parse(readFileSync(box.linkFile, 'utf8'));
assert.equal(refused.baselinePause, undefined);
const remote = await fetch(box.origin + '/api/v1/boards/' + refused.board + '/events?after=' + baselineSequence, {