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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(relay): a phone move names the phone's person [E3,E4]
Corey Olsona08553c5eb29
diff --git a/docs/api.md b/docs/api.mdindex d8bf5304..1153c3d2 100644--- a/docs/api.md+++ b/docs/api.md@@ -522,7 +522,7 @@ upgrade guidance; it never returns an older or partial image.The authenticated relay page calls `cockpitPage` with `readOnly: true` and the separate `requests: true` capability. This enables only the person's literal intents through the sealing transport; generic API writes remain refused. Local read-only pages and exported snapshots omit this capability and refuse every action.-When `pullboard.json` names `approvers`, only those GitHub logins act as the person on the linked board: a phone request to `answer`, `hold`, `spec-approve` or `spec-decline` from another writer's session is received as refused with `NOT_APPROVER`, and so is a direct person move. `add` and `shout` requests stay open to every writer. Each event a relayed move writes names its `person`, the sender's GitHub login, in `event_detail`, beside `event_by`.+When `pullboard.json` names `approvers`, only those GitHub logins act as the person on the linked board: a phone request to `answer`, `hold`, `spec-approve` or `spec-decline` from another writer's session is received as refused with `NOT_APPROVER`, and so is a direct person move. `add` and `shout` requests stay open to every writer. Each event a relayed move writes names its `person`, the sender's GitHub login, in `event_detail`, beside `event_by`. A move a computer makes to carry out a phone request names the phone's person, and a refused move or request names the person who tried it.A paired relay browser translates `add`, `shout`, `answer`, `hold` (including `args.off: true`), `spec-approve` and `spec-decline` into literal CLI intent. Its transport accepts `{verb, item?, args}` at the paired board's moves address and seals a separate request document before posting `{sequence, sealed}` to `/api/v1/boards/:board/requests`. It never sends plaintext arguments, an engine operation or the board key. The relay stores and orders that opaque envelope; it neither executes a command nor writes a repository. Agent credentials cannot submit person intent or person-attributed holds and releases.diff --git a/docs/formats.md b/docs/formats.mdindex 06965724..7f49e655 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -192,7 +192,7 @@ The relay outbox (#922, opt in with `relay.outbox`) lives beside `relay.json` asEngine 69 (`REVIEW_SKIP_ENGINE`) lets `reserveNextReview` carry `skipIds`: the submitted items the reviewer's own agent session built, which `pullboard next --verify` never offers it. A move with a non-empty `skipIds` needs engine 69, so an older reader refuses it instead of reserving a different item; moves without `skipIds`, and every move recorded before engine 69, replay as before.-Engine 71 (`PEOPLE_ENGINE`) names people and lets approvers alone act as the person. The relay stamps each stored record's sender with the GitHub login behind it, the engine the sender declared and, on a board that names approvers, `approver: true|false` for a person sender. Replaying a move made at engine 71 or later, every event it writes carries `person`, that login, beside `event_by`, the agent or seat. `pullboard.json` may list `approvers`, GitHub logins, at most fifty; leaving it out keeps today's behaviour. On a board that names them, every replica refuses with `NOT_APPROVER` a person move (a row or sentinel decision, an answer, hold or fact as the person, a person request shout) or a phone request to answer, hold or decide rows whose sender is not an approver, and the relay refuses an unlink or snapshot replacement from anyone else. A record whose seal no key opens, from an engine no newer than the replica's, is set aside as `relay_refused` with code `RELAY_SEAL`, and replay goes on; one from a newer engine still asks for an upgrade.+Engine 71 (`PEOPLE_ENGINE`) names people and lets approvers alone act as the person. The relay stamps each stored record's sender with the GitHub login behind it, the engine the sender declared and, on a board that names approvers, `approver: true|false` for a person sender. Replaying a move made at engine 71 or later, every event it writes carries `person`, that login, beside `event_by`, the agent or seat. A move that carries out a recorded phone request carries the request sender's login instead, and a `relay_refused` event carries the login of the person who tried the move or request. `pullboard.json` may list `approvers`, GitHub logins, at most fifty; leaving it out keeps today's behaviour. On a board that names them, every replica refuses with `NOT_APPROVER` a person move (a row or sentinel decision, an answer, hold or fact as the person, a person request shout) or a phone request to answer, hold or decide rows whose sender is not an approver, and the relay refuses an unlink or snapshot replacement from anyone else. A record whose seal no key opens, from an engine no newer than the replica's, is set aside as `relay_refused` with code `RELAY_SEAL`, and replay goes on; one from a newer engine still asks for an upgrade.The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 48 after issuing any agent token or machine credential, includingdiff --git a/src/board.js b/src/board.jsindex 45f0610d..5ce29d56 100644--- a/src/board.js+++ b/src/board.js@@ -539,8 +539,8 @@ export function logEvent(board, by, kind, itemId, detail = {}, at) {}/** Log an authenticated relay refusal without making an item, shout or verdict move [H2,H16]. */-export function recordRelayRefusal(board, { by, sequence, kind, operation, actor, code, itemId = null }) {- logEvent(board, by, 'relay_refused', itemId, { sequence, kind, operation, actor, code });+export function recordRelayRefusal(board, { by, sequence, kind, operation, actor, code, itemId = null, person = null }) {+ logEvent(board, by, 'relay_refused', itemId, { sequence, kind, operation, actor, code, ...(person ? { person } : {}) }); // who tried it, from engine 71 [E3]}/**diff --git a/src/engine.js b/src/engine.jsindex 8aa96ef5..0203d98c 100644--- a/src/engine.js+++ b/src/engine.js@@ -45,6 +45,8 @@ import { firstRefusal } from './claims.js';import {requestMoveProblem,recordRequestMove,+ relayPerson,+ requestPerson,} from './relay-requests.js';import {relayMoveActor,@@ -265,7 +267,7 @@ export function refuseRelayMove(board, move, { sequence, at, sender, kind, code,board.clock = { now: () => new Date(at) };try {store.recordRelayRefusal(board, { by: normalizedBy, sequence, kind, operation: typeof move?.operation === 'string' ? move.operation : null,- actor: typeof relayMoveActor(move) === 'string' ? relayMoveActor(move) : null, code, itemId });+ actor: typeof relayMoveActor(move) === 'string' ? relayMoveActor(move) : null, code, itemId, person: requestPerson(board, move) ?? relayPerson(sender) });} finally { board.clock = clock; }metadata(board, key, JSON.stringify({ record, outcome }));metadata(board, 'relay_applied_sequence', String(sequence));@@ -316,8 +318,10 @@ export function applyRelayMove(board, move, { sequence, at, sender, kind, digest// The person is above every seat; their own moves act with the coordinator's standing.const standing = move?.engine >= VERIFIER_STANDING_ENGINE ? { root: sender?.root === true || sender?.kind === 'person',person: sender?.kind === 'person', lineage: sender?.root === true && typeof sender.lineage === 'string' ? sender.lineage : null } : null;- // The relay-authenticated GitHub login names the person behind the move, whoever sent it [E3].- return applyEngineMove(board, move, { sequence, at, standing, enrollment: registration?.target ?? null, person: typeof sender?.login === 'string' ? sender.login : null });+ // The relay-authenticated GitHub login names the person behind the move, whoever sent it; a move that carries out+ // a phone request is the phone person's, though their computer sent it [E3].+ return applyEngineMove(board, move, { sequence, at, standing, enrollment: registration?.target ?? null,+ person: requestPerson(board, move) ?? (typeof sender?.login === 'string' ? sender.login : null) });}return refuseRelayMove(board, move, { sequence, at, sender, kind, code: problem.code, digest, refusal: problem });}diff --git a/src/relay-requests.js b/src/relay-requests.jsindex 6038a7f8..f599eaf1 100644--- a/src/relay-requests.js+++ b/src/relay-requests.js@@ -6,6 +6,7 @@ import { Refused } from './refused.js';import { parseImplies } from './implies.js';import { validatePersonRequest } from './person-request.js';import { relayMoveActor } from './relay-sender.js';+import { PEOPLE_ENGINE } from './people-engine.js';const INDEX = 'relay_person_requests';@@ -20,6 +21,30 @@ export function personRequestRecords(board) {return row ? JSON.parse(row.meta_value) : [];}+/**+ * The GitHub login the relay stamped on a record from engine 71 on, or null: the person who made or tried it [E3].+ *+ * @param {any} sender+ * @returns {string | null}+ */+export function relayPerson(sender) {+ return typeof sender?.login === 'string' && sender.engine >= PEOPLE_ENGINE ? sender.login : null;+}++/**+ * The person whose phone asked for this move, when the move carries out a recorded phone request, or null. The+ * computer that carries the request out sends the move, but the move is the phone person's [E3].+ *+ * @param {any} board+ * @param {any} move+ * @returns {string | null}+ */+export function requestPerson(board, move) {+ if (!move?.personRequest || requestMoveProblem(board, move, { checkExecutorLease: false })) return null;+ const record = personRequestRecords(board).find((entry) => entry.id === move.personRequest.id && !entry.duplicateOf);+ try { return relayPerson(JSON.parse(record.received).sender); } catch { return null; }+}+/** Persist request receipts inside the caller's existing board transaction. */function save(board, records) {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(INDEX, JSON.stringify(records));@@ -64,7 +89,7 @@ export function receivePersonRequest(board, document, { sequence, at, sender })if (error) {const clock = board.clock;board.clock = { now: () => new Date(at) };- try { store.recordRelayRefusal(board, { by: sender?.kind === 'agent' ? sender.agent : 'person', sequence, kind: 'request', operation: document?.operation ?? null, actor: relayMoveActor(document), code: error.code }); }+ try { store.recordRelayRefusal(board, { by: sender?.kind === 'agent' ? sender.agent : 'person', sequence, kind: 'request', operation: document?.operation ?? null, actor: relayMoveActor(document), code: error.code, person: relayPerson(sender) }); }finally { board.clock = clock; }}}diff --git a/test/team.test.js b/test/team.test.jsindex 31616c25..2ffaa210 100644--- a/test/team.test.js+++ b/test/team.test.js@@ -603,6 +603,28 @@ test('the board knows its people: events name them, approvers decide [E3,E4,E20]assert.equal((await box.cli('status')).code, 0, 'alice’s board still reads');});+test('the board knows its people: a phone move names the phone’s person, refused or not [E3,E4]', { timeout: 180_000 }, async (t) => { // budget: hang ceiling for real CLI runs and relay calls; not a speed target.+ const box = await teamBoard(t, ['alice']);+ const bob = await personSession(box, 'bob');+ // Bob's phone adds an item; alice's computer carries it out, so the move is sent with alice's credential.+ const title = 'An item from bob’s phone';+ const added = await phoneRequest(box, bob, { verb: 'add', args: { lane: box.lane, title } });+ const asked = await box.cli('shout', 'person', 'Plain text or JSON?', '--decision');+ assert.equal(asked.code, 0);+ const decision = asked.document.id ?? asked.document.shout_id ?? asked.document.result?.id;+ const denied = await phoneRequest(box, bob, { verb: 'answer', item: Number(decision), args: { text: 'JSON' } });+ const requests = await receivedRequests(box);+ assert.equal(requests[added].status, 'done', 'bob’s phone adds the item');+ assert.equal(requests[denied].error?.code, 'NOT_APPROVER', 'bob’s phone cannot answer as the person');+ const tables = (await box.cli('export')).document.tables;+ const id = tables.item.find((item) => item.item_title === title)?.item_id;+ const add = tables.event.find((event) => event.event_kind === 'add' && event.item_id === id);+ const refused = tables.event.find((event) => event.event_kind === 'relay_refused' && JSON.parse(event.event_detail).sequence === requests[denied].sequence);+ assert.ok(add && refused, 'both are on the record');+ assert.equal(JSON.parse(add.event_detail).person, 'bob', 'the add names bob, whose phone asked for it, not alice, whose computer carried it out');+ assert.equal(JSON.parse(refused.event_detail).person, 'bob', 'the refused answer still names bob, who tried it');+});+test('a board that names no approvers takes person moves as before [E4]', { timeout: 120_000 }, async (t) => { // budget: hang ceiling for real CLI runs and relay calls; not a speed target.const box = await teamBoard(t, null);const link = JSON.parse(readFileSync(box.linkFile, 'utf8'));