Open
Conversation
🦋 Changeset detectedLatest commit: af91fd6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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
Greptile SummaryAdded support for custom CDP headers when connecting to local browsers via
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: b5a8065 |
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Confidence score: 3/5
- There is a concrete risk of breaking the Stagehand REST API because
packages/core/lib/v3/types/public/api.tsmodifies a shared request shape without the required integration test coverage underpackages/server/test. - The issue is medium severity (6/10) and could affect client/server interoperability, so this isn't quite a risk-free merge.
- Pay close attention to
packages/core/lib/v3/types/public/api.ts- shared request shape changed without the mandated integration test.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/core/lib/v3/types/public/api.ts">
<violation number="1" location="packages/core/lib/v3/types/public/api.ts:44">
P2: Custom agent: **Any breaking changes to Stagehand REST API client / server implementation must be covered by an integration test under packages/server/test**
This change modifies a shared request shape (`LocalBrowserLaunchOptionsSchema`) in the public API types file, and the new `cdpHeaders` option is plumbed through `V3` and `V3Context` to `CdpConnection.connect`. Per the rule, any changes to `packages/core/**/types/public/api.ts` shared request/response shapes must be covered by at least one integration test under `packages/server/test/`. No such test exists for the `cdpHeaders` feature. Please add an integration test that exercises session start with `cdpHeaders` in the launch options to verify the field is accepted and correctly forwarded.</violation>
</file>
Architecture diagram
sequenceDiagram
participant App as Client Application
participant V3 as V3 Orchestrator
participant Context as V3Context
participant CDP as CdpConnection
participant WS as WebSocket (ws)
participant Browser as Remote Browser / CDP Proxy
Note over App,V3: Initialization with LocalBrowserLaunchOptions
App->>V3: init(options)
Note right of App: Includes NEW: cdpHeaders record
opt if options.cdpUrl is present
V3->>Context: create(cdpUrl, { cdpHeaders, ... })
Context->>CDP: CHANGED: connect(wsUrl, { headers: cdpHeaders })
CDP->>CDP: Merge defaults (User-Agent) with NEW: cdpHeaders
CDP->>WS: new WebSocket(wsUrl, { headers })
WS->>Browser: NEW: Connection Request + Custom Headers
alt Connection Successful
Browser-->>WS: 101 Switching Protocols
WS-->>CDP: "open" event
CDP-->>Context: CdpConnection instance
Context-->>V3: V3Context instance
V3-->>App: Session Ready
else Connection Failed (Auth/Network)
Browser-->>WS: Error (e.g. 401 Unauthorized)
WS-->>CDP: "error" event
CDP-->>Context: Connection Rejected
Context-->>V3: Throw Error
end
end
Note over V3,Browser: Control flow via CDP WebSocket
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
3 tasks
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
unblocking a local configuration
what changed
added ability to pass headers to the browser
test plan
Summary by cubic
Adds support for custom CDP headers on WebSocket connections to the browser. Enables local setups that require auth or custom proxies.
Written for commit af91fd6. Summary will update on new commits. Review in cubic