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(board): route decisions up the chain [B21,B25,B26,B27]

Corey Olsonee30d6e7c711
diff --git a/docs/api.md b/docs/api.md
index 5db94c47..e7e11463 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -4,6 +4,8 @@ Add `--json` to a Pullboard command to receive one JSON document on stdout. The
The API version is independent of the package version. Its contract is stable within each major API version: existing command names, required fields, field types, and refusal fields do not change within that version. An incompatible change requires a new `version`. New fields may be added, so clients should ignore fields they do not use.
+Decision shouts without a recipient go to the agent's coordinator, or to `person` when sent by the coordinator. `pullboard pass <shout-id> <note>` is for coordinators: it forwards an open coordinator decision to the person with the original question and note. From the main checkout, `pullboard decisions` and `pullboard answer <shout-id> <text>` default to the coordinator; use `--as person` to select the person's queue or answer a person-addressed decision. Person mode is accepted only in the main checkout. An answer in person mode cannot answer a coordinator-addressed decision, and a coordinator-default answer cannot impersonate the person; the refusal prints the command to retry. A person answer is delivered to the original asker. An agent worktree cannot select person mode.
+
A successful command returns the fields listed below. `version` is always the number `1`. The catalog lists required top-level fields; nested objects and arrays are command data, and optional top-level fields may be added.
<!-- api-command-shapes:start -->
@@ -43,6 +45,7 @@ A successful command returns the fields listed below. `version` is always the nu
| `refreeze` | `version:number`, `id:number`, `after:string` |
| `shout` | `version:number`, `id:number`, `decision:boolean` |
| `answer` | `version:number`, `id:number`, `answers:number` |
+| `pass` | `version:number`, `id:number`, `answers:number` |
| `tour` | `version:number`, `messages:array` |
| `lifecycle` | `version:number`, `markdown:string` |
| `view` | `version:number`, `url:string`, `port:number` |
diff --git a/src/board.js b/src/board.js
index c758413d..8af82cd7 100644
--- a/src/board.js
+++ b/src/board.js
@@ -15,6 +15,7 @@ import { GUARDS, IN_STATE, MOVES, STATES, UNKNOWN_MOVE, effectiveGuards, storeTr
import { Refused } from './refused.js';
export const ACCEPT_REASON = 'CRITERION_MET';
+export const PERSON = 'person';
/**
* Who can take an item (B13), as tiers in order of the model an item needs: `light` is work a small
@@ -1114,17 +1115,21 @@ export function verdictsFor(board, id) {
}
/**
- * Shout to a lane, an agent, or `all` (B7). The caller passes the lanes the config declares.
+ * Insert a shout within the caller's transaction.
*
* @param {any} board
- * @param {{ from: string, to: string, text: string, lanes: string[] }} message
+ * @param {{ from: string, to: string, text: string, lanes: string[], decision?: boolean, answers?: number | null, evidence?: any }} message
+ * @returns {number}
*/
-export function shout(board, { from, to, text, lanes, decision = false, answers = null, evidence = null }) {
+function insertShout(board, { from, to, text, lanes, decision = false, answers = null, evidence = null }) {
if (!text.trim()) throw new Refused('EMPTY_SHOUT', 'a shout needs text');
const isAgent = board.db.prepare('SELECT 1 FROM agent WHERE agent_id = ?').get(to);
- if (to !== 'all' && !lanes.includes(to) && !isAgent) {
+ if (to !== 'all' && to !== PERSON && !lanes.includes(to) && !isAgent) {
throw new Refused('NO_READER', `nobody reads "${to}": name a lane, an agent or all`);
}
+ if (to === PERSON && decision && from !== COORDINATOR) {
+ throw new Refused('B26_PERSON_DECISION', `only the coordinator can ask the person for a decision; ask your coordinator: pullboard shout coordinator "${text.trim()}" --decision`);
+ }
if (answers !== null && !getShout(board, answers).shout_decision) {
throw new Refused('NOT_A_DECISION', `shout #${answers} asked for no decision; reply with pullboard shout`);
}
@@ -1139,6 +1144,65 @@ export function shout(board, { from, to, text, lanes, decision = false, answers
return Number(result.lastInsertRowid);
}
+/**
+ * Shout to a lane, an agent, `all`, or the person (B7, B25, B26). The caller passes declared lanes.
+ *
+ * @param {any} board
+ * @param {{ from: string, to: string, text: string, lanes: string[], decision?: boolean, answers?: number | null, evidence?: any }} message
+ * @returns {number}
+ */
+export function shout(board, message) {
+ return atomic(board, () => insertShout(board, message));
+}
+
+/**
+ * Pass an open coordinator decision to the person with the original question and note (B27).
+ *
+ * @param {any} board
+ * @param {number} id
+ * @param {{ agentId: string, note: string, lanes: string[] }} options
+ * @returns {number}
+ */
+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) 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 });
+ });
+}
+
+/**
+ * Answer an open decision addressed to the caller, delivering passed-up answers to the asker (B27).
+ *
+ * @param {any} board
+ * @param {number} id
+ * @param {{ agentId: string, text: string, lanes: string[], asPerson?: boolean }} options
+ * @returns {number}
+ */
+export function answerDecision(board, id, { agentId, text, lanes, asPerson = false }) {
+ return atomic(board, () => {
+ const ask = getShout(board, id);
+ if (!ask.shout_decision) throw new Refused('NOT_A_DECISION', `shout #${id} asked for no decision`);
+ if (board.db.prepare('SELECT 1 FROM shout WHERE shout_answers = ?').get(id)) throw new Refused('ALREADY_ANSWERED', `shout #${id} already has an answer`);
+ if (asPerson && agentId !== COORDINATOR) throw new Refused('B26_PERSON_ANSWER', `only the main checkout can answer as the person; ask your coordinator: pullboard answer ${id} "<answer>"`);
+ if (asPerson && ask.shout_to !== PERSON) throw new Refused('B26_PERSON_ANSWER', `person mode answers only decisions addressed to the person; the coordinator answers this one: pullboard answer ${id} "<answer>"`);
+ if (!asPerson && ask.shout_to === PERSON && agentId === COORDINATOR) throw new Refused('B26_PERSON_ANSWER', `this decision is addressed to the person; answer from the main checkout: pullboard answer ${id} "<answer>" --as person`);
+ const personAnswer = asPerson;
+ if (ask.shout_to !== agentId && !personAnswer) throw new Refused('NOT_YOUR_DECISION', `shout #${id} is addressed to ${ask.shout_to}, not ${agentId}`);
+ const from = personAnswer ? PERSON : agentId;
+ const answerId = insertShout(board, { from, to: ask.shout_from, text, lanes, answers: id });
+ if (personAnswer && 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 });
+ }
+ return answerId;
+ });
+}
+
/** The kinds of evidence a shout can carry (B22): what was tried, or what was measured. */
export const EVIDENCE_KINDS = ['attempt', 'receipt'];
@@ -1176,12 +1240,13 @@ export function getShout(board, id) {
* in the person's Needs-you, until an answer names them; nothing ever edits the ask.
*
* @param {any} board
+ * @param {string} [recipient=PERSON]
* @returns {any[]}
*/
-export function openDecisions(board) {
+export function openDecisions(board, recipient = PERSON) {
return board.db
- .prepare('SELECT * FROM shout ask WHERE ask.shout_decision = 1 AND NOT EXISTS (SELECT 1 FROM shout reply WHERE reply.shout_answers = ask.shout_id) ORDER BY ask.shout_id')
- .all();
+ .prepare('SELECT * FROM shout ask WHERE ask.shout_decision = 1 AND ask.shout_to = ? AND NOT EXISTS (SELECT 1 FROM shout reply WHERE reply.shout_answers = ask.shout_id) ORDER BY ask.shout_id')
+ .all(recipient);
}
/**
diff --git a/src/cli.js b/src/cli.js
index 7efc7b16..c12f5f9f 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -92,11 +92,12 @@ Work
pullboard verify <id> accept --note "what you broke or which edge you tried, and what happened"
pullboard verify <id> reject --reason TEST_FAILURE --note "what failed"
any --note can be --note-file <file>, which keeps quotes, $ and backticks intact
- pullboard shout <lane|agent|all> <text> pullboard inbox
- pullboard shout <to> <text> --decision ask for a decision; it stays open until answered
+ pullboard shout <lane|agent|person|all> <text> pullboard inbox
+ 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> answer a shout that asked for a decision
- pullboard decisions shouts still waiting for a decision
+ pullboard answer <shout-id> <text> [--as person] answer your decision; person mode is main-checkout only
+ pullboard pass <shout-id> <note> coordinator passes a decision to the person
+ pullboard decisions [--as person] shouts waiting for you; main checkout defaults to coordinator
Coordinator
pullboard sweep --run "<checker>" --check "<checker on {file}>" [--route light] [--max 20] [--dry-run]
@@ -267,6 +268,23 @@ function checkMainVerifier(ctx, board, values) {
);
}
+/**
+ * Select the person actor only through the main checkout's explicit person mode (B26).
+ *
+ * @param {any} ctx
+ * @param {{ id: string }} me
+ * @param {{ as?: string }} values
+ * @returns {boolean}
+ */
+function personMode(ctx, me, values) {
+ if (values.as === undefined) return false;
+ if (values.as !== 'person') throw new Refused('USAGE', '--as person is supported for answer and decisions');
+ if (!ctx.info.isMain || me.id !== COORDINATOR) {
+ throw new Refused('B26_PERSON_ANSWER', 'only the main checkout can act as the person; ask your coordinator to answer or pass this decision');
+ }
+ return true;
+}
+
/**
* A brief whose Files section stays inside the item's lane (B14), so a builder working from it
* never runs into the lane check: an item's files sit in its lane.
@@ -899,7 +917,11 @@ function readCommands(io, { first, values }) {
},
decisions: () => {
const ctx = context(io);
- const asks = withBoard(ctx, (board) => store.openDecisions(board));
+ const asks = withBoard(ctx, (board) => {
+ const me = whoAmI(ctx, board);
+ const asPerson = personMode(ctx, me, values);
+ return store.openDecisions(board, asPerson ? 'person' : me.id);
+ });
io.result?.({ decisions: asks });
if (!asks.length) io.say('no open decisions');
for (const ask of asks) io.say(`#${ask.shout_id} ${ask.shout_from} -> ${ask.shout_to}, ${span(ctx, ask.shout_at)} ago: ${firstLine(ask.shout_text)}`);
@@ -1308,17 +1330,32 @@ function workCommands(io, args) {
}),
shout: () => act((ctx, board, me) => {
const evidence = values.evidence === undefined ? null : evidenceFrom(ctx, values);
- const text = [second, ...rest].filter(Boolean).join(' ');
- const id = store.shout(board, { from: me.id, to: first ?? '', text, lanes: laneNames(ctx.config), decision: Boolean(values.decision), evidence });
+ const recipients = ['all', 'person', ...laneNames(ctx.config), ...board.db.prepare('SELECT agent_id FROM agent').all().map((agent) => agent.agent_id)];
+ const hasRecipient = first && recipients.includes(first);
+ const to = hasRecipient ? first : values.decision ? (me.id === COORDINATOR ? 'person' : COORDINATOR) : first ?? '';
+ const text = [hasRecipient ? second : first, ...(hasRecipient ? rest : [second, ...rest])].filter(Boolean).join(' ');
+ const id = store.shout(board, { from: me.id, to, text, lanes: laneNames(ctx.config), decision: Boolean(values.decision), evidence });
io.result?.({ id, decision: Boolean(values.decision) });
- io.say(values.decision ? `asked ${first} for a decision as #${id}; it stays open until someone runs: pullboard answer ${id} "<the decision>"` : `shouted to ${first}`);
+ io.say(values.decision ? `asked ${to} for a decision as #${id}; it stays open until someone runs: pullboard answer ${id} "<the decision>"` : `shouted to ${to}`);
return 0;
}),
answer: () => act((ctx, board, me) => {
+ const asPerson = personMode(ctx, me, values);
+ const id = store.answerDecision(board, idArg(first), { agentId: me.id, text: [second, ...rest].filter(Boolean).join(' '), lanes: laneNames(ctx.config), asPerson });
const ask = store.getShout(board, idArg(first));
- const id = store.shout(board, { from: me.id, to: ask.shout_from, text: [second, ...rest].filter(Boolean).join(' '), lanes: laneNames(ctx.config), answers: ask.shout_id });
io.result?.({ id, answers: ask.shout_id });
- io.say(`answered #${ask.shout_id} to ${ask.shout_from} as #${id}`);
+ if (asPerson) {
+ const originalAsker = ask.shout_answers === null ? ask.shout_from : store.getShout(board, ask.shout_answers).shout_from;
+ io.say(`person answered #${ask.shout_id}; notified ${originalAsker} as #${id}`);
+ } else {
+ io.say(`answered #${ask.shout_id} to ${ask.shout_from} as #${id}`);
+ }
+ return 0;
+ }),
+ pass: () => act((ctx, board, me) => {
+ const id = store.passDecision(board, 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}`);
return 0;
}),
};
@@ -1541,6 +1578,9 @@ async function runCommand(argv, io) {
}
const args = { first, second, rest, values };
try {
+ if (values.as === 'person' && !['answer', 'decisions'].includes(command)) {
+ throw new Refused('USAGE', '--as person works only with pullboard answer or decisions');
+ }
if (command === 'tour') return tour(io);
if (command === 'lifecycle') {
io.result?.({ markdown: lifecycleMarkdown().trimEnd() });
diff --git a/src/json.js b/src/json.js
index 84169483..e9353f82 100644
--- a/src/json.js
+++ b/src/json.js
@@ -43,6 +43,7 @@ export const JSON_SHAPES = {
refreeze: shape({ id: 'number', after: 'string' }),
shout: shape({ id: 'number', decision: 'boolean' }),
answer: shape({ id: 'number', answers: 'number' }),
+ pass: shape({ id: 'number', answers: 'number' }),
tour: shape({ messages: 'array' }),
lifecycle: shape({ markdown: 'string' }),
view: shape({ url: 'string', port: 'number' }),
@@ -65,7 +66,7 @@ export const JSON_SHAPES = {
/** Extract a concrete repair from existing refusals, retaining their original guidance. */
function nextStep(message) {
- const match = /(?:; |\. |: )((?:run|install|fix|restore|commit|check out|set|give|use|the coordinator|to keep looking|never work around)\b[\s\S]*)/i.exec(message);
+ const match = /(?:; |\. |: )((?:run|install|fix|restore|commit|check out|set|give|use|ask your coordinator|answer from the main checkout|the coordinator|to keep looking|never work around)\b[\s\S]*)/i.exec(message);
return match?.[1] ?? 'Run pullboard help, correct the reported problem, and retry the command.';
}
diff --git a/test/api.test.js b/test/api.test.js
index abc35bda..ed5eb4f2 100644
--- a/test/api.test.js
+++ b/test/api.test.js
@@ -242,9 +242,10 @@ test('[A1] command results match the catalog across roots and subcommands', () =
json(box, repo, 'hold', ['app', '--reason', 'exercise JSON']);
json(box, repo, 'hold', ['app', '--off']);
- json(box, secondPath, 'shout', ['coordinator', 'Please decide', '--decision']);
+ json(box, secondPath, 'shout', ['Please decide', '--decision']);
json(box, repo, 'decisions');
- json(box, repo, 'answer', ['1', 'Yes, keep the change']);
+ json(box, repo, 'pass', ['1', 'The test run is complete']);
+ json(box, repo, 'answer', ['2', 'Yes, keep the change', '--as', 'person']);
json(box, secondPath, 'inbox');
json(box, repo, 'sweep', ['--run', 'true', '--check', 'true {file}']);
diff --git a/test/board.test.js b/test/board.test.js
index 66aab55b..846d5c0a 100644
--- a/test/board.test.js
+++ b/test/board.test.js
@@ -232,16 +232,50 @@ test('a shout can ask for a decision; it stays open until someone answers it [B2
const lanes = ['coordinator', 'web', 'api'];
const ask = store.shout(board, { from: 'web-1', to: 'coordinator', text: 'ship the page today or tomorrow?', lanes, decision: true });
const note = store.shout(board, { from: 'web-1', to: 'coordinator', text: 'fyi: the gate is slow', lanes });
- assert.deepEqual(store.openDecisions(board).map((shout) => shout.shout_id), [ask]);
+ assert.deepEqual(store.openDecisions(board, 'coordinator').map((shout) => shout.shout_id), [ask]);
assert.throws(() => store.shout(board, { from: 'coordinator', to: 'web-1', text: 'ok', lanes, answers: note }), /NOT_A_DECISION/);
assert.throws(() => store.shout(board, { from: 'coordinator', to: 'web-1', text: 'ok', lanes, answers: 999 }), /NO_SHOUT/);
- assert.deepEqual(store.openDecisions(board).map((shout) => shout.shout_id), [ask], 'a refused answer leaves it open');
+ assert.deepEqual(store.openDecisions(board, 'coordinator').map((shout) => shout.shout_id), [ask], 'a refused answer leaves it open');
const answer = store.shout(board, { from: 'coordinator', to: 'web-1', text: 'today', lanes, answers: ask });
- assert.deepEqual(store.openDecisions(board), []);
+ assert.deepEqual(store.openDecisions(board, 'coordinator'), []);
assert.equal(store.getShout(board, answer).shout_answers, ask);
assert.equal(store.getShout(board, ask).shout_text, 'ship the page today or tomorrow?', 'an answer is a new shout; the ask is never edited');
});
+test('decisions climb to the person and answers return to the first asker [B25, B26, B27]', () => {
+ const lanes = ['coordinator', 'web', 'api'];
+ const original = store.shout(board, { from: 'web-1', to: 'coordinator', text: 'Ship today?', lanes, decision: true });
+ assert.throws(() => store.shout(board, { from: 'web-1', to: 'person', text: 'Ship today?', lanes, decision: true }), /B26_PERSON_DECISION.*ask your coordinator/);
+ const passed = store.passDecision(board, original, { agentId: 'coordinator', note: 'the final CSS screenshot is ready', lanes });
+ const escalated = store.getShout(board, passed);
+ assert.equal(escalated.shout_to, 'person');
+ assert.equal(escalated.shout_answers, original);
+ assert.match(escalated.shout_text, /web-1: Ship today\?/);
+ assert.match(escalated.shout_text, /final CSS screenshot is ready/);
+ assert.deepEqual(store.openDecisions(board, 'person').map((row) => row.shout_id), [passed]);
+ assert.deepEqual(store.openDecisions(board, 'coordinator'), []);
+ assert.throws(() => store.answerDecision(board, passed, { agentId: 'web-1', text: 'No', lanes }), /NOT_YOUR_DECISION/);
+ assert.deepEqual(store.openDecisions(board, 'person').map((row) => row.shout_id), [passed]);
+ assert.throws(() => store.answerDecision(board, passed, { agentId: 'coordinator', text: 'Yes, ship today.', lanes }), /B26_PERSON_ANSWER.*--as person/);
+ const answer = store.answerDecision(board, passed, { agentId: 'coordinator', text: 'Yes, ship today.', lanes, asPerson: true });
+ assert.equal(store.getShout(board, answer).shout_from, 'person');
+ assert.deepEqual(store.openDecisions(board, 'person'), []);
+ assert.deepEqual(store.openDecisions(board, 'coordinator'), []);
+ assert.throws(() => store.passDecision(board, original, { agentId: 'coordinator', note: 'retry', lanes }), /ALREADY_ANSWERED/);
+ assert.throws(() => store.answerDecision(board, passed, { agentId: 'coordinator', text: 'Again', lanes }), /ALREADY_ANSWERED/);
+ const delivered = store.inbox(board, 'web-1');
+ assert.equal(delivered[0].shout_text, `Person answered #${passed}: Yes, ship today.`);
+ assert.equal(delivered[0].shout_answers, original, 'the notice closes the first asker’s decision');
+});
+
+test('only the coordinator can pass an open coordinator decision [B27]', () => {
+ const lanes = ['coordinator', 'web', 'api'];
+ const ask = store.shout(board, { from: 'web-1', to: 'coordinator', text: 'Ship?', lanes, decision: true });
+ assert.throws(() => store.passDecision(board, ask, { agentId: 'web-1', note: 'please', lanes }), /COORDINATOR_ONLY/);
+ assert.throws(() => store.passDecision(board, ask, { agentId: 'coordinator', note: '', lanes }), /EMPTY_NOTE/);
+ assert.equal(store.openDecisions(board, 'coordinator')[0].shout_id, ask);
+});
+
test('a shout can carry typed evidence: attempt or receipt, outcome, item and commit [B22]', () => {
const lanes = ['coordinator', 'web', 'api'];
const id = submitted();
diff --git a/test/e2e.test.js b/test/e2e.test.js
index 6bb7c725..f38b3ce4 100644
--- a/test/e2e.test.js
+++ b/test/e2e.test.js
@@ -302,7 +302,7 @@ test('submit needs a clean tree, nothing untracked, and the gate green at HEAD [
assert.equal(box.git(box.repo, 'rev-parse', `refs/pullboard/items/1/${head.slice(0, 12)}`), head, 'submit pins the commit');
});
-test('decisions are asked, listed and answered, and evidence attached, from the command line [B21, B22]', () => {
+test('decisions are asked, listed and answered, and evidence attached, from the command line [B21, B22, B26]', () => {
const box = project();
box.run(box.repo, 'add', 'web', 'Page', '--specs', 'G1');
const asked = box.run(box.web, 'shout', 'coordinator', 'ship', 'today?', '--decision');
@@ -311,6 +311,9 @@ test('decisions are asked, listed and answered, and evidence attached, from the
assert.ok(id, asked.out);
assert.match(box.run(box.repo, 'decisions').out, new RegExp(`#${id} {2}web-1 -> coordinator, \\d+m ago: ship today\\?`));
assert.match(box.run(box.repo, 'inbox').out, new RegExp(`web-1 -> coordinator: asks for a decision \\(#${id}; pullboard answer ${id}`));
+ const wrongActor = box.run(box.repo, 'answer', id, 'yes, today', '--as', 'person');
+ assert.notEqual(wrongActor.code, 0);
+ assert.match(wrongActor.err, /B26_PERSON_ANSWER.*person mode answers only/);
assert.match(box.run(box.repo, 'answer', id, 'yes, today').out, new RegExp(`answered #${id} to web-1 as #\\d+`));
assert.match(box.run(box.repo, 'decisions').out, /no open decisions/);
assert.match(box.run(box.web, 'inbox').out, new RegExp(`coordinator -> web-1: answers #${id}: yes, today`));
@@ -321,6 +324,52 @@ test('decisions are asked, listed and answered, and evidence attached, from the
assert.match(box.run(box.web, 'shout', 'coordinator', 'x', '--evidence', 'receipt', '--outcome', 'measured', '--item', '1', '--commit', 'nope').err, /BAD_EVIDENCE.*"nope"/);
});
+test('decisions default up the chain, pass to the person, and return to the original asker [B25, B26, B27]', () => {
+ const box = project();
+ const asked = box.run(box.web, 'shout', 'Ship the patch?', '--decision');
+ assert.equal(asked.code, 0, asked.err);
+ const id = /as #(\d+)/.exec(asked.out)?.[1];
+ assert.ok(id, asked.out);
+ assert.match(box.run(box.repo, 'decisions').out, new RegExp(`#${id} {2}web-1 -> coordinator`));
+ const passed = box.run(box.repo, 'pass', id, 'the checks are green');
+ assert.equal(passed.code, 0, passed.err);
+ const personId = /as #(\d+)/.exec(passed.out)?.[1];
+ assert.ok(personId, passed.out);
+ assert.match(box.run(box.repo, 'decisions', '--as', 'person').out, new RegExp(`#${personId} {2}coordinator -> person`));
+ const personModeFromAgent = box.run(box.web, 'decisions', '--as', 'person');
+ assert.notEqual(personModeFromAgent.code, 0);
+ assert.match(personModeFromAgent.err, /B26_PERSON_ANSWER.*main checkout/);
+ const agentPersonAnswer = box.run(box.web, 'answer', personId, 'Ship it.', '--as', 'person');
+ assert.notEqual(agentPersonAnswer.code, 0);
+ assert.match(agentPersonAnswer.err, /B26_PERSON_ANSWER.*main checkout/);
+ const agentAnswer = box.run(box.web, 'answer', personId, 'Ship it.');
+ assert.notEqual(agentAnswer.code, 0);
+ assert.match(agentAnswer.err, /NOT_YOUR_DECISION/);
+ const coordinatorAnswer = box.run(box.repo, 'answer', personId, 'Ship it.', '--json');
+ assert.notEqual(coordinatorAnswer.code, 0);
+ const answerRefusal = JSON.parse(coordinatorAnswer.out);
+ assert.equal(answerRefusal.error.code, 'B26_PERSON_ANSWER');
+ assert.match(answerRefusal.error.next, new RegExp(`pullboard answer ${personId} "<answer>" --as person`));
+ assert.match(box.run(box.repo, 'answer', personId, 'Ship it.', '--as', 'person').out, new RegExp(`person answered #${personId}; notified web-1`));
+ assert.match(box.run(box.web, 'resume').out, new RegExp(`newest from person: Person answered #${personId}: Ship it\\.`));
+ assert.match(box.run(box.web, 'inbox').out, new RegExp(`person -> web-1: answers #${id}: Person answered #${personId}: Ship it\\.`));
+ assert.match(box.run(box.repo, 'decisions').out, /no open decisions/);
+ const refused = box.run(box.web, 'shout', 'person', 'Ship?', '--decision', '--json');
+ assert.notEqual(refused.code, 0);
+ const refusal = JSON.parse(refused.out);
+ assert.equal(refusal.error.code, 'B26_PERSON_DECISION');
+ assert.match(refusal.error.next, /ask your coordinator: pullboard shout coordinator/);
+ const coordinatorAsk = box.run(box.repo, 'shout', 'Should we publish?', '--decision');
+ assert.equal(coordinatorAsk.code, 0, coordinatorAsk.err);
+ assert.match(coordinatorAsk.out, /asked person for a decision/);
+ const personDecision = /as #(\d+)/.exec(coordinatorAsk.out)?.[1];
+ assert.ok(personDecision, coordinatorAsk.out);
+ const defaultPersonAnswer = box.run(box.repo, 'answer', personDecision, 'Yes.');
+ assert.notEqual(defaultPersonAnswer.code, 0);
+ assert.match(defaultPersonAnswer.err, /B26_PERSON_ANSWER.*--as person/);
+ assert.equal(box.run(box.repo, 'answer', personDecision, 'Yes.', '--as', 'person').code, 0);
+});
+
test('pullboard worktree makes a joined worktree for a lane in one command [I4]', () => {
const box = project();
const made = box.run(box.repo, 'worktree', 'api');