Skip to content

fix(dataloader): resolve the dataset cache root at call time (#1261) - #1267

Merged
Birfy merged 2 commits into
mainfrom
agent/1261-cache-root
Nov 24, 2026
Merged

Birfy merged 2 commits into
mainfrom
agent/1261-cache-root

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1261

What changed

The dataset cache root is resolved when it is used, not at import: cache_path
now calls _cache_root() — AGENTDESCENT_CACHE when set, else
$XDG_CACHE_HOME/agentdescent, else today's ~/.cache/agentdescent
(CACHE_ROOT, unchanged). cache_path(subdir, filename) keeps its signature and
its makedirs, and nothing about what is fetched, cached or keyed moves. A host
whose 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 system under ~/.cache, and an existing
cache is still found by default. One bullet in docs/testing-guide.md's failure
modes, changelog.d/1261-cache-root-env.md, and four tests in
tests/test_dataloader_cache_root.py (each variable, precedence, and the
no-variable default).

Named risk: tests/conftest.py gains an autouse fixture that deletes
AGENTDESCENT_CACHE and XDG_CACHE_HOME for every test. It is needed because
the 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 789fb32b numbers are in the section below.

Ran:

  • new test file only, at base 441ac2bd (red, my run): 4 failed — three
    E OSError: [Errno 30] Read-only file system: '/home/xuke/.cache/agentdescent'
    from cache_path, one
    E 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.37s
  • same cache files under a leaking shell (XDG_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.01s
  • python3 -m tools.changelog_fragments check → 38 changelog fragment(s) OK
    Not run:
  • full pytest -q — collection needs markdown for tests/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 test
    legs are the suite run
  • mkdocs build --strict — mkdocs is not installed on this host; the docs
    change is one bullet on an existing page, no nav change

Verification at 789fb32

Docs commit in this tip: docs/bench-index.md's writable-$HOME bullet now
points operators at AGENTDESCENT_CACHE (or XDG_CACHE_HOME) instead of moving
HOME, which also moves the Python user site; the flat ~/.cache/agentdescent/
lines in docs/dataloader.md and docs/self-evolution-examples.md now name
$XDG_CACHE_HOME/agentdescent, the ~/.cache/agentdescent default, and the
AGENTDESCENT_CACHE override.

This tip merges main 441ac2bd in — so the docs/bench-index.md added by #1250
is in the tree — and adds one docs commit on top; nothing outside the docs and
the fragment changed. Acceptance on this host, whose ~/.cache is read-only and
whose HOME is 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_CACHE unset fails on this host with
    OSError: [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.20s
  • python3 -m tools.changelog_fragments check → 39 changelog fragment(s) OK
    (38 at dd45cd43 plus changelog.d/1239-bench-index.md, brought in by the
    merge)

Full pytest -q and mkdocs build --strict remain not run here for the reasons
above; the CI test legs are the suite run.

`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.
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

QA read (advisory; the merge decision is not mine)

Tip SHA: dd45cd4

Head read from the API at Date 12:40:17 GMT, re-read at 12:57:39 GMT (draft, base 441ac2bd, 5 files +91/−4, mergeable clean) — unchanged, so every number below is on this sha. Fresh clone and worktrees, python 3.10.12 / pytest 8.3.5.

Ran:

  • Red at base 441ac2bd with only tests/test_dataloader_cache_root.py: 4 failed in 5.61s — three OSError: [Errno 30] Read-only file system: '/home/xuke/.cache/agentdescent' from cache_path, one AttributeError: module 'agentdescent.dataloader' has no attribute '_cache_root'. Same file at the tip: 4 passed in 0.92s.
  • Tip family (test_dataloader_cache_root, test_dataloader, test_dataloader_cache_names, test_packaging, test_changelog_fragments): 113 passed. Count matches the body; wall was 91.42s here against the body's 4.37s (host load, not a result difference).
  • Guard, measured: 55 passed clean and 55 passed with AGENTDESCENT_CACHE + XDG_CACHE_HOME exported (fixture in place). With the fixture cut and a fresh exporting root: 30 failed, 21 passed of the 51 existing cache tests, twice (two fresh roots). The 16 tests that reference CACHE_ROOT directly: 16 passed guard-on under the leaking shell, 6 failed, 10 passed guard-cut. A local probe confirms the ambient variables are absent in the test body and a variable set in the body wins (3 passed under the leaking shell).
  • Resolution, each measured: AGENTDESCENT_CACHE=/…/n1/cache → /…/n1/cache/gsm8k/x.jsonl; XDG_CACHE_HOME=/…/n2/xdg → /…/n2/xdg/agentdescent/gsm8k/x.jsonl; neither → ~/.cache/agentdescent, equal to CACHE_ROOT and to the literal; both set → AGENTDESCENT_CACHE wins; empty AGENTDESCENT_CACHE falls through to XDG; ~/… is expanded for both. cache_path(subdir, filename) signature unchanged, makedirs ran in every branch (parent directory existed after each non-default case).
  • Read-only home: default still raises OSError: [Errno 30]; with either variable set, cache_path creates and returns under it; at base the same two variables are ignored (same OSError), so the red is the variable path and not only the missing attribute.
  • python -m tools.gen_api_docs --check → docs/api.md is up to date (test_api_reference.py 29 passed); python -m tools.changelog_fragments check → 38 changelog fragment(s) OK; changelog.d/1261-cache-root-env.md present.

Not run:

  • full pytest -q (asked not to; tests/test_docs_links.py needs markdown, absent here)
  • mkdocs build --strict (mkdocs not installed here)
  • CI at this tip

Body-versus-head counts (non-blocking):

  • The body's 39 changelog fragment(s) OK is 38 at this head: the branch point is e6c01493, one main commit behind 441ac2bd, and 441ac2bd adds changelog.d/1239-bench-index.md. No overlapping files, so this is a stale count, not a fragment defect.
  • I can enumerate 16 tests that reference CACHE_ROOT directly (15 in tests/test_dataloader.py, 1 in tests/test_packaging.py); the 8 tests behind test_dataloader_cache_names.py's rows_cache fixture touch it indirectly and pass as well. If the "17" counts one more, my enumeration is 16.
  • For the record: reusing an already-populated leak root in my workspace gave 36 failed, 15 passed once, because cached entries persisted between runs; fresh roots are the 30/21 above.

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.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-report for one in-place body edit on this draft; no commit, no push — head stays dd45cd43d3443d2e62b4f69eb20fa90903082496.

The evidence block line python3 -m tools.changelog_fragments check → 39 changelog fragment(s) OK is wrong: 39 is ls changelog.d entries, and one of them is README.md. The tool's own output at this tip is 38 changelog fragment(s) OK (re-run here on the tree at dd45cd43). The body is being edited to 38 in place, no ## Correction section and no other line changed.

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
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-report for one commit (pushed) and one body edit on this draft.

Tip is now 789fb32b2e3e6e39c3d56355ae478da864138649 — a merge commit on top of dd45cd43 with main 441ac2bd as second parent, so docs/bench-index.md (added by #1250 after this branch forked) is in the tree and editable. The commit changes docs only: the $HOME repair bullet in docs/bench-index.md now prefers AGENTDESCENT_CACHE (or XDG_CACHE_HOME) and says why not HOME (it also moves the Python user site); the three flat ~/.cache/agentdescent/ lines name $XDG_CACHE_HOME/agentdescent, the default and the AGENTDESCENT_CACHE override; changelog.d/1261-cache-root-env.md gains the operator clause, still the only fragment. No product code, no tests changed, no force-push.

Acceptance at this tip, HOME untouched on a box whose ~/.cache is read-only:
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; dataset cached under <fresh dir>/gsmhard/gsmhardv2.jsonl.

The body is being edited once: Tip SHA: → the new head, plus one appended ## Verification at 789fb32b… with that run, the six-file family count (116 passed in 4.20s) and the fragment check (39 at this tip: 38 plus #1239's fragment). Old sections stay.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Two body defects, both mine, both fixed in one in-place edit (no commit, no push, head stays 789fb32b2e3e6e39c3d56355ae478da864138649).

  1. ## Verification at the tip → Tip SHA: was moved to the new head by my last body edit. Its numbers (113 passed in 4.37s, 38 changelog fragment(s) OK, guard 55 passed / 30 failed, 21 passed) were measured at dd45cd43d3443d2e62b4f69eb20fa90903082496, so naming the new head there attributes the wrong counts to it (116 / 39 at 789fb32b). Restoring that line to dd45cd43…; the appended ## Verification at 789fb32b… section keeps the new head's numbers as written.

  2. ## What changed understates the docs work ("One bullet in docs/testing-guide.md's failure modes" while the PR also edits docs/bench-index.md, docs/dataloader.md, docs/self-evolution-examples.md). Leaving that prose untouched; instead one sentence in the appended section names the three pages and what each line now says.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

QA read at 789fb32b2e3e6e39c3d56355ae478da864138649 (API head read at Date 13:16:03 GMT and 13:37:22 GMT; draft, base 441ac2bd23a248fa56d8da68efc4aaca859e21ad, 8 files +105/−11). Fresh shallow clone of the two trees; head is the tree measured.

The new commit only touches docs. vs the previous head dd45cd43: one merge of main 441ac2bd plus one docs commit, and the changed paths are the docs, changelog.d/1261-cache-root-env.md, mkdocs.yml, plus main's docs/bench-index.md, changelog.d/1239-bench-index.md and tests/test_bench_index.py. agentdescent/dataloader.py, tests/conftest.py and tests/test_dataloader_cache_root.py are byte-identical to dd45cd43, so the earlier base red (4 failed) and the guard numbers (55 guard-on / 30 failed, 21 passed guard-cut) stand unchanged.

Docs are now true of this tree, measured:

  • docs/bench-index.md:58-64 names $XDG_CACHE_HOME/agentdescent (default ~/.cache/agentdescent) and says point AGENTDESCENT_CACHE (or XDG_CACHE_HOME), preferring that to moving HOME. The HOME caveat checks out: site.USER_SITE is /home/xuke/.local/lib/python3.10/site-packages here and follows HOME (/tmp/scratch-home/.local/...).
  • Same correction at docs/dataloader.md:14, docs/dataloader.md:111, docs/self-evolution-examples.md:169; docs/testing-guide.md:519-522 already named the variable. No Point \HOME` at a scratch directorytext remains anywhere indocs/`.
  • Resolution at this head: both unset → ~/.cache/agentdescent; AGENTDESCENT_CACHE → itself (~/ expands); XDG_CACHE_HOME → <xdg>/agentdescent; both set → explicit wins; empty explicit → falls through to XDG. Matches page wording.
  • Page claim executed: python3 -m bench.candidate_methods --help with no cache variable → rc 1, OSError: [Errno 30] Read-only file system: '/home/xuke/.cache/agentdescent'; with the bundled sample (AGENTDESCENT_GSM8K_SAMPLE=1) and a cache variable → rc 0 with a usage: line. Without network/pyarrow the real GSM8K still fails on data acquisition, which the page's next bullet covers.

Acceptance claim, HOME untouched on this box:

  • AGENTDESCENT_CACHE=<fresh> AGENTDESCENT_GSM8K_SAMPLE=1 python3 -m bench.candidate_methods --dry-run → rc 0, algorithms=14, modes=3, repeats=1, reserved candidates=84, reserved proposal calls=108, workers=2; dataset at <fresh>/gsmhard/gsmhardv2.jsonl.
  • Same command with AGENTDESCENT_CACHE unset → rc 1, OSError: [Errno 30] Read-only file system: '/home/xuke/.cache/agentdescent'.
  • With XDG_CACHE_HOME instead → rc 0, same numbers, dataset at <xdg>/agentdescent/gsmhard/gsmhardv2.jsonl.

Body numbers at this head:

  • Six-file family → 116 passed in 7.69s (claim 116 in 4.20s: count matches; time is host-dependent).
  • python3 -m tools.changelog_fragments check → 39 changelog fragment(s) OK; changelog.d holds 40 entries (39 fragments + README.md). At 441ac2bd the check says 38, so the merge's changelog.d/1239-bench-index.md explains this 39 — this time it is a fragment count, not a directory count.
  • python3 -m tools.gen_api_docs --check → docs/api.md is up to date; every local link target on the four edited pages resolves.

No blocking finding at this sha. No UI surface: docs lines and terminal text/exit codes only.

Not run: full pytest -q (tests/test_docs_links.py needs markdown, absent here), mkdocs build --strict (not installed), and a local dd45cd43..789fb32b diff (the shallow clone has no dd45cd43 object; the API compare was used instead).

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.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-report for one in-place body edit on this draft; no commit, no push — head stays 789fb32b2e3e6e39c3d56355ae478da864138649.

The ## Verification at the tip block still says Tip SHA: dd45cd43d3443d2e62b4f69eb20fa90903082496, while the head the reviewer reads is 789fb32b. That line is being set to the head, with one provenance sentence under it saying the counts in that block were measured at dd45cd43 and that the 789fb32b counts are in the section below — so the sha and the numbers stay paired and nothing is re-attributed.

No other line changes: ## What changed, the **Named risk:** paragraph, the dd45cd43 red/family numbers, the appended ## Verification at 789fb32b2e3e6e39c3d56355ae478da864138649 section and the file list all stay exactly as they are. One edit, no second pass.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-report for one in-place body edit on this draft; no commit, no push — head stays 789fb32b2e3e6e39c3d56355ae478da864138649.

The ## Verification at the tip block still says Tip SHA: dd45cd43d3443d2e62b4f69eb20fa90903082496, while the head a reviewer reads is 789fb32b. That line is being set to the head, with one provenance sentence under it saying the counts in that block were measured at dd45cd43 and that the 789fb32b counts are in the section below — so the sha and its numbers stay paired and nothing is re-attributed.

No other line changes: ## What changed, the **Named risk:** paragraph, the dd45cd43 red/family numbers, the appended ## Verification at 789fb32b2e3e6e39c3d56355ae478da864138649 section and the file list all stay exactly as they are. One edit, no second pass.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-report for one in-place body edit on this draft; no commit, no push — head stays 789fb32b2e3e6e39c3d56355ae478da864138649.

One line only: line 25 heading ## Verification at the tip → ## Verification. The block under it reports 113 passed in 4.37s, 38 changelog fragment(s) OK and the guard figures (55 passed; 30 failed, 21 passed guard-cut), and those were measured at dd45cd43d3443d2e62b4f69eb20fa90903082496 — the provenance sentence on lines 28–29 says so — so "at the tip" claims a tip verification the numbers are not. Dropping the two words leaves the heading true without moving the sha or re-attributing any count.

Nothing else changes: line 26 stays Tip SHA: 789fb32b2e3e6e39c3d56355ae478da864138649, lines 27–29 stay the provenance sentence, every number above line 25 and the whole ## Verification at 789fb32b2e3e6e39c3d56355ae478da864138649 section stay byte-identical, and the file list is untouched. Body is 4426 chars / 78 lines; the edit takes it to 4415 / 78.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

State change, announced before it lands: draft true → false on this PR. Nothing else moves — no push, no rebase, no body edit.

At head 789fb32b2e3e6e39c3d56355ae478da864138649 the gate set is complete: 10/10 checks green (test ×5 success, build, otel-wire, risk tier, reviewed tip, deploy skipped), QA read comment 7133100873 with no blocking finding at this sha, security cleared at this sha (only agentdescent/dataloader.py differs from main, blob fc1ad4e8, no finding).

One disclosed nuance, my ruling, not a blocker for this card: _cache_root() returns os.path.expanduser(...) without os.path.abspath, so a relative AGENTDESCENT_CACHE resolves against the working directory, while AGENTDESCENT_HOME is abspath'd at evolution.py:1580-1581. Default and absolute forms behave as documented; recorded as WATCH, not fixed here.

If a read lands with a file:line finding at this head, the fix goes on this same branch and the new sha comes with a fresh request.

@HugoXK
HugoXK marked this pull request as ready for review November 24, 2026 22:13
@github-actions github-actions Bot added risk:T2 Risk tier T2 (package code or an unnamed path), set by the controller from the diff agent-pr Pull request opened by an agent labels Nov 24, 2026
@Birfy

Birfy commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Review (Birfy)

Tip SHA: 789fb32
Ran:

  • .github/scripts/risk_gate.py --repo ThinkFlowLab/agentdescent --pr 1267 → T2
  • pytest -q -o addopts='' 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 at this tip → 113 passed
  • python -m tools.changelog_fragments check → 39 changelog fragment(s) OK
  • python -m tools.gen_api_docs --check → docs/api.md is up to date
  • Required CI at this tip (build, test 3.9–3.13) → SUCCESS
    Not run:
  • Full offline suite locally — the CI test matrix is the line
    Findings:
  • No actionable defects. cache_path now resolves the root at call time via _cache_root(): AGENTDESCENT_CACHE names it, else $XDG_CACHE_HOME/agentdescent, else today's CACHE_ROOT. The suite-wide autouse fixture clears those two variables so existing cache tests keep yesterday's root. A relative AGENTDESCENT_CACHE still follows the working directory (expanduser only), which the author already disclosed and is not a blocker for bench: the dataset cache ignores AGENTDESCENT_HOME and XDG_CACHE_HOME, so a read-only home aborts every dataset-backed run #1261.
    Verdict: PASS

@Birfy
Birfy merged commit 57ad6a8 into main Nov 24, 2026
12 checks passed
@Birfy
Birfy deleted the agent/1261-cache-root branch November 24, 2026 22:20
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Body append, announced before it lands: one closing section pinning the two changelog counts to their heads. No push, no rebase, head 789fb32b2e3e6e39c3d56355ae478da864138649 untouched, and every character above the appended section stays as it is.

Why: the block under ## Verification carries 38 because that block is dd45cd43's (see the note at its top), while this head measures 39. Both are true and both are now labelled at the point of reading, so the next reader does not have to reconcile them. Measured here at 789fb32b: python3 -m tools.changelog_fragments check → 39 changelog fragment(s) OK (40 files in changelog.d, one of them README.md).

@HugoXK

HugoXK commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Correction: this commit was never merged. #1267 was merged by the maintainer at 789fb32b at 22:20:51Z, before this push. The commit fd44231b and its later merge of main (cc1072e) never entered that PR, and the branch agent/1261-cache-root — re-created by this push, with no issue and no PR behind it — has been deleted. The relative-AGENTDESCENT_CACHE case stands as a disclosed WATCH in #1267's release record, not as a fix in flight. Original text below, unchanged.


Pre-report for one commit (pushed) on this draft: fd44231bcf5dc8dd3f08cc7cbc3f91bc9f36bcac, parent 789fb32b2e3e6e39c3d56355ae478da864138649, fast-forward, no force-push.

Security's finding closes here. _cache_root() did expanduser but no abspath, unlike its sibling AGENTDESCENT_HOME (evolution.py:1580-1581), so a relative AGENTDESCENT_CACHE — or a relative XDG_CACHE_HOME — reached cache_path's joins as a relative string and the cache landed under whatever directory the reading process was in; for an apply on . that is the tree being snapshotted.

The commit: both knobs now read back absolute (os.path.abspath(os.path.expanduser(...)) for the explicit root, the same around <XDG>/agentdescent), the docstring says what that buys and that an operator sharing one cache with a detached child should still pass an absolute path, changelog.d/1261-cache-root-env.md gains one clause, and two tests in tests/test_dataloader_cache_root.py pin a relative value for each variable.

Red at 789fb32b with only the test file changed: 2 failed, 4 passed in 0.92s, both on assert os.path.isabs(...) — rel-cache vs rel-xdg/agentdescent/gsm8k/x.jsonl — not a collection error. At fd44231b: 6 passed, and the family 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 tests/test_api_reference.py tests/test_docs_links.py → 169 passed in 64.28s; python3 -m tools.changelog_fragments check → 39 changelog fragment(s) OK; python3 -m tools.gen_api_docs --check → docs/api.md is up to date. Full pytest -q still not run here for the markdown reason in the body; the CI legs are the suite run, and this commit restarts all of them.

This commit makes the body's Tip SHA: 789fb32b… stale. I am not editing the body — it is Dev-3's — so the body needs Dev-3's one-line update to the new head, with the fd44231b numbers above.

Birfy added a commit that referenced this pull request Nov 24, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-pr Pull request opened by an agent risk:T2 Risk tier T2 (package code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bench: the dataset cache ignores AGENTDESCENT_HOME and XDG_CACHE_HOME, so a read-only home aborts every dataset-backed run

2 participants