ECO-2484: feat(datasets): cache HF rows pages and task repo checkouts on disk - #44
Open
abhinav-pola wants to merge 8 commits into
Open
ECO-2484: feat(datasets): cache HF rows pages and task repo checkouts on disk#44abhinav-pola wants to merge 8 commits into
abhinav-pola wants to merge 8 commits into
Conversation
HF /rows pages are cached per (dataset, config, split, revision, offset) under BENCH_DATASET_CACHE_DIR (default ~/.cache/openrouter-bench-harness); revision-pinned pages never expire, unpinned (HEAD) pages use a 24h TTL (BENCH_HF_CACHE_TTL_MS). GitHub task sources clone into stable <cache>/repos/<label>-<commit> dirs reused across runs and processes instead of a fresh tmp dir per process. BENCH_DATASET_CACHE_DISABLE=1 bypasses the cache entirely; cache write failures never fail a run. Closes ECO-2484.
abhinav-pola
force-pushed
the
feat/dataset-cache
branch
from
August 19, 2026 21:47
ee5a7aa to
dd96a88
Compare
…leakage - disable the on-disk cache by default under bun test unless BENCH_DATASET_CACHE_DIR is set, so stubbed fetch responses never leak into (or get served from) the developer's real cache - clone task repos into a private staging dir and atomically rename it into the shared path, so concurrent runs never delete a checkout another process is cloning into or reading from; corrupt leftovers are replaced wholesale - scope HF rows cache entries by a hash of the HF token so gated dataset contents are never served to callers without that token, and write cache files with owner-only permissions
…kouts - key shared-checkout replacement on a completion marker written only after a successful checkout, so a transient git-probe failure can never cause a valid in-use checkout to be deleted; marked-but-incomplete shared dirs are never deleted (error asks for manual removal) - remove the staging dir when a clone fails, so failed downloads no longer accumulate partial copies in the cache - create <cache>/repos with mode 0o700 and strip group/other permissions from published checkouts before rename
Contributor
Author
|
Addressed the remaining review findings in ed8c5a3:
|
…ten perms - an empty tasks-dir override (BENCH_TASKS_DIR / BENCH_<BENCH>_TASKS_DIR) is once again the clone target even when a shared cache checkout exists, restoring the pre-cache precedence for users who pin the checkout location - sweep .staging- dirs older than 24h from <cache>/repos before each clone, so staging copies abandoned by killed processes no longer accumulate; publishStagedCheckout also cleans staging when the replacement path throws - mkdirOwnerOnly chmods the target dir even when it pre-exists, so cache dirs created by older versions or loose operator-provided paths get tightened to 0700 instead of keeping inherited group/world-traversable permissions
Contributor
Author
|
Addressed the latest review findings in ec8d328:
|
…ges too Gated dataset rows cached under a pinned revision previously never expired, leaving restricted content on disk indefinitely with no eviction path. An explicitly configured TTL now applies to pinned entries as well, giving operators a data-retention lever; the default semantics (pinned never expires, unpinned 24h) are unchanged.
Contributor
Author
|
Addressed the residual retention concern in a76db84, plus design context: Change: an explicitly set Design context on the residual risk (why long-lived caching of gated rows is intended here):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes ECO-2484 — stop re-fetching HF/GitHub task datasets on every run.
/rowspages cached on disk per (token scope, dataset, config, split, revision, offset) underBENCH_DATASET_CACHE_DIR(default~/.cache/openrouter-bench-harness). Revision-pinned pages never expire; unpinned (HEAD) pages use a 24h TTL (BENCH_HF_CACHE_TTL_MS).<cache>/repos/<label>-<commit>dirs reused across runs and processes, instead of a fresh tmp dir per process.BENCH_DATASET_CACHE_DISABLE=1bypasses the cache entirely; cache write failures never fail a run.Review hardening (from Devin review)
bun testthe on-disk cache is disabled by default unlessBENCH_DATASET_CACHE_DIRis set (orBENCH_DATASET_CACHE_DISABLE=0opts in explicitly). Tests that stubfetchcan no longer persist fake rows into — or read stale entries from — the developer's real cache. The terminal-bench network integration test opts in explicitly since it intentionally reuses the shared checkout.renamed into the shared path (publishStagedCheckoutinsrc/datasets/local-cache.ts). Replacement of an existing shared dir is decided by a.bench-checkout-completemarker written only after a successful checkout (a plainstatSync— no git spawn that could transiently fail and cause a false-negative deletion of an in-use checkout): a marked dir is always reused (or errors out asking for manual removal if its tasks are missing), a marker-less dir was never adopted by any process running this code and is safely replaced wholesale. Checkouts are also only reused on the fast path when the marker, the pinned commit, and the tasks dir all check out.HF_TOKENare keyed by a hash of the token (under<cache>/hf/<token-scope>/...), so gated dataset contents are never served to callers without that token. Cache files are written0o600, and<cache>/reposplus published task-repo checkouts have group/other permissions stripped (0o700dirs,0o600/0o700files) before publishing.Test plan
bun run format:checkbun run check(0 errors)bun run typecheck(0 errors)bun test— 1379 pass, 0 fail (incl.local-cachemarker/permissions/publishStagedCheckouttests,huggingface-cachetoken-scoping, and harbor shared-checkout tests covering staging cleanup on clone failure, owner-only permissions, marker-gated reuse, and corrupt-leftover replacement)bun run build~/.cache/openrouter-bench-harnessuntouched (removed the pre-existing poisonedhf/entries written by the old mmlu-pro test)