fix(fetch): add fallback for streaming SSR content and support configurable timeout - #4659
Open
AbhiPra24 wants to merge 1 commit into
Conversation
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
Fixes #3878 and #4448.
1. Fallback for Progressive/Streaming SSR Content (Fixes #3878)
readabilipy) strips HTML elements styled withvisibility: hiddenor off-screen positioning commonly used in modern SSR skeleton hydration (Next.js, Remix). Only the loading shell text survived, silently dropping up to 85% of the page.extract_content_from_html(), if Readability returns empty content or extracted content that is significantly shorter than the source HTML (< len(html) * 0.05), fall back to markdownifying the source HTML directly viamarkdownify.2. Configurable Timeout (Fixes #4448)
fetch_url.DEFAULT_TIMEOUT = 30.0, support forMCP_FETCH_TIMEOUTenvironment variable,--timeoutCLI flag, and an optionaltimeoutparameter in theFetchtool input schema.Verification
src/fetch/tests/test_server.pycovering SSR fallback, timeout resolution precedence, robots.txt timeout, and Fetch model validation.pytest: 36/36 passed.ruff checkandpyright: 0 errors.cc @olaservo for review when available. Thank you!