You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add CrawlerRunConfig.body_visibility_timeout, defaulting to the existing 30-second behavior, and use it for the body visibility check. This lets callers lower the ceiling for pages whose body remains hidden without changing the default crawl behavior. The value is included in config serialization and the untrusted-config allowlist.
List of files changed and why
crawl4ai/async_configs.py - define, document, serialize, and allow the new configuration field.
crawl4ai/async_crawler_strategy.py - pass the configured timeout to the body visibility wait.
tests/test_config_defaults.py - cover the unchanged default and custom-value dump/load round trip.
uv run --python 3.12 --with ruff ruff check --select E9,F63,F7,F82 --ignore F821 crawl4ai/async_configs.py crawl4ai/async_crawler_strategy.py tests/test_config_defaults.py — passed. (F821 is excluded because of the existing VirtualScrollConfig forward-reference finding in async_crawler_strategy.py.)
@nightcityblade Thanks — approach looks right. Default stays 30000 so nobody's existing crawls change, and I checked the plumbing: from_kwargs reads the __init__ signature so that path is covered automatically, and clone/dump/load all go through to_dict, which you updated. Allowlist entry is in the right set too.
Three things before merge:
Docs. docs/md_v2/api/parameters.md and docs/md_v2/complete-sdk-reference.md both document ignore_body_visibility and should get the new option too. The docstring alone isn't enough.
The timeout goes straight into JavaScript at async_crawler_strategy.py:324. Passing None renders > None and blows up as a RuntimeError. That's pre-existing, but this PR makes it reachable from user input, including over the Docker API now that it's allowlisted. Worth a basic check on the value.
The test only checks the default and a dump/load round trip. Nothing verifies the value actually reaches csp_compliant_wait — the test would still pass if the call site kept using 30000. A mock asserting the timeout that gets passed would cover the real thing.
Separate from this PR: even after it lands, the default path still spends 30 silent seconds on these pages. csp_compliant_wait returns False on timeout instead of raising, so nothing is logged and the crawl reports success. @mvletter had to profile the pipeline to find it. A debug log when that wait times out would make this option discoverable — happy to do it as a follow-up rather than expand the scope 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
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 #2129.
Add
CrawlerRunConfig.body_visibility_timeout, defaulting to the existing 30-second behavior, and use it for the body visibility check. This lets callers lower the ceiling for pages whose body remains hidden without changing the default crawl behavior. The value is included in config serialization and the untrusted-config allowlist.List of files changed and why
crawl4ai/async_configs.py- define, document, serialize, and allow the new configuration field.crawl4ai/async_crawler_strategy.py- pass the configured timeout to the body visibility wait.tests/test_config_defaults.py- cover the unchanged default and custom-value dump/load round trip.How Has This Been Tested?
uv run --python 3.12 --with pytest python -m pytest tests/test_config_defaults.py -q— 33 passed, 1 existing deprecation warning.uv run --python 3.12 --with ruff ruff check --select E9,F63,F7,F82 --ignore F821 crawl4ai/async_configs.py crawl4ai/async_crawler_strategy.py tests/test_config_defaults.py— passed. (F821is excluded because of the existingVirtualScrollConfigforward-reference finding inasync_crawler_strategy.py.)python3 -m compileall -q crawl4ai/async_configs.py crawl4ai/async_crawler_strategy.py tests/test_config_defaults.py— passed.git diff --check— passed.Checklist: