[PR #10997] feat: BROWSER interrupt #13628

Open
opened 2026-02-16 18:18:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10997

State: open
Merged: No


What does this PR do?

I'm mainly opening this PR to discuss the approach and spark debate, not with intent to merge it. So take it as a sketch!

Some CLI tools turn interactive, like Git opening a text editor, or Vite opening a browser.

Coding Agent implementations currently struggle with detecting this interactiveness.

  • opencode explitictly tells models to use &, making it hard to prevent process leaks
  • Claude SDK has an is_background tool param that decides a priori whether a tool call is in the background or not, which means it only works through knowledge of popular tools or mentions in the context

I have a hunch that we should implement the convention of the EDITOR environment variable. When Git needs to open an interactive editor, it spawns the binary in EDITOR and waits until completion. Vite does the same with the BROWSER environment variable.
These env variables are hooks for interactiveness, and Coding Agents can inject themselves to perform the interaction like a user would.

This PR sketches how that could work for BROWSER. If a command calls BROWSER, opencode yields back control to the model and asks it to handle the interaction.

As mentioned, at this point I'd love to hear your thoughts on the approach. Thanks!

How did you verify your code works?

Manual testing, not meant to be merged.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10997 **State:** open **Merged:** No --- ### What does this PR do? I'm mainly opening this PR to discuss the approach and spark debate, not with intent to merge it. So take it as a sketch! Some CLI tools turn interactive, like Git opening a text editor, or Vite opening a browser. Coding Agent implementations currently struggle with detecting this interactiveness. - opencode [explitictly tells models to use `&`](https://github.com/anomalyco/opencode/blob/8798a77a72ddfc7c41563f63af39890245d4a4c6/packages/opencode/src/session/prompt/gemini.txt#L56), making it hard to prevent process leaks - Claude SDK has an [`is_background`](https://github.com/microsoft/vscode-copilot-chat/blob/7af31e6f35a643803a8412b0c4e889e3cb5cd3e2/src/extension/agents/claude/common/toolPermissionHandlers/bashToolHandler.ts#L42) tool param that decides a priori whether a tool call is in the background or not, which means it only works through knowledge of popular tools or mentions in the context I have a hunch that we should implement the convention of the `EDITOR` environment variable. When Git needs to open an interactive editor, it spawns the binary in `EDITOR` and waits until completion. Vite does the same with the `BROWSER` environment variable. These env variables are hooks for interactiveness, and Coding Agents can inject themselves to perform the interaction like a user would. This PR sketches how that could work for `BROWSER`. If a command calls `BROWSER`, opencode yields back control to the model and asks it to handle the interaction. As mentioned, at this point I'd love to hear your thoughts on the approach. Thanks! ### How did you verify your code works? Manual testing, not meant to be merged.
yindo added the pull-request label 2026-02-16 18:18:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13628