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.

feat(inbox): preserve ordinary message audiences [R2,N26,H16]

Corey Olson026658e3e856
diff --git a/src/board-query.js b/src/board-query.js
index 6c2e4c21..b7e2f13a 100644
--- a/src/board-query.js
+++ b/src/board-query.js
@@ -490,7 +490,9 @@ export function agentActivity(board, agentId, { after = 0, newsAfter = 0, workin
.map(event => activityEventDetail(event).shout).filter(id => Number.isSafeInteger(id) && id > 0);
for (let offset = 0; offset < possibleNewsIds.length; offset += 500) {
const ids = possibleNewsIds.slice(offset, offset + 500);
- messages.push(...board.db.prepare(`SELECT * FROM shout WHERE shout_id IN (${ids.map(() => '?').join(',')}) AND shout_to='all'`).all(...ids));
+ messages.push(...board.db.prepare(`SELECT * FROM shout WHERE shout_id IN (${ids.map(() => '?').join(',')})
+ AND shout_to='all' AND shout_from IN ('coordinator','person') AND shout_decision=0
+ AND shout_request=0 AND shout_answers IS NULL`).all(...ids));
}
const byShout = new Map(messages.map(message => [message.shout_id, message]));
const newsIds = [...rows.values()].filter(event => isActivityNews(event, byShout.get(activityEventDetail(event)?.shout)))
diff --git a/src/board.js b/src/board.js
index 0fd1eee7..8c8fe414 100644
--- a/src/board.js
+++ b/src/board.js
@@ -1653,9 +1653,8 @@ export { getItem } from './board-query.js';
* @param {{ from: string, to: string, text: string, lanes: string[], item?: number, decision?: boolean, answers?: number | null, evidence?: any, request?: boolean, news?: boolean, channel?: 'terminal' | 'view', detail?: object }} message - detail: extra event fields
* @returns {number}
*/
-function insertShout(board, { from, to, text, lanes, item, decision = false, answers = null, evidence = null, request = false, news, channel = 'terminal', detail = {} }) {
+function insertShout(board, { from, to, text, lanes, item, decision = false, answers = null, evidence = null, request = false, channel = 'terminal', detail = {} }) {
const engine = board.executionEngineVersion ?? ENGINE_VERSION;
- detail = { ...detail, ...activityNewsDetail({ news, from, to, item, decision, request, answers, detail }, engine) };
if (item !== undefined) {
if (engine < ITEM_SHOUT_ENGINE) throw new Refused('ENGINE_VERSION', 'item messages require engine 93; upgrade every linked device before sending one');
to = itemShoutTarget(board.db, item);
@@ -1724,7 +1723,8 @@ function persistShout(board, { from, to, text, decision = false, answers = null,
* @returns {number}
*/
export function shout(board, message) {
- return atomic(board, () => insertShout(board, message));
+ return atomic(board, () => insertShout(board, { ...message, detail: { ...message.detail,
+ ...activityNewsDetail(message, board.executionEngineVersion ?? ENGINE_VERSION) } }));
}
/** Record one current health snapshot atomically, notifying each new or resolved episode once [A6]. */
diff --git a/src/commands/inbox.js b/src/commands/inbox.js
index 32bfe1c9..2c9d332f 100644
--- a/src/commands/inbox.js
+++ b/src/commands/inbox.js
@@ -42,6 +42,6 @@ export function run(io) {
const delivered = new Set(shouts.map(shout => shout.shout_id));
for (const entry of activity.entries) if (!delivered.has(entry.shout)) io.say(`${entry.at.slice(0, 16)} ${entry.text}`);
for (const digest of activity.digests) io.say(digest.text);
- if (!saveActivityCursor(delivery, activity.cursor)) io.say('activity cursor could not be saved; activity may repeat when you read inbox again');
+ if (!saveActivityCursor(delivery, activity.cursor)) io.err('activity cursor could not be saved; activity may repeat when you read inbox again');
return 0;
}
diff --git a/test/activity-feed.test.js b/test/activity-feed.test.js
index 01dc71c5..c60857f0 100644
--- a/test/activity-feed.test.js
+++ b/test/activity-feed.test.js
@@ -291,6 +291,10 @@ test('inbox delivery uses real Git paths and board-bound cursors without consumi
rmSync(delivery.file);
mkdirSync(delivery.file);
assert.equal(saveActivityCursor(delivery, 1), false, 'a refused cursor save reports failure without hiding it');
+ const refusedSave = box.run(box.web, 'inbox', '--json');
+ assert.equal(refusedSave.code, 0, refusedSave.err);
+ assert.ok(JSON.parse(refusedSave.out).activity, 'delivery remains readable when local persistence fails');
+ assert.match(refusedSave.err, /activity cursor could not be saved/u, 'JSON callers receive the persistence warning too');
rmSync(delivery.file, { recursive: true });
});
@@ -308,6 +312,8 @@ test('old ordinary shout replay does not become newly typed news [H16,N26]', (t)
const feed = store.agentActivity(board, 'web-1', { sessionStart: true });
assert.ok(feed.entries.some(entry => entry.text === 'Historical metadata is not a new delivery instruction.'));
assert.deepEqual(feed.digests, [], 'only the new versioned explicit representation is digested');
+ assert.equal(feed.entries.some(entry => entry.text === 'Legacy agent metadata cannot hide a direct message.'), false,
+ 'supplemental news reads never reintroduce the sender\'s own ordinary broadcast');
// The sender does not read its own broadcast; the coordinator must still receive it directly.
const coordinator = store.agentActivity(board, 'coordinator', { sessionStart: true });
assert.ok(coordinator.entries.some(entry => entry.text === 'Legacy agent metadata cannot hide a direct message.'));