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
chore(merge): include accepted scrollbar fix [N26,H2,H9]
Corey Olson6dda3e71d456
diff --cc test/cockpit.test.jsindex bef14955,109ef605..d383b191--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@@ -7775,161 -7773,104 +7775,263 @@@ test('search in the top bar finds anyth}});+ test('shout cards fit beside a classic scrollbar [N26]', { timeout: 120_000 }, async () => {+ assert.ok(chromeExecutable(), 'this scrollbar regression proof requires actual Chrome');+ const box = machine();+ const alpha = project(box, 'cards');+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');+ box.run(alpha.repo, 'add', 'web', 'Farewell', '--specs', 'G1', '--criterion', 'says goodbye');+ box.run(alpha.web, 'claim', '1');+ const second = join(box.dir, 'cards-web-2');+ box.git(alpha.repo, 'worktree', 'add', '-q', second, '-b', 'web/cards2');+ box.run(second, 'join', 'web');+ // A committed page at a path too long for a phone, for a code reference to name.+ const deep = 'docs/a/very/long/path/that/keeps/going/past/a/phone/screen.md';+ mkdirSync(join(alpha.repo, deep, '..'), { recursive: true });+ writeFileSync(join(alpha.repo, deep), 'Deep line one\n');+ box.git(alpha.repo, 'add', deep);+ box.git(alpha.repo, 'commit', '-q', '-m', 'docs: a deep page');+ const head = box.git(alpha.repo, 'rev-parse', 'HEAD');+ const sha = '0123456789abcdef0123456789abcdef01234567';+ const lines = (first, n) => [first, ...Array.from({ length: n - 1 }, (_, k) => `Line ${k + 2} of the note.`)].join('\n');+ const older = 'Started on #1 two days back.';+ const colour = lines('Which colour for the button? #99 is no item.', 8);+ const ship = 'Ship #1 today?';+ const chips = `See #1 in src/cockpit.js at ${sha}; run pullboard check --json, then \`npm test\`.`;+ const long = lines('A long note that folds.', 12);+ const mixed = 'Moved #2 along.';+ const longCommand = 'node bin/run-tests.js test/relay-person-requests.test.js', longPath = 'test/relay-person-requests.test.js';+ const longerPath = 'docs/a/very/long/path/that/keeps/going/well/past/any/phone/screen/width.md';+ const longChips = `Ran \`${longCommand}\` on ${longPath} and ${longerPath} today.`;+ const sourceRefs = [`SPEC.md:1-2@${head}`, `${deep}:1@${head}`];+ const refsShout = `Check ${sourceRefs[0]} and ${sourceRefs[1]} before you merge.`;+ const blockShout = `Evidence for the page:\n${sourceRefs[0]}`;+ const twoDays = new Date(); twoDays.setDate(twoDays.getDate() - 2); twoDays.setHours(12, 0, 0, 0);+ earlier(alpha.repo, twoDays, (board) => shoutOnBoard(board, { from: 'web-1', to: 'coordinator', text: older, lanes: ['web'] }));+ earlier(alpha.repo, Date.now() - 65 * 60e3, (board) => shoutOnBoard(board, { from: 'web-2', to: 'coordinator', text: colour, decision: true, lanes: ['web'] }));+ earlier(alpha.repo, Date.now() - 125e3, (board) => shoutOnBoard(board, { from: 'web-1', to: 'coordinator', text: ship, decision: true, lanes: ['web'] }));+ const asked = JSON.parse(box.run(alpha.repo, 'decisions', '--json')).decisions.find((d) => d.shout_text === ship);+ box.run(alpha.repo, 'answer', String(asked.shout_id), 'Yes, ship it.');+ box.run(alpha.web, 'shout', 'all', 'the page loads in 80ms', '--evidence', 'receipt', '--outcome', 'measured 80ms', '--item', '1', '--commit', head);+ box.run(alpha.web, 'shout', 'all', chips);+ box.run(alpha.web, 'shout', 'all', mixed, '--evidence', 'receipt', '--outcome', 'moved', '--item', '1', '--commit', head);+ box.run(alpha.web, 'shout', 'all', longChips);+ box.run(alpha.web, 'shout', 'all', refsShout);+ box.run(alpha.web, 'shout', 'all', blockShout);+ box.run(alpha.repo, 'shout', 'person', 'Launch on Friday?', '--decision');+ box.run(alpha.web, 'shout', 'all', long);+++ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-classic-scrollbar-'));+ let chrome;+ try {+ chrome = await openSnapshotChrome(chromeExecutable(), view.link.href, profile);+ await chrome.waitFor('typeof data !== "undefined" && data?.project?.shouts?.length >= 12');+ /** Press a real mouse at an uncovered control after layout settles. */+ const press = async (selector) => {+ const point = await chrome.evaluate(`(async () => {+ const e=document.querySelector(${JSON.stringify(selector)}); e.scrollIntoView({block:'center',behavior:'instant'});+ await new Promise(done=>requestAnimationFrame(()=>requestAnimationFrame(done)));+ const r=e.getBoundingClientRect(),x=r.x+r.width/2,y=r.y+r.height/2,hit=document.elementFromPoint(x,y);+ if(!r.width||!r.height||(hit!==e&&!e.contains(hit)))throw Error('mouse target is hidden or covered');+ return {x,y};+ })()`);+ for (const type of ['mouseMoved','mousePressed','mouseReleased']) await chrome.send('Input.dispatchMouseEvent', {+ type,...point,...(type==='mouseMoved'?{}:{button:'left',clickCount:1}),+ });+ };+ await press('[data-tab="shouts"]');+ await chrome.waitFor('document.querySelector("[data-pane=shouts]:not([hidden]) #feed .shout")');+ if (await chrome.evaluate(`document.querySelector('.asks-toggle[data-fold="waiting"]')?.getAttribute('aria-expanded') === 'false'`)) await press('.asks-toggle[data-fold="waiting"]');+ for (const font of ['monospace', '']) for (const scheme of ['light','dark']) {+ // A portable fallback exercises the wider font metrics used by CI, alongside the native font.+ await chrome.evaluate(`document.documentElement.style.setProperty('--sans', ${JSON.stringify(font)})`);+ await shoutsAt(chrome,375,scheme);+ const gutter=await chrome.evaluate('innerWidth-document.documentElement.clientWidth');+ assert.ok(gutter>=0&&gutter<=30, 'the fixture measures the browser scrollbar before selecting the viewport');+ await shoutsAt(chrome,360+gutter,scheme);+ const metrics=await chrome.evaluate(`(() => {+ const width=document.documentElement.clientWidth;+ const edge=e=>{const r=e.getBoundingClientRect();return {left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.width};};+ const cards=[...document.querySelectorAll('#feed .shout,#decisions .shout')];+ return {width,scroll:document.documentElement.scrollWidth,body:document.body.scrollWidth,+ headers:cards.map(card=>({box:edge(card.querySelector('header')),text:edge(card.querySelector('.text')),age:{...edge(card.querySelector('time')),whole:card.querySelector('time').scrollWidth<=card.querySelector('time').clientWidth},children:[...card.querySelector('header').children].map(e=>({kind:e.className||e.tagName,...edge(e)}))})),+ models:[...document.querySelectorAll('#feed .agent-model')].map(e=>e.textContent),+ ids:cards.flatMap(card=>[...card.querySelectorAll('.agent-id')].map(id=>({id:edge(id),card:edge(card)}))),+ over:cards.flatMap(card=>[...card.querySelectorAll('header,header>*')].filter(e=>edge(e).right>width).map(e=>({kind:e.className||e.tagName,...edge(e)})))};+ })()`);+ assert.equal(metrics.width,360, scheme+': actual page content is 360px, including on classic-scrollbar Chrome');+ assert.ok(metrics.models.some(text=>text.includes('Test Model')), 'the regression fixture includes real API model names');+ assert.ok(metrics.scroll<=metrics.width&&metrics.body<=metrics.width, scheme+': no sideways scroll: '+JSON.stringify({width:metrics.width,scroll:metrics.scroll,body:metrics.body,over:metrics.over}));+ assert.ok(metrics.headers.every(h=>h.children.every(e=>e.left>=h.box.left-1&&e.right<=h.box.right+1)&&h.age.whole&&Math.abs(h.age.right-h.box.right)<=1&&h.age.bottom<=h.text.top+1),+ scheme+': each header fits one line with its complete age at the right: '+JSON.stringify(metrics.headers));+ assert.ok(metrics.ids.length>0&&metrics.ids.every(({id,card})=>id.width>0&&id.left>=card.left&&id.right<=card.right),+ scheme+': every address remains visible inside its card');+ }+ assert.deepEqual(chrome.exceptions, [], 'the real page raises no uncaught exception');+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, {recursive:true,force:true});+ await view.stop();+ }+ });+++test('local agents panel inventories and phone-revokes a scoped credential [H2,H9,H16,B26,N26]', { timeout: 180_000 }, async (t) => {+ assert.ok(chromeExecutable(), 'this security proof requires actual Chrome');+ const box = await relayClientFixture(t);+ const personEnv = { ...box.env };+ for (const key of [...AGENT_SHELL_MARKERS, ...SSH_SHELL_MARKERS]) delete personEnv[key];+ const privateBin = box.env.PATH.split(delimiter)[0];+ /** Quote a private fixture executable path literally for its hook shim. */+ const shellQuote = (value) => "'" + value.replaceAll("'", "'\\''") + "'";+ writeFileSync(join(privateBin, 'pullboard'), '#!/bin/sh\nexec ' + shellQuote(process.execPath) + ' ' + shellQuote(BIN) + ' "$@"\n', { mode: 0o700 });+ execFileSync('git', ['add', '-A'], { cwd: box.root, env: personEnv, stdio: 'pipe' });+ execFileSync('git', ['commit', '-q', '-m', 'test: prepare private credential view'], { cwd: box.root, env: personEnv, stdio: 'pipe' });+ const machineFile = join(box.env.PULLBOARD_HOME, 'relay-machine/state.json');+ const setup = spawn(process.execPath, [BIN, 'relay', 'on', '--all', '--url', box.origin, '--json'], {+ cwd: box.root, env: personEnv, stdio: ['ignore', 'pipe', 'pipe'],+ });+ let setupOutput = '';+ setup.stdout.setEncoding('utf8').on('data', chunk => { setupOutput += chunk; });+ setup.stderr.resume();+ const setupDone = new Promise((resolve, reject) => setup.once('close', (code, signal) => {+ if (signal) return reject(new Error('private foreground pairing was interrupted'));+ try { resolve({ code, document: JSON.parse(setupOutput) }); }+ catch { reject(new Error('private foreground pairing returned no JSON')); }+ }));+ t.after(async () => { if (setup.exitCode === null) setup.kill('SIGTERM'); await setupDone.catch(() => {}); });+ /** Poll persisted private fixture state without retrying an operation. */+ const waitFixture = async (read, message, timeout = 30_000) => {+ const deadline = Date.now() + timeout;+ do { const value = await read(); if (value) return value; await new Promise(resolve => setTimeout(resolve, 25)); } while (Date.now() < deadline);+ assert.fail(message);+ };+ const pending = await waitFixture(() => existsSync(machineFile) && JSON.parse(readFileSync(machineFile, 'utf8')).pending,+ 'foreground pairing publishes the one-use device enrollment');+ const phone = await box.phoneSession();+ const phoneChrome = await startChrome();+ t.after(() => phoneChrome.close());+ const localChrome = await startChrome();+ t.after(() => localChrome.close());+ assert.equal((await phoneChrome.send('Network.setCookie', {+ name: 'pb_session', value: phone.token, url: box.origin, httpOnly: true, sameSite: 'Lax',+ })).success, true);+ await phoneChrome.navigate(`${box.origin}/#device=${pending.locator}.${pending.secret}`);+ assert.equal((await setupDone).code, 0, 'the real phone session pairs the machine');+ await phoneChrome.waitFor("document.querySelector('#phone-approvals') !== null");++ const joined = await box.cli('worktree', box.lane);+ assert.equal(joined.code, 0, joined.failure ?? 'a real agent worktree joins with machine credentials');+ const agentRoot = joined.document.path;+ const agentId = joined.document.agent;+ const other = await box.cli('worktree', box.lane);+ assert.equal(other.code, 0, other.failure ?? 'a second agent receives its own credential');+ const link = JSON.parse(readFileSync(box.linkFile, 'utf8'));+ const oldPA = link.agentTokens[agentId], otherPA = link.agentTokens[other.document.agent];+ assert.match(oldPA.token, /^pa_[A-Za-z0-9_-]{43}$/u);+ const listed = await box.cli('relay', 'tokens');+ assert.equal(listed.code, 0, listed.failure ?? 'the real CLI reads token metadata');+ const expected = listed.document.tokens.find(row => row.agent === agentId);+ assert.ok(expected?.id && expected.created && expected.expires);+ assert.deepEqual(listed.document.tokens.map(row => row.agent).sort(), [agentId, other.document.agent].sort(), 'both independent agent credentials are listed');+ assert.equal(JSON.stringify(listed.document).includes(oldPA.token), false, 'the native inventory contains no PA value');++ const view = await startView({ dir: box.root, env: personEnv });+ try {+ await localChrome.navigate(view.link.href);+ await localChrome.waitFor("typeof data === 'object' && !!data?.project");+ /** Deliver actual mouse input only after layout settles and the target is uncovered. */+ const tap = async (selector) => {+ await localChrome.waitFor(`Boolean(document.querySelector(${JSON.stringify(selector)})?.getBoundingClientRect().width)`);+ const point = JSON.parse(await localChrome.evaluate(`(async () => {+ const find=()=>document.querySelector(${JSON.stringify(selector)}); const e=find();+ e.scrollIntoView({block:'center',inline:'nearest'});+ const frame=()=>new Promise(done=>requestAnimationFrame(()=>done())); let previous='', stable=0;+ for(let i=0;i<120&&stable<2;i++){await frame();const n=find(),r=n?.getBoundingClientRect(),v=r?[r.x,r.y,r.width,r.height,scrollX,scrollY].join():'';stable=v&&v===previous?stable+1:0;previous=v;}+ const n=find(),r=n?.getBoundingClientRect(); if(!n||!r||r.width<=0||r.height<=0)throw Error('control is not laid out');+ const x=r.x+r.width/2,y=r.y+r.height/2,hit=document.elementFromPoint(x,y);+ if(hit!==n&&!n.contains(hit))throw Error('the real mouse point is covered by another control');+ return JSON.stringify({x,y});+ })()`));+ for (const type of ['mouseMoved', 'mousePressed', 'mouseReleased']) await localChrome.send('Input.dispatchMouseEvent', {+ type, ...point, ...(type === 'mouseMoved' ? {} : { button: 'left', clickCount: 1 }),+ });+ };+ await tap('[data-tab="shouts"]');+ for (const scheme of ['light', 'dark']) for (const width of [375, 1280]) {+ await localChrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });+ await localChrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: scheme }] });+ await localChrome.waitFor(`innerWidth === ${width} && matchMedia('(prefers-color-scheme: ${scheme})').matches`);+ if (!await localChrome.evaluate('Boolean(document.querySelector("[data-token-id]"))')) await tap('[data-credentials]');+ for (const metadata of listed.document.tokens) {+ const selector = `[data-token-id="${metadata.id}"]`;+ await localChrome.waitFor(`Boolean(document.querySelector(${JSON.stringify(selector)}))`);+ const row = JSON.parse(await localChrome.evaluate(`JSON.stringify((() => {+ const e=document.querySelector(${JSON.stringify(selector)}),r=e.getBoundingClientRect();+ return {id:e.dataset.tokenId,text:e.innerText,overflow:document.documentElement.scrollWidth>document.documentElement.clientWidth,+ rowOverflow:r.right>document.documentElement.clientWidth};+ })())`));+ assert.equal(row.id, metadata.id);+ for (const value of [metadata.id, metadata.agent, new Date(metadata.created).toISOString(), new Date(metadata.expires).toISOString()]) {+ assert.ok(row.text.includes(value), `${width}/${scheme}: the row shows token id, agent and ISO creation/expiry`);+ }+ assert.equal(row.text.includes(oldPA.token), false, 'the credential value never enters the DOM');+ for (const secret of [oldPA.token, otherPA.token, link.token, phone.token, readFileSync(box.keyFile, 'utf8').trim()]) {+ assert.equal(await localChrome.evaluate(`document.documentElement.outerHTML.includes(${JSON.stringify(secret)}) || JSON.stringify(data).includes(${JSON.stringify(secret)}) || JSON.stringify([...credentials]).includes(${JSON.stringify(secret)})`), false,+ 'the local page, projected board and inventory retain no credential value or board key');+ }+ assert.equal(await localChrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).querySelector('[data-revoke-token]').getBoundingClientRect().height >= 44`), true,+ `${width}/${scheme}: revocation has a full touch target`);++ assert.equal(row.overflow || row.rowOverflow, false, `${width}/${scheme}: the inventory stays within the viewport`);+ }+ }++ const authorizationsBefore = box.calls.filter(call => call.path.endsWith('/authorize')).length;+ await tap(`[data-revoke-token="${expected.id}"]`);+ await localChrome.waitFor("document.querySelector('#credentials [role=status]')?.textContent.includes('Approve revocation on your phone…')");+ assert.equal(box.calls.filter(call => call.path.endsWith('/authorize')).length, authorizationsBefore,+ 'the local button waits for a person and has not silently authorized revocation');++ // A separate paired-phone browser completes the actual pending native grant with real mouse input.+ const encodedKey = readFileSync(box.keyFile, 'utf8').trim();+ const board = JSON.parse(readFileSync(box.linkFile, 'utf8')).board;+ await phoneChrome.navigate(`${box.origin}/#board=${board}&key=${encodedKey}`);+ await phoneChrome.waitFor("document.querySelector('#phone-approvals') !== null");+ await phoneChrome.waitFor(` [...document.querySelectorAll('.phone-approval')].some(node => node.textContent.includes(${JSON.stringify(expected.id)}))`);+ const approvalPoint = JSON.parse(await phoneChrome.evaluate(`(() => {+ const card=[...document.querySelectorAll('.phone-approval')].find(node=>node.textContent.includes(${JSON.stringify(expected.id)}));+ const button=card?.querySelector('button'); button?.scrollIntoView({block:'center',behavior:'instant'});+ const r=button?.getBoundingClientRect(); if(!r||r.width<=0||r.height<=0)throw Error('approval button is not visible');+ const x=r.x+r.width/2,y=r.y+r.height/2,hit=document.elementFromPoint(x,y);+ if(hit!==button&&!button.contains(hit))throw Error('approval mouse point is covered'); return JSON.stringify({x,y});+ })()`));+ for (const type of ['mouseMoved', 'mousePressed', 'mouseReleased']) await phoneChrome.send('Input.dispatchMouseEvent', {+ type, ...approvalPoint, ...(type === 'mouseMoved' ? {} : { button: 'left', clickCount: 1 }),+ });+ await localChrome.waitFor("document.querySelector('#credentials [role=status]')?.textContent.includes('Credential revoked.')");+ assert.equal(await localChrome.evaluate(`document.querySelector('[data-token-id="${expected.id}"]')?.textContent.includes('Revoked')`), true, 'the acknowledged credential row is marked revoked');+ assert.equal(box.calls.filter(call => call.path.endsWith('/authorize')).length, authorizationsBefore + 1,+ 'one real phone tap authorizes exactly one revoke');++ const mintsBefore = box.calls.filter(call => call.method === 'POST' && call.path === '/auth/tokens').length;+ const stale = await runFixtureChildAsync(process.execPath, [BIN, 'add', box.lane, 'must refuse revoked scoped credential', '--json'], {+ cwd: agentRoot, encoding: 'utf8', env: {+ ...personEnv, PULLBOARD_RELAY_TOKEN: oldPA.token, AI_AGENT: '1', CODEX_SHELL: '1',+ CODEX_THREAD_ID: 'private-credential-inventory',+ },+ });+ assert.equal(stale.status, 1);+ assert.equal(JSON.parse(stale.stdout).error.code, 'AUTH_REQUIRED', 'the old PA refuses its very next native move');+ assert.equal(box.calls.filter(call => call.method === 'POST' && call.path === '/auth/tokens').length, mintsBefore, 'the refused explicit credential is never silently replaced');+ const unaffected = await runFixtureChildAsync(process.execPath, [BIN, 'shout', 'coordinator', 'the other credential still works', '--json'], {+ cwd: other.document.path, env: { ...personEnv, PULLBOARD_RELAY_TOKEN: otherPA.token, AI_AGENT: '1', CODEX_SHELL: '1', CODEX_THREAD_ID: 'private-credential-inventory-other' },+ });+ assert.equal(unaffected.status, 0, 'revoking one credential leaves the other agent able to move');+ } finally {+ await localChrome.close();+ await phoneChrome.close();+ await view.stop();+ }+});