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(needs): board_status reads held items with the board clock [A9,N26]

Corey Olsonda7c8ea41599
diff --git a/src/needs-state.js b/src/needs-state.js
index 00bd29ec..1654f9cf 100644
--- a/src/needs-state.js
+++ b/src/needs-state.js
@@ -24,7 +24,8 @@ import {
/** Borrow an existing connection or open a read-only one; retain exact row-decision matching. */
export function personNeedsState(root, { board: providedBoard = null, includeRigorUndrafted = false } = {}) {
const info = repoInfo(root);
- const board = providedBoard ?? { db: store.openBoardReadOnly(join(info.commonDir, 'pullboard', 'board.sqlite')) };
+ // A held item is judged against the board's clock (#974), so the read-only board carries the CLI's clock.
+ const board = providedBoard ?? { db: store.openBoardReadOnly(join(info.commonDir, 'pullboard', 'board.sqlite')), clock: store.systemClock };
try {
const decisions = store.rowDecisions(board);
const state = projectFit(pendingFit(info.commonDir), projectRowDecisions(decisions, projectState(root, { board })));
diff --git a/test/mcp.test.js b/test/mcp.test.js
index 2d111664..0edbef84 100644
--- a/test/mcp.test.js
+++ b/test/mcp.test.js
@@ -321,6 +321,26 @@ test('[A9,P5] an MCP client reads the board and shouts as its agent', async (t)
assert.equal(counts(box.database).shouts, before.shouts + 3);
});
+test('board_status answers through MCP on a board with a held item [A9,N26]', async (t) => {
+ const box = project(t);
+ const added = cli(box, box.repo, ['add', 'web', 'Held MCP item', '--criterion', 'a held item still lets MCP read the board']);
+ assert.equal(added.status, 0, JSON.stringify(added.document));
+ const itemId = added.document.item.item_id;
+ const claimed = cli(box, box.web, ['claim', String(itemId)], box.sessionA);
+ assert.equal(claimed.status, 0, JSON.stringify(claimed.document));
+
+ const client = mcpClient(t, box, box.web, box.sessionA);
+ await initialize(client);
+ const status = await client.call('board_status', {});
+ assert.equal(status.isError, false, JSON.stringify(status));
+ assert.ok(status.structuredContent.items.some((item) => item.item_id === itemId && item.item_status === 'claimed'),
+ 'status lists the held item as claimed');
+ assert.deepEqual(status.structuredContent.needsYou, personNeeds(personNeedsState(box.web)),
+ 'the read-only needs builder reads a held item with the board clock');
+ const { code } = await client.close();
+ assert.equal(code, 0);
+});
+
test('[P6,A9] a person\'s move through MCP is refused', async (t) => {
const box = project(t);
const decisionId = personDecision(box);