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(api): keep person requests on view channel [P6,B26,A2]
Corey Olson1031d5bae004
diff --git a/docs/api.md b/docs/api.mdindex 21d17314..d482cb49 100644--- a/docs/api.md+++ b/docs/api.md@@ -202,7 +202,7 @@ The server checks any Origin against its own address and grants no CORS permissi| `GET /api/v1/boards/:board/code?ref=path:lines@commit&before=...` | A bounded preview of committed file lines from that registered board || `GET /api/v1/boards/:board/events?after=N` | Events after sequence N, in order, and their event-log format version || `POST /api/v1/boards/:board/moves` | One CLI move and its emitted event |-| `POST /api/v1/boards/:board/requests` | A person's request for the coordinator |+| `POST /api/v1/boards/:board/requests` | A person's request for the coordinator (view only) |The boards response keeps `boards` and may include `warnings` for registered entries that could not be opened. State `seen` must be a nonnegative safe integer; omitting it retains the `unseen: null` result. State continues to include only the newest 40 shouts. Use `GET /api/v1/boards/:board/shouts/:id` to resolve an older address; its `{ shout }` result contains the complete stored shout row, including sender, recipient, text, timestamp, decision flag and reply relationship. Decision shouts also include `decision_state` (`open` or `answered`) and `decision_answer` (the reply row or `null`); other shouts use `null` for both fields. A missing id returns `NO_SHOUT` with HTTP 404; malformed ids are refused with HTTP 400. Code previews read only a registered repo's committed tree, use a plain commit SHA and at most 60 lines, and never read the working tree. The shared router lets adapters omit the optional code capability; such adapters return the versioned `CODE_NOT_AVAILABLE` refusal.@@ -296,4 +296,4 @@ Only the person can run `pullboard land --waive <test> --until <date> --reason "A `pullboard serve` key grants access to a board; it does not identify the person. API moves always use a non-person channel, including when the server was started in an ordinary terminal. `spec-approve`, `spec-decline`, answering or verifying with `as: person`, and any other person-only move are refused with `B26_PERSON_CHANNEL` without recording an event. Token revocation through the standalone API is refused for the same reason. Spec signing off is not an offered API move. Use the person's terminal or the actual `pullboard view` page for person actions; ordinary agent moves remain available through the API.-The view's own page retains its person channel. Residual: an agent that starts `pullboard view` itself also holds that view's link; this change does not isolate that link from the agent. Signed person moves (#408) address that separate boundary. A coordinator request (`POST /api/v1/boards/:board/requests`) is still recorded as sent by the person on either server; it approves, answers and signs nothing, and its sender attribution is a separate follow-up.+The view's own page retains its person channel. The standalone API refuses `POST /api/v1/boards/:board/requests` with `B26_PERSON_CHANNEL`; the view continues to record the person's coordinator request. Residual: an agent that starts `pullboard view` itself also holds that view's link; this change does not isolate that link from the agent. Signed person moves (#408) address that separate boundary.diff --git a/src/api.js b/src/api.jsindex ea5ec94b..8cb5577b 100644--- a/src/api.js+++ b/src/api.js@@ -248,8 +248,9 @@ export async function executeMove(root, body, runCommand, isMain, personChannelreturn { status: 200, body: { version: VERSION, event, result } };}-/** Create a person's coordinator request through the same shout transaction as the CLI. */-async function createRequest(root, body, isMain) {+/** Create a person's coordinator request through the view's channel, never a standalone serve key. */+async function createRequest(root, body, isMain, personChannel) {+ if (personChannel !== 'view') throw new Refused('B26_PERSON_CHANNEL', 'person requests use the terminal or the view; run pullboard view');if (typeof body.text !== 'string' || !body.text.trim() || Object.keys(body).some((key) => key !== 'text')) throw new Refused('BAD_REQUEST', 'a request needs {text: "what the coordinator should do"}');const message = { from: 'person', to: COORDINATOR, text: body.text, request: true, lanes: laneNames(loadConfig(root)) };if (relayLinked(root)) {@@ -324,7 +325,7 @@ export function createLocalApiHandler({ secret, getPort, runCommand, projects =events: (board, after) => afterEvents(board.root, after, codeIsMain),eventLogVersion: () => store.EVENT_LOG_VERSION,move: (board, body) => executeMove(board.root, body, runCommand, codeIsMain, personChannel),- request: (board, body) => createRequest(board.root, body, codeIsMain),+ request: (board, body) => createRequest(board.root, body, codeIsMain, personChannel),tokens: async (board) => (await relayTokens(board.root, { err() {} })).tokens,revokeToken: (board, id) => relayRevoke(board.root, id, { personChannel, say() {}, err() {} }),});diff --git a/test/api-http.test.js b/test/api-http.test.jsindex 4983a087..474fcf1b 100644--- a/test/api-http.test.js+++ b/test/api-http.test.js@@ -100,6 +100,42 @@ async function httpBox(t, { includeMissing = false, onStateBuild } = {}) {return { ...box, api, origin, key, id, call, path: '/api/v1/boards/' + id };}+/** Serve one registered private fixture through the actual person's view adapter. */+async function viewHttpBox(t, existing = null) {+ const box = existing ?? fixture(t);+ const previousHome = process.env.PULLBOARD_HOME;+ let view;+ t.after(async () => {+ try { await view?.close(); }+ finally {+ if (previousHome === undefined) delete process.env.PULLBOARD_HOME;+ else process.env.PULLBOARD_HOME = previousHome;+ }+ });+ process.env.PULLBOARD_HOME = box.env.PULLBOARD_HOME;+ registerProject(box.root);+ view = await serveView({ port: 0 });+ const url = new URL(view.url);+ const key = url.searchParams.get('k');+ const origin = url.origin;+ /** Make a real HTTP call to this fixture's person-owned view and decode its versioned response. */+ async function call(path, value, headers = {}) {+ const response = await fetchFresh(origin + path, {+ method: value === undefined ? 'GET' : 'POST',+ headers: { 'x-pullboard-key': key, ...(value === undefined ? {} : { 'content-type': 'application/json' }), ...headers },+ ...(value === undefined ? {} : { body: JSON.stringify(value) }),+ });+ const document = await response.json();+ assert.equal(document.version, 1);+ return { status: response.status, document };+ }+ const listed = await call('/api/v1/boards');+ assert.equal(listed.status, 200);+ assert.equal(listed.document.boards.length, 1);+ const id = listed.document.boards[0].id;+ return { ...box, api: view, origin, key, id, call, path: '/api/v1/boards/' + id };+}+test('[A2] a stale registered folder does not hide another readable board', async (t) => {const box = await httpBox(t, { includeMissing: true });const listed = await box.call('/api/v1/boards');@@ -475,7 +511,7 @@ test('[A2,V2] HTTP add and edit preserve explicit blocking baseline requests', a});test('[A2, H12, R2] requests and shouts append events and requests stay outside decisions', async (t) => {- const box = await httpBox(t);+ const box = await viewHttpBox(t);const requested = await box.call(box.path + '/requests', { text: 'Please approve the fixture row.' });assert.equal(requested.status, 200);assert.equal(requested.document.result.request, true);@@ -776,3 +812,54 @@ async (t) => {assert.equal(approved.event_by, 'person');assert.equal(box.cli(box.root, 'log').events.length, before + 1);});++test("a request through serve is never the person's [P6,B26,A2]", { timeout: 60_000 }, // budget: private CLI/API startup and request-channel checks, not a throughput claim.+async (t) => {+ const box = fixture(t);+ const child = startFixtureChild(process.execPath, [BIN, 'serve', '--port', '0', '--json'], {+ cwd: box.root, env: { ...box.env, CLAUDECODE: '1' }, stdio: ['ignore', 'pipe', 'pipe'],+ });+ const closed = new Promise(resolveClosed => child.once('close', resolveClosed));+ let stopped = false;+ /** Stop only the private server and await its terminal close before deleting its fixture. */+ async function stopServer() {+ if (stopped) return;+ stopped = true;+ if (child.exitCode === null && child.signalCode === null) child.kill('SIGTERM');+ let timer;+ try {+ const ended = await Promise.race([closed.then(() => true), new Promise(resolveWait => { timer = setTimeout(() => resolveWait(false), 2000); })]); // budget: owned fixture server TERM grace before its bounded KILL fallback.+ if (!ended) { child.kill('SIGKILL'); await closed; }+ } finally { clearTimeout(timer); }+ }+ t.after(stopServer);+ const served = await new Promise((resolveAddress, rejectAddress) => {+ let output = '';+ const timer = setTimeout(() => rejectAddress(new Error('private agent serve did not announce its address')), 20_000); // budget: private CLI address startup ceiling.+ child.once('exit', () => { clearTimeout(timer); rejectAddress(new Error('private agent serve exited before its address')); });+ child.stdout.on('data', chunk => {+ output += chunk;+ try {+ const document = JSON.parse(output);+ if (typeof document.url === 'string') { clearTimeout(timer); resolveAddress(new URL(document.url)); }+ } catch { /* Wait for the complete private JSON announcement, never print its key. */ }+ });+ });+ const headers = { 'x-pullboard-key': served.searchParams.get('k'), 'content-type': 'application/json' };+ const listing = await (await fetchFresh(served.origin + '/api/v1/boards', { headers })).json();+ const id = listing.boards.find(board => resolve(board.root) === resolve(box.root)).id;+ const path = '/api/v1/boards/' + id;+ const before = box.cli(box.root, 'log').events.length;+ const refused = await fetchFresh(served.origin + path + '/requests', {+ method: 'POST', headers, body: JSON.stringify({ text: 'Please review this private fixture.' }),+ });+ assert.equal((await refused.json()).error?.code, 'B26_PERSON_CHANNEL');+ assert.notEqual(refused.status, 200);+ assert.equal(box.cli(box.root, 'log').events.length, before, 'a standalone serve request adds no event');+ await stopServer();+ const view = await viewHttpBox(t, box);+ const requested = await view.call(view.path + '/requests', { text: 'Please review this from the actual view.' });+ assert.equal(requested.status, 200, "the actual view keeps the person's request channel");+ assert.equal(requested.document.event.event_by, 'person');+ assert.equal(box.cli(box.root, 'log').events.length, before + 1);+});