Repository navigation
perf: skip discarded CDP logs and duplicate locator setup - #3128
Open
antonvishal wants to merge 4 commits into
Open
antonvishal wants to merge 4 commits into
antonvishal wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: e1cde8c The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
antonvishal
marked this pull request as ready for review
October 7, 2026 15:57
…ator-overhead # Conflicts: # packages/sdk-go/internal/extensionassets/stagehand-extension.zip
…erf-cdp-locator-overhead # Conflicts: # packages/sdk-go/internal/extensionassets/stagehand-extension.zip
This branch has not been deployed
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.
Why
Local billing runs used about 8% less browser CPU time and finished about 6.4% sooner.
Medians of three local runs, each with 128 billing flows and four reused browsers. No LLM calls.
Discarded CDP logs still serialized data and created spans. Locator actions repeated domain setup, and fill resolved the same input twice.
What
Skip work for discarded logs, remove unused retained data, reuse successful internal Runtime/DOM setup, and fill using the original input handle. Resolve a replacement input once if the page swaps it.
Raw CDP calls still dispatch normally. Failed enables and explicit disables invalidate the cache. Failed fill preparation rejects; suppressed logs no longer create spans. Enabled debug logs and operation spans remain.
How
1,181 extension/TypeScript tests and 23 browser integration tests passed. Builds and extension typecheck passed.
Summary by cubic
Reduces per-action CDP overhead. Across three local runs of 128 billing flows, median wall time fell from 11.44 to 10.70 seconds and browser CPU time from 50.82 to 46.76 seconds, with all 384 flows passing.
Discarded CDP logs now shortcut
StagehandLoggerbefore serialization or span creation. Successful internal domain setup is cached and reused across locator calls, andfillprepares its original input handle, retrying once when the page swaps the element. Cached setup is invalidated on failed enable or explicitRuntime.disable/DOM.disable. The Go SDK's embedded extension bundle was rebuilt to match the protocol version.Behavior changes
fillnow rejects when a replacement input also fails preparation, instead of falling back to typing into whatever focus is active.Written for commit e1cde8c. Summary will update on new commits.