Skip to content

feat(harness): add WebBrain extension agent - #273

Open
alectimison-maker wants to merge 5 commits into
TIGER-AI-Lab:mainfrom
alectimison-maker:feat/webbrain-harness
Open

feat(harness): add WebBrain extension agent#273
alectimison-maker wants to merge 5 commits into
TIGER-AI-Lab:mainfrom
alectimison-maker:feat/webbrain-harness

Conversation

@alectimison-maker

Copy link
Copy Markdown

What does this PR do?

Adds a webbrain harness that evaluates the pinned
WebBrain MV3 browser extension on ClawBench tasks.

The harness:

  • loads an exact WebBrain commit alongside the existing ClawBench recorder;
  • maps an openai-completions model config into WebBrain's persisted provider contract;
  • invokes WebBrain's existing background/chat extension interface through CDP;
  • writes WebBrain updates, structured trace events, the final response, and normalized token
    usage into ClawBench's standard data artifacts; and
  • participates in the existing registry, image build, watchdog, interceptor, and recording
    lifecycle without changing other harnesses.

Motivation and design

ClawBench currently covers CLI, framework, and bridged extension agents, but it cannot evaluate a
self-contained browser-extension agent through the same corpus and five-layer recording pipeline.
The existing EXTRA_LOAD_EXTENSIONS seam and data-driven harness registry make a dedicated adapter
smaller than introducing a new generic protocol.

WebBrain is pinned to commit 7b2357502da03d931117404bb89a60006bc3fa97; its source is loaded
unpacked and no WebBrain repository scripts or dependencies run during the image build. The driver
uses the base runtime's existing websocket-client dependency, so the harness adds no Python
package dependency.

Unattended runs use WebBrain's supported Instant clarification setting rather than patching its
safety logic. The benchmark instruction is the user request, while ClawBench's interceptor remains
the final boundary for consequential network submissions.

Corpus

  • v2
  • v1
  • both
  • not applicable

Test plan

  • uv run --frozen pytest tests -q — 166 passed
  • uv run --frozen ruff check . — passed
  • uv run --frozen ruff format --check . — passed
  • uv run --frozen pyright src/clawbench tests — passed
  • bash -n src/clawbench/runtime/harnesses/webbrain/{setup-webbrain.sh,run-webbrain.sh} — passed
  • Python byte-compilation for the driver and usage emitter — passed
  • uv build plus twine check and wheel-content inspection — passed
  • Local Docker/Podman image build — unavailable because neither container engine is installed
    in the development environment; the changed-harness CI job exercises the real Docker build.

Compatibility and risks

  • v1 supports local browser mode and api_type: openai-completions; unsupported modes/types fail
    before a model request.
  • api_keys currently selects its first entry rather than rotating keys.
  • Model vision support is not present in ClawBench's model schema, so the generic WebBrain provider
    stays text/tool-only to avoid sending image blocks to incompatible endpoints.
  • Cost is reported as price_unavailable; token counts are preserved from WebBrain trace usage.
  • A real model-backed browser smoke run was not performed locally because it requires a container
    engine and model credentials.

Related issues

Closes #272

@Perry2004

Copy link
Copy Markdown
Collaborator

Thanks for the PR. I'll look into this. 🙌

@Perry2004 Perry2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @alectimison-maker, thanks for the PR!

I reviewed the new integration and found a couple of issues:

  1. The agent seems to be stuck on the initial about:blank page and is unable to perform any actions.
  2. The stop reason is reported incorrectly. A run in which no request is intercepted is classified as "stop_reason": "eval_matched".
{
  "intercepted": false,
  "stop_reason": "eval_matched",
  "stop_description": "Session stopped: eval_matched.",
  "request": null,
  "schema": {
    "url_pattern": "https://never-match.invalid/",
    "method": "GET"
  }
}

To reproduce:

  • Create a dummy task:
{
  "instruction": "Go to Google Search and search for clawench. Do not click any search results.",
  "eval_schema": {
    "url_pattern": "https://never-match.invalid/",
    "method": "GET"
  },
  "time_limit": 2
}
  • Run the new WebBrain harness.

I suspect the stalling may be caused by a permission/consent/mode issue, as the extension's settings page opens when the agent starts and when I manually install the extension on a new profile it needs me to conscent a few things and select the mode:

{
  "type": "pageLoad",
  "timestamp": 1785794425648,
  "url": "chrome-extension://opnkcadpbfggglmiofmahfblhlghklob/src/ui/settings.html",
  "title": "WebBrain Settings"
}

I'm not familiar with this agent, so my suspicions may be incorrect. Please let me know if you're able to reproduce and resolve these issues.

@Perry2004 Perry2004 added enhancement New feature or request good first issue Good for newcomers labels Aug 3, 2026
@Perry2004 Perry2004 moved this from Todo to In Progress in ClawBench Aug 3, 2026
@Perry2004 Perry2004 moved this from In Progress to Under Review in ClawBench Aug 3, 2026
@alectimison-maker

Copy link
Copy Markdown
Author

Thanks for the detailed reproduction. I was able to trace and address both issues in f8e6d8f:

  • unattended runs now preconfigure WebBrain's first-run onboarding and prompt-free permission mode, in addition to the existing Instant clarification setting, so the settings/consent flow no longer leaves the agent on about:blank;
  • .stop-requested is now classified as eval_matched only when interception.json explicitly contains "intercepted": true; missing, invalid, or false interception data reports stop_requested instead.

I added regressions for the storage configuration and all three stop-classification cases (missing/false/true, plus invalid JSON). Revalidated the current head with:

  • uv run --frozen pytest tests/test_webbrain_harness.py -q - 12 passed
  • targeted Ruff check and format check - passed
  • git diff --check - passed

A live container/model-backed run still requires the repository CI environment because this local host has no Docker/Podman engine or model credentials.

@Perry2004

Copy link
Copy Markdown
Collaborator

Thanks for the changes! I'll re-review it in a bit.

@Perry2004 Perry2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, this time it is very close to a complete integration, other than a few small issues.

  1. The agent error stop reason is not recorded in results.py.
  2. When the run is intercepted by the interception, the agent-messages only contain the initial user input.
  3. In run-meta.json, the run_metrics.usage.status shows usage_unavailable with all 0 values.

I think both issues are somewhere in run-webbrain-agent.py since that's the transcript & usage recording happens though I might be wrong.
For non-intercepted runs, I believe the agent-messages are recorded correctly, so might be the SIGTERM handling issue.
To reproduce, you may use this dummy task:

{
  "instruction": "Open https://httpbin.org/forms/post. Fill the customer name with Clawbench User, set telephone to 1234567, set email to clawbench@example.com, choose Medium pizza size, check the Bacon topping, and submit the order. Stop after submitting.",
  "eval_schema": {
    "url_pattern": "https://httpbin\\.org/post(?:[?#].*)?$",
    "method": "POST"
  },
  "time_limit": 4
}

if [ "$AGENT_STATUS" -eq 0 ]; then
STOP_REASON="agent_exited"
else
STOP_REASON="agent_error"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new agent_error reason is not included in

INFRA_STOP_REASONS = {
"chrome_cdp_timeout",
"gateway_failed",
"opencode_failed",
"claude_code_failed",
"codex_failed",
"browser_use_failed",
"hermes_failed",
"pi_failed",
"proxy_failed",
"missing_harness",
}
.
It'd be great to change it to webbrain_failed and record in results.py.

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

Labels

enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(harness): add a WebBrain browser-extension agent

2 participants