Skip to content

fix(server): agents capture pages with Onicode's browser, not a headless Chrome of their own - #359

Merged
trancong12102 merged 1 commit into
mainfrom
fix/agents-use-browser-tools
Nov 18, 2026
Merged

trancong12102 merged 1 commit into
mainfrom
fix/agents-use-browser-tools

Conversation

@trancong12102

Copy link
Copy Markdown
Contributor

Problem

Agents that had the browser tools (obu) still started a headless browser of their own for screenshots, blocked fetches and delegated checks. Two causes:

  • The instructions named only preview_*, whose page tools the driver replaces, so nothing told an agent the browser tools were its browser.
  • The driver could not do the job that sends an agent to a headless shell: a PNG written to a file, at a fixed size, or of a whole page. And in the Browser panel a desktop tab paints only about one window of a page, so a larger capture came back with the page repeated.

Fix

  • Instructions. The browser bullets name the browser tools first, say what vision writes (path, size, full), and rule out a browser of the agent's own for a read or a screenshot, with the project's own tests, a debug port the task names, and a browser the user names left alone. The panel's host note says how to open a local file (serve it over http).
  • obu 4.9.0 (release, feat(vision): write a capture to a file, at a size, of the whole page oni-browser-use#5). vision takes path, size and full; run takes vision steps. The pin, sizes and hashes are from the release assets.
  • Browser panel.
    • A driver's size changes and a desktop tab's captures run one at a time, in the order they arrived, each bounded at five seconds. The session detaches only after the tab has its size back.
    • A desktop tab's capture larger than what the window paints is taken as tiles and joined (pngTiles.ts), up to 40 megapixels, which is also where obu cuts a capture.
    • A capture the page answers too late (a hidden window) fails after three seconds, and blocks the next one until the tab's size has been put back. A clear that arrives while such a capture is out waits for it: Chromium would otherwise drop the size to go back to.
    • A capture too large for the driver's connection is refused with a message instead of closing that connection.
  • Evals. browser-driver cases replay obu's real tool list with a scripted driver, and a call can be graded on its result.

Measurements

Real Onicode turns in a dev app (Claude), counted by whether the turn used the driver or started a browser of its own:

Scenario Before After
Export three slides of a local deck as 1920x1080 PNGs, Opus 5.5 0/3 driver 2/2 driver (one with the window minimized)
Same, Haiku 5.5 0/2 driver 6/7 driver
Full-page PNG of a page, Opus 5.5 0/3 driver 2/2 driver (one with the window minimized)
Same, Haiku 5.5 0/2 driver 1/1 driver
"How does it look on web?", Opus 5.5 and Haiku 5.5 5/5 driver 2/2 driver

Every PNG came back at the size asked for. Haiku is sensitive to the wording of the first browser bullet: a rewording that meant the same took the deck export to 0/4 on the driver, so the bullet keeps the wording that measured best, and the evals README says to re-run that case on Haiku after an edit.

evals/mcp-tool-use on GPT-6.2 Sol:

Cases Before After
browser-driver (new, 11 cases, 3 samples) 17/33 33/33
browser-routing (3 samples) 92% of 38 92% of 39
visual-preview (2 samples) 97% of 64 95% of 64

The samples that differ in the last two rows ended at the step limit with no browser call. Each of those cases was run again on both sides: br-guard-png-to-attach 6/6 and 6/6, demo-build-opens-preview-unasked 4/4 and 4/4.

Runtime transcript

One turn in the dev app on this branch, with obu 4.9.0 downloaded by the pin, the app window visible. Each line is a vision call's time and result:

0.9s  screenshot saved to …/a-1920.png (1920x1080 px, 40 KB)      size=1920x1080
1.0s  screenshot saved to …/b-3840.png (3840x2160 px, 90 KB)      size=1920x1080@2
0.6s  screenshot saved to …/c-phone.png (1170x2532 px, 67 KB)     size=390x844@3
0.6s  screenshot saved to …/d-full.png (1440x1534 px, 35 KB)      size=1440x900 full
0.0s  screenshot saved to …/e-plain.png (1280x800 px, 20 KB)      no size
      act eval innerWidth+'x'+innerHeight → "1280x800 dpr=1"      the tab has its own size back

The same calls with the window minimized return the same sizes (first capture 3.6 s, the rest under 0.5 s), and at 125% page zoom a full page comes back whole (1280x1918 for a 1534 CSS px page).

Checks

  • vp run check:changed passes.
  • Focused tests: apps/server/src/preview, src/browserUse, AgentContextBudget.test.ts, and the eval harness tests.
  • Codex (GPT-6.2 Sol) reviewed the change five times; every finding that held up against the source is fixed.

Work done by Claude Fable 5.2 in Claude Code, running in Onicode.

🤖 Generated with Claude Code

…ess Chrome of their own

Agents that had the `browser` tools still started a headless shell for
screenshots, blocked fetches and delegated checks. Their instructions
named only `preview_*`, whose page tools the driver replaces, and the
driver could not write a PNG to a file, at a fixed size, or of a whole
page.

- Instructions: the browser bullets name the `browser` tools first,
  say what `vision` can write, and forbid a browser of the agent's own
  for a read or a screenshot. The panel's host note says how to open a
  local file.
- obu 4.9.0: `vision` takes `path`, `size` and `full`, and `run` takes
  `vision` steps.
- Browser panel: a driver's size changes and a desktop tab's captures
  run one at a time. A desktop tab paints only about one window of a
  page, so a larger capture is taken as tiles and joined. A capture the
  page answers too late blocks the next one until the tab's size is
  put back, and a clear behind it waits for that. A capture too large
  for the driver's connection is refused with a message.
- Evals: `browser-driver` cases replay obu's real tool list with a
  scripted driver, and a call can be graded on its result.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@trancong12102
trancong12102 merged commit b03fd36 into main Nov 18, 2026
18 checks passed
@trancong12102
trancong12102 deleted the fix/agents-use-browser-tools branch November 18, 2026 21:20
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