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(sentinel): background scans only health [A6,D3,H16]

Corey Olson00ce05b88e9b
diff --git a/src/help.js b/src/help.js
index 0bf71342..78403189 100644
--- a/src/help.js
+++ b/src/help.js
@@ -106,7 +106,7 @@ Work
pullboard sentinel propose <name> --check "<command>" --every 10m|hourly|daily --owner <seat or lane> [--directory <path>] [--timeout <milliseconds>] [--next "<step>"]
propose an exact board watch; only the person may approve it
pullboard sentinel approve <name> person: approve this command, directory and schedule
- pullboard sentinel run run due approved watches in a prepared trunk checkout
+ pullboard sentinel run [--health-only] run due approved watches, or only scan board health
pullboard sentinel decline <name> --reason "<why>" person: prevent future runs
pullboard sentinels approvals, owners and the last result; does not run checks
pullboard loop declare <name> --every 10m --owner <seat or lane> coordinator: declare a recurring job's cadence
diff --git a/src/sentinel-command.js b/src/sentinel-command.js
index 8eb77ebc..bbf654aa 100644
--- a/src/sentinel-command.js
+++ b/src/sentinel-command.js
@@ -19,6 +19,7 @@ export const SENTINEL_OPTIONS = {
timeout: { type: 'string' },
next: { type: 'string' },
sentinel: { type: 'boolean' },
+ 'health-only': { type: 'boolean' },
};
/** Resume reports due watches in one line and never starts their commands. */
@@ -29,8 +30,8 @@ export function resumeSentinels({ ctx, withBoard }) {
});
}
-/** Run due approved watches on pinned trunk, recording through the original caller's board. */
-async function runSentinels({ ctx, withBoard, whoAmI, ordered }) {
+/** Scan health, then run due approved watches on pinned trunk unless the observer requests health only. */
+async function runSentinels({ ctx, withBoard, whoAmI, ordered, healthOnly = false }) {
return withBoard(ctx, async board => {
const me = whoAmI(ctx, board);
const enabled = healthSentinelEnabled(ctx.config);
@@ -49,9 +50,9 @@ async function runSentinels({ ctx, withBoard, whoAmI, ordered }) {
}
}
const health = recordedHealthFindings(board);
- if (!enabled || !dueSentinels(board).length) {
+ if (healthOnly || !enabled || !dueSentinels(board).length) {
ctx.io.result?.({ sentinels: [], health });
- ctx.io.say('No enabled sentinel is due.');
+ ctx.io.say(healthOnly ? 'Health scan complete; approved watches require an explicit pullboard sentinel run.' : 'No enabled sentinel is due.');
return 0;
}
const { results, trunk } = await withSentinelTrunk(ctx.info.root, root => runDueSentinels({ root, board, agentId: me.id,
@@ -66,7 +67,7 @@ async function runSentinels({ ctx, withBoard, whoAmI, ordered }) {
/** Keep command parsing separate from the CLI's process and server setup. */
export async function sentinelCommand({ ctx, words, values, withBoard, whoAmI, ordered }) {
const [verb, name, ...extra] = words;
- if (verb === 'run' && !name && !extra.length) return runSentinels({ ctx, withBoard, whoAmI, ordered });
+ if (verb === 'run' && !name && !extra.length) return runSentinels({ ctx, withBoard, whoAmI, ordered, healthOnly: Boolean(values['health-only']) });
if (extra.length || !['propose', 'approve', 'decline'].includes(verb) || !name) {
throw new Refused('USAGE', 'use pullboard sentinel run, sentinel propose <name> --check "<command>" --every 10m --owner <seat or lane>, sentinel approve <name>, sentinel decline <name> --reason "<why>", or pullboard sentinels');
}
diff --git a/src/serve-sentinel.js b/src/serve-sentinel.js
index d3bcf200..f7f080b2 100644
--- a/src/serve-sentinel.js
+++ b/src/serve-sentinel.js
@@ -14,10 +14,10 @@ function sentinelRunsFor(root) {
return healthSentinelEnabled(loadConfig(root));
}
-/** Run the ordinary ordered sentinel path in one owned child and drain it on view shutdown. */
+/** Run only the ordered health scan in one owned child and drain it on view shutdown. */
function refreshBoard(root, signal) {
return new Promise((resolve, reject) => {
- const child = spawn(process.execPath, [CLI, 'sentinel', 'run', '--json'], {
+ const child = spawn(process.execPath, [CLI, 'sentinel', 'run', '--health-only', '--json'], {
cwd: root, env: process.env, stdio: 'ignore', signal,
});
let timer;
diff --git a/test/health-sentinel-background.test.js b/test/health-sentinel-background.test.js
index df075cd9..d916dd01 100644
--- a/test/health-sentinel-background.test.js
+++ b/test/health-sentinel-background.test.js
@@ -151,6 +151,9 @@ test('the actual background sentinel scans once, honors off switches and drains
await tick(); assert.equal(receipts().notices.length, 0, 'the machine off switch prevents a real child scan');
writeFileSync(settingsFile, JSON.stringify(settings));
await tick();
+ const scans = observations().filter(row => row.kind === 'loaded' && row.argv.includes('sentinel') && row.argv.includes('run'));
+ assert.equal(scans.length, 1, 'one real CLI child performs the enabled scan');
+ assert.ok(scans[0].argv.includes('--health-only'), 'the observer explicitly excludes approved board watches');
const first = receipts();
assert.equal(first.notices.length, 2, 'the actual worker child scans the real board and publishes its finding');
assert.deepEqual(first.notices.map(row => row.shout_to).sort(), ['coordinator', builder].sort());