Skip to content

feat(browser): report the extension's state to the daemon's clients - #1440

Merged
edenreich merged 2 commits into
mainfrom
fix/issue-1403
Sep 30, 2026
Merged

edenreich merged 2 commits into
mainfrom
fix/issue-1403

Conversation

@inference-gateway-maintainer

@inference-gateway-maintainer inference-gateway-maintainer Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #1403

Summary

A client of the daemon's binding could not tell whether the browser extension is attached; it only found out when a Browser tool failed with "no browser extension connected". The daemon now reports the extension connection's state as the browser_extension_status app frame: once when a client connects (its first frame names the state at that moment) and again whenever the extension attaches or detaches. The frame belongs to the browser context's own wire vocabulary, and internal/protocols/agui stays free of client names.

Changes

  • internal/browser/infrastructure/extension_wire.go: the frame name browser_extension_status, its own protocol_version (1, independent of the handshake's), and the frame builder, next to the rest of the browser wire vocabulary.
  • internal/browser/infrastructure/extension_relay.go: the relay now tracks the non-extension connections on the binding and delivers the frame to them whenever the extension attaches or detaches, reading extension_version from the attached extension's hello; a joining client is framed with the current state at once. Deliveries stay under the relay's state mutex, so every client's frames leave in state-change order.
  • internal/protocols/agui/binding.go: DialConfig.HelloAttrs, the other hello fields a dialing client declares (the host reads them back with HelloAttr like it already does for the extension). This makes the version passthrough testable over the wire. The handshake's own fields (type, token, client, protocol_version) are set after the attrs, so a declared attribute never overrides them.
  • No frame and no CUSTOM event for pausing or resuming browser use: a client stops the run, which ends with outcome cancelled, and continues with a new run on the thread, the same path computer use takes in [TASK] Refactor replace custom events and frames with standard AG-UI #1419.
  • docs/browser-extension-protocol.md: new "Browser extension status" section documenting the frame.

Tests

  • A client that connects before the extension receives the disconnected state at its join, then the frame on attach (carrying the extension's version from its hello) and the frame on detach.
  • A client that connects after the extension receives the current state at its join; the extension itself never receives the frame.
  • A client-sent status frame passes through to the host (the relay claims only its own frames).
  • go test ./internal/browser/... ./internal/protocols/agui/ -race green; task precommit:run (mod tidy, mocks, gofmt, golangci-lint, markdownlint) passing.

Follow-ups

The daemon now sends the browser_extension_status app frame to every client that is not the extension, once when the client connects and again whenever the extension attaches or detaches. The browser context owns the frame next to the rest of its wire vocabulary, and the relay delivers the frames under its state mutex so a client's join frame and the attach broadcasts leave in state-change order.

Resolves #1403
@edenreich
edenreich marked this pull request as ready for review September 30, 2026 22:19
@edenreich
edenreich requested a review from a team as a code owner September 30, 2026 22:19
A dialing client's HelloAttrs are copied first and the type, token, client and protocol_version fields set after them, so a declared attribute can never override what the handshake owns. The marshal of a map of strings cannot fail, so its error branch is gone.
@edenreich
edenreich merged commit bde7de5 into main Sep 30, 2026
12 checks passed
@edenreich
edenreich deleted the fix/issue-1403 branch September 30, 2026 22:31
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.221.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 Oct 1, 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

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Report the browser extension's state to the daemon's clients

1 participant