You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
browser: preview returns success for paths that don't exist or resolve only against another repo #61625
browser.preview returns success for a path that does not exist, and resolves relative paths only against the session's directory. An agent that previews a file from another repo it has access to (a project reference) gets a success result while the Review pane shows a missing file, so it never learns the preview failed.
Environment
opencode version: v2.0.21
OS: Darwin 23.6.0 (darwin arm64)
Terminal: Apple_Terminal, xterm-256color
Shell: /bin/zsh
Install/channel: latest (desktop app)
Active plugins: @opencode-plugins/ai-model-router, @opencode-plugins/slack-mcp
Reproduction
Use a session whose working directory is repo A, with repo B configured under references in opencode.jsonc.
From Code Mode, call tools.browser.preview({ path: "pkg/file.html" }), where pkg/file.html is a real file in repo B but not in repo A.
Call it again with a path that does not exist anywhere ("no-such-file.html").
Expected Behavior
The tool reports that the file was not found, so the agent can correct the path. Alternatively, a relative path resolves against the reference root it came from. Either way, the tool result should reflect whether the pane could open the file.
Actual Behavior
Every call resolves successfully and returns the input path unchanged, including a path that exists nowhere:
The Review pane cannot resolve the first two and shows a missing-file error (reported by the user). The agent sees three successes, so it reports "opened in the Review pane" and the failure only surfaces to the user.
Additional Context
Reproducible consistently: 3 of 3 inputs in the same session, and the same pattern of failures across earlier sessions.
Workaround: pass absolute paths only. That always opens correctly, so the pane itself is fine; the problem is path resolution and the missing validation on the tool result.
Thanks for the detailed report. I couldn't reproduce this here because browser.preview only works inside the OpenCode Desktop app with the Review pane connected, and this sandbox can't run the desktop app.
The code does match what you describe, both in v2.0.21 and on the current dev branch. The preview handler passes the path to the window and returns { path } straight away. It never checks that the file exists and never waits to hear whether the pane opened it, and relative paths are resolved only against the session's workspace, not against references roots. A maintainer with the desktop app will need to confirm it. Until then, absolute paths are the workaround, as you found.
Confirmed in a real, isolated macOS desktop at dev cd47971fd (Bun 1.4.4, Electron 44.9.1), using a deterministic local provider fixture. Both missing paths return a successful path object while Review shows a navigation error. Existing workspace files and absolute reference paths display correctly.
The tested patch checks the server-local regular file before dispatch. In a separate patched desktop, both missing paths report ENOENT and valid previews still display. File URLs and line suffixes remain supported. Paths retain workspace-relative or absolute semantics; success still acknowledges dispatch, without waiting for pane loading.
The regression fails on the base. Local validation: 40 browser test runs, 89 plugin tests, and the repository lint/typechecks pass. My three existing open PRs still occupy the submission slots, so the patch is available on preview-file-check in the meantime.
Activity
opencodejr commentedon Nov 4, 2026
Thanks for the detailed report. I couldn't reproduce this here because
browser.previewonly works inside the OpenCode Desktop app with the Review pane connected, and this sandbox can't run the desktop app.The code does match what you describe, both in v2.0.21 and on the current
devbranch. The preview handler passes the path to the window and returns{ path }straight away. It never checks that the file exists and never waits to hear whether the pane opened it, and relative paths are resolved only against the session's workspace, not againstreferencesroots. A maintainer with the desktop app will need to confirm it. Until then, absolute paths are the workaround, as you found.Related, but not the same problem:
browser.previewdoesn't render until the window is reloadedr266-tech commentedon Nov 6, 2026
Confirmed in a real, isolated macOS desktop at
dev cd47971fd(Bun 1.4.4, Electron 44.9.1), using a deterministic local provider fixture. Both missing paths return a successful path object while Review shows a navigation error. Existing workspace files and absolute reference paths display correctly.The tested patch checks the server-local regular file before dispatch. In a separate patched desktop, both missing paths report
ENOENTand valid previews still display. File URLs and line suffixes remain supported. Paths retain workspace-relative or absolute semantics; success still acknowledges dispatch, without waiting for pane loading.The regression fails on the base. Local validation: 40 browser test runs, 89 plugin tests, and the repository lint/typechecks pass. My three existing open PRs still occupy the submission slots, so the patch is available on
preview-file-checkin the meantime.AI-assisted verification and implementation.
fix(browser): fail preview for a missing file and name the file when …