**fix(harness): route 202/499 and JS-shell pages through jina reader** - #524
Open
michaelatamuk wants to merge 1 commit into
Open
Conversation
fetch_webpage returns a raw HTTP GET, so JS-rendered pages (weatherspark) came back as a 202 "empty" shell, and paywalled sites (climate-data.org, HTTP 499 "Pay for usage") hard-failed. Both are cases the jina.ai reader is designed for, but the fallback only fired on 401/403/429. - add 202 (soft-block) and 499 (paywall) to the jina fallback status set - after HTML extraction, if the body was non-empty but yielded no title/text (a JS-rendered shell), fall back to the reader as well
|
head_sha: 变更摘要此 PR 扩展了 主要改动
|
|
head_sha: 代码审查✅ 未发现问题 |
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.
Paired: GitHub #524 ↔ GitCode !2322
What type of PR is this?
/kind bugfix
What does this PR do / why do we need it
This PR expands the
fetch_webpagefallback logic so that JS-rendered pages (HTTP 202) and paywalled/anti‑bot pages (HTTP 499) are routed through the jina.ai reader, which performs server‑side rendering.Without this fix, the tool returned empty shells or hard errors for these pages, even though the reader can often retrieve real content.
This resolves **Bug #523 **: fetch_webpage returns empty/errors for JS-rendered and paywalled pages (202 / 499).
Problem
Non‑technical
Many modern websites do not return meaningful HTML to a plain HTTP GET:
The agent sees either:
Status: 202 / Content: [empty]HTTP 499; response body: Pay for usageeven though the page has real content when opened in a browser.
Technical
fetch_webpage:Two common failure modes were not recognized:
202 soft-block / JS shell
499 paywall
This caused repeated failures and prevented the agent from accessing real page content.
Solution
Non‑technical
Route both 202 and 499 responses through the jina.ai reader, and also fall back when HTML extraction yields no meaningful content.
This recovers real page text for JS-rendered and paywalled sites whenever the reader can fetch them.
Technical
The fix adds:
After HTML extraction, if the response body was non-empty but produced no title and no text, treat it as a JS-rendered shell and fall back to the reader.
This ensures:
Expected Impact
[empty]Validation
python -m py_compile openjiuwen/harness/tools/web/fetch_webpage.pypassesLinked Closing Issues: