evals: declare the cdp_code agent mount - #2595
Merged
miguelg719 merged 1 commit intoAug 9, 2026
Merged
Conversation
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Architecture diagram
sequenceDiagram
participant Eval as Eval Harness
participant LLMExp as prepareLLMExposure()
participant Target as prepareCoreBrowserTarget()
participant CDPCon as CdpConnection
participant CDP as CDP Browser
participant Agent as Claude Code Agent
Note over Eval,Agent: Runtime Flow: cdp_code LLMExposure
Eval->>LLMExp: prepareLLMExposure(plan, env, logger, startupProfile?)
LLMExp->>LLMExp: Resolve startup profile (runner_provided_local_cdp | runner_provided_browserbase_cdp)
alt Invalid profile
LLMExp->>Eval: Throw EvalsError
end
LLMExp->>Target: prepareCoreBrowserTarget({env, toolSurface, startupProfile})
Target-->>LLMExp: {cleanup, providedEndpoint, metadata?}
alt Missing endpoint
LLMExp->>Eval: Throw EvalsError
end
LLMExp->>CDPCon: CdpConnection.connect(providedEndpoint)
CDPCon-->>LLMExp: connection
LLMExp->>LLMExp: attachActiveCdpPage(connection)
LLMExp-->>LLMExp: {targetId, sessionId, url}
LLMExp->>LLMExp: Log init metadata (targetId, sessionId, etc.)
Note over LLMExp: Build CdpRuntime object
LLMExp-->>Eval: LLMExposure {kind: "code_handles", handles: {cdp}, promptInstructions, runTool, captureFinalState, cleanup}
Eval->>Agent: Exposure with runTool + handles
Note over Agent: Agent executes JavaScript via runTool
Agent->>Agent: cdp.send("Page.navigate", {url: startUrl})
Agent->>Agent: cdp.waitForEvent("Page.loadEventFired")
Agent->>Agent: cdp.send(Page commands...)
Agent->>CDP: Page-scoped CDP commands
CDP-->>Agent: Responses
alt Browser-level commands
Agent->>CDP: cdp.browser(Browser commands...)
CDP-->>Agent: Responses
end
Note over Agent: Event handling
Agent->>Agent: cdp.on(method, listener)
Agent->>Agent: cdp.once(method)
Agent->>Agent: cdp.waitForEvent(method, timeout)
Note over Agent,LLMExp: Final state capture
Eval->>LLMExp: captureFinalState()
LLMExp->>CDP: Page.captureScreenshot
alt Success
CDP-->>LLMExp: Screenshot data
LLMExp-->>LLMExp: Buffer.from(shot.data, "base64")
else Failure
LLMExp-->>LLMExp: Best-effort skip
end
LLMExp->>CDP: Runtime.evaluate({expression: "location.href"})
alt Success
CDP-->>LLMExp: URL value
else Failure
LLMExp-->>LLMExp: Best-effort skip
end
LLMExp-->>Eval: {screenshot?, url?}
Note over Eval,LLMExp: Cleanup
Eval->>LLMExp: cleanup()
LLMExp->>CDPCon: connection.close()
CDPCon-->>LLMExp: Closed
LLMExp->>LLMExp: targetCleanup()
Note over LLMExp: Error handling during setup
alt Error occurs in setup
LLMExp->>CDPCon: connection?.close()
LLMExp->>LLMExp: targetCleanup()
LLMExp->>Eval: Throw original error
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 5, 2026 07:14
45bb71e to
038235a
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
2 times, most recently
from
August 5, 2026 08:28
c2a9bce to
65ed807
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 5, 2026 17:45
65ed807 to
30769d5
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 5, 2026 19:06
30769d5 to
62aa8ff
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 5, 2026 22:40
62aa8ff to
5248155
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 6, 2026 02:16
5248155 to
0c5ae65
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 6, 2026 02:46
0c5ae65 to
a369ac7
Compare
miguelg719
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 6, 2026 22:23
a369ac7 to
2d1587d
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 6, 2026 23:12
2d1587d to
5dfb54c
Compare
miguelg719
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 6, 2026 23:27
5dfb54c to
6c3826d
Compare
shriyatheunicorn
force-pushed
the
stg-2671-cdp-code-exposure
branch
from
August 8, 2026 04:49
6c3826d to
e641edf
Compare
miguelg719
approved these changes
Aug 9, 2026
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.
Same shape as #2592 for the CDP surface: prompt instructions carried
over verbatim, code_handles declaration, captureEvidence() for the
terminal screenshot, URL, and aria tree. Behavior is unchanged until the
adapter consumes mounts generically in #2596.
Part of the nondeterministic-evals stack (#2591 → #2611).
Summary by cubic
Expose
cdp_codeas anLLMExposurewith an agent-mountablecdpruntime, clearer prompt instructions, and richer final-state evidence. Linked to Linear STG-2671 (part 5/6). Requires theLLMExposurecontract (1/6).handles.cdp; prompt includesAGENT_RUN_TOOL_NAME, a first navigate/load recipe, run-tool description and code param, and a deny message;captureEvidencecollects screenshot, URL, andariaTree.send/browserpluson/off/once/waitForEvent/waitwith session scoping, timeouts, safe teardown, and unhandled-rejection guards; exposestargetId/sessionId;createAgentRuntime(logger)initializes it.representationcapability;page.represent()returns the accessibility tree with metadata; evidence includesariaTree.syncPageskeeps session pages current beforelistPages/activePage; bootstrap only creates a target if none exist.Written for commit e641edf. Summary will update on new commits.