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(view): a review in progress names its reviewer [N26]

Corey Olson7398963dd39f
diff --git a/src/cockpit.js b/src/cockpit.js
index 0649971a..02ad3703 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -590,7 +590,7 @@ function render() {
const needs = [
...p.spec.filter((r) => r.status === 'pending').map((r) => ['spec:' + r.id, r.id, r.text, 'answer in SPEC.md']),
...by('back').map((i) => ['item:' + i.id, '#' + i.id, i.title, 'sent back: ' + i.verdict.reason]),
- ...by('verify').map((i) => ['item:' + i.id, '#' + i.id, i.title, (rejected(i) ? 'resubmitted after ' + i.verdict.reason : 'to verify'), i.updatedAt]),
+ ...by('verify').map((i) => ['item:' + i.id, '#' + i.id, i.title, (i.reviewer ? 'being reviewed by ' + i.reviewer : rejected(i) ? 'resubmitted after ' + i.verdict.reason : 'to verify'), i.updatedAt]),
...p.holds.map((h) => ['tab:shouts', h.hold_lane, h.hold_reason, 'lane held']),
];
const drafts = p.spec.filter((r) => r.status === 'draft').length;
@@ -630,6 +630,7 @@ function render() {
const gated = waits.length > 0 || !!hold;
const pills = (waits.length ? '<span class="gate">waits on ' + waits.map((id) => '<button class="ref" data-go="item:' + id + '" type="button">#' + id + '</button>').join(', ') + '</span>' : '') + (hold ? '<span class="gate">lane held: ' + esc(hold.hold_reason) + '</span>' : '');
const tag = s === 'building' && i.owner ? '<span class="chip busy" title="building, held by ' + esc(i.owner) + '">' + esc(i.owner) + '</span>'
+ : s === 'verify' && i.reviewer ? '<span class="chip warn" title="reviewing until ' + esc(when(i.reviewUntil)) + '">' + esc(i.reviewer) + ' reviewing</span>'
: s === 'open' ? (gated ? '<span class="chip gate">' + (waits.length ? 'gated' : 'lane held') + '</span>' : '<span class="chip free">unclaimed</span>') : chip(s);
return '<li class="row' + (view.item === i.id ? ' on' : '') + (gated ? ' gated' : '') + '" data-item="' + i.id + '"><span class="dot ' + s + '"></span><div><div class="t"><span>#' + i.id + '</span>' + esc(i.title) + '</div><div class="meta"><span>' + esc(i.lane) + '</span>' + (i.specs.length ? '<span>' + esc(i.specs.join(', ')) + '</span>' : '') + (who ? '<span>' + esc(who) + '</span>' : '') + pills + '<span>' + age(i.updatedAt) + '</span>' + (rejected(i) ? '<span class="why">' + esc(i.verdict.reason + ': ' + firstLine(i.verdict.note)) + '</span>' : '') + '</div></div>' + tag + '</li>';
}).join('') : '<li class="empty">' + (items.length ? 'No items match.' : 'No items yet. Add the first one with New item.') + '</li>';
@@ -670,12 +671,13 @@ function render() {
$('shout-targets').innerHTML = ['all', ...lanes, ...p.agents.map((a) => a.agent_id)].map((t) => '<option value="' + esc(t) + '">').join('');
// Each agent with what it holds: its claim, then its work sent back, then its work waiting for a
// verdict. The worktree path is there on hover; what the person reads is who is doing what.
- const order = ['building', 'back', 'verify'];
- const holding = (a) => items.filter((i) => i.status === 'claimed' ? i.owner === a.agent_id : i.builtBy === a.agent_id && order.includes(stateOf(i))).sort((x, y) => order.indexOf(stateOf(x)) - order.indexOf(stateOf(y)));
+ // A review an agent holds (V15) comes right after its claim.
+ const rank = (a, i) => i.status === 'claimed' ? 0 : i.reviewer === a.agent_id ? 1 : stateOf(i) === 'back' ? 2 : 3;
+ const holding = (a) => items.filter((i) => i.status === 'claimed' ? i.owner === a.agent_id : i.reviewer === a.agent_id || (i.builtBy === a.agent_id && ['back', 'verify'].includes(stateOf(i)))).sort((x, y) => rank(a, x) - rank(a, y));
$('agents').innerHTML = p.agents.length ? p.agents.map((a) => {
const mine = holding(a);
return '<div class="agent"><div><b title="' + esc(a.agent_path) + '">' + esc(a.agent_id) + '</b><span class="muted">' + esc(a.agent_lane) + ' · ' + esc(a.agent_route) + '</span>' + (a.lastMoveAt ? '<time data-ago="' + esc(a.lastMoveAt) + '" title="last moved ' + when(a.lastMoveAt) + '">' + ago(a.lastMoveAt) + '</time>' : '') + '</div>'
- + (mine.length ? mine.map((i) => '<button data-go="item:' + i.id + '" type="button"><span>#' + i.id + ' ' + esc(i.title) + '</span>' + chip(stateOf(i)) + '</button>').join('') : '<small>idle</small>') + '</div>';
+ + (mine.length ? mine.map((i) => '<button data-go="item:' + i.id + '" type="button"><span>#' + i.id + ' ' + esc(i.title) + '</span>' + (i.reviewer === a.agent_id ? '<span class="chip warn">reviewing</span>' : chip(stateOf(i))) + '</button>').join('') : '<small>idle</small>') + '</div>';
}).join('') : '<div class="empty">No agents yet.</div>';
const held = new Map(p.holds.map((h) => [h.hold_lane, h]));
$('lanes').innerHTML = working.map((l) => '<div class="lane"><span><b>' + esc(l) + '</b> ' + (held.has(l) ? '<span class="chip no">held</span> <span class="muted">' + esc(held.get(l).hold_reason) + '</span>' : '<span class="chip ok">open</span>') + '</span>' + (held.has(l) ? '<button class="ghost" data-release="' + esc(l) + '" type="button">Release</button>' : '') + '</div>').join('');
diff --git a/src/serve.js b/src/serve.js
index 4a0dcadf..1d557942 100644
--- a/src/serve.js
+++ b/src/serve.js
@@ -100,6 +100,9 @@ export function projectState(root) {
status: item.item_status,
route: item.item_route,
owner: item.item_owner,
+ // Who holds the review under a live lease (V15), by the board's own rule.
+ reviewer: store.reviewHolder(board, item),
+ reviewUntil: item.item_review_until ?? null,
builtBy: item.item_built_by,
verifiedBy: item.item_verified_by,
specs: item.item_spec_ids ? item.item_spec_ids.split(',') : [],
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index dbe8502f..70d41dc6 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -541,6 +541,38 @@ test('the agents panel says what each agent holds [N26]', async () => {
}
});
+test('a review in progress names its reviewer [N26]', async () => {
+ const box = machine();
+ const alpha = project(box, 'alpha');
+ const second = join(box.dir, 'alpha-web-two');
+ box.git(alpha.repo, 'worktree', 'add', '-q', second, '-b', 'web/two');
+ box.run(second, 'join', 'web');
+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');
+ build(box, alpha, 1, 'greeting.html');
+ box.run(second, 'next', '--verify');
+ const view = await startView(box);
+ try {
+ const page = await openPage(view);
+ assert.match(itemRow(page.show('chain'), 1), /<span class="chip warn" title="reviewing until [^"]+">web-2 reviewing<\/span><\/li>$/, 'the row names who holds the review');
+ assert.match(page.show('needs'), /<code>#1<\/code><span>Greeting<\/span><em>being reviewed by web-2, <time data-ago="[^"]+">[^<]+<\/time> →<\/em>/);
+ const holds = (id) => agentEntries(page.show('agents')).find((agent) => agent.id === id).holds;
+ assert.deepEqual(holds('web-2'), ['#1 Greeting: reviewing'], 'the reviewer holds it');
+ assert.deepEqual(holds('web-1'), ['#1 Greeting: to verify'], 'the builder waits on it');
+ // A name is board text, so it is escaped: give the board on hand a reviewer with markup and redraw.
+ page.run('data.project.items.find((i) => i.id === 1).reviewer = "web<b>"; render();');
+ assert.match(itemRow(page.show('chain'), 1), />web&lt;b&gt; reviewing<\/span><\/li>$/);
+ await page.run('refresh()');
+
+ box.git(second, 'switch', '-q', '--detach', alpha.branch);
+ box.run(second, 'verify', '1', 'accept', '--note', 'opened the page and read the greeting');
+ await page.run('refresh()');
+ await page.click({ state: 'all' });
+ assert.match(itemRow(page.show('chain'), 1), /<span class="chip ok">verified<\/span><\/li>$/, 'once the verdict lands, the review is over');
+ assert.deepEqual(holds('web-2'), []);
+ } finally {
+ await view.stop();
+ }
+});
test('the tab title says what needs you [N26]', async () => {
const box = machine();
const alpha = project(box, 'alpha');