Repository navigation
Closed
Labels
area/desktopDesktop appplatform/windowsWindowstype/featureNew behaviour or an improvementversion/v2OpenCode 2.x
Description
Summary
browser.snapshot defaults to depth 8, so on any real page the accessibility snapshot stops before most interactive elements and returns almost no element refs. browser.find uses the same shallow tree and silently returns nothing for text that is visibly on the page. Since browser.click, fill, select and check only accept refs, most controls on a normal site are unreachable, and the default workflow ("snapshot, then click") fails on exactly the pages the tool is meant for.
Environment
- opencode version: desktop app 2.3.0 (process file version), CLI
opencode --versionreports 1.18.5 - OS: Windows 11,
Microsoft Windows NT 10.0.26300.0(win32 x64) - Terminal:
xterm-256color(desktop app Review pane, no external terminal) - Shell: cmd / PowerShell 7.7
- Install/channel: desktop release build
- Active plugins: none in
opencode.json(MCP entries only: genoffice, attio, railway)
Reproduction
Minimal, self-contained page (depth only affects nesting, nothing else):
<!doctype html>
<html><body>
<h1>snapshot depth repro</h1>
<div><button>depth-marker-02</button>
<div><div><button>depth-marker-04</button>
<div><div><button>depth-marker-06</button>
<div><div><button>depth-marker-08</button>
<div><div><button>depth-marker-10</button>
<div><div><button>depth-marker-12</button>
<div><div><button>depth-marker-14</button>
<div><div><button aria-label="depth-marker-16">deepest</button>
</div></div></div></div></div></div></div></div>
</div></div></div></div></div></div></div></div>
</body></html>- Serve it (e.g.
python -m http.server 8155) andbrowser.tabs.open({ url: "http://127.0.0.1:8155/repro.html" }). browser.snapshot({ tabID })→ onlydepth-marker-02,-04,-06get refs;truncated: true.browser.snapshot({ tabID, depth: 12 })→-08,-10appear as well.browser.snapshot({ tabID, depth: 20 })→ all eight buttons,truncated: false.browser.find({ tabID, text: "depth-marker-16" })→ empty result, no error, although the button exists and is exposed at depth 20.
Same on real pages:
| Page | interactive elements | snapshot(tabID) |
snapshot(tabID, depth: 12) |
|---|---|---|---|
https://github.com/anomalyco/opencode |
189 | 2 refs, 1672 chars | 22 refs, 4660 chars |
| a public marketing site (React, cookie banner, footer) | 69 | 8 refs, 2493 chars | 65 refs, 20317 chars |
| the repro page above | 8 | 3 refs | 5 refs |
find on the GitHub page returns nothing for Issues and Contributors, both visible in the DOM and rendered.
Expected Behavior
- A snapshot that the tools can act on: every interactive element reachable, or at least an explicit, discoverable indication that the tree was truncated and how to get the rest.
findshould search the same tree thatsnapshot({ depth })can expose, or accept adepth.- The default depth should either be configurable (config or tool parameter default) or documented in the tool description; right now the tool descriptions only mention
depthas a number, not that the default cuts real pages in half.
Actual Behavior
- Default depth is 8 (
snapshot({ depth: 8 })is byte-identical tosnapshot({ tabID })), which puts almost every control of a normal marketing or app page below the cut. truncated: truestays true up todepth: 20on real pages, and nothing in the response says which subtree was dropped.findis bound to the shallow tree: it returns an empty string with no error for existing, visible text.- Refs obtained from
snapshot({ depth: 12 | 20 })work correctly forclick, so the deeper tree is usable once requested — it is only the default that is unusable.
Additional Context
- Workaround used here: take
snapshot({ tabID, depth: 12 })first and match text locally instead offind, or re-snapshot a container with a smalldepthto keep tokens down. That works, but costs ~20 KB for a single page and has to be re-learned per session because the default looks fine on small test pages. - Two related observations from the same session, happy to file separately:
browser.clickreturns success when the click hits a fixed/sticky overlay or apointer-events: noneelement, so the action silently does nothing. Verified with a sticky footer at 624×424 and withpointer-events: none.- The first
browser.clickafternavigate/reloadoften fails with[browser.operation_failed] … UnknownVizError; repeating the same call with the same ref succeeds. Seen in 5 of 5 consecutive runs, then not reproduced once.
- Not affected: clicking inside iframes (refs from
snapshot({ frameID })work) and inside open shadow roots (exposed as refs). - All numbers above were measured with the desktop app's Review pane at a 624×424 viewport.
Metadata
Metadata
Assignees
Labels
area/desktopDesktop appplatform/windowsWindowstype/featureNew behaviour or an improvementversion/v2OpenCode 2.x
Activity
opencodejr commentedon Nov 16, 2026
Thanks for the detailed write-up and the minimal test page, it makes the problem very clear.
As I read it, the request is that the desktop browser tools reach the interactive elements of real pages by default. That means a deeper or configurable default snapshot depth, a way for
browser.findto search deeper (or the full tree), and a clearer signal when a snapshot is cut, with a hint on how to get the rest.The code matches what you measured, and the limits are deliberate rather than a malfunction:
browser.snapshotuses a depth of 8 when none is given, andbrowser.findalways uses depth 8.depthcan be set from 1 to 20 onbrowser.snapshot.browser.findtakes onlytabID,frameIDandtext, so it can't be told to go deeper.So I've filed this as a feature request for the maintainers to consider. I can't promise when or whether it will change. Until then, your workaround (
snapshot({ tabID, depth: 12 }), or a smalldepthon a container'sref) is the way to reach deeper elements.About your two side observations:
UnknownVizErroras fixed. It isn't merged yet.browser.clickreporting success when it hits a sticky overlay or apointer-events: noneelement. A separate issue with your sticky-footer test case would be welcome.