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
test: item kinds, the skip rule, a ladder that learns
Corey Olsona14b66115aa1
diff --git a/test/e2e.test.js b/test/e2e.test.jsindex 67b53108..05ffbca1 100644--- a/test/e2e.test.js+++ b/test/e2e.test.js@@ -421,7 +421,7 @@ test('run builds routed items unattended: the failure feeds the next attempt; reconst shown = box.run(box.repo, 'show', '2').out;assert.match(shown, /#2 {2}open {2}web {2}Say bye {2}mid/);assert.match(shown, /unattended attempts: red, red/);- assert.match(shown, /escalated light -> mid by web-2, pinned at refs\/pullboard\/attempts\/2\/[0-9a-f]{12}: 2 attempts stayed red/);+ assert.match(shown, /escalated light -> mid by web-2, pinned at refs\/pullboard\/attempts\/2\/[0-9a-f]{12}: every rung stayed red/);assert.match(box.run(box.repo, 'inbox').out, /web-2 -> coordinator: #2 escalated light -> mid after 2 red attempts/);});@@ -449,10 +449,38 @@ test('one runner climbs the tiers: an escalated item goes to the next command, wassert.match(ran.out, /runner done: 1 submitted, 1 escalated/);assert.equal(box.tryGit(apiRunner, 'merge-base', '--is-ancestor', commit, 'HEAD').status, 0);const packs = join(box.dir, 'repo', '.git', 'worktrees', apiRunner.split('/').at(-1), 'pullboard', 'packs');- assert.match(readFileSync(join(packs, '2-mid-1.md'), 'utf8'), /## Earlier tries by a lighter model\n- 2 attempts stayed red/);+ assert.match(readFileSync(join(packs, '2-mid-1.md'), 'utf8'), /## Earlier tries by a lighter model\n- every rung stayed red/);assert.equal(existsSync(join(packs, '2-light-1.md')), true);});+test('a ladder climbs within a tier; routing history skips a rung that keeps failing a kind of item [N18]', () => {+ const box = project();+ const script = (name, line) => {+ writeFileSync(join(box.dir, name), ['#!/bin/sh', 'mkdir -p web', line, ''].join('\n'));+ return `sh ${join(box.dir, name)}`;+ };+ const weak = script('weak.sh', 'echo nope > web/a$PULLBOARD_ITEM.js');+ const strong = script('strong.sh', 'echo fixed > web/a$PULLBOARD_ITEM.js');+ const history = join(box.dir, 'routing.jsonl');+ for (const n of [1, 2, 3, 4]) {+ const brief = `Kind: rename\n${LIGHT_BRIEF.replace('web/page.js', `web/a${n}.js`)}`;+ assert.equal(box.run(box.repo, 'add', 'web', `Rename ${n}`, '--route', 'light', '--criterion', 'renamed', '--check', `grep -q fixed web/a${n}.js`, '--brief', brief).code, 0);+ }+ const tree = box.run(box.repo, 'worktree', 'web', '--route', 'light').out.match(/^made (\S+) /)[1];+ const ran = box.run(tree, 'run', '--agent-light', weak, '--agent-light', strong, '--attempts', '1', '--items', '3', '--history', history, '--minutes', '2');+ assert.equal(ran.code, 0, ran.err);+ assert.match(ran.out, /#1 attempt 1: red[\s\S]*#1 attempt 1\/1: running the light agent \(rung 2\)\n#1 attempt 1: green/);+ assert.match(ran.out, /#3 skips rung 1: it failed rename 2 times and never fixed it\n#3 attempt 1\/1: running the light agent \(rung 2\)/);+ assert.match(ran.out, /runner done: 3 submitted, 0 escalated/);+ const records = readFileSync(history, 'utf8').trim().split('\n').map((line) => JSON.parse(line));+ assert.deepEqual(records.map((record) => `${record.command === weak ? 'weak' : 'strong'}:${record.result}`), ['weak:red', 'strong:green', 'weak:red', 'strong:green', 'strong:green']);+ assert.deepEqual(records[0].features, ['rename']);+ const attempt = JSON.parse(box.run(box.repo, 'log', '1').out.split('\n').filter((line) => line.includes(' attempt ')).at(-1).replace(/^.*?(\{.*\})$/, '$1'));+ assert.equal(attempt.rung, 2);+ const only = box.run(tree, 'run', '--agent-light', weak, '--attempts', '1', '--history', history, '--minutes', '2');+ assert.match(only.out, /#4 skips rung 1: it failed rename 2 times and never fixed it\n#4 escalated light -> mid, without spending an attempt/);+});+test('sweep files one light item per flagged file, in its lane; a second sweep skips what is open [N15]', () => {const box = project();writeFileSync(join(box.dir, 'novar.mjs'), [diff --git a/test/route.test.js b/test/route.test.jsnew file mode 100644index 00000000..d6a9ad7c--- /dev/null+++ b/test/route.test.js@@ -0,0 +1,25 @@+/**+ * Routing by evidence (N18): what kind an item is, and which rungs of a ladder to try for it.+ */+import assert from 'node:assert/strict';+import { test } from 'node:test';+import { featuresOf, routePlan } from '../src/run.js';++test('an item is the kind its brief names, or the rules its sweep listed [N18]', () => {+ assert.deepEqual(featuresOf({ item_brief: 'Kind: wiring, test\nFiles:\n- a.js' }), ['test', 'wiring']);+ assert.deepEqual(featuresOf({ item_brief: 'Files:\n- a.js\nChange:\n- line 3:1 no-var: x\n- line 9 camelcase: y\n- line 12:2 no-var: z' }), ['camelcase', 'no-var']);+ assert.deepEqual(featuresOf({ item_brief: 'Files:\n- a.js' }), ['unlabelled']);+});++test('a rung is skipped only after failing a feature twice without ever fixing it, per tier [N18]', () => {+ const red = (features, command = 'small', tier = 'light') => ({ tier, command, features, result: 'red' });+ const green = (features, command = 'small', tier = 'light') => ({ tier, command, features, result: 'green' });+ const ladder = ['small', 'large'];+ assert.deepEqual(routePlan(ladder, ['camelcase'], 'light', []).map((step) => step.skip), ['', '']);+ assert.deepEqual(routePlan(ladder, ['camelcase'], 'light', [red(['camelcase'])]).map((step) => step.skip), ['', '']);+ const twice = [red(['camelcase', 'no-var']), red(['camelcase'])];+ assert.deepEqual(routePlan(ladder, ['camelcase', 'no-var'], 'light', twice).map((step) => step.skip), ['it failed camelcase 2 times and never fixed it', '']);+ assert.deepEqual(routePlan(ladder, ['no-var'], 'light', twice).map((step) => step.skip), ['', '']);+ assert.deepEqual(routePlan(ladder, ['camelcase'], 'light', [...twice, green(['camelcase'])]).map((step) => step.skip), ['', '']);+ assert.deepEqual(routePlan(ladder, ['camelcase'], 'mid', twice).map((step) => step.skip), ['', '']);+});