improve(web-fetch): speed up provider fallback loading - #98559
Conversation
|
Codex review: stale review; fresh review needed. Summary Next step Review history (5 earlier review cycles)
|
988776d to
1b67241
Compare
1b67241 to
4721b4b
Compare
4721b4b to
06d0392
Compare
|
Land-ready maintainer proof for exact head
Best-fix verdict: yes. Provider discovery caching lives at the shared runtime owner, bundled Firecrawl resolution stays behind canonical activation policy, external providers retain the full-loader fallback, and credentials are still read per selection. No known proof gaps block landing. |
06d0392 to
50d130d
Compare
|
Updated land-ready maintainer proof after required mainline sync, for exact head
Best-fix verdict: yes. Provider discovery caching lives at the shared runtime owner, bundled Firecrawl resolution stays behind canonical activation policy, external providers retain the full-loader fallback, and credentials are still read per selection. No known proof gaps block landing. |
50d130d to
7e2b03a
Compare
|
Updated land-ready maintainer proof after the required package-overlap mainline sync, for exact head
Best-fix verdict: yes. Provider discovery caching lives at the shared runtime owner, bundled Firecrawl resolution stays behind canonical activation policy, external providers retain the full-loader fallback, and credentials are still read per selection. No known proof gaps block landing. |
7e2b03a to
53d8df7
Compare
53d8df7 to
bc48ec5
Compare
|
Merged via squash.
|
|
Final landing proof:
The Testbox lease is stopped and the remote topic branch is removed. |
* perf(web-fetch): add web fetch benchmark * perf(web-fetch): cache provider fallback resolution * perf(firecrawl): avoid duplicate scrape payload wrapping * perf(web-readability): reuse void tag lookup * fix(web-fetch): keep provider cache live * fix(web-fetch): invalidate provider cache on registry swap * perf(web-fetch): reduce html extraction overhead * fix(web-fetch): bound provider discovery cache * perf(web-fetch): avoid full plugin load on fallback
What Problem This Solves
Resolves a performance problem where
web_fetchshell-like HTML fallback paths loaded the complete bundled Firecrawl plugin graph after direct readability extraction returned no content. In a fresh process, that path spent roughly 6.4-6.9 seconds in plugin discovery/loading before doing useful fetch work.Why This Change Was Made
This adds a deterministic
perf:web-fetchbenchmark, caches provider fallback discovery with bounded invalidation, and gives bundled web-fetch providers a narrow runtime-artifact path. The fast path uses the canonical bundled-plugin activation policy, so plugin deny lists, explicit disables, allow lists, and global plugin disablement still apply. Explicit activation and mixed/external provider origins continue through the full loader.The bundled Firecrawl provider now exposes a narrow runtime artifact and lazily imports its client only when the tool executes. The branch also removes duplicate Firecrawl scrape payload wrapping and trims HTML/readability hot-path work.
User Impact
Fresh shell-like HTML fallback now resolves in roughly 0.92-1.11 seconds instead of 6.4-6.9 seconds on the same machine, an approximately 83-86% reduction. The first old-path sample reached 13.9 seconds and 811 MB RSS; the new path remained near one second across repeated fresh-process runs.
Provider behavior still updates when plugins load or unload, config changes, credentials appear, or callers explicitly request activation. External and non-bundled providers retain the existing full-loader behavior.
Evidence
6933.901ms,6658.163ms,6417.874ms,6476.341msafter a first-run outlier of13945.523ms.1222.835ms,1102.780ms,1113.427ms,949.066ms,969.586ms,916.912ms,988.535ms.pnpm buildpassed through Testbox idtbx_01kwn1evj9cjt8xz43hmj5yahgin75.5s.pnpm check:changedpassed through Crabbox/Testbox idtbx_01kwn1r744fs714103fns86pr0, Actions run28686129791, exit0, total10m05.984s. This covered all typecheck lanes, core/extensions/tooling lint, dependency and shrinkwrap guards, runtime import cycles, and repository policy guards.patch is correct, confidence0.90.