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(lanes): route questions through named leads [B21,B26,N26]

Corey Olsond2fca3fd922c
diff --git a/src/board-health.js b/src/board-health.js
new file mode 100644
index 00000000..f52bb11b
--- /dev/null
+++ b/src/board-health.js
@@ -0,0 +1,55 @@
+/** Health mutation extracted without changing its transaction or notice order [A6]. */
+import { ENGINE_VERSION } from './machine.js';
+import {
+ itemById,
+ listAgents,
+} from './board-query.js';
+import { logEvent } from './board-event-log.js';
+import { Refused } from './refused.js';
+import { normalizedHealthFindings } from './health-receipts.js';
+import { healthFindingIdentity } from './health-receipts.js';
+import { healthTargets } from './health-receipts.js';
+import { deliverHealthNotices } from './health-receipts.js';
+import { HEALTH_SENTINEL_ENGINE } from './health-receipts.js';
+import { COORDINATOR } from './config.js';
+import { PERSON } from './board-query.js';
+
+/** Record one current health snapshot atomically, notifying each new or resolved episode once [A6]. */
+export function applyHealthFindings(board, { agentId, observedRevision, findings }, { atomic, insertShout }) {
+ return atomic(board, () => {
+ if ((board.executionEngineVersion ?? ENGINE_VERSION) < HEALTH_SENTINEL_ENGINE) {
+ throw new Refused('ENGINE_VERSION', `sentinel receipts require engine ${HEALTH_SENTINEL_ENGINE}; upgrade Pullboard before scanning`);
+ }
+ if (!board.db.prepare('SELECT 1 FROM agent WHERE agent_id = ?').get(agentId)) {
+ throw new Refused('NOT_JOINED', 'join this board before recording a health scan: pullboard join <lane>');
+ }
+ const revision = board.db.prepare('SELECT COALESCE(MAX(event_id), 0) AS revision FROM event').get().revision;
+ if (!Number.isSafeInteger(observedRevision) || observedRevision !== revision) {
+ throw new Refused('HEALTH_SCAN_STALE', 'the board changed while health was scanning; run pullboard resume again');
+ }
+ const active = normalizedHealthFindings(findings);
+ const last = board.db.prepare("SELECT event_detail FROM event WHERE event_kind = 'health-scan' ORDER BY event_id DESC LIMIT 1").get();
+ const previous = last ? JSON.parse(last.event_detail).active : [];
+ const before = new Map(previous.map(finding => [healthFindingIdentity(finding), finding]));
+ const after = new Map(active.map(finding => [healthFindingIdentity(finding), finding]));
+ const added = active.filter(finding => !before.has(healthFindingIdentity(finding)));
+ const resolved = previous.filter(finding => !after.has(healthFindingIdentity(finding)));
+ if (!added.length && !resolved.length) return { added: [], resolved: [] };
+ const agents = listAgents(board);
+ const lanes = [...new Set(agents.map(agent => agent.agent_lane))];
+ const engine = board.executionEngineVersion ?? ENGINE_VERSION;
+ /** Deliver through ordinary feed/inbox records without registering a synthetic worktree seat. */
+ const log = (finding, cleared) => {
+ const item = finding.item === null ? null : itemById(board, finding.item);
+ logEvent(board, 'sentinel', cleared ? 'health-resolved' : 'health-failure', finding.item, {
+ key: finding.key, cause: `refusal:${finding.cause}`, since: finding.since, subject: finding.subject,
+ owner: finding.owner, commit: item?.item_commit ?? null, engine: HEALTH_SENTINEL_ENGINE,
+ });
+ };
+ deliverHealthNotices({ resolved, added, engine, log, coordinator: COORDINATOR, shout: (to, text) => insertShout(board, { from: 'sentinel', to, text, lanes }),
+ targets: finding => healthTargets(finding, { engine, coordinator: COORDINATOR, person: PERSON, lanes, agents }) });
+ logEvent(board, agentId, 'health-scan', null, { active, engine: HEALTH_SENTINEL_ENGINE });
+ return { added: added.map(finding => finding.key), resolved: resolved.map(finding => finding.key) };
+ });
+}
+
diff --git a/src/board.js b/src/board.js
index 8eb82fd7..1243571b 100644
--- a/src/board.js
+++ b/src/board.js
@@ -1,3 +1,12 @@
+import { applyHealthFindings } from './board-health.js';
+import {
+ applyLaneLead,
+ isLaneEscalation,
+ laneLeads,
+ leadOwnsDecision,
+ routeLaneMessage,
+} from './lane-lead.js';
+export { laneLeads };
import {
focusOrder,
focusReasons,
@@ -244,13 +253,6 @@ import {
conflictProblem,
returnedHeadNotice,
} from './trunk-conflict.js';
-import {
- HEALTH_SENTINEL_ENGINE,
- deliverHealthNotices,
- healthFindingIdentity,
- healthTargets,
- normalizedHealthFindings,
-} from './health-receipts.js';
import { factReference } from './fact-reference.js';
import {
factFromEvent,
@@ -1730,46 +1732,12 @@ 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, routeLaneMessage(board, message, board.executionEngineVersion ?? ENGINE_VERSION)));
}
-/** Record one current health snapshot atomically, notifying each new or resolved episode once [A6]. */
-export function recordHealthFindings(board, { agentId, observedRevision, findings }) {
- return atomic(board, () => {
- if ((board.executionEngineVersion ?? ENGINE_VERSION) < HEALTH_SENTINEL_ENGINE) {
- throw new Refused('ENGINE_VERSION', `sentinel receipts require engine ${HEALTH_SENTINEL_ENGINE}; upgrade Pullboard before scanning`);
- }
- if (!board.db.prepare('SELECT 1 FROM agent WHERE agent_id = ?').get(agentId)) {
- throw new Refused('NOT_JOINED', 'join this board before recording a health scan: pullboard join <lane>');
- }
- const revision = board.db.prepare('SELECT COALESCE(MAX(event_id), 0) AS revision FROM event').get().revision;
- if (!Number.isSafeInteger(observedRevision) || observedRevision !== revision) {
- throw new Refused('HEALTH_SCAN_STALE', 'the board changed while health was scanning; run pullboard resume again');
- }
- const active = normalizedHealthFindings(findings);
- const last = board.db.prepare("SELECT event_detail FROM event WHERE event_kind = 'health-scan' ORDER BY event_id DESC LIMIT 1").get();
- const previous = last ? JSON.parse(last.event_detail).active : [];
- const before = new Map(previous.map(finding => [healthFindingIdentity(finding), finding]));
- const after = new Map(active.map(finding => [healthFindingIdentity(finding), finding]));
- const added = active.filter(finding => !before.has(healthFindingIdentity(finding)));
- const resolved = previous.filter(finding => !after.has(healthFindingIdentity(finding)));
- if (!added.length && !resolved.length) return { added: [], resolved: [] };
- const agents = listAgents(board);
- const lanes = [...new Set(agents.map(agent => agent.agent_lane))];
- const engine = board.executionEngineVersion ?? ENGINE_VERSION;
- /** Deliver through ordinary feed/inbox records without registering a synthetic worktree seat. */
- const log = (finding, cleared) => {
- const item = finding.item === null ? null : itemById(board, finding.item);
- logEvent(board, 'sentinel', cleared ? 'health-resolved' : 'health-failure', finding.item, {
- key: finding.key, cause: `refusal:${finding.cause}`, since: finding.since, subject: finding.subject,
- owner: finding.owner, commit: item?.item_commit ?? null, engine: HEALTH_SENTINEL_ENGINE,
- });
- };
- deliverHealthNotices({ resolved, added, engine, log, coordinator: COORDINATOR, shout: (to, text) => insertShout(board, { from: 'sentinel', to, text, lanes }),
- targets: finding => healthTargets(finding, { engine, coordinator: COORDINATOR, person: PERSON, lanes, agents }) });
- logEvent(board, agentId, 'health-scan', null, { active, engine: HEALTH_SENTINEL_ENGINE });
- return { added: added.map(finding => finding.key), resolved: resolved.map(finding => finding.key) };
- });
+/** Record one health snapshot through its unchanged transactional implementation [A6]. */
+export function recordHealthFindings(board, options) {
+ return applyHealthFindings(board, options, { atomic, insertShout });
}
/**
@@ -1782,13 +1750,14 @@ export function recordHealthFindings(board, { agentId, observedRevision, finding
*/
export function passDecision(board, id, { agentId, note, lanes }) {
return atomic(board, () => {
- if (agentId !== COORDINATOR) throw new Refused('COORDINATOR_ONLY', 'only the coordinator can pass a decision up');
const ask = getShout(board, id);
- if (!ask.shout_decision || (ask.shout_to !== COORDINATOR && ask.shout_to !== COORDINATION_SHOUT && shoutItemId(ask.shout_to) === null)) throw new Refused('NOT_COORDINATOR_DECISION', `shout #${id} is not a decision waiting for the coordinator`);
+ const laneEscalation = leadOwnsDecision(board, ask, agentId);
+ if (agentId !== COORDINATOR && !laneEscalation) throw new Refused('COORDINATOR_ONLY', 'only the coordinator or the addressed lane lead can pass a decision up');
+ if (!ask.shout_decision || (!laneEscalation && ask.shout_to !== COORDINATOR && ask.shout_to !== COORDINATION_SHOUT && shoutItemId(ask.shout_to) === null)) throw new Refused('NOT_COORDINATOR_DECISION', `shout #${id} is not a decision waiting for the coordinator`);
if (board.db.prepare('SELECT 1 FROM shout WHERE shout_answers = ?').get(id)) throw new Refused('ALREADY_ANSWERED', `shout #${id} already has an answer`);
const text = `Passed up from ${ask.shout_from}: ${ask.shout_text}\nCoordinator note: ${String(note ?? '').trim()}`;
if (!String(note ?? '').trim()) throw new Refused('EMPTY_NOTE', 'include a note with the reason for passing this decision');
- return insertShout(board, { from: COORDINATOR, to: PERSON, text, lanes, decision: true, answers: id, detail: shoutItemId(ask.shout_to) === null ? {} : { item: shoutItemId(ask.shout_to), text } });
+ return insertShout(board, { from: agentId, to: laneEscalation ? COORDINATOR : PERSON, text, lanes, decision: true, answers: id, detail: shoutItemId(ask.shout_to) === null ? {} : { item: shoutItemId(ask.shout_to), text } });
});
}
@@ -1823,10 +1792,11 @@ export function answerDecision(board, id, { agentId, text, lanes, asPerson = fal
throw new Refused('NOT_YOUR_DECISION', `shout #${id} is addressed to ${ask.shout_to}, not ${lane} (agent ${agentId})`);
}
const from = personAnswer ? PERSON : agentId;
+ if (!personAnswer && leadOwnsDecision(board, ask, agentId)) insertShout(board, { from, to: COORDINATOR, text: `Lane decision #${id}: ${String(text).trim()}`, lanes, detail: { messageKind: 'decision' } });
const answerId = tellAnswerImplications(board, (by, itemId, fact) => logEvent(board, by, 'fact', itemId, fact), insertShout(board, { from, to: ask.shout_from, text, lanes, answers: id, channel, ...(addressedItem === null ? {} : { item: addressedItem }), detail: { ...(implies?.length ? { implies } : {}), ...(supersedes !== null ? { supersedes } : {}) } }), { seed: impliesId, implies, supersedes, from, person: PERSON });
- if (personAnswer && ask.shout_answers !== null) {
+ if ((personAnswer || agentId === COORDINATOR && isLaneEscalation(board, ask)) && ask.shout_answers !== null) {
const original = getShout(board, ask.shout_answers);
- insertShout(board, { from: PERSON, to: original.shout_from, text: `Person answered #${id}: ${String(text).trim()}`, lanes, answers: original.shout_id, channel, ...(shoutItemId(original.shout_to) === null ? {} : { item: shoutItemId(original.shout_to) }) });
+ insertShout(board, { from, to: original.shout_from, text: `${personAnswer ? 'Person' : 'Coordinator'} answered #${id}: ${String(text).trim()}`, lanes, answers: original.shout_id, channel, ...(shoutItemId(original.shout_to) === null ? {} : { item: shoutItemId(original.shout_to) }) });
}
return answerId;
});
@@ -2393,3 +2363,8 @@ export function intakeOutside(board, options) { return applyOutsideIntake(board,
/** Record the person's exact-commit owner approval. */
export function approveOutside(board, id, options) { return applyOutsideApproval(board, id, options, atomic); }
+
+/** Name a lane lead only through coordinator-owned ordered policy [B21]. */
+export function setLaneLead(board, options) {
+ return applyLaneLead(board, options, { atomic, logEvent });
+}
diff --git a/src/cli-main.js b/src/cli-main.js
index 5f9b3d99..8ec64dad 100644
--- a/src/cli-main.js
+++ b/src/cli-main.js
@@ -126,6 +126,7 @@ const OPTIONS = {
since: { type: 'string' },
window: { type: 'string' },
decision: { type: 'boolean' },
+ kind: { type: 'string' },
evidence: { type: 'string' },
outcome: { type: 'string' },
item: { type: 'string' },
diff --git a/src/commands/lanes.js b/src/commands/lanes.js
index e660f971..95137e6a 100644
--- a/src/commands/lanes.js
+++ b/src/commands/lanes.js
@@ -2,14 +2,29 @@
import {
COORDINATOR,
} from '../config.js';
+import * as store from '../board.js';
+import { Refused } from '../refused.js';
+import { laneNames } from '../lanes.js';
import {
+ actOn,
context,
+ ordered,
+ withBoard,
} from '../cli.js';
/** Run `pullboard lanes` and return its exit code. */
-export function run(io) {
+export async function run(io, { first, second, rest }) {
+ if (first !== undefined) {
+ if (first !== 'lead' || !second || rest.length !== 1) throw new Refused('USAGE', 'use pullboard lanes lead <lane> <seat|off>');
+ return actOn(io, async (ctx, board, me) => {
+ const leads = await ordered(ctx, board, 'setLaneLead', [{ agentId: me.id, lane: second, seat: rest[0] === 'off' ? null : rest[0], lanes: laneNames(ctx.config) }]);
+ io.result?.({ leads }); io.say(rest[0] === 'off' ? `removed lead for ${second}` : `${second} lead is ${rest[0]}`);
+ return 0;
+ });
+ }
const { config } = context(io);
- io.result?.({ lanes: config.lanes, shared: config.shared, coordinator: COORDINATOR });
+ const leads = withBoard(context(io), board => store.laneLeads(board));
+ io.result?.({ lanes: config.lanes, shared: config.shared, coordinator: COORDINATOR, leads });
io.say(`${COORDINATOR.padEnd(14)} everything no lane owns; verifies, merges, may change any path`);
for (const [name, lane] of Object.entries(config.lanes)) {
const specs = lane.specs?.length ? ` [${lane.specs.join(', ')}]` : '';
diff --git a/src/commands/pass.js b/src/commands/pass.js
index 7f39e911..614d6189 100644
--- a/src/commands/pass.js
+++ b/src/commands/pass.js
@@ -14,7 +14,7 @@ export async function run(io, { first, second, rest }) {
return act(async (ctx, board, me) => {
const id = await ordered(ctx, board, 'passDecision', [idArg(first), { agentId: me.id, note: [second, ...rest].filter(Boolean).join(' '), lanes: laneNames(ctx.config) }]);
io.result?.({ id, answers: idArg(first) });
- io.say(`passed #${first} to the person as #${id}`);
+ io.say(`passed #${first} upward as #${id}`);
return 0;
});
}
diff --git a/src/commands/shout.js b/src/commands/shout.js
index e2b07fab..81786917 100644
--- a/src/commands/shout.js
+++ b/src/commands/shout.js
@@ -25,7 +25,7 @@ export async function run(io, { first, second, rest, values }) {
const hasRecipient = first && recipients.includes(first) && (values.item === undefined || second !== undefined);
const to = values.item !== undefined ? `item:${values.item}` : hasRecipient ? first : values.decision ? (me.id === COORDINATOR ? 'person' : COORDINATOR) : first ?? '';
const text = [hasRecipient ? second : first, ...(hasRecipient ? rest : [second, ...rest])].filter(Boolean).join(' ');
- const id = await ordered(ctx, board, 'shout', [{ from: personShout(io, me) ? store.PERSON : me.id, to, text, ...(values.item !== undefined ? { item: Number(values.item) } : {}), lanes: laneNames(ctx.config), decision: Boolean(values.decision), evidence }]);
+ const id = await ordered(ctx, board, 'shout', [{ from: personShout(io, me) ? store.PERSON : me.id, to, text, ...(values.item !== undefined ? { item: Number(values.item) } : {}), lanes: laneNames(ctx.config), decision: Boolean(values.decision), ...(values.kind === undefined ? {} : { kind: values.kind }), evidence }]);
io.result?.({ id, decision: Boolean(values.decision) });
const agents = store.listAgents(board);
const recipient = agents.some((agent) => agent.agent_id === to) ? agentDisplayName(agents, ctx.config, to) : to;
diff --git a/src/help.js b/src/help.js
index 93f31957..25b9ae2c 100644
--- a/src/help.js
+++ b/src/help.js
@@ -151,13 +151,15 @@ Work
pullboard shout <lane|agent|person|all> <text> pullboard inbox
pullboard shout --item <id> <text> message the item builder, reviewer and coordinator
A seat shout to all reaches only coordinator and person; their broadcasts reach everyone.
+ pullboard shout coordinator <text> --kind question|blocker --decision route through a named lane lead
+ pullboard lanes lead <lane> <seat|off> coordinator names or removes the existing lane seat
pullboard shout [<to>] <text> --decision ask for a decision; defaults to your coordinator or the person
pullboard shout <to> <text> --evidence attempt|receipt --outcome <word> --item <id> --commit <rev>
pullboard answer <shout-id> <text> [--as person] [--implies <ids>] [--supersedes <answer-id>]
answer your decision; person mode is main-checkout only
--supersedes tells the items an earlier answer implied; only the person
supersedes the person's answer
- pullboard pass <shout-id> <note> coordinator passes a decision to the person
+ pullboard pass <shout-id> <note> lead escalates to coordinator; coordinator passes to person
pullboard decisions [--as person] shouts waiting for you; main checkout defaults to coordinator
pullboard watch [--to <agent|lane|all>] [--kinds <kinds>] [--item <id>] [--since <sequence>] [--json]
[--work <lane>] [--review-wait <minutes>]
@@ -339,7 +341,7 @@ const HELP_ALIASES = {
help: { usage: 'pullboard help', source: null },
version: { usage: 'pullboard version', source: null },
whoami: { usage: 'pullboard whoami', source: 'whoami' },
- lanes: { usage: 'pullboard lanes', source: 'whoami' },
+ lanes: { usage: 'pullboard lanes [lead <lane> <seat|off>]', source: 'whoami' },
agents: { usage: 'pullboard agents', source: 'whoami' },
lane: { usage: 'pullboard lane add <name> --owns <path>[,<path>]', source: 'lane add' },
status: { usage: 'pullboard status', source: 'whoami' },
diff --git a/src/lane-lead-engine.js b/src/lane-lead-engine.js
new file mode 100644
index 00000000..036471fd
--- /dev/null
+++ b/src/lane-lead-engine.js
@@ -0,0 +1,3 @@
+/** Unassigned ordered lane-lead protocol version [B21,H16]. */
+import { unassignedEngine } from './engine-next.js';
+export const LANE_LEAD_ENGINE = unassignedEngine();
diff --git a/src/lane-lead.js b/src/lane-lead.js
new file mode 100644
index 00000000..96007e22
--- /dev/null
+++ b/src/lane-lead.js
@@ -0,0 +1,73 @@
+/** Explicit lane coordination never grants coordinator or person authority [B21,B26]. */
+import { Refused } from './refused.js';
+import { LANE_LEAD_ENGINE } from './lane-lead-engine.js';
+
+/** Read only valid current lane seats; stale policy never grants a different lane authority. */
+export function laneLeads(board) {
+ const row = board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key=?').get('lane_leads');
+ const values = row ? JSON.parse(row.meta_value) : {};
+ return Object.fromEntries(Object.entries(values).filter(([lane, seat]) => lane !== 'coordinator'
+ && board.db.prepare('SELECT 1 FROM agent WHERE agent_id=? AND agent_lane=?').get(seat, lane)));
+}
+
+/** Name an existing same-lane seat through the normal coordinator-only ordered transaction. */
+export function applyLaneLead(board, { agentId, lane, seat, lanes }, { atomic, logEvent }) {
+ return atomic(board, () => {
+ if (agentId !== 'coordinator') throw new Refused('COORDINATOR_ONLY', 'ask the coordinator to name or remove a lane lead');
+ if (!lanes.includes(lane) || lane === 'coordinator') throw new Refused('BAD_LANE_LEAD', 'name a configured non-coordinator lane');
+ if (seat !== null && !board.db.prepare('SELECT 1 FROM agent WHERE agent_id=? AND agent_lane=?').get(seat, lane)) {
+ throw new Refused('BAD_LANE_LEAD', 'name an existing seat in the same lane, or use off');
+ }
+ const leads = laneLeads(board);
+ if (seat === null) delete leads[lane]; else leads[lane] = seat;
+ board.db.prepare('INSERT INTO board_meta(meta_key,meta_value) VALUES (?,?) ON CONFLICT(meta_key) DO UPDATE SET meta_value=excluded.meta_value')
+ .run('lane_leads', JSON.stringify(leads));
+ logEvent(board, agentId, 'lane-lead', null, { lane, seat });
+ return leads;
+ });
+}
+
+/** Route only explicitly typed upward coordination; ordinary and item-specific notes stay unchanged. */
+export function routeLaneMessage(board, message, engine) {
+ const { from, to, item } = message;
+ const kind = message.kind ?? (engine >= LANE_LEAD_ENGINE && message.decision && message.answers == null
+ && to === 'coordinator' && item === undefined ? 'question' : undefined);
+ if (kind === undefined) return message;
+ if (engine < LANE_LEAD_ENGINE) throw new Refused('ENGINE_VERSION', 'upgrade every linked device before sending typed lane coordination');
+ if (!['question', 'blocker', 'decision', 'status'].includes(kind)) throw new Refused('BAD_MESSAGE_KIND', 'use question, blocker or decision for lane coordination');
+ if (kind === 'status') throw new Refused('STATUS_IS_ACTIVITY', 'status belongs in board activity, not a shout; keep working on your item');
+ if (item !== undefined) throw new Refused('LANE_MESSAGE_ITEM', 'keep item notes separate from lane coordination; omit --kind for an item message');
+ const lane = board.db.prepare('SELECT agent_lane FROM agent WHERE agent_id=?').get(from)?.agent_lane;
+ const lead = lane && laneLeads(board)[lane];
+ if (kind === 'decision' && from !== 'coordinator' && lead !== from) throw new Refused('NOT_LANE_LEAD', 'ask your lane lead to send the lane decision upward');
+ return { ...message, to: to === 'coordinator' && lead && lead !== from && ['question', 'blocker'].includes(kind) ? lead : to,
+ detail: { ...message.detail, messageKind: kind } };
+}
+
+/** A lead may escalate only a real decision addressed to it from its own lane. */
+export function leadOwnsDecision(board, ask, actor) {
+ const lane = board.db.prepare('SELECT agent_lane FROM agent WHERE agent_id=?').get(ask.shout_from)?.agent_lane;
+ return (board.executionEngineVersion === undefined || board.executionEngineVersion >= LANE_LEAD_ENGINE) && ask.shout_decision && ask.shout_to === actor && laneLeads(board)[lane] === actor;
+}
+
+/** Identify only the existing addressed lead's genuine escalation, never an arbitrary caller flag. */
+export function isLaneEscalation(board, ask) {
+ if (ask.shout_from === 'coordinator' || ask.shout_to !== 'coordinator' || ask.shout_answers === null) return false;
+ const original = board.db.prepare('SELECT * FROM shout WHERE shout_id=?').get(ask.shout_answers);
+ return Boolean(original?.shout_decision && original.shout_to === ask.shout_from);
+}
+
+/** Floor only operations that execute the new lane policy; historical untyped messages retain old semantics. */
+export function laneAnswerFloor(board, args) {
+ if (!board?.db) return 1;
+ const ask = board.db.prepare('SELECT * FROM shout WHERE shout_id=?').get(args?.[0]);
+ return ask && (leadOwnsDecision(board, ask, args?.[1]?.agentId) || isLaneEscalation(board, ask)) ? LANE_LEAD_ENGINE : 1;
+}
+
+/** Existing explicit decision questions opt in only when a lane has a named lead. */
+export function laneMessageFloor(board, message) {
+ if (message?.kind !== undefined) return LANE_LEAD_ENGINE;
+ if (!board?.db || !message?.decision || message.answers != null || message.to !== 'coordinator' || message.item !== undefined) return 1;
+ const lane = board.db.prepare('SELECT agent_lane FROM agent WHERE agent_id=?').get(message.from)?.agent_lane;
+ return lane && laneLeads(board)[lane] ? LANE_LEAD_ENGINE : 1;
+}
diff --git a/src/moves/answerDecision.js b/src/moves/answerDecision.js
index 2d9fc158..1fd8ff17 100644
--- a/src/moves/answerDecision.js
+++ b/src/moves/answerDecision.js
@@ -1,3 +1,4 @@
+import { laneAnswerFloor } from '../lane-lead.js';
import { RIGOR_AUTO_ENGINE } from '../rigor-auto-engine.js';
/** Routing metadata owned by answerDecision, discovered without a shared registry edit [C7,V4,H16]. */
import { LANDING_LEASE_ENGINE } from '../landing-lease-engine.js';
@@ -7,6 +8,8 @@ import { BOARD_SENTINEL_ENGINE } from '../sentinel-engine.js';
/** Preserve this operation's historical first-matching engine conditions [H16]. */
function minimumEngine(args, board, at) {
+ const laneFloor = laneAnswerFloor(board, args);
+ if (laneFloor > 1) return laneFloor;
if (typeof args[1]?.cause === 'string' && args[1].cause.startsWith('conflict:')) return RIGOR_AUTO_ENGINE;
if (args[0]?.landingFence !== undefined) return LANDING_LEASE_ENGINE;
if (typeof args[1]?.cause === 'string' && args[1].cause.startsWith('sentinel:')) return BOARD_SENTINEL_ENGINE;
diff --git a/src/moves/passDecision.js b/src/moves/passDecision.js
index 2be37d1d..42974d0f 100644
--- a/src/moves/passDecision.js
+++ b/src/moves/passDecision.js
@@ -1,3 +1,4 @@
+import { laneAnswerFloor } from '../lane-lead.js';
import { RIGOR_AUTO_ENGINE } from '../rigor-auto-engine.js';
/** Routing metadata owned by passDecision, discovered without a shared registry edit [C7,V4,H16]. */
import { LANDING_LEASE_ENGINE } from '../landing-lease-engine.js';
@@ -5,6 +6,8 @@ import { BOARD_SENTINEL_ENGINE } from '../sentinel-engine.js';
/** Preserve this operation's historical first-matching engine conditions [H16]. */
function minimumEngine(args, board, at) {
+ const laneFloor = laneAnswerFloor(board, args);
+ if (laneFloor > 1) return laneFloor;
if (typeof args[1]?.cause === 'string' && args[1].cause.startsWith('conflict:')) return RIGOR_AUTO_ENGINE;
if (args[0]?.landingFence !== undefined) return LANDING_LEASE_ENGINE;
if (typeof args[1]?.cause === 'string' && args[1].cause.startsWith('sentinel:')) return BOARD_SENTINEL_ENGINE;
diff --git a/src/moves/setLaneLead.js b/src/moves/setLaneLead.js
new file mode 100644
index 00000000..0046183e
--- /dev/null
+++ b/src/moves/setLaneLead.js
@@ -0,0 +1,10 @@
+/** Coordinator-owned lane policy is an ordered board move [B21,H16]. */
+import { LANE_LEAD_ENGINE } from '../lane-lead-engine.js';
+/** Policy changes require every replica to understand the lead protocol. */
+function minimumEngine() { return LANE_LEAD_ENGINE; }
+/** Read the authenticated actor from the operation's sole argument. */
+function actor(move) { return move.args[0]?.agentId ?? null; }
+export default Object.freeze({ operation: 'setLaneLead', order: 1000, engine: LANE_LEAD_ENGINE,
+ itemIdFirstArgument: false, minimumEngine, actor,
+ nextSteps: Object.freeze({ COORDINATOR_ONLY: 'ask the coordinator to do it: pullboard shout coordinator \"<what you need>\"',
+ BAD_LANE_LEAD: 'name a configured lane and an existing seat in that lane, or off' }) });
diff --git a/src/moves/shout.js b/src/moves/shout.js
index 52421427..cc1b9451 100644
--- a/src/moves/shout.js
+++ b/src/moves/shout.js
@@ -1,3 +1,4 @@
+import { laneMessageFloor } from '../lane-lead.js';
import { RIGOR_AUTO_ENGINE } from '../rigor-auto-engine.js';
/** Routing metadata owned by shout, discovered without a shared registry edit [C7,V4,H16]. */
import { ITEM_SHOUT_ENGINE } from '../item-shout-engine.js';
@@ -6,6 +7,8 @@ import { BOARD_SENTINEL_ENGINE } from '../sentinel-engine.js';
/** Preserve this operation's historical first-matching engine conditions [H16]. */
function minimumEngine(args, board, at) {
+ const laneFloor = laneMessageFloor(board, args[0]);
+ if (laneFloor > 1) return laneFloor;
if (typeof args[1]?.cause === 'string' && args[1].cause.startsWith('conflict:')) return RIGOR_AUTO_ENGINE;
if (args[0]?.item !== undefined) return ITEM_SHOUT_ENGINE;
if (args[0]?.landingFence !== undefined) return LANDING_LEASE_ENGINE;
@@ -19,6 +22,10 @@ function actor(move) { return move.args[0]?.from ?? null; }
export default Object.freeze({ operation: "shout", order: 23, engine: 1,
itemIdFirstArgument: false, minimumEngine, actor,
nextSteps: Object.freeze({
+ BAD_MESSAGE_KIND: 'use --kind question, blocker or decision',
+ STATUS_IS_ACTIVITY: 'keep working on the item; status is board activity, not a shout',
+ LANE_MESSAGE_ITEM: 'omit --kind for an item-specific message',
+ NOT_LANE_LEAD: 'ask your named lane lead to send the decision upward',
"B26_PERSON_CHANNEL": "record it as the person through pullboard view or the person's own terminal",
"B26_PERSON_DECISION": "ask your coordinator: pullboard shout coordinator \"<question>\" --decision",
"BAD_EVIDENCE": "pass the evidence fields the message names, then retry",
diff --git a/src/recorded-move.js b/src/recorded-move.js
index 187175dd..2fdf2d0f 100644
--- a/src/recorded-move.js
+++ b/src/recorded-move.js
@@ -30,7 +30,7 @@ export function requestedCommandMove(command, operation) {
init: ['register'], join: ['register'], worktree: ['register'], takeover: ['takeCoordinator'],
shout: ['shout'], answer: ['answerDecision'], pass: ['passDecision'], fact: ['appendFact'],
hold: ['holdLane', 'releaseLane', 'holdItem', 'releaseItemHold'],
- bar: ['setBarReady', 'signBar'], settings: ['setLineSetting', 'setPersonSigning'], check: ['acceptCheck'],
+ lanes: ['setLaneLead'], bar: ['setBarReady', 'signBar'], settings: ['setLineSetting', 'setPersonSigning'], check: ['acceptCheck'],
spec: ['recordRowDecisions', 'decideSpecRevisions', 'applyRowDecisions', 'draftSpecRow', 'appendFact', 'editItem', 'withdraw'],
blueprint: ['draftSpecRow', 'addItem', 'appendFact'], rigor: ['draftSpecRow', 'proposeSentinel'], sweep: ['addItem'],
milestone: ['addMilestone', 'editMilestoneItems', 'orderMilestoneItems', 'moveMilestone', 'editMilestone', 'removeMilestone', 'shipMilestone'],
diff --git a/src/relay-outbox.js b/src/relay-outbox.js
index c1c65150..38784fb4 100644
--- a/src/relay-outbox.js
+++ b/src/relay-outbox.js
@@ -168,7 +168,7 @@ const FIRST_ITEM = ['approveOutside', 'signBar', 'editItem', 'completeCheckBasel
* (test/relay-outbox.test.js walks them all) (#922).
*/
export const ITEM_SLOTS = Object.freeze({
- setBarReady: [], setLineSetting: [],
+ setBarReady: [], setLineSetting: [], setLaneLead: [],
recordPublishFinding: [[0, 'item']],
register: [], ensureCoordinator: [], shout: [], passDecision: [], holdLane: [], releaseLane: [],
moveMilestone: [], editMilestone: [], removeMilestone: [], shipMilestone: [],
diff --git a/test/lane-lead.test.js b/test/lane-lead.test.js
index 1e8b75f9..b335718f 100644
--- a/test/lane-lead.test.js
+++ b/test/lane-lead.test.js
@@ -37,7 +37,7 @@ test('a lane question reaches its lead and only the decision reaches the coordin
const denied = box.run(box.web, 'lanes', 'lead', 'web', 'off', '--json');
assert.equal(JSON.parse(denied.out).error?.code, 'COORDINATOR_ONLY');
assert.equal(document(box, box.repo, 'lanes').leads.web, leadId);
- const question = document(box, box.web, 'shout', 'coordinator', 'Which interface?', '--kind', 'question', '--decision');
+ const question = document(box, box.web, 'shout', 'coordinator', 'Which interface?', '--decision');
assert.equal(message(box, question.id).shout_to, leadId);
assert.ok(document(box, lead, 'inbox').shouts.some(row => row.shout_id === question.id));
assert.equal(document(box, box.repo, 'inbox').shouts.some(row => row.shout_id === question.id), false);
diff --git a/test/move-registry-baseline.json b/test/move-registry-baseline.json
index d6511691..ce8450ad 100644
--- a/test/move-registry-baseline.json
+++ b/test/move-registry-baseline.json
@@ -62,7 +62,8 @@
"recordJobRun",
"takeCoordinator",
"landingLeaseMove",
- "recordPublishFinding"
+ "recordPublishFinding",
+ "setLaneLead"
],
"itemIdFirstArgument": [
"signBar",
@@ -631,6 +632,14 @@
null,
null,
null
+ ],
+ "setLaneLead": [
+ null,
+ "first",
+ null,
+ null,
+ null,
+ null
]
},
"floorCases": [
@@ -6949,7 +6958,12 @@
"WRONG_BOARD": "open the repository registered to this board and confirm its identity with pullboard status",
"WRONG_LANE": "create a worktree in the required lane with pullboard worktree <lane> --model \"<model name>\", or take an item in your lane with pullboard next",
"EXCLUDED_REPOSITORY": "restore the GitHub origin of each excluded project, then run pullboard relay on --all",
- "EXCLUDED_INVENTORY": "restore at most 256 excluded boards and their active paired devices, then run pullboard relay on --all"
+ "EXCLUDED_INVENTORY": "restore at most 256 excluded boards and their active paired devices, then run pullboard relay on --all",
+ "BAD_LANE_LEAD": "name a configured lane and an existing seat in that lane, or off",
+ "BAD_MESSAGE_KIND": "use --kind question, blocker or decision",
+ "STATUS_IS_ACTIVITY": "keep working on the item; status is board activity, not a shout",
+ "LANE_MESSAGE_ITEM": "omit --kind for an item-specific message",
+ "NOT_LANE_LEAD": "ask your named lane lead to send the decision upward"
},
"replay": {
"initial": {
diff --git a/test/relay-credential.test.js b/test/relay-credential.test.js
index 762a5715..b4b4739e 100644
--- a/test/relay-credential.test.js
+++ b/test/relay-credential.test.js
@@ -29,6 +29,7 @@ test('every current operation selects its native actor credential without a seco
if (['claim', 'refreeze'].includes(operation)) args = [box.before.tables.item[0].item_id, options];
if (operation === 'reserveNextReview') args = [options];
if (operation === 'setLineSetting') args = [{ agentId: actor, key: 'reviewsFirst', value: true, reason: 'credential fixture', window: { windowMinutes: 60, activeReviewers: 1 } }];
+ if (operation === 'setLaneLead') args = [{ agentId: actor, lane: box.lane, seat: null, lanes: [box.lane] }];
if (operation === 'setBarReady') args = [{ agentId: actor, enabled: false }];
if (operation === 'recordHealthFindings') args = [{ agentId: actor, observedRevision: 0, findings: [] }];
if (operation === 'recordSpecApprovalBaseline') args = [{ agentId: actor, baseline: { version: 1, file: 'SPEC.md', anchor: null, rows: [] } }];