From 59a76a3789dd84024b819e625b5ed924db72f0b9 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Tue, 14 Apr 2026 19:11:15 -0700 Subject: [PATCH] fix: extract Step 0 from review SKILL.md in E2E test The review-base-branch E2E test was copying the full 1493-line review/SKILL.md into the test fixture. The agent spent 8+ turns reading it in chunks, leaving only 7 turns for actual work, causing error_max_turns on every attempt. Now extracts only Step 0 (base branch detection, ~50 lines) which is all the test actually needs. Follows the CLAUDE.md rule: "NEVER copy a full SKILL.md file into an E2E test fixture." Co-Authored-By: Claude Opus 4.6 (1M context) --- test/skill-e2e-review.test.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/skill-e2e-review.test.ts b/test/skill-e2e-review.test.ts index dacd4b16..0e0bca02 100644 --- a/test/skill-e2e-review.test.ts +++ b/test/skill-e2e-review.test.ts @@ -286,18 +286,21 @@ describeIfSelected('Base branch detection', ['review-base-branch', 'ship-base-br run('git', ['add', 'app.rb'], dir); run('git', ['commit', '-m', 'feat: add hello method'], dir); - // Copy review skill files - fs.copyFileSync(path.join(ROOT, 'review', 'SKILL.md'), path.join(dir, 'review-SKILL.md')); - fs.copyFileSync(path.join(ROOT, 'review', 'checklist.md'), path.join(dir, 'review-checklist.md')); - fs.copyFileSync(path.join(ROOT, 'review', 'greptile-triage.md'), path.join(dir, 'review-greptile-triage.md')); + // Extract only Step 0 (base branch detection) + minimal review instructions + // Full SKILL.md is ~1500 lines — copying it causes the agent to spend all turns reading + const full = fs.readFileSync(path.join(ROOT, 'review', 'SKILL.md'), 'utf-8'); + const step0Start = full.indexOf('## Step 0: Detect platform and base branch'); + const step1Start = full.indexOf('## Step 1: Check branch'); + const step1End = full.indexOf('---', step1Start + 10); + const extracted = full.slice(step0Start, step1End > step1Start ? step1End : step1Start + 500); + fs.writeFileSync(path.join(dir, 'review-SKILL.md'), extracted); const result = await runSkillTest({ prompt: `You are in a git repo on a feature branch with changes. -Read review-SKILL.md for the review workflow instructions. -Also read review-checklist.md and apply it. +Read review-SKILL.md for the base branch detection instructions. IMPORTANT: Follow Step 0 to detect the base branch. Since there is no remote, gh commands will fail — fall back to main. -Then run the review against the detected base branch. +Then run git diff against the detected base branch and write a brief review. Write your findings to ${dir}/review-output.md`, workingDirectory: dir, maxTurns: 15,