Skip to content

Extension's connection not working #28

Description

@Cyber-Oscar

Repository: https://github.com/different-ai/opencode-browser
Package version: 4.6.1 · Extension version: 4.6.0
Environment: Windows 11, Chrome (standard, not Beta/Dev), Chrome 13x

Summary

After npx @different-ai/opencode-browser install and loading the unpacked extension,
the badge shows ON for only ~3 seconds and then drops. browser_status reports
hostConnected flipping to false, and every tool call (browser_get_tabs,
browser_navigate, …) times out ("Timed out waiting for broker response").

The connection only establishes; it never persists.

Root cause

extension/background.js opens the native-messaging port with
chrome.runtime.connectNative(...) inside the MV3 service worker. Chrome
terminates idle MV3 service workers (observed here ~3s after the worker goes idle).
When the worker is killed:

  1. Chrome closes the connectNative port,
  2. the native host receives EOF on stdin and exits,
  3. the broker's hostConnected becomes false,
  4. the badge flips to OFF and tool calls time out.

Outgoing keepalives (extension → host ping every 10s) and broker → host pings
every 2s cannot revive a terminated worker — they only wake a suspended one.
The native host itself is fine: launching host-wrapper.cmd manually keeps
hostConnected:true indefinitely, proving the broker/native-host/host-manifest
wiring is correct and the only failure is the worker lifetime.

Evidence

  • Manual launch: host-wrapper.cmd → native host stays connected (hostConnected:true for minutes).
  • Chrome-launched host: exits within ~3s; hostConnectedfalse; no native-host
    process remains.
  • Setting the Chrome policy NativeHostsExecutablesLaunchDirectly=Disabled fixed the
    .cmd launch (direct-launch mode in Chrome 113+ cannot start .cmd hosts), but did
    not fix persistence — the worker is still terminated.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions