Skip to content

fix(cf): add slow fallback token poll for managed widgets#117

Merged
DivMode merged 1 commit intomainfrom
fix/managed-widget-token-poll
Mar 12, 2026
Merged

fix(cf): add slow fallback token poll for managed widgets#117
DivMode merged 1 commit intomainfrom
fix/managed-widget-token-poll

Conversation

@DivMode
Copy link
Copy Markdown
Owner

@DivMode DivMode commented Mar 12, 2026

Summary

  • Adds a 1s getResponse() fallback poll (90s lifetime) in turnstile-hooks.ts to catch tokens from managed/invisible Turnstile widgets that auto-solve after the fast 20ms hook poll stops
  • Eliminates remaining ghost cf.resolutionRace traces (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 no getResponse() check catches the token, leaving only auto_navigation to resolve

Root cause

The fast 20ms poll in setupTurnstileHooks() stops once hooks are installed (~line 130). The render() 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 — passes
  • npx vitest run — 261/261 pass
  • 6/6 CF sites pass (integration tests)
  • Deploy and verify via Tempo: ghost cf.resolutionRace >30s should drop to near-zero

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.
@DivMode DivMode merged commit 3570113 into main Mar 12, 2026
@DivMode DivMode deleted the fix/managed-widget-token-poll branch March 12, 2026 12:12
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.

1 participant