Repository navigation
fix(browser): propagate snapshot timeouts - #856
Merged
artemgetmann merged 1 commit intoJun 5, 2026
Merged
Conversation
- What: thread snapshot timeoutMs through the plan, route, and Playwright AI/refs=aria helpers; recover stuck AI snapshots with exact-target disconnect plus local raw-CDP aria fallback. - Why: heavy pages like GrabFood should use the caller's browser-tool budget instead of silently dying at Playwright's hidden 5s default or wedging the lane. - Risk: fallback returns aria structure instead of AI text on recoverable local snapshot failures; covered by targeted route/helper regression tests.
artemgetmann
marked this pull request as ready for review
June 5, 2026 08:58
artemgetmann
enabled auto-merge (squash)
June 5, 2026 09:01
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.
Review Fast Path
browser.snapshoton heavy pages now uses the caller timeout budget for Playwright AI snapshots andrefs=aria, instead of falling into a hidden 5s timeout.pnpm exec vitest run src/browser/server.agent-contract-snapshot-endpoints.test.ts;pnpm exec vitest run --config vitest.e2e.config.ts src/browser/pw-ai.e2e.test.ts; changed-fileoxlint --type-aware;git diff --check.targetId, then local managed profiles fall back to the same tab's raw CDP aria snapshot.Why This Matters
Scope Boundary
timeoutMsat the plan boundary.snapshotAiViaPlaywrightandsnapshotRoleViaPlaywrightforrefs=aria.Verification
pnpm installto bootstrap this isolated lane aftervitestwas missing.pnpm exec vitest run src/browser/server.agent-contract-snapshot-endpoints.test.ts-> 1 file, 4 tests passed.pnpm exec vitest run --config vitest.e2e.config.ts src/browser/pw-ai.e2e.test.ts-> 1 file, 8 tests passed.pnpm exec oxlint --type-aware src/browser/routes/agent.snapshot.ts src/browser/routes/agent.snapshot.plan.ts src/browser/pw-tools-core.snapshot.ts src/browser/server.agent-contract-snapshot-endpoints.test.ts src/browser/pw-ai.e2e.test.ts src/browser/server.control-server.test-harness.ts-> 0 warnings/errors.git diff --check-> clean.AI Assistance
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
browser.snapshot?format=ai&timeoutMs=...can now spend the requested timeout budget up to the existing 60s clamp. On recoverable local AI snapshot failure, response can degrade toformat: "aria"withfallback: "raw-cdp-aria"instead of hard failing.Security Impact (required)
NoNoNoNoNoRepro + Verification
Environment
Steps
timeoutMs=42000and exacttargetId.refs=aria&interactive=true&timeoutMs=12000._snapshotForAItimeout on exacttargetId=abce9999.Expected
Actual
targetId.Evidence
Human Verification (required)
targetId._snapshotForAItimeout text does not get mistaken for missing-private-API fallback.Review Conversations
Compatibility / Migration
YesNoNoFailure Recovery (if this breaks)
src/browser/routes/agent.snapshot.ts,src/browser/routes/agent.snapshot.plan.ts,src/browser/pw-tools-core.snapshot.ts, related tests/harness.Risks and Mitigations
fallback: "raw-cdp-aria".