Skip to content

fix: keep fetch when shadow-DOM prerender retry is 4xx - #277

Merged
Kikobeats merged 2 commits into
masterfrom
cursor/critical-bug-management-a892
Aug 18, 2026
Merged

fix: keep fetch when shadow-DOM prerender retry is 4xx#277
Kikobeats merged 2 commits into
masterfrom
cursor/critical-bug-management-a892

Conversation

@cursor

@cursor cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

#276 stopped a 4xx prerender from cancelling a parallel 2xx fetch. The auto-mode shadow-DOM upgrade still treated page.content() on a WAF/challenge document as success and replaced the working fetch.

Bug

A fetch-mode page with custom elements is upgraded to prerender. If the browser hits CloudFront/WAF (403 HTML) and the retry's inner fetch also fails (timeout/2, browser UA, or a later 4xx), the 2xx fetch is overwritten with the challenge page. Microlink then extracts metadata from the error document.

Fix

Only accept the prerender retry when it is actually usable (html and statusCode < 400), the same predicate as #276.

Validation

npx ava test/shadow-dom.js test/mode.js — 11 passed, including the new regression test.

Open in Web View Automation 

Note

Low Risk
Narrow guard on an existing auto-upgrade path; behavior change only when prerender retry is 4xx/empty, with a dedicated regression test.

Overview
Fixes auto-mode shadow DOM upgrades replacing a good fetch result with WAF/challenge HTML when the prerender retry still returns page.content() but with a 4xx status.

The shadow-DOM retry now only swaps in prerender when the result is usable (html present and statusCode < 400), matching the existing prerender-vs-parallel-fetch fallback in #276. Tests add a 403 prerender regression case and share SHADOW_DOM_HTML across shadow-DOM specs.

Reviewed by Cursor Bugbot for commit 6b2ab1e. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 2 commits August 18, 2026 04:11
#276 only cancelled a parallel fetch when prerender itself was
usable. The auto-mode shadow-DOM upgrade still treated WAF/challenge
HTML from page.content() as success and replaced a working 2xx fetch.

Co-authored-by: kikohumanbeatbox <kikohumanbeatbox@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Kikobeats
Kikobeats marked this pull request as ready for review August 18, 2026 08:26
@Kikobeats
Kikobeats merged commit de35952 into master Aug 18, 2026
3 checks passed
@Kikobeats
Kikobeats deleted the cursor/critical-bug-management-a892 branch August 18, 2026 08:35
Kikobeats pushed a commit that referenced this pull request Aug 20, 2026
#276 returns the parallel fetch (mode: fetch, 2xx) when page.content()
is a 4xx challenge. The #277 upgrade guard only checked status, so that
later fetch replaced the already-good first snapshot — including a 200
soft-block or interstitial body.

Only accept a successful prerender result for the auto-mode upgrade.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
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.

2 participants