Skip to content

jina fetch bypasses the reader cache so web fetch returns the page now - #2516

Closed
7vignesh wants to merge 2 commits into
Agent-Field:devfrom
7vignesh:fix/1771-jina-no-cache
Closed

7vignesh wants to merge 2 commits into
Agent-Field:devfrom
7vignesh:fix/1771-jina-no-cache

Conversation

@7vignesh

@7vignesh 7vignesh commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

What

codeaf web fetch https://example.com could return r.jina.ai's own stale cached snapshot (a "Test Document" page carrying Jina's cached-snapshot warning) instead of the live page. The model's web tool goes through the same reader, so a model asked to read a page could be handed someone else's cache of it without knowing.

Fixes #1771.

Fix

r.jina.ai caches a rendered page for an hour (lifetime 3600s). The fetch now sends x-no-cache: true, documented by Jina as bypassing the cached page, so what comes back is the page at that address now rather than a stale or foreign snapshot.

One line in internal/search/jina.go's Fetch. The keyed/unkeyed paths and verbatim-URL routing are unchanged.

Tested

  • New TestJinaFetchBypassesTheCache in internal/search/search_test.go asserts the fetch request carries x-no-cache: true (red before the fix, green after), using the package's existing httptest pattern - no network.
  • go test ./internal/search/ -count=1 passes; go vet ./internal/search/ clean.

Acceptance

The issue's e2e (codeaf web fetch https://example.com contains Example Domain) needs a live network and is not run in CI; the unit test covers the mechanism deterministically.

r.jina.ai caches a rendered page for an hour, so a plain fetch could
return a stale snapshot - and worse, someone else's cache of that
address, carrying Jina's own cached-snapshot warning. An agent handed
that cache reasons about the wrong page. Send x-no-cache: true so the
reader skips its cache and returns the page at that address now.

Fixes Agent-Field#1771
@7vignesh

7vignesh commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #1915, which the issue author opened first and which is the more complete fix.

Both send X-No-Cache: true, but #1915 also handles the case this PR misses: when r.jina.ai ignores the no-cache ask and still answers from its cache (X-Cache: HIT), it discards the snapshot and fetches the target directly, with tests for the fallback, its error naming, and the empty-body case. That second half is the part that actually closes the hole on the example.com repro, so there's no version of this PR that improves on #1915 without re-implementing it.

Deferring to #1915.

@7vignesh 7vignesh closed this Nov 8, 2026
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.

web fetch: https://example.com returns r.jina.ai's stale cached snapshot, not the page

1 participant