Repository navigation
Bridge native computer tools to Pi and un-gate browser takeover specs - #101
Merged
Merged
Conversation
Pi declared only product tools through the MCP gateway; Bots could not call browser_agent_browser_* at all. Wrap the tool registry with the enabled computer services' native catalogs: calls route through the worker's journaled call path and mutating calls pass the shared approver with Automatic set so a Bot's auto approval mode allows them (computer.tools.invoke). The takeover card flow needed the same pieces catalog.ts has: the card carries a live preview frame, flips between waiting and controlling as the owning viewer's control changes (approval.Service.SetTakeover, driven by TakeRequest, back, and viewer close), and Runtime.Message serves a pending card from persona.computer-requests before engine drafts so the card image detail loads. The fixture gains takeover mode (scripted open/takeover/observe/final turns), the takeover page/state/metrics endpoints on the service origin, an open-takeover-page command that navigates the Bot browser's streamed page through the driver CLI (matching services.call, which is not a tool invocation), and a browser driver that proxies the real agent-browser MCP while recording tool invocations and serving the composite agent_browser_observe from the shared page script. All five browser-takeover specs pass against PERSONA_WEB_SERVER=go and leave go-gaps.ts; the approval-cards spec stays gated (pending requests are in memory only). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
… on an ephemeral port - nativetools declares browser_agent_browser_observe/run_steps/restart (the composites browser-service.mjs layers on the raw daemon catalog) and answers them through the journaled ops; the fixture driver is removed. - callService rejects calls while a viewer holds the control lease and degrades List when a service catalog cannot load, matching services.ts. - Product calls append to PERSONA_BROWSER_METRICS_FILE at the service layer, keeping service-internal calls (get_url, view input) out of the metrics. - go-server binds serve to an ephemeral port so the proxy can hold the requested port across restarts; open-takeover-page spawns agent-browser directly. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
dispatch stripped a browser_-style prefix from every service name, but desktop tools are declared under their native names — the strip corrupted the action name and could panic on names shorter than the prefix. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pi on the Go runtime declared only product tools, so Bots could not call
browser_agent_browser_*at all and the five browser-takeover specs were gated ingo-gaps.ts.computers.NativeTools(registry, catalog)wraps the tool registry that backs Pi's MCP gateway: it lists each enabled service's native catalog (browser names prefixed, desktop names as-is,agent_browser_wait_msfiltered out) and routes calls through the worker's journaledcallop. Non-observation tools getMutates+ newDefinition.Automatic, which maps toapproval.Request.Automaticso a Bot'sautoapproval mode allows them, matchingcomputer.tools.invoke.catalog.ts:Catalog.Handoffcaptures a preview frame for the card (views.captureopens a short-lived viewer and reads one frame),approval.Service.SetTakeoverflips a pending card'stakeover.statebetweenwaiting/controlling, driven byTakeRequest, viewerback, and viewerclose;agent.Runtime.Messageserves a pending card frompersona.computer-requestsbefore engine drafts soslimMessage's detail fetch resolves.internal/workerexportsObservation(service, name)for the bridge's read-only allowlist and accepts aPERSONA_COMPUTER_DRIVER_<SERVICE>JSON env override so fixtures can serve a scripted driver.Fixture (
go-server.ts+ newbrowser-driver.mjs): takeover mode scripts the open/takeover/observe/final turns, the proxy serves/takeover-*endpoints on the service origin, andopen-takeover-pagenavigates the Bot browser's streamed page through the driver CLI against the same session (asservices.call, which is not a tool invocation and so is not counted in the takeover metrics). The driver proxies the realagent-browser mcp, records invocations for/takeover-metrics(excluding the handoff's service-internalagent_browser_get_url), and answers the compositeagent_browser_observeitself viaagent_browser_evalof the shared page script.All five
browser-takeoverspecs pass againstPERSONA_WEB_SERVER=goand leavego-gaps.ts. The approval-cards spec stays gated: the Go approver keeps pending requests in memory, so the fixture still cannot inject one over the wire.Link to Devin session: https://app.devin.ai/sessions/dd13702c910149ffaa30fc2797fa3b72
Open in Devin Desktop: https://app.devin.ai/desktop/session/dd13702c910149ffaa30fc2797fa3b72?variant=devin
Requested by: @Personed
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work