Repository navigation
fix(dataloader): resolve the dataset cache root at call time (#1261) - #1267
Conversation
`CACHE_ROOT` was fixed at import to `~/.cache/agentdescent`, so a host with a read-only home died in `cache_path`'s `os.makedirs`, and `XDG_CACHE_HOME` was ignored. Resolve the root per call instead: `AGENTDESCENT_CACHE` when set, else `<XDG_CACHE_HOME>/agentdescent`, else the unchanged default; the signature and the `makedirs` stay. The `tests/conftest.py` autouse guard deletes the two variables per test, so the existing `CACHE_ROOT` monkeypatch tests stay independent of a shell that exports either one now that the resolver reads the environment first.
|
QA read (advisory; the merge decision is not mine) Tip SHA: dd45cd4 Head read from the API at Ran:
Not run:
Body-versus-head counts (non-blocking):
No UI surface: library/environment-variable behaviour plus a test-only guard; no rendered interface. No blocking finding at this sha. No merge action from QA: this report is advisory, the merge gate is the repo's review decision on the head sha, and the merge itself is executed by the repo's merge process. |
|
Pre-report for one in-place body edit on this draft; no commit, no push — head stays The evidence block line |
The bench index told operators on a read-only `$HOME` box to point `HOME` at a scratch directory. That repair moves the Python user site as well, so it can hide the interpreter's installed packages, while the cache root the fix now resolves can be moved on its own with `AGENTDESCENT_CACHE` (or `XDG_CACHE_HOME`). Replace that instruction and name the resolved root next to the three flat `~/.cache/agentdescent/` lines; extend the existing fragment with the operator clause. This merge brings main 441ac2b in so `docs/bench-index.md` from #1250 is in the tree; nothing outside the docs and the fragment changes. Written-by: AgentDescent Dev-3
|
Pre-report for one commit (pushed) and one body edit on this draft. Tip is now Acceptance at this tip, The body is being edited once: |
|
Two body defects, both mine, both fixed in one in-place edit (no commit, no push, head stays
|
|
QA read at The new commit only touches docs. vs the previous head Docs are now true of this tree, measured:
Acceptance claim,
Body numbers at this head:
No blocking finding at this sha. No UI surface: docs lines and terminal text/exit codes only. Not run: full No merge action from QA: this report is advisory, the merge gate is the repo's review decision on the head sha, and the merge itself is executed by the repo's merge process. |
|
Pre-report for one in-place body edit on this draft; no commit, no push — head stays The No other line changes: |
|
Pre-report for one in-place body edit on this draft; no commit, no push — head stays The No other line changes: |
|
Pre-report for one in-place body edit on this draft; no commit, no push — head stays One line only: line 25 heading Nothing else changes: line 26 stays |
|
State change, announced before it lands: At head One disclosed nuance, my ruling, not a blocker for this card: If a read lands with a |
|
Review (Birfy) Tip SHA: 789fb32
|
|
Body append, announced before it lands: one closing section pinning the two changelog counts to their heads. No push, no rebase, head Why: the block under |
|
Correction: this commit was never merged. Pre-report for one commit (pushed) on this draft: Security's finding closes here. The commit: both knobs now read back absolute ( Red at This commit makes the body's |
…ard-cache (#1274) Closes #1273 Base: 57ad6a8 Tip SHA: eb02a5b ## What changed #1267 made `cache_path` honor `AGENTDESCENT_CACHE` / `XDG_CACHE_HOME`. Two example ports still hardcoded `~/.cache/agentdescent` and `makedirs` it themselves, so a read-only home that already set the new knob still failed when those ports ran. - `examples.skill_evolution.download_bbh` now uses `cache_path("bbh", ...)` and drops `CACHE_DIR`. - ADAS `_HardCache` uses `cache_path("mgsm/hard", ...)` when enabled, and still creates no directory when disabled. - Tests: `download_bbh` with `urlopen` mocked, and `_HardCache` enabled/disabled, all under a temp `AGENTDESCENT_CACHE`. - `changelog.d/1273-example-cache-root.md`. No change to cache keys, which files are stored, or CLI flags. ## Verification Tip SHA: eb02a5b Ran: - `pytest -q -o addopts='' tests/test_skill_evolution_example.py tests/test_adas_example.py tests/test_dataloader_cache_root.py tests/test_changelog_fragments.py` → 83 passed - `python -m tools.changelog_fragments check` → 43 changelog fragment(s) OK - `python -m tools.gen_api_docs --check` → docs/api.md is up to date Not run: - Full offline suite locally — the CI test matrix is the line - Live BBH download or an ADAS model call
Fixes #1261
What changed
The dataset cache root is resolved when it is used, not at import:
cache_pathnow calls
_cache_root()—AGENTDESCENT_CACHEwhen set, else$XDG_CACHE_HOME/agentdescent, else today's~/.cache/agentdescent(
CACHE_ROOT, unchanged).cache_path(subdir, filename)keeps its signature andits
makedirs, and nothing about what is fetched, cached or keyed moves. A hostwhose home is read-only — a container or CI sandbox — can now run
dataset-backed ports and benches instead of dying with
OSError: [Errno 30] Read-only file systemunder~/.cache, and an existingcache is still found by default. One bullet in
docs/testing-guide.md's failuremodes,
changelog.d/1261-cache-root-env.md, and four tests intests/test_dataloader_cache_root.py(each variable, precedence, and theno-variable default).
Named risk:
tests/conftest.pygains an autouse fixture that deletesAGENTDESCENT_CACHEandXDG_CACHE_HOMEfor every test. It is needed becausethe root now reads the environment at call time: with the guard removed and
either variable exported, 30 existing cache tests fail (measured below). The
fixture is suite-wide, so a future test that wants either variable must set it
after the fixture, as the new file does.
Verification
Tip SHA: 789fb32
Measured at the previous head
dd45cd43d3443d2e62b4f69eb20fa90903082496;the
789fb32bnumbers are in the section below.Ran:
441ac2bd(red, my run): 4 failed — threeE OSError: [Errno 30] Read-only file system: '/home/xuke/.cache/agentdescent'from
cache_path, oneE AttributeError: module 'agentdescent.dataloader' has no attribute '_cache_root'pytest tests/test_dataloader_cache_root.py tests/test_dataloader.py tests/test_dataloader_cache_names.py tests/test_packaging.py tests/test_changelog_fragments.py→
113 passed in 4.37sXDG_CACHE_HOME=/tmp/leak-xdg AGENTDESCENT_CACHE=/tmp/leak-cache), guard on →55 passed in 2.56s;with the guard cut by hand →
30 failed, 21 passed in 4.01spython3 -m tools.changelog_fragments check→38 changelog fragment(s) OKNot run:
pytest -q— collection needsmarkdownfortests/test_docs_links.py(not installed, and site-packages is read-only on this host); the run with
that file ignored was still executing when this PR opened, so the CI
testlegs are the suite run
mkdocs build --strict— mkdocs is not installed on this host; the docschange is one bullet on an existing page, no nav change
Verification at 789fb32
Docs commit in this tip:
docs/bench-index.md's writable-$HOMEbullet nowpoints operators at
AGENTDESCENT_CACHE(orXDG_CACHE_HOME) instead of movingHOME, which also moves the Python user site; the flat~/.cache/agentdescent/lines in
docs/dataloader.mdanddocs/self-evolution-examples.mdnow name$XDG_CACHE_HOME/agentdescent, the~/.cache/agentdescentdefault, and theAGENTDESCENT_CACHEoverride.This tip merges
main 441ac2bdin — so thedocs/bench-index.mdadded by #1250is in the tree — and adds one docs commit on top; nothing outside the docs and
the fragment changed. Acceptance on this host, whose
~/.cacheis read-only andwhose
HOMEis untouched:AGENTDESCENT_CACHE=<fresh dir> AGENTDESCENT_GSM8K_SAMPLE=1 python3 -m bench.candidate_methods --dry-run→ exit 0;
algorithms=14, modes=3, repeats=1, reserved candidates=84, reserved proposal calls=108, workers=2; the dataset was cached under<fresh dir>/gsmhard/gsmhardv2.jsonl.The same command with
AGENTDESCENT_CACHEunset fails on this host withOSError: [Errno 30] Read-only file system: '/home/xuke/.cache/agentdescent'(measured at
dd45cd43).pytest tests/test_dataloader_cache_root.py tests/test_dataloader.py tests/test_dataloader_cache_names.py tests/test_packaging.py tests/test_changelog_fragments.py tests/test_bench_index.py→
116 passed in 4.20spython3 -m tools.changelog_fragments check→39 changelog fragment(s) OK(38 at
dd45cd43pluschangelog.d/1239-bench-index.md, brought in by themerge)
Full
pytest -qandmkdocs build --strictremain not run here for the reasonsabove; the CI
testlegs are the suite run.