fix(cf): add slow fallback token poll for managed widgets#117
Merged
Conversation
Managed/invisible Turnstile widgets (e.g. Ahrefs) auto-solve after 30-60s but the fast 20ms hook poll stops once hooks are installed. The render() callback handles most cases, but managed widgets can solve after the fast poll exits — leaving only auto_navigation (page navigates) to resolve, causing 50-60s ghost traces in cf.resolutionRace. Add a 1s getResponse() fallback poll (90s lifetime) that catches tokens from widgets solved after the fast poll stops. This should eliminate the remaining ghost traces not fixed by PR #116's bridge event buffering.
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
getResponse()fallback poll (90s lifetime) inturnstile-hooks.tsto catch tokens from managed/invisible Turnstile widgets that auto-solve after the fast 20ms hook poll stopscf.resolutionRacetraces (50-60s) not fixed by PR fix(tracing): buffer bridge events to eliminate ghost traces #116's bridge event buffering — managed widgets (e.g. Ahrefs) solve after 30-60s but nogetResponse()check catches the token, leaving onlyauto_navigationto resolveRoot cause
The fast 20ms poll in
setupTurnstileHooks()stops once hooks are installed (~line 130). Therender()callback wrapper handles most token deliveries, but managed/invisible widgets can auto-solve 30-60s after render — well after the fast poll exits. Without a slow fallback, these tokens are only detected when the page navigates.Test plan
npx tsc --noEmit— passesnpx vitest run— 261/261 passcf.resolutionRace>30s should drop to near-zero