fix(#280): anchor execute-phase subagent reads to project root (#286)

This commit is contained in:
Tom Boucher
2026-05-26 12:09:26 -04:00
committed by GitHub
parent c66705d6ba
commit e08fea7ef2
3 changed files with 31 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
---
type: Fixed
pr: 280
---
Fixed execute-phase subagent prompt file paths to anchor reads to PROJECT_ROOT in worktree execution.

View File

@@ -619,18 +619,20 @@ increases monotonically across waves. `{status}` is `complete` (success),
</execution_context>
<files_to_read>
Read these files at execution start using the Read tool:
- {phase_dir}/{plan_file} (Plan)
- .planning/PROJECT.md (Project context — core value, requirements, evolution rules)
- .planning/STATE.md (State)
- .planning/config.json (Config, if exists)
Read these files at execution start using the Read tool.
First resolve repo root so every path is anchored:
\`PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)\`
- ${PROJECT_ROOT}/{phase_dir}/{plan_file} (Plan)
- ${PROJECT_ROOT}/.planning/PROJECT.md (Project context — core value, requirements, evolution rules)
- ${PROJECT_ROOT}/.planning/STATE.md (State)
- ${PROJECT_ROOT}/.planning/config.json (Config, if exists)
${CONTEXT_WINDOW >= 500000 ? `
- ${phase_dir}/*-CONTEXT.md (User decisions from discuss-phase — honors locked choices)
- ${phase_dir}/*-RESEARCH.md (Technical research — pitfalls and patterns to follow)
- ${prior_wave_summaries} (SUMMARY.md files from earlier waves in this phase — what was already built)
- ${PROJECT_ROOT}/${phase_dir}/*-CONTEXT.md (User decisions from discuss-phase — honors locked choices)
- ${PROJECT_ROOT}/${phase_dir}/*-RESEARCH.md (Technical research — pitfalls and patterns to follow)
- ${PROJECT_ROOT}/${prior_wave_summaries} (SUMMARY.md files from earlier waves in this phase — what was already built)
` : ''}
- ./CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
- .claude/skills/ or .agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
- ${PROJECT_ROOT}/CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
- ${PROJECT_ROOT}/.claude/skills/ or ${PROJECT_ROOT}/.agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
</files_to_read>
${AGENT_SKILLS}

View File

@@ -84,6 +84,20 @@ describe('bug #3099: absolute-path safety guidance in gsd-executor.md', () => {
);
});
test('execute-phase prompt anchors subagent file paths to project_root before files_to_read (#280)', () => {
const filesIdx = executePhaseSrc.indexOf('<files_to_read>');
assert.ok(filesIdx !== -1, 'files_to_read block not found in execute-phase.md');
const dispatchSnippet = executePhaseSrc.slice(filesIdx, filesIdx + 1800);
assert.ok(
dispatchSnippet.includes('PROJECT_ROOT=$(git rev-parse --show-toplevel'),
'executor dispatch must compute PROJECT_ROOT in the prompt before file reads',
);
assert.ok(
dispatchSnippet.includes('${PROJECT_ROOT}/'),
'executor files_to_read paths must be anchored to ${PROJECT_ROOT}/',
);
});
test('worktree-path-safety.md reference file exists', () => {
assert.ok(
fs.existsSync(path.join(ROOT, 'get-shit-done', 'references', 'worktree-path-safety.md')),