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(next): a seat is only told it holds its own claim [N2,B13]
Corey Olsonc7479d066637
diff --git a/src/cli.js b/src/cli.jsindex 6eac9c86..71a2ef16 100644--- a/src/cli.js+++ b/src/cli.js@@ -3205,11 +3205,11 @@ async function nextOnce(ctx, values) {if (values.verify) return nextReview(ctx, board, me, values, { ordered: (operation, args) => ordered(ctx, board, operation, args), idArg, trunkMerge });const warm = warmFiles(ctx, board, me);const seats = nextSessionSeats(ctx, board);- const owners = new Set(seats?.map((seat) => seat.agent_id));- const heldItems = seats ? store.listItems(board).filter((item) => item.item_status === 'claimed'- && item.item_parent_id === null && owners.has(item.item_owner)- && store.ROUTES.indexOf(item.item_route) <= store.ROUTES.indexOf(me.route)) : [];- const heldItem = heldItems.find((item) => item.item_owner === me.id) ?? heldItems[0];+ // A claim belongs to the seat that made it: seats of one session share its environment, so a sibling's claim is+ // never this seat's to resume or be pointed at (#958).+ const heldItem = seats ? store.listItems(board).find((item) => item.item_status === 'claimed'+ && item.item_parent_id === null && item.item_owner === me.id+ && store.ROUTES.indexOf(item.item_route) <= store.ROUTES.indexOf(me.route)) : undefined;const { item, reasons, shared } = heldItem ? { item: heldItem, reasons: [], shared: [] }: store.nextFor(board, { agentId: me.id, lane: me.lane, runnable: values.runnable, routes: values.routes, warm,...(seats ? { lanes: laneNames(ctx.config).filter((lane) => lane !== COORDINATOR) } : {}),diff --git a/test/next-order.test.js b/test/next-order.test.jsindex 1306fe99..a62acbad 100644--- a/test/next-order.test.js+++ b/test/next-order.test.js@@ -226,16 +226,38 @@ test('an agent pulls the top item in any of its lanes [N2,B13]', (t) => {assert.equal(next.review, false);assert.equal(next.held, false);assert.deepEqual(box.binding(peer.root), peerBinding, 'another session’s seat is never borrowed or rebound');- const resumed = box.json(box.runAs(box.session, box.web, 'next', '--build', '--json'));- assert.equal(resumed.item.item_id, first, 'next resumes the claim in its named seat rather than starting a second item');+ const resumed = box.json(box.runAs(box.session, api.root, 'next', '--build', '--json'));+ assert.equal(resumed.item.item_id, first, 'next resumes the claim in the seat that holds it rather than starting a second item');assert.equal(resumed.held, true);assert.equal(resumed.seat.agent, api.agent);+ const sibling = box.json(box.runAs(box.session, box.web, 'next', '--build', '--json'));+ assert.equal(sibling.held, false, 'a sibling seat answers from its own claims, not the api seat\'s (#958)');+ assert.notEqual(sibling.item.item_id, first);const wrongLane = box.runAs(box.session, api.root, 'claim', String(later), '--json');assert.equal(wrongLane.code, 1);assert.equal(JSON.parse(wrongLane.out).error.code, 'WRONG_LANE', 'cross-lane routing does not widen a seat’s write authority');assert.notEqual(web.agent, api.agent);});+test('a seat that holds nothing is never told it holds another seat\'s claim [N2,B13]', (t) => {+ const box = crossLaneFixture(t);+ const holder = box.seat('claim-holder', 'web', box.session);+ const idle = box.seat('claim-idle', 'web', box.session);+ const bystander = box.seat('claim-bystander', 'api', box.session);+ const held = box.add('web', 'Held by the first seat');+ box.json(box.runAs(box.session, holder.root, 'claim', String(held), '--json'));+ for (const seat of [idle, bystander]) {+ const next = box.runAs(box.session, seat.root, 'next', '--build', '--json');+ const text = `${next.out}\n${next.err}`;+ assert.doesNotMatch(text, /you hold #/u, `${seat.agent} is never told it holds the claim of ${holder.agent}`);+ assert.equal(text.includes(holder.root), false, `${seat.agent} is never sent to ${holder.agent}'s checkout`);+ if (next.code === 0) assert.notEqual(JSON.parse(next.out).item.item_id, held, 'the held item is not offered again');+ }+ const own = box.json(box.runAs(box.session, holder.root, 'next', '--build', '--json'));+ assert.equal(own.item.item_id, held, 'the holding seat is still told it holds its item');+ assert.equal(own.held, true);+});+test('next names the seat to open for a lane the agent lacks [N2,B13]', (t) => {const box = crossLaneFixture(t);const web = box.seat('owned-mid-web', 'web', box.session, 'mid');