fix(pstack-c1): fold design-twice into Section 1 of the eng review section, per-host transcript table, fixture and slice-cap repairs

The remote free run reported nine failures in seven files, all from this
branch: four tests encode plan-eng-review's one companion section
(eng-scope-entry-ap, autoplan-methodology-names, plan-review-cases,
review-checklists), so the design-twice pass now lives inside Section 1 of
sections/review-sections.md with the skeleton, manifest and
bin/gstack-autoplan-snapshot.ts back at main; the Codex render of
context-restore named ~/.claude/ through the all-hosts transcript table, so
{{TRANSCRIPT_SOURCES}} renders this host's row only; the transcript fixture
is declared in FREE_FIXTURES; and the two new periodic cases took the census
to 39 slices, so evals-periodic.yml's eval-slices max-parallel goes 38 -> 40.
Pins: 11 plan-eng-review re-pins at +2,896; maxSizeRatio 1.2400 (measured
1.2389); Codex gpt-5.4 overlay 159,588 bytes.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-26 22:02:47 +00:00
1 parent 6b530ccc0b
commit 0119569a6e
19 files changed
+195 -212

No files matched your search

+4 -11
View File
@@ -122,13 +122,9 @@ describe('autoplan reads installed host methodology', () => {
expect(directive).toContain('"<REVIEW_SKILL>"');
}
if (carved) {
// An install carries every generated section, not only the review body:
// plan-eng-review's design-twice companion is bound by the same snapshot.
const sectionsDir = path.dirname(sectionSource);
for (const file of fs.readdirSync(sectionsDir).filter(name => name.endsWith('.md'))) {
installFile(path.join(sectionsDir, file), path.resolve(path.dirname(entry), reference, '..', 'sections', file), mode);
}
const sectionInstalled = path.resolve(path.dirname(entry), reference, '..', 'sections/review-sections.md');
const relative = 'sections/review-sections.md';
const sectionInstalled = path.resolve(path.dirname(entry), reference, '..', relative);
installFile(sectionSource, sectionInstalled, mode);
const section = fs.readFileSync(sectionInstalled, 'utf8');
expect(section).toBe(fs.readFileSync(sectionSource, 'utf8'));
expect(section).toContain('## Review Sections');
@@ -139,10 +135,7 @@ describe('autoplan reads installed host methodology', () => {
const restore = path.join(registry, 'restore.md');
fs.writeFileSync(restore, 'owned restore\n');
const skillPath = path.resolve(path.dirname(entry), reference);
// The bundle binds every section the skill's index names, in index order.
const indexed = [...loaded.matchAll(/^\| .* \| `(sections\/[^`]+)` \|$/gm)].map(match => match[1]!);
expect(indexed).toContain('sections/review-sections.md');
assertBundle(methodology(phase, skillPath, restore), [skillPath, ...indexed.map(rel => path.resolve(path.dirname(skillPath), rel))]);
assertBundle(methodology(phase, skillPath, restore), [skillPath, sectionInstalled]);
} else {
expect(directive).not.toContain('sections/review-sections.md');
expect(loaded).toContain('## Review Sections');
+13 -9
View File
@@ -48,16 +48,20 @@ describe('context-restore carve: the transcript fallback', () => {
expect(skeleton).toMatch(/HARD GATE:\*\* Do NOT implement code changes/);
});
test('the host table comes from hosts/*.ts and carries Claude Code, Codex and the Capy row', () => {
const table = generateTranscriptSources();
expect(section).toContain(table);
for (const host of ALL_HOST_CONFIGS.filter(h => h.transcripts)) {
expect(table).toContain('| ' + host.displayName + ' | \u0060' + host.transcripts!.root + '\u0060 |');
}
test("the host table comes from hosts/*.ts: this host's row plus the Capy row, never another host's paths", () => {
const ctx = (host: string) => ({ host, skillName: 'context-restore', paths: { binDir: '$GSTACK_BIN' } }) as never;
expect(ALL_HOST_CONFIGS.filter(h => h.transcripts).map(h => h.name).sort()).toEqual(['claude', 'codex']);
expect(table).toContain('~/.claude/projects/<slug>/*.jsonl');
expect(table).toContain('~/.codex/sessions/');
expect(table).toContain('| Capy (any model) | none |');
const claude = generateTranscriptSources(ctx('claude'));
expect(section).toContain(claude);
expect(claude).toContain('| Claude Code | `~/.claude/projects/<slug>/*.jsonl` |');
expect(claude).not.toContain('~/.codex/');
const codex = generateTranscriptSources(ctx('codex'));
expect(codex).toContain('| OpenAI Codex CLI | `~/.codex/sessions/');
expect(codex).not.toContain('~/.claude/');
const cursor = generateTranscriptSources(ctx('cursor'));
expect(cursor).toContain('| Cursor | none |');
expect(cursor).not.toContain('~/.claude/');
for (const table of [claude, codex, cursor]) expect(table).toContain('| Capy (any model) | none |');
expect(section).toMatch(/Capy[^\n]*say so and use the shared record and git/);
});
+11 -11
View File
@@ -8,7 +8,7 @@
"agy/gstack-land-and-deploy": 117690,
"agy/gstack-plan-design-review": 139981,
"agy/gstack-plan-devex-review": 135728,
"agy/gstack-plan-eng-review": 155459,
"agy/gstack-plan-eng-review": 155470,
"agy/gstack-review": 124400,
"claude/design-review": 136499,
"codex/gstack-autoplan": 130596,
@@ -18,7 +18,7 @@
"codex/gstack-office-hours": 102276,
"codex/gstack-plan-design-review": 142434,
"codex/gstack-plan-devex-review": 138617,
"codex/gstack-plan-eng-review": 158005,
"codex/gstack-plan-eng-review": 158016,
"codex/gstack-review": 125304,
"copilot/gstack-autoplan": 131605,
"copilot/gstack-codex": 100203,
@@ -28,7 +28,7 @@
"copilot/gstack-office-hours": 100432,
"copilot/gstack-plan-design-review": 140852,
"copilot/gstack-plan-devex-review": 136880,
"copilot/gstack-plan-eng-review": 156184,
"copilot/gstack-plan-eng-review": 156195,
"copilot/gstack-review": 125671,
"cursor/gstack-autoplan": 129246,
"cursor/gstack-design-consultation": 107190,
@@ -36,7 +36,7 @@
"cursor/gstack-land-and-deploy": 116613,
"cursor/gstack-plan-design-review": 138936,
"cursor/gstack-plan-devex-review": 134559,
"cursor/gstack-plan-eng-review": 154313,
"cursor/gstack-plan-eng-review": 154324,
"cursor/gstack-review": 142320,
"factory/gstack-autoplan": 131530,
"factory/gstack-codex": 100623,
@@ -46,34 +46,34 @@
"factory/gstack-office-hours": 101311,
"factory/gstack-plan-design-review": 141717,
"factory/gstack-plan-devex-review": 137928,
"factory/gstack-plan-eng-review": 157427,
"factory/gstack-plan-eng-review": 157438,
"factory/gstack-review": 146099,
"gbrain/gstack-autoplan": 129783,
"gbrain/gstack-design-review": 132810,
"gbrain/gstack-land-and-deploy": 117135,
"gbrain/gstack-plan-design-review": 127823,
"gbrain/gstack-plan-devex-review": 115097,
"gbrain/gstack-plan-eng-review": 137045,
"gbrain/gstack-plan-eng-review": 137056,
"hermes/gstack-autoplan": 129873,
"hermes/gstack-design-review": 132917,
"hermes/gstack-land-and-deploy": 117237,
"hermes/gstack-plan-design-review": 127932,
"hermes/gstack-plan-devex-review": 115183,
"hermes/gstack-plan-eng-review": 137130,
"hermes/gstack-plan-eng-review": 137141,
"kiro/gstack-autoplan": 129008,
"kiro/gstack-design-consultation": 107032,
"kiro/gstack-design-review": 142289,
"kiro/gstack-land-and-deploy": 116501,
"kiro/gstack-plan-design-review": 138776,
"kiro/gstack-plan-devex-review": 134399,
"kiro/gstack-plan-eng-review": 154163,
"kiro/gstack-plan-eng-review": 154174,
"kiro/gstack-review": 142132,
"openclaw/gstack-autoplan": 129488,
"openclaw/gstack-design-review": 131615,
"openclaw/gstack-land-and-deploy": 116725,
"openclaw/gstack-plan-design-review": 126674,
"openclaw/gstack-plan-devex-review": 113936,
"openclaw/gstack-plan-eng-review": 135442,
"openclaw/gstack-plan-eng-review": 135453,
"opencode/gstack-autoplan": 131608,
"opencode/gstack-design-consultation": 109325,
"opencode/gstack-design-review": 144673,
@@ -81,7 +81,7 @@
"opencode/gstack-office-hours": 100266,
"opencode/gstack-plan-design-review": 140706,
"opencode/gstack-plan-devex-review": 136780,
"opencode/gstack-plan-eng-review": 156065,
"opencode/gstack-plan-eng-review": 156076,
"opencode/gstack-review": 144555,
"slate/gstack-autoplan": 129127,
"slate/gstack-design-consultation": 107111,
@@ -89,7 +89,7 @@
"slate/gstack-land-and-deploy": 116557,
"slate/gstack-plan-design-review": 138856,
"slate/gstack-plan-devex-review": 134479,
"slate/gstack-plan-eng-review": 154238,
"slate/gstack-plan-eng-review": 154249,
"slate/gstack-review": 142226
}
}
+4 -4
View File
@@ -195,13 +195,13 @@ export const CARVE_GUARDS: Record<string, CarveGuard> = {
},
'plan-eng-review': {
skill: 'plan-eng-review',
expectedSections: ['design-twice.md', 'review-sections.md'],
expectedSections: ['review-sections.md'],
requiredReads: ['review-sections.md'],
scenario:
'Review the plan in PLAN.md. Accept the current scope. Run the full engineering review (architecture, code quality, tests, performance) and produce the review report.',
staticInvariants: {
mustStayInSkeleton: ['### Step 0: Scope Challenge'],
mustMoveToSection: ['### 1. Architecture review', '## Two shapes before one', '### The eight red flags'],
mustMoveToSection: ['### 1. Architecture review', '### Two shapes before one (design-twice)', '**The eight red flags.**'],
gateAfterStop: 'EXIT PLAN MODE GATE',
},
behavioral: 'plan',
@@ -212,7 +212,7 @@ export const CARVE_GUARDS: Record<string, CarveGuard> = {
// check grew every plan-review skeleton ~0.7KB. Measured values noted.
// #2499 project-scope MCP jq in the brain-sync block grew every tier-2+
// skeleton ~1.5KB (entry resolution emitted once per SKILL.md).
maxSkeletonBytes: 57_800, // Scoped reuse entry guidance; measured 57,549 bytes (2026-09-16). Shared rubric remains in the existing section. + pstack item 9 (Garry 2026-10-26 "do it"): the design-twice STOP pointer and its index row; measured 52,185 (2026-10-26), inside the cap.
maxSkeletonBytes: 57_800, // Scoped reuse entry guidance; measured 57,549 bytes (2026-09-16). Shared rubric remains in the existing section.
minUnionBytes: 99_800, // token-reduction Phases 1-2 (v1.69.x branch); measured union 110,910
mustContain: ['Architecture', 'Code Quality', 'Test', 'Performance', 'interface depth'],
// Cross-cutting preamble growth (v1.57.2.0 AUQ-failure prose fallback + the
@@ -223,7 +223,7 @@ export const CARVE_GUARDS: Record<string, CarveGuard> = {
// 1.08 → 1.10: the scope-gate exceptions block (+ its adversarial-review
// hardening: host-anchored mode signal, precedence, passing-mention
// guards) and the plan-mode preamble reword land the union at 1.092.
maxSizeRatio: 1.26, // pstack item 9 (Garry 2026-10-26 "do it"): the design-twice section (3.0 KB) joins the union; measured 154,988 / 124,597 = 1.2439 (2026-10-26). Earlier history: + clarity rules for saved decisions/setup gates + the Aside probe's failure reason; measured 1.1504. + test value bar and Tests to Retire in the lazy Test review section (~2.6KB); measured 1.168 + W1 guarded state-root resolution (`eval gstack-paths; : "${GSTACK_STATE_ROOT:?…}"`) in the Context Recovery preamble, the eureka log and each state-writing bash block; measured 1.173 (2026-09-30). + v1.91.12.0 merge of #2999 (headless rule: a disallowed question tool never qualifies) with #3002; measured 1.1741 (2026-10-01). + Oct 6 fix wave A3/CEO-12: free text reaches commands only through agent-written mktemp files (mktemp block, write rule, path rebuild and refusal at each posting, prompt and brief site); measured 146,905 / 124,597 = 1.1790 (2026-10-06). Combined Oct 6 wave head (A and B): measured 147,524 / 124,597 = 1.1840 (2026-10-06). + Oct 7 wave B3: the Codex probe runs as a command (select-model capture lines, check-sandbox/probe-model/run-with-timeout subcommands) instead of being sourced; measured 147,693 / 124,597 = 1.1854 (2026-10-07). + Oct 7 wave CEO-28/DX-11: review prompts ask for a severity per finding and design proposals use the proposal gate; measured 147,752 / 124,597 = 1.1858 (2026-10-07). + fix wave PR D: the prerequisite offer is skipped in spawned/headless sessions (#1958); measured 147,864 / 124,597 = 1.1867 (2026-10-07). + Oct 10 multi-agent wave PR D1 (reality rows): the Scope Challenge reality-rows block, the deep incident table (18 rows, each tied to the incident that earned it), the Completion summary line and the checklist row; measured 151,423 / 124,597 = 1.2153 (2026-10-10). + #280: the Design Doc Check finds the CEO plan (`gstack-ceo-plan-find`) and names it in the data rule, +325 bytes on main's 151,630; measured 151,955 / 124,597 = 1.2196 (2026-10-12). Fix wave PR 4 (owner-approved raise 1.2170 → 1.2196): #3182's timer-bounded native fallback (net −17 bytes) plus #280's cross-branch rule, offset by tightening the Design Doc Check; measured 151,950 / 124,597 = 1.2195 (2026-10-15).
maxSizeRatio: 1.2400, // pstack item 9 (Garry 2026-10-26 "do it"): the design-twice pass (two shapes, eight red flags, ~2.4 KB) joins Section 1 of the lazy review section; measured 154,366 / 124,597 = 1.2389 (2026-10-26). Earlier history: + clarity rules for saved decisions/setup gates + the Aside probe's failure reason; measured 1.1504. + test value bar and Tests to Retire in the lazy Test review section (~2.6KB); measured 1.168 + W1 guarded state-root resolution (`eval gstack-paths; : "${GSTACK_STATE_ROOT:?…}"`) in the Context Recovery preamble, the eureka log and each state-writing bash block; measured 1.173 (2026-09-30). + v1.91.12.0 merge of #2999 (headless rule: a disallowed question tool never qualifies) with #3002; measured 1.1741 (2026-10-01). + Oct 6 fix wave A3/CEO-12: free text reaches commands only through agent-written mktemp files (mktemp block, write rule, path rebuild and refusal at each posting, prompt and brief site); measured 146,905 / 124,597 = 1.1790 (2026-10-06). Combined Oct 6 wave head (A and B): measured 147,524 / 124,597 = 1.1840 (2026-10-06). + Oct 7 wave B3: the Codex probe runs as a command (select-model capture lines, check-sandbox/probe-model/run-with-timeout subcommands) instead of being sourced; measured 147,693 / 124,597 = 1.1854 (2026-10-07). + Oct 7 wave CEO-28/DX-11: review prompts ask for a severity per finding and design proposals use the proposal gate; measured 147,752 / 124,597 = 1.1858 (2026-10-07). + fix wave PR D: the prerequisite offer is skipped in spawned/headless sessions (#1958); measured 147,864 / 124,597 = 1.1867 (2026-10-07). + Oct 10 multi-agent wave PR D1 (reality rows): the Scope Challenge reality-rows block, the deep incident table (18 rows, each tied to the incident that earned it), the Completion summary line and the checklist row; measured 151,423 / 124,597 = 1.2153 (2026-10-10). + #280: the Design Doc Check finds the CEO plan (`gstack-ceo-plan-find`) and names it in the data rule, +325 bytes on main's 151,630; measured 151,955 / 124,597 = 1.2196 (2026-10-12). Fix wave PR 4 (owner-approved raise 1.2170 → 1.2196): #3182's timer-bounded native fallback (net −17 bytes) plus #280's cross-branch rule, offset by tightening the Design Doc Check; measured 151,950 / 124,597 = 1.2195 (2026-10-15).
},
'plan-design-review': {
skill: 'plan-design-review',
+1
View File
@@ -32,6 +32,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/autoplan-with-result-au.json': ['test/autoplan-phase-observer.test.ts'],
'test/fixtures/browse-judge/**': ['test/workflow-judge-cache.test.ts'],
'test/fixtures/ceo-completion-handoff-m-call.json': ['test/plan-count-completion.test.ts'],
'test/fixtures/context-restore-transcript.jsonl': ['test/context-restore-transcripts.test.ts'],
'test/fixtures/ceo-completion-handoff-o-call.json': ['test/plan-count-completion.test.ts'],
'test/fixtures/ceo-completion-handoff-q-call.json': ['test/plan-count-completion.test.ts'],
'test/fixtures/ceo-count-ad-v2.json': ['test/ceo-count-ad-v2.test.ts'],
+42 -31
View File
@@ -1,6 +1,6 @@
/**
* pstack absorb (GSTA-116 plan, items 6 and 9): benchmark's vet-the-number
* section and plan-eng-review's design-twice section. Pins the carve shape
* section and plan-eng-review's design-twice pass. Pins the carve shape
* (manifest ids, STOP pointers, where each pointer sits) and the tokens each
* section must carry; prose is not pinned.
*/
@@ -50,38 +50,39 @@ describe('benchmark carve: vet the number', () => {
});
});
describe('plan-eng-review carve: two shapes before one', () => {
describe('plan-eng-review: two shapes before one inside Section 1 of the lazy review section', () => {
const skeleton = read('plan-eng-review/SKILL.md');
const section = read('plan-eng-review/sections/design-twice.md');
const manifest = JSON.parse(read('plan-eng-review/sections/manifest.json')) as { sections: Array<{ id: string; file: string; scope?: string; runner_only?: boolean }> };
const section = read('plan-eng-review/sections/review-sections.md');
const manifest = JSON.parse(read('plan-eng-review/sections/manifest.json')) as { sections: Array<{ id: string }> };
test('registered beside review-sections, pointed to before it, and visible to the autoplan runner', () => {
expect(manifest.sections.map(s => s.id)).toEqual(['review-sections', 'design-twice', 'checklist']);
const entry = manifest.sections.find(s => s.id === 'design-twice')!;
expect(entry.scope).toBe('always');
expect(entry.runner_only).toBeUndefined();
expect(CARVE_GUARDS['plan-eng-review']!.expectedSections).toEqual(['design-twice.md', 'review-sections.md']);
const designStop = skeleton.indexOf('sections/design-twice.md', skeleton.indexOf('> **STOP.**'));
const reviewStop = skeleton.indexOf('sections/review-sections.md', skeleton.indexOf('> **STOP.**'));
expect(designStop).toBeGreaterThan(0);
expect(designStop).toBeLessThan(reviewStop);
expect(skeleton.lastIndexOf('EXIT PLAN MODE GATE')).toBeGreaterThan(skeleton.lastIndexOf('> **STOP.**'));
test('the pass lives in review-sections.md between Sections 1 and 2, the skeleton and manifest are unchanged, and the checklist maps it', () => {
expect(manifest.sections.map(s => s.id)).toEqual(['review-sections', 'checklist']);
expect(CARVE_GUARDS['plan-eng-review']!.expectedSections).toEqual(['review-sections.md']);
expect(skeleton).not.toContain('design-twice');
expect(skeleton.match(/> \*\*STOP\.\*\*/g)).toHaveLength(1);
const one = section.indexOf('### 1. Architecture review');
const pass = section.indexOf('### Two shapes before one (design-twice)');
const two = section.indexOf('### 2. Code quality review');
expect(one).toBeGreaterThan(0);
expect(pass).toBeGreaterThan(one);
expect(two).toBeGreaterThan(pass);
expect(section.slice(pass, two)).toMatch(/only when the plan introduces a new module, service, package or\s+boundary/);
expect(read('plan-eng-review/sections/checklist.md')).toContain('Two shapes before one (design-twice)');
});
test('a second structurally distinct shape, interface depth, the agent-contributor assumption, and the eight red flags in order', () => {
expect(section).toContain('## Two shapes before one');
expect(section).toContain('### Ask for the second shape');
expect(section).toMatch(/require a second shape that is structurally\s+different/);
expect(section).toMatch(/A point fix inside the first shape is not a\s+second candidate\./);
expect(section).toContain('interface depth');
expect(section).toContain('A deep module is not a deep call chain');
expect(section).toMatch(/an agent that sees only the files it opened, copies the nearest example\s+and takes the shortest path that compiles/);
const pass = section.slice(section.indexOf('### Two shapes before one (design-twice)'), section.indexOf('### 2. Code quality review'));
expect(pass).toContain('**Ask for the second shape.**');
expect(pass).toMatch(/require a second\s+shape that is structurally different/);
expect(pass).toMatch(/A point fix inside\s+the first shape is not a second candidate\./);
expect(pass).toContain('interface depth');
expect(pass).toContain('A deep module is not a deep call chain');
expect(pass).toMatch(/an agent that sees only the files it opened,\s+copies the nearest example and takes the shortest path that compiles/);
const flags = ['**Shallow module.**', '**Information leakage.**', '**Temporal decomposition.**', '**Pass-through method.**', '**Split ownership.**', '**Two ways to do one task.**', '**Importable internals.**', '**Hand-synced list.**'];
let last = section.indexOf('### The eight red flags');
let last = pass.indexOf('**The eight red flags.**');
expect(last).toBeGreaterThan(0);
for (const f of flags) {
const at = section.indexOf(f);
const at = pass.indexOf(f);
expect(at, f).toBeGreaterThan(last);
last = at;
}
@@ -89,14 +90,24 @@ describe('plan-eng-review carve: two shapes before one', () => {
});
describe('every pstack-derived section carries its credit line', () => {
for (const rel of ['investigate/sections/blast-radius.md.tmpl', 'context-restore/sections/transcripts.md.tmpl', 'benchmark/sections/vet-the-number.md.tmpl', 'plan-eng-review/sections/design-twice.md.tmpl']) {
const credited = {
'investigate/sections/blast-radius.md.tmpl': 0,
'context-restore/sections/transcripts.md.tmpl': 0,
'benchmark/sections/vet-the-number.md.tmpl': 0,
// The design-twice pass lives inside an existing section; its credit sits on the line above its heading.
'plan-eng-review/sections/review-sections.md.tmpl': '### Two shapes before one (design-twice)',
} as const;
for (const [rel, where] of Object.entries(credited)) {
test(rel, () => {
const first = read(rel).split('\n')[0]!;
expect(first.startsWith('<!--')).toBe(true);
expect(first).toContain('pstack');
expect(first).toContain('MIT');
expect(first).toContain('rewritten');
expect(first).toContain('See NOTICE.md');
const lines = read(rel).split('\n');
const at = typeof where === 'number' ? where : lines.indexOf(where) - 1;
expect(at).toBeGreaterThanOrEqual(0);
const credit = lines[at]!;
expect(credit.startsWith('<!--')).toBe(true);
expect(credit).toContain('pstack');
expect(credit).toContain('MIT');
expect(credit).toContain('rewritten');
expect(credit).toContain('See NOTICE.md');
expect(read('NOTICE.md')).toContain(rel.replace('.tmpl', ''));
});
}