Skip to content

fix(daemon): serve the browser extension on loopback when the binding needs client certs - #1779

Merged
edenreich merged 1 commit into
mainfrom
fix/extension-loopback-listener
Nov 9, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/extension-loopback-listener

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

A computer-use workspace pod now runs Firefox with the opentask extension, so its agent can use the cheaper browser_* tools. The extension dials the daemon at plain ws://127.0.0.1:<port>/ws and authenticates with a token in its browser_hello. In a Kubernetes pod, though, the operator serves the daemon's AG-UI binding as 0.0.0.0:52789 with mutual TLS. That binding was the only listener, so the extension could never connect.

When the extension backend is on and the binding requires client certificates, the daemon now also listens on plain 127.0.0.1:<browser_use.extension.port> for the extension. That listener uses the extension token, the same handshake, origin check and handler, and none of the binding's HTTP routes, so the terminal, screen, artifacts and peer A2A endpoint stay behind mTLS. Every other configuration keeps its single listener.

Changes

  • config/daemon.go: (*Config).ExtensionLoopback() is a pure config rule. It answers whether the loopback listener is needed and what it serves, and it fails boot clearly in two cases:

    • the extension port equals the binding port, including an unset daemon.binding.port that falls back to it
    • the extension token is empty

    servesMutualTLS() is TLS on with client certificates required.

  • config/browser_use.go: an extensionBackend() helper.

  • cmd/daemon/daemon.go:

    • startExtensionLoopback starts the listener after the main binding, closes the main binding if the loopback fails, and closes the loopback on stop.
    • startThreads builds the handler once.
  • config/daemon_test.go: a table test covering when the listener is needed, the port fallback, and both errors.

  • tests/e2e/daemon_test.go: with a binding that requires client certs:

    • a TLS dial without a certificate is refused
    • a chrome-extension:// WebSocket on the loopback port gets browser_hello_ack
    • /terminal/ on the loopback port answers 404

    This test fails against the daemon without this change.

  • docs/daemon.md: one paragraph in "The binding".

Verified:

  • task lint reports 0 issues, and the config, cmd, agui and browser tests pass.
  • task test:e2e passes.
  • With the computer image and Firefox ESR plus opentask configured by policy, the extension attaches on its own (browser extension attached).

Related:

… needs client certs

In a Kubernetes workspace pod the operator serves the AG-UI binding with
mutual TLS, so a browser extension in the same pod, which dials plain
ws://127.0.0.1 with a token and cannot present a client certificate, was
locked out of the daemon.

When the extension backend is on and the binding requires client
certificates, the daemon now also listens on plain
127.0.0.1:<browser_use.extension.port> with the extension token, the same
handshake, origin check and handler, and none of the binding's HTTP routes,
so the terminal, screen, artifacts and peer endpoint stay behind mTLS. Boot
fails clearly when that port is the binding's or the extension token is
empty. Every other setup keeps its single listener.
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.251.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 9, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant