fix: settle adaptive navigation before capture - #2345
Merged
Conversation
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
domcontentloadedbefore final browser capturepage.content()itself inside the existing adaptive stabilization/command wall budgetincomplete, retain available steps/errors/network/screenshot evidence, and omit unavailable artifact refs instead of throwing a workload execution errorRoot cause
Adaptive exploration could finish after its final action while the main frame was still navigating. The actions runner then called
page.content()directly. Playwright either rejected that call withUnable to retrieve content because the page is navigating and changing the contentor kept it pending until outside the intended capture budget, which escaped through the fuzz workload boundary asfuzz_suite_runtime_workload_execution_error.Capture lifecycle
The Playground capture session now observes main-frame navigation requests and considers them settled on
domcontentloadedor request failure. HTML capture first waits for observed navigation, bounds everypage.content()attempt, and retries only the exact Playwright navigation race while budget remains.If navigation cannot settle, adaptive evidence is marked
incompletewithbrowser_adaptive_capture_navigation_unsettled. A requested screenshot gets one bounded attempt from the same capture budget; if unavailable,browser_adaptive_capture_screenshot_unavailableis retained while steps/errors/network evidence remains intact. Normal settled capture still performs onepage.content()call and emits the same HTML and screenshot artifacts.Before / after evidence
Before:
0.23.4run_857b993f1e374f8da65ae93afbd316e1runtime-mt7ib5r0-27v2pustudio-gardner-social-operator-adaptive-1page.content()race becamefuzz_suite_runtime_workload_execution_errorAfter exact disposable replay:
run_70e71ece0b9e4e7c9cc1194d6db1a464runtime-mt7k7icc-cuxi1rincomplete,timedOut: 0, diagnosticcampaign-case-resource-exhaustedbudgetMs: 100,waitedMs: 100; screenshot attempt bounded at100msfuzz_suite_runtime_workload_execution_errorcdb62d3e865fae3fbaee3c71d0e6ad6bdbcfef92e28fc4aff635c12221fbf0e6Verification
npx tsx --test tests/browser-actions-navigation-capture.browser.test.ts(5 passed)npx tsx --test tests/browser-actions-navigation-capture.browser.test.ts tests/browser-adaptive-exploration.test.ts(31 passed)npx tsx --test tests/browser-actions-environment.browser.test.ts(10 passed)npm run buildnode packages/cli/dist/index.js artifacts verify --bundle <replay-bundle> --json(valid, zero violations)git diff --checknpm run checkreaches the existingtest:generic-primitivesgate, then fails on the unrelated clean-tree callback fixture mismatch tracked in #2344. The current callback output addscontentLength,serviceWorkerAllowed, andbodyRewritten, whiletests/browser-callback-materialization-contracts.test.ts:245expects the older exact shape. This PR does not touch that surface.Fixes #2343