Skip to content

fix(datasets): validate, gate, and drain cached file fetches; single retry owner for banking - #79

Merged
abhinav-pola merged 2 commits into
mainfrom
devin/1788975023-cached-file-hardening
Sep 9, 2026
Merged

fix(datasets): validate, gate, and drain cached file fetches; single retry owner for banking#79
abhinav-pola merged 2 commits into
mainfrom
devin/1788975023-cached-file-hardening

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

TL;DR

Hardens fetchCachedTextFile (added in #75/#78) against four issues found by Devin Review on the downstream subtree sync (openrouter-web#41251): cache poisoning by malformed 200s, ignored BENCH_DATASET_CACHE_DISABLE, unreleased error bodies, and multiplied retries in the banking dataset.

What changed?

  • cached-file.ts
    • New optional validate?: (text) => string | undefined on CachedTextFileRequest; a rejected body fails with CachedFileError (no status, so not retried) and is not written to the cache.
    • New jsonTextValidator("object" | "array") helper.
    • store.enabled is now honored before both readJson and writeJson (mirrors the HF page cache).
    • Non-2xx responses drain their body (ignore(response.text)) before failing.
  • tau-bench-airline/environment.ts: db.json fetch uses jsonTextValidator("object").
  • tau3-bench-banking/environment.ts: ensureBankingData/ensureBankingTasks accept an optional RetryConfig and validate db.json (object) / tasks.json (array).
  • tau3-bench-banking/dataset.ts: drops the outer retry(hfFetchRetrySchedule(retryConfig)) and threads retryConfig into ensureBankingTasks, so maxRetries bounds origin requests exactly once.

Why?

The tau file cache keys on immutable URLs with no TTL, so a single malformed 200 (e.g. an HTML rate-limit page) would be served forever from disk/GCS. Banking retries were (inner 3 default) × (outer maxRetries), so maxRetries=0 still made 4 requests.

How to test

bun test src/datasets/cached-file.test.ts src/benchmarks/tau3-bench-banking

New cases: validator rejects a 200 body without caching or retrying; disabled store sees zero reads/writes; failed response bodyUsed === true; banking maxRetries: 0 makes exactly one request.

Benchmark impact

No score change. Failure mode changes: a malformed dataset download now fails the run instead of silently caching bad data.

Reviewer focus

  • ensureBankingData/ensureBankingTasks signature gains an optional trailing param — backward compatible; the solver call sites still use defaults.
  • Whether draining (vs. cancelling) the error body is acceptable for the FetchHttpClient.

Checklist

  • Tests cover changed behavior
  • Public API or configuration changes are backward compatible, or the break is documented
  • Benchmark changes document dataset provenance and licensing
  • No credentials, private results, or restricted dataset contents are included
  • Documentation is updated where needed

Link to Devin session: https://openrouter.devinenterprise.com/sessions/949ffdf48c7843febc66e0c2d8dc8486
Open in Devin Desktop: https://openrouter.devinenterprise.com/desktop/session/949ffdf48c7843febc66e0c2d8dc8486?variant=devin
Requested by: @abhinav-pola

…retry owner for banking

Co-Authored-By: Abhinav Pola <abhinav.pola@openrouter.ai>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Abhinav

SYSTEM:
<latest_message>
Abhinav Pola (U090K0G7JF3) [ts=1788974411.868429]: @Devinsync benchmark harness subtree
</latest_message>

=== BEGIN THREAD HISTORY (in #ecosystem-agents) ===
Abhinav Pola (U090K0G7JF3) [ts=1788974411.868429]: @Devinsync benchmark harness subtree
=== END THREAD HISTORY ===
Channel ID: C0BU53A7VEH
Thread URL: https://openrouter.slack.com/archives/C0BU53A7VEH/p1788974411868429?thread_ts=1788974411.868429&amp;cid=C0BU53A7VEH

The <latest_message> is the message that you should use to guide your goals + task for this session, and you should use the rest of the slack thread as context.
A [ts=...] marker on a Slack message is that message's timestamp. To act on a specific message with the slack tool (e.g. adding an emoji reaction via the reaction command), pass that value as timestamp along with the Channel ID — no extra lookup call is needed.

Co-Authored-By: Abhinav Pola <abhinav.pola@openrouter.ai>
@abhinav-pola
abhinav-pola merged commit 689ac6a into main Sep 9, 2026
4 checks passed
@abhinav-pola
abhinav-pola deleted the devin/1788975023-cached-file-hardening branch September 9, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant