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(review): exclude seats sharing author parents [V1,B3]

Corey Olson0bd0fc88bc51
diff --git a/src/agent-tree.js b/src/agent-tree.js
index 5920dfbf..f5adcd8b 100644
--- a/src/agent-tree.js
+++ b/src/agent-tree.js
@@ -28,7 +28,7 @@ export function agentTree(info, config, board) {
}
const known = new Set(agents.map((agent) => agent.agent_id));
const row = (agent, seen) => ({
- id: agent.agent_id, displayName: displayAgentName(agent, config.agents.names), lane: agent.agent_lane, path: agent.agent_path,
+ id: agent.agent_id, parentSession: agent.agent_parent_session ?? null, displayName: displayAgentName(agent, config.agents.names), lane: agent.agent_lane, path: agent.agent_path,
seats: agents.filter((seat) => seat.agent_id === agent.agent_id || (digests.has(agent.agent_id) && digests.get(seat.agent_id) === digests.get(agent.agent_id)))
.map((seat) => ({ id: seat.agent_id, path: seat.agent_path })),
holds: held.get(agent.agent_id) ?? [],
@@ -49,7 +49,7 @@ export function agentTreeLines(tree, indent = '') {
if (!indent && !tree.length) return ['no agents have joined'];
return tree.flatMap((agent) => {
const held = agent.holds.map((hold) => `#${hold.item} (${hold.status})`).join(', ');
- return [`${indent}${agent.displayName} (${agent.lane} lane) at ${agent.path}${held ? `: ${held}` : ''}`, ...agentTreeLines(agent.helpers, indent + ' ')];
+ return [`${indent}${agent.displayName} (${agent.lane} lane) parent ${agent.parentSession ?? 'unknown'} at ${agent.path}${held ? `: ${held}` : ''}`, ...agentTreeLines(agent.helpers, indent + ' ')];
});
}
diff --git a/src/board.js b/src/board.js
index ef087044..7564f016 100644
--- a/src/board.js
+++ b/src/board.js
@@ -16,6 +16,7 @@ export { verdictReviewProblem, verdictsFor, acceptedVerdict, checkedLandingCommi
export { landingLeaseMove, landingLeaseState } from './landing-lease.js';
import { guardLandingWrite } from './landing-lease.js';
import {
+ createHash,
randomBytes,
randomUUID,
} from 'node:crypto';
@@ -73,6 +74,8 @@ import {
import { LOCAL_LANDING_ENGINE } from './land-engine.js';
import { SPEC_APPROVAL_ENGINE } from './spec-approval-engine.js';
import { Refused } from './refused.js';
+import { PARENT_SESSION_ENGINE } from './parent-session-engine.js';
+import { parentIdentity } from './parent-session.js';
import { itemAuthorProblem } from './item-authors.js';
import { refuseMaskedExit } from './check-mask.js';
import {
@@ -88,6 +91,8 @@ import {
newSeatId,
routeOf,
saveAgentModel,
+ saveAgentParent,
+ saveAgentSession,
seatLineage,
} from './seats.js';
import {
@@ -602,13 +607,17 @@ function current(board, item) {
* the relay already issued a token for the next name; ids then skip taken names.
*
* @param {any} board
- * @param {{ lane: string, path: string, route?: string, family?: string | null, model?: string | null, createdBy?: string, id?: string }} who
+ * @param {{ lane: string, path: string, route?: string, family?: string | null, model?: string | null, parent?: string | null, session?: string | null, createdBy?: string, id?: string }} who
* @returns {string} The agent's id.
*/
-export function register(board, { lane, path, route = 'strong', family, model, createdBy, id: named }) {
+export function register(board, { lane, path, route = 'strong', family, model, parent, session, createdBy, id: named }) {
const engine = board.executionEngineVersion ?? ENGINE_VERSION;
if (engine < 8) model = undefined;
if (engine < VERIFIER_STANDING_ENGINE) { createdBy = undefined; named = undefined; }
+ const parentDigest = engine >= PARENT_SESSION_ENGINE && parent != null
+ ? createHash('sha256').update(JSON.stringify(['parent-session', parentIdentity(parent)])).digest('hex') : null;
+ const sessionDigest = engine >= PARENT_SESSION_ENGINE && session != null
+ ? createHash('sha256').update(JSON.stringify(['parent-session', parentIdentity(session)])).digest('hex') : null;
checkRoute(route);
if (lane === COORDINATOR && route !== 'strong') {
throw new Refused('BAD_ROUTE', 'the coordinator plans, merges and verifies; it is always strong');
@@ -622,6 +631,8 @@ export function register(board, { lane, path, route = 'strong', family, model, c
`this worktree is ${existing.agent_id} in the ${existing.agent_lane} lane, routed ${existing.agent_route}; use another worktree for ${lane} routed ${route}`,
);
}
+ if (parentDigest) saveAgentParent(board, existing.agent_id, parentDigest);
+ if (sessionDigest) saveAgentSession(board, existing.agent_id, sessionDigest);
if (family !== undefined && family !== existing.agent_family) {
board.db.prepare('UPDATE agent SET agent_family = ? WHERE agent_id = ?').run(family, existing.agent_id);
logEvent(board, existing.agent_id, 'family', null, { family });
@@ -648,6 +659,8 @@ export function register(board, { lane, path, route = 'strong', family, model, c
'INSERT INTO agent (agent_id, agent_lane, agent_path, agent_route, agent_family, agent_created_at) VALUES (?, ?, ?, ?, ?, ?)',
)
.run(id, lane, path, route, family ?? null, now(board));
+ if (parentDigest) saveAgentParent(board, id, parentDigest);
+ if (sessionDigest) saveAgentSession(board, id, sessionDigest);
if ((board.executionEngineVersion ?? ENGINE_VERSION) >= 8) saveAgentModel(board, id, model);
if (createdBy !== undefined) board.db.prepare('INSERT INTO board_meta (meta_key, meta_value) VALUES (?, ?)').run(`agent_creator:${id}`, createdBy);
// Only a relay replica replaying a receipt-bound registration marks the seat enrolled.
diff --git a/src/commands/join.js b/src/commands/join.js
index 509c9916..f70f4f72 100644
--- a/src/commands/join.js
+++ b/src/commands/join.js
@@ -1,3 +1,4 @@
+import { joinParentSession, runtimeSessionIdentity } from '../parent-session.js';
/** The pullboard join command, in its own module so an item adding another command never edits these lines. */
import {
displayAgentName,
@@ -27,13 +28,15 @@ import {
/** Run `pullboard join` and return its exit code. */
export async function run(io, { first, values }) {
const ctx = context(io);
+ const parent = joinParentSession(values.parent);
+ const session = runtimeSessionIdentity()?.session;
if (ctx.info.isMain) {
if (first !== COORDINATOR) throw new Refused('MAIN_IS_COORDINATOR', 'the main checkout is the coordinator; join from a worktree: git worktree add ../<dir>');
const route = values.route ?? 'strong';
const model = requiredModel(values.model, process.env, `join ${shellWord(COORDINATOR)}${values.route ? ` --route ${shellWord(values.route)}` : ''}${values.family ? ` --family ${shellWord(values.family)}` : ''}`);
if (relayLinked(ctx.info.root)) refuseRemoteCoordinatorModel(ctx, 'join coordinator');
const id = await withBoard(ctx, async (board) => await ordered(ctx, board, 'register', [
- { lane: COORDINATOR, path: ctx.info.root, route, family: values.family, model },
+ { lane: COORDINATOR, path: ctx.info.root, route, family: values.family, model, parent, session },
]));
const displayName = displayAgentName({ agent_id: id, agent_model: model }, ctx.config.agents.names);
io.result?.({ agent: id, lane: COORDINATOR, route, path: ctx.info.root, model, displayName });
@@ -45,7 +48,7 @@ export async function run(io, { first, values }) {
}
const route = values.route ?? 'strong';
const model = requiredModel(values.model, process.env, `join ${shellWord(first)}${values.route ? ` --route ${shellWord(values.route)}` : ''}${values.family ? ` --family ${shellWord(values.family)}` : ''}`);
- const id = await withBoard(ctx, async (board) => await ordered(ctx, board, 'register', [{ lane: first, path: ctx.info.root, route, family: values.family, model }]));
+ const id = await withBoard(ctx, async (board) => await ordered(ctx, board, 'register', [{ lane: first, path: ctx.info.root, route, family: values.family, model, parent, session }]));
const displayName = displayAgentName({ agent_id: id, agent_model: model }, ctx.config.agents.names);
io.result?.({ agent: id, lane: first, route, path: ctx.info.root, model, displayName });
io.say(`joined as ${displayName} in the ${first} lane${route === 'light' ? ', on the light route' : ''}`);
diff --git a/src/commands/queue.js b/src/commands/queue.js
index cf5e8577..e82131ad 100644
--- a/src/commands/queue.js
+++ b/src/commands/queue.js
@@ -1,3 +1,4 @@
+import { agentAt } from '../seats.js';
/** The pullboard queue command, in its own module so an item adding another command never edits these lines. */
import * as queueView from '../queue.js';
import {
@@ -7,5 +8,7 @@ import {
/** Run `pullboard queue` and return its exit code. */
export function run(io, { first, second, rest }) {
- return queueView.queueCommand(io, [first, second, ...rest], (work) => withBoard(context(io), work));
+ const ctx = context(io);
+ return queueView.queueCommand(io, [first, second, ...rest], (work) => withBoard(ctx, work),
+ board => agentAt(board, ctx.info.root)?.agent_id ?? null);
}
diff --git a/src/help.js b/src/help.js
index 629142c7..dc8e42c2 100644
--- a/src/help.js
+++ b/src/help.js
@@ -13,7 +13,7 @@ Set up
pullboard init [--model <name>] [--blueprint <name or file>]... [--no-permissions] [--yes] [--verbose] short setup summary; --verbose shows recipes; --yes commits only setup's own files with your Git identity
pullboard worktree <lane> --model <name> [--route light] [--family <name>] make and join a worktree for a new agent
pullboard.json worktrees: inside or beside; init defaults to inside
- pullboard join <lane> --model <name> [--route light] [--family <name>] register this worktree as an agent
+ pullboard join <lane> --model <name> [--route light] [--family <name>] [--parent <session-id>] register this worktree and its parent session
A model is required (or set PULLBOARD_MODEL); family is a separate declaration
pullboard join coordinator --model <name> declare the main checkout's coordinator model
pullboard.json agents.names: suffix (default) or prefix
diff --git a/src/item-authors.js b/src/item-authors.js
index 59ae9b73..217bfeb1 100644
--- a/src/item-authors.js
+++ b/src/item-authors.js
@@ -2,6 +2,8 @@
import { ENGINE_VERSION } from './machine.js';
import { HISTORICAL_AUTHORS_ENGINE } from './historical-authors-engine.js';
import { Refused } from './refused.js';
+import { PARENT_SESSION_ENGINE } from './parent-session-engine.js';
+import { effectiveAgentParent } from './seats.js';
import { standingProblem } from './seats.js';
/** Read one item's indexed author history; older ordered moves retain their original current-builder rule. */
@@ -18,6 +20,12 @@ export function itemAuthors(board, item) {
export function itemAuthorProblem(board, item, reviewer) {
const authors = itemAuthors(board, item);
if (authors.includes(reviewer)) return new Refused('SELF_VERIFY', 'the builder never verifies its own work; another agent must');
+ if ((board.executionEngineVersion ?? ENGINE_VERSION) >= PARENT_SESSION_ENGINE) {
+ const parent = effectiveAgentParent(board, reviewer);
+ if (authors.some(author => effectiveAgentParent(board, author) === parent)) {
+ return new Refused('SELF_SESSION_VERIFY', `this seat shares a parent session with an author of #${item.item_id}; ask a seat under another parent session to verify it`);
+ }
+ }
return (authors.length ? authors : [item.item_built_by])
.map(author => standingProblem(board, reviewer, author, item.item_id)).find(Boolean) ?? null;
}
diff --git a/src/parent-session-engine.js b/src/parent-session-engine.js
new file mode 100644
index 00000000..6fe5d247
--- /dev/null
+++ b/src/parent-session-engine.js
@@ -0,0 +1,2 @@
+/** Parent sessions preserve review independence across sibling seats [V1,B3]. */
+export const PARENT_SESSION_ENGINE = 90;
diff --git a/src/parent-session.js b/src/parent-session.js
new file mode 100644
index 00000000..d549fc0a
--- /dev/null
+++ b/src/parent-session.js
@@ -0,0 +1,58 @@
+/** Stable parent identities recorded at join, from an explicit declaration or this runtime's own session metadata [V1,B3]. */
+import { closeSync, openSync, readSync, readdirSync } from 'node:fs';
+import { homedir } from 'node:os';
+import { join } from 'node:path';
+import { Refused } from './refused.js';
+
+/** Accept an opaque identity, never a path, whitespace, credential or arbitrary session metadata. */
+export function parentIdentity(value) {
+ if (typeof value !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u.test(value)) {
+ throw new Refused('BAD_PARENT', 'a parent session is a stable id of at most 128 letters, numbers, dots, colons, underscores or hyphens; join again with --parent <session-id>');
+ }
+ return value;
+}
+
+/** Read only the bounded first record; conversation history and other sessions' contents are never opened. */
+function ownSessionMetadata(file, session) {
+ let descriptor;
+ try {
+ descriptor = openSync(file, 'r');
+ const buffer = Buffer.alloc(256 * 1024);
+ const count = readSync(descriptor, buffer, 0, buffer.length, 0);
+ const text = buffer.subarray(0, count).toString('utf8');
+ const end = text.indexOf('\n');
+ if (end < 0) return null;
+ const record = JSON.parse(text.slice(0, end));
+ if (record.type !== 'session_meta' || ![record.payload?.id, record.payload?.session_id].includes(session)) return null;
+ return record.payload;
+ } catch { return null; }
+ finally { if (descriptor !== undefined) closeSync(descriptor); }
+}
+
+/** Discover only the invoking Codex session's metadata file, matching its runtime id before reading it. */
+export function runtimeSessionIdentity(environment = process.env, home = homedir()) {
+ const session = environment.CODEX_THREAD_ID || environment.CODEX_SESSION_ID;
+ if (!session || !/^[A-Za-z0-9-]+$/u.test(session)) return null;
+ const sessions = join(environment.CODEX_HOME || join(home, '.codex'), 'sessions');
+ let entries;
+ try { entries = readdirSync(sessions, { recursive: true, withFileTypes: true }); }
+ catch { return null; }
+ for (const entry of entries) {
+ if (!entry.isFile() || !entry.name.endsWith(`-${session}.jsonl`)) continue;
+ const metadata = ownSessionMetadata(join(entry.parentPath, entry.name), session);
+ if (!metadata) continue;
+ try { return { session: parentIdentity(session), parent: metadata.parent_thread_id ? parentIdentity(metadata.parent_thread_id) : null }; }
+ catch { /* An invalid runtime record cannot declare another identity. */ }
+ }
+ return null;
+}
+
+/** Read this runtime's parent, keeping a primary session's missing parent visible as unknown. */
+export function runtimeParentSession(environment = process.env, home = homedir()) {
+ return runtimeSessionIdentity(environment, home)?.parent ?? null;
+}
+
+/** An explicit declaration and the runtime record use exactly the same canonical identity. */
+export function joinParentSession(declared, environment = process.env) {
+ return declared === undefined ? runtimeParentSession(environment) : parentIdentity(declared);
+}
diff --git a/src/queue.js b/src/queue.js
index b7a0c0cf..41541f35 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -5,6 +5,7 @@
* get from next now. The order is the board's own buildOrder, never a second copy, so the queue and
* next cannot disagree. It is for agents and coordinators; the person reads the Roadmap instead.
*/
+import { itemAuthorProblem } from './item-authors.js';
import { Refused } from './refused.js';
import {
buildOrder,
@@ -53,11 +54,11 @@ function waitsOf(board, item) {
* @param {any} board
* @returns {{ releases: { name: string, landed: number, total: number, items: any[] }[], unreleased: any[], first: Record<string, number | null> }}
*/
-export function workQueue(board) {
+export function workQueue(board, reviewer = null) {
const now = board.clock.now().getTime();
const release = milestonePriorities(board);
const planned = roadmap(board, (reference) => ({ id: reference, title: reference, status: 'unavailable' }));
- const items = listItems(board).sort(buildOrder(board));
+ const items = listItems(board).filter(item => !reviewer || item.item_status !== 'submitted' || !itemAuthorProblem(board, item, reviewer)).sort(buildOrder(board));
const entry = (item) => ({ id: item.item_id, title: item.item_title, route: item.item_route, lane: item.item_lane,
status: item.item_status, holder: holderOf(item, now), waits: waitsOf(board, item) });
const releases = planned.map((milestone, index) => ({ name: milestone.name, landed: milestone.landed, total: milestone.total, shipped: Boolean(milestone.shipped),
@@ -101,9 +102,9 @@ export function sayQueue(io, queue) {
* @param {(work: (board: any) => any) => any} read - opens the board for one read
* @returns {number}
*/
-export function queueCommand(io, words, read) {
+export function queueCommand(io, words, read, reviewer = () => null) {
if (words.some((word) => word !== undefined)) throw new Refused('USAGE', 'pullboard queue takes no arguments');
- const queue = read((board) => workQueue(board));
+ const queue = read((board) => workQueue(board, reviewer(board)));
io.result?.(queue);
sayQueue(io, queue);
return 0;
diff --git a/src/seats.js b/src/seats.js
index ddf2a693..5556c669 100644
--- a/src/seats.js
+++ b/src/seats.js
@@ -38,7 +38,7 @@ export function agentModel(board, id) {
/** Attach an agent's model to a row from the legacy stable agent table. */
export function withModel(board, agent) {
- return agent ? { ...agent, agent_model: agentModel(board, agent.agent_id) } : agent;
+ return agent ? { ...agent, agent_model: agentModel(board, agent.agent_id), agent_parent_session: agentParent(board, agent.agent_id) } : agent;
}
/** Save or clear a model label without changing the shared SQLite schema. */
@@ -59,7 +59,7 @@ export function saveAgentModel(board, id, model) {
*/
export function listAgents(board) {
return board.db.prepare(`SELECT agent.*, board_meta.meta_value AS agent_model FROM agent
- LEFT JOIN board_meta ON board_meta.meta_key='agent_model:' || agent.agent_id ORDER BY agent.rowid`).all().map(agent => ({ ...agent }));
+ LEFT JOIN board_meta ON board_meta.meta_key='agent_model:' || agent.agent_id ORDER BY agent.rowid`).all().map(agent => ({ ...agent, agent_parent_session: agentParent(board, agent.agent_id) }));
}
/**
@@ -226,3 +226,32 @@ export function standingProblem(board, verifier, builder, itemId) {
seat = creator;
}
}
+
+/** Read a seat's immutable parent session digest; unknown parents remain separate seats. */
+export function agentParent(board, id) {
+ return board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key = ?').get(`agent_parent_session:${id}`)?.meta_value ?? null;
+}
+
+/** A root session is its own parent, even while its missing parent is displayed as unknown. */
+export function effectiveAgentParent(board, id) {
+ return agentParent(board, id)
+ ?? board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key = ?').get(`agent_session:${id}`)?.meta_value
+ ?? `seat:${id}`;
+}
+
+/** Persist the joined session independently of its parent, so a root and its children share independence. */
+export function saveAgentSession(board, id, digest) {
+ const key = `agent_session:${id}`;
+ const previous = board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key = ?').get(key)?.meta_value;
+ if (previous && previous !== digest) throw new Refused('PARENT_SESSION_CHANGED', 'this seat already belongs to another session; create a fresh worktree and join there');
+ if (!previous) board.db.prepare('INSERT INTO board_meta (meta_key, meta_value) VALUES (?, ?)').run(key, digest);
+}
+
+/** Persist a parent once, preserving author independence across later joins. */
+export function saveAgentParent(board, id, digest) {
+ const previous = agentParent(board, id);
+ if (previous && previous !== digest) throw new Refused('PARENT_SESSION_CHANGED', 'this seat already belongs to another parent session; create a fresh worktree and join there');
+ const own = board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key = ?').get(`agent_session:${id}`)?.meta_value;
+ if (!previous && own && own !== digest) throw new Refused('PARENT_SESSION_CHANGED', 'this seat already joined as its own parent session; create a fresh worktree to declare another parent');
+ if (!previous) board.db.prepare('INSERT INTO board_meta (meta_key, meta_value) VALUES (?, ?)').run(`agent_parent_session:${id}`, digest);
+}
diff --git a/test/parent-session.test.js b/test/parent-session.test.js
new file mode 100644
index 00000000..0f2223df
--- /dev/null
+++ b/test/parent-session.test.js
@@ -0,0 +1,72 @@
+/** Parent discovery reads the invoking runtime record and preserves unknown identity [V1,B3]. */
+import assert from 'node:assert/strict';
+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { test } from 'node:test';
+import { joinParentSession, runtimeParentSession } from '../src/parent-session.js';
+import * as store from '../src/board.js';
+import { runFixtureGit } from './fixture-child.js';
+import { submitFixture } from './board-submit-fixture.js';
+import { workQueue } from '../src/queue.js';
+import { prepareEngineMove, applyEngineMove } from '../src/engine.js';
+import { exportBoard, importBoard } from '../src/exchange.js';
+import { effectiveAgentParent } from '../src/seats.js';
+
+test('[V1,B3] parent discovery reads only matching own runtime metadata and agrees with --parent', (t) => {
+ const home = mkdtempSync(join(tmpdir(), 'pullboard-parent-'));
+ t.after(() => rmSync(home, { recursive: true, force: true }));
+ const sessions = join(home, 'sessions', '2026', '10', '23');
+ mkdirSync(sessions, { recursive: true });
+ const own = join(sessions, 'rollout-2026-10-23-own-session.jsonl');
+ const environment = { CODEX_HOME: home, CODEX_SESSION_ID: 'own-session' };
+ writeFileSync(own, JSON.stringify({ type: 'session_meta', payload: { id: 'own-session', parent_thread_id: 'root-session' } }) + '\n');
+ writeFileSync(join(sessions, 'rollout-2026-10-23-other-session.jsonl'), '{foreign unreadable metadata');
+ assert.equal(runtimeParentSession(environment), 'root-session');
+ assert.equal(joinParentSession(undefined, environment), joinParentSession('root-session', {}));
+ writeFileSync(own, JSON.stringify({ type: 'session_meta', payload: { id: 'other-session', parent_thread_id: 'foreign-parent' } }) + '\n');
+ assert.equal(runtimeParentSession(environment), null, 'a filename alone cannot authenticate another session record');
+ assert.equal(joinParentSession(undefined, {}), null, 'missing runtime metadata remains unknown');
+ assert.throws(() => joinParentSession('/private/session.jsonl'), { code: 'BAD_PARENT' });
+});
+
+test('[V1,B3] ordered parent registration survives replay and board export without local session records', (t) => {
+ const root = mkdtempSync(join(tmpdir(), 'pullboard-parent-replay-'));
+ t.after(() => rmSync(root, { recursive: true, force: true }));
+ const boards = ['source', 'replica', 'imported'].map(name => store.openBoard(join(root, `${name}.sqlite`)));
+ t.after(() => boards.forEach(board => store.closeBoard(board)));
+ const [source, replica, imported] = boards;
+ const move = prepareEngineMove(source, 'register', [{ lane: 'web', path: '/fixture/child', parent: 'parent-P', session: 'child-C' }]);
+ const receipt = applyEngineMove(replica, move, { sequence: 1, at: '2026-10-23T12:00:00.000Z' });
+ assert.equal(receipt.error, undefined);
+ const registered = store.agentAt(replica, '/fixture/child');
+ assert.match(registered.agent_parent_session, /^[a-f0-9]{64}$/u);
+ importBoard(imported, exportBoard(replica));
+ assert.equal(effectiveAgentParent(imported, registered.agent_id), registered.agent_parent_session);
+ const legacy = { ...move, id: 'historical-parent-registration', engine: 80,
+ args: [{ lane: 'web', path: '/fixture/legacy', parent: 'parent-P', session: 'legacy-C' }] };
+ applyEngineMove(replica, legacy, { sequence: 2, at: '2026-10-23T12:01:00.000Z' });
+ assert.equal(store.agentAt(replica, '/fixture/legacy').agent_parent_session, null, 'historical moves never invent parent metadata');
+});
+
+test('[V1,B3] an unknown-parent primary session and its child cannot review each other, including queue', (t) => {
+ const root = mkdtempSync(join(tmpdir(), 'pullboard-primary-parent-'));
+ t.after(() => rmSync(root, { recursive: true, force: true }));
+ runFixtureGit(['init', '-q'], { cwd: root });
+ const board = store.openBoard(join(root, '.git', 'board.sqlite'));
+ t.after(() => store.closeBoard(board));
+ const primary = store.register(board, { lane: 'web', path: root, session: 'primary-R' });
+ const child = store.register(board, { lane: 'web', path: join(root, 'child'), parent: 'primary-R', session: 'child-C' });
+ const outside = store.register(board, { lane: 'review', path: join(root, 'outside'), parent: 'outside-Q' });
+ assert.equal(store.agentById(board, primary).agent_parent_session, null, 'the primary parent is visibly unknown');
+ for (const [author, reviewer] of [[primary, child], [child, primary]]) {
+ const id = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Root and child independence', criterion: 'Independent review', check: 'true' });
+ store.claim(board, id, { agentId: author, lane: 'web', leaseMs: 3600000, freeze: () => ({ text: 'criterion', digest: 'a'.repeat(64) }) });
+ submitFixture(board, id, { agentId: author, commit: String(id).padStart(40, 'a'), tree: String(id).padStart(40, 'b') });
+ assert.equal(store.nextFor(board, { agentId: reviewer, lane: 'web', verify: true }).item, null);
+ assert.throws(() => store.verify(board, id, { agentId: reviewer, decision: 'ACCEPT', policy: 'any' }), { code: 'SELF_SESSION_VERIFY' });
+ assert.equal(workQueue(board, reviewer).unreleased.some(item => item.id === id), false);
+ assert.equal(workQueue(board, outside).unreleased.some(item => item.id === id), true);
+ }
+ assert.throws(() => store.register(board, { lane: 'web', path: join(root, 'child'), parent: 'changed-parent' }), { code: 'PARENT_SESSION_CHANGED' });
+});