Skip to main content
Run any Skill in Manus
with one click

worktree-historical-test-replay-missing-dirs

Stars2
Forks0
UpdatedJuly 8, 2026 at 12:17

Fix `pytest exit 4` ("file or directory not found") when running a test command in a git worktree checked out at an OLD commit. Use when: (1) you're doing historical replay (incident replay, mutation testing, git bisect with tests) and the suite errors out in 1-2 seconds with no test execution, (2) the test command works fine at HEAD but fails at pre-fix SHAs, (3) `pytest scripts/overnight/tests/ goal/tests/ --tb=no -q` returns "ERROR: file or directory not found: scripts/overnight/tests/" at an old SHA, (4) you're building tooling that runs the project's canonical test command across multiple historical SHAs. The fix is NOT to add the missing dir back — it didn't exist then. The fix is to filter the test-dir list at each SHA to only those that exist in that commit's tree, then invoke pytest with the filtered list. If none survive, classify the SHA as "unrunnable" rather than failing the whole replay.

Installation

Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.

SKILL.md
readonly