Skip to content

examples: skill_evolution and the ADAS hard-cache still mkdir under ~/.cache after #1267 #1273

Done

Description

@Birfy

Problem

#1267 made agentdescent.dataloader.cache_path resolve the dataset cache root at call time (AGENTDESCENT_CACHE, else $XDG_CACHE_HOME/agentdescent, else ~/.cache/agentdescent). Two example ports still hardcode the default home path and makedirs it themselves, so a read-only-$HOME host that already set the new knob still dies with OSError: [Errno 30] Read-only file system when it actually runs those ports.

Measured at main 57ad6a83aa077f84c03a152e8d378c7afeb9f27c (the #1267 tip):

  • examples/skill_evolution.py sets CACHE_DIR = os.path.expanduser("~/.cache/agentdescent/bbh") at line 42 and os.makedirs(CACHE_DIR, exist_ok=True) in download_bbh (line 50). A --dry-run that fetches BBH still writes under ~/.cache.
  • examples/adas/adas_meta_agent_search.py _HardCache.__init__ (line 752) does os.path.join(os.path.expanduser("~/.cache/agentdescent"), "mgsm", "hard") and os.makedirs(root, exist_ok=True) when the hard-subset cache is enabled.

The other ports already go through cache_path (for example examples/_gsm8k_domain.py and the ERA helpers). These two were left behind.

Fix

Route both sites through agentdescent.dataloader.cache_path, the same public helper #1267 updated:

  • download_bbh should use cache_path("bbh", f"{task}.json") and drop CACHE_DIR.
  • _HardCache should use cache_path("mgsm/hard", f"direct_{key}.json") when the cache is enabled, and must not create a directory when it is disabled (today it also skips makedirs in that case).

Acceptance

  • Red first: on 57ad6a83, the two paths are the hardcoded ~/.cache/agentdescent/... strings (confirmed by reading the files). After the change, a test that sets AGENTDESCENT_CACHE to a temp directory and calls download_bbh (with urlopen mocked) writes only under that temp directory; constructing _HardCache(model, enabled=True) places direct_*.json under <temp>/mgsm/hard/ and does not create ~/.cache/agentdescent. With enabled=False, no directory is created.
  • Default with neither variable set stays ~/.cache/agentdescent/... as today.
  • No network or model call in the new tests. No change to which files are cached, the cache key, or CLI flags.
  • python -m tools.changelog_fragments check and a changelog fragment; docs/api.md unchanged.

Activity

  1. added
    bug
    area:ports
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:portsbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions