Skip to content

fix(swe): ONE env root — a second cache made the benchmark unable to report its own coverage - #2334

Merged
joelteply merged 1 commit into
canaryfrom
fix/one-swe-env-root
Aug 17, 2026
Merged

fix(swe): ONE env root — a second cache made the benchmark unable to report its own coverage#2334
joelteply merged 1 commit into
canaryfrom
fix/one-swe-env-root

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Two SWE env roots existed and neither named the other:

root state
~/.continuum/benchmarks/swe/envs (swe_cache_dir()/envs) LIVE — 46 envs, 8 repo families
~/.continuum/cache/swe-envs (legacy grade_local.py default) retired — 14 envs, 3 repos, untouched since Aug 4

Nothing failed. Each root was internally consistent, so whichever one you looked at answered confidently and never mentioned the other.

What it cost (2026-08-17): reading the retired root produced "77% of staged instances have no environment; the env builder only works for sympy/flask/requests" — reported as the benchmark's root cause, with a design approved on top of it. Truth was 95% coverage, all 8 families. Same question, two directories, opposite answers, and the wrong one drove a decision.

The general defect — why this gets a guard, not just a delete: a cache with two roots cannot report its own coverage. Every reader picks one and receives a self-consistent lie. That is a missing constraint, not stale data.

Three parts

  1. Retired root deleted (154 MB, 14 venvs). Only the quarantined script read it.
  2. grade_local.py --env-root repointed to the canonical path — if the legacy script runs, it writes where the core reads. A second cache can't re-form by accident.
  3. Guard: the_swe_env_root_has_exactly_one_spelling scans crate source (comments stripped) and fails if either root appears as a path literal. Needles are assembled at runtime — a literal needle matched its own declaration and the guard failed on itself first run, which doubles as its positive control.

swe_cache_dir()'s doc carries the incident and the rule: derive the envs dir from the function, never spell the path.

14 swe_bench tests green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…report its own coverage

Two SWE env roots existed and neither named the other:

  ~/.continuum/benchmarks/swe/envs   swe_cache_dir()/envs — LIVE. 46 envs, 8 repos.
  ~/.continuum/cache/swe-envs        legacy grade_local.py default — 14 envs, 3 repos,
                                     untouched since Aug 4.

Nothing failed. Each root was internally consistent, so whichever one you looked at
answered confidently and never mentioned the other.

WHAT IT COST, 2026-08-17: `ls` on the retired root showed sympy/flask/requests only.
That became the reported finding — "77% of staged instances have no environment; the
env builder only works for three repos" — presented as the benchmark's root cause, with
a design approved on top of it. The live root held 46 envs across all 8 repo families:
95% coverage, astropy and django and pytest and pylint and sphinx all present. Same
question, two directories, opposite answers, and the wrong one drove a decision.

THE GENERAL DEFECT, which is why this gets a guard and not just a delete: a cache with
two roots cannot report its own coverage. Every reader picks one and receives a
self-consistent lie. That is not a stale-data problem — it is a missing constraint
([[the-same-bug-at-two-sites-is-a-missing-constraint-not-two-bugs]]).

THREE PARTS:

1. Retired root DELETED (154MB, 14 venvs). Nothing read it but the quarantined script.

2. `grade_local.py --env-root` now defaults to the canonical path, so even if the legacy
   script is run it writes where the core reads. A second cache cannot re-form by
   accident.

3. GUARD: `the_swe_env_root_has_exactly_one_spelling` scans crate source (comments
   stripped) and fails if either root appears as a path literal anywhere. Needles are
   ASSEMBLED at runtime — a literal needle matched its own declaration and the guard
   failed on itself on first run, which is also its positive control: it demonstrably
   scans rather than passing vacuously.

`swe_cache_dir()`'s doc now carries the incident and the rule: derive the envs dir from
the function, never spell the path. Corollary written down for the next person measuring
coverage — read the root from the code, never from a directory you found by name.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 4d0c551 into canary Aug 17, 2026
4 checks passed
@joelteply
joelteply deleted the fix/one-swe-env-root branch August 17, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant