Skip to content

feat(evals): run v4_code through shared MCP - #2614

Draft
shrey150 wants to merge 1 commit into
shrey/stg-2662-v4-code-aifrom
shrey/stg-2753-v4-code-mcp-eval-adapter
Draft

feat(evals): run v4_code through shared MCP#2614
shrey150 wants to merge 1 commit into
shrey/stg-2662-v4-code-aifrom
shrey/stg-2753-v4-code-mcp-eval-adapter

Conversation

@shrey150

@shrey150 shrey150 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Why

This PR proves that the Claude Code v4_code eval path can consume the shared Stagehand code-mode MCP product instead of owning a separate executor and browser lifecycle.

Dependency shape

This is a two-file consumer fork with two logical dependencies:

It remains based on #2378 so the public diff contains only the consumer adapter and its tests. Making it a literal linear child of #2620 would also pull the independent eval stack into the package stack. The eval base must be refreshed with the package stack before merge.

What changed

  • routes the Claude Code v4_code surface through the shared @browserbasehq/stagehand-integrations stdio server
  • exposes mcp__stagehand_browser__code_execute as its browser execution tool
  • maps eval startup profiles to explicit local or Browserbase STAGEHAND_BROWSER configuration
  • installs the package's canonical SKILL.md and REFERENCE.md into a temporary Claude Code project skill
  • limits the agent to the skill loader, shell, and shared code-execution tool
  • leaves the deterministic V4 surface unchanged

Stagehand operation-metric capture remains deferred until the shared MCP contract exposes a metrics snapshot. This adapter does not recreate an eval-owned executor or browser lifecycle to collect it.

E2E Test Matrix

Command / flow Observed output Confidence / sufficiency
Locally built v4_code adapter with explicit local startup and a real Claude Code agent Loaded the stagehand-v4-code project skill, called mcp__stagehand_browser__code_execute, read Example Domain from https://example.com, completed successfully, and left zero MCP/eval child processes. Browserbase credentials remained present during the run. Proves explicit local startup wins even when remote credentials exist and exercises the consumer end to end.
Locally built v4_code adapter with Browserbase startup and a real Claude Code agent Reported Browserbase configuration, loaded the project skill, called code_execute, read Example Domain, completed successfully, and left zero new running Browserbase sessions. Exercises remote provisioning and task-scoped shutdown through the shared stdio MCP path.
pnpm exec vitest run --root . packages/evals/tests/framework/claudeCodeToolAdapter.test.ts packages/evals/tests/framework/claudeCodeRunner.test.ts 2 test files and 35 tests passed. Covers adapter/profile configuration and guards the existing Claude Code runner contract.
pnpm --filter @browserbasehq/stagehand-evals typecheck && pnpm --filter @browserbasehq/stagehand-evals build TypeScript completed without errors; both ESM and CLI builds completed. Confirms the exact eval package under review compiles into both build targets.
pnpm exec oxfmt --check packages/evals/framework/claudeCodeToolAdapter.ts packages/evals/tests/framework/claudeCodeToolAdapter.test.ts Both files passed formatting. Supporting source-format check.

Changeset

None. This changes eval-harness and test plumbing rather than a published package.

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 32653f1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant