Skip to content

Bridge native computer tools to Pi and un-gate browser takeover specs - #101

Merged
Personed merged 3 commits into
mainfrom
devin/1795526834-go-takeover-fixture
Nov 24, 2026
Merged

Personed merged 3 commits into
mainfrom
devin/1795526834-go-takeover-fixture

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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 in go-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_ms filtered out) and routes calls through the worker's journaled call op. Non-observation tools get Mutates + new Definition.Automatic, which maps to approval.Request.Automatic so a Bot's auto approval mode allows them, matching computer.tools.invoke.
  • Takeover cards now behave like catalog.ts: Catalog.Handoff captures a preview frame for the card (views.capture opens a short-lived viewer and reads one frame), approval.Service.SetTakeover flips a pending card's takeover.state between waiting/controlling, driven by TakeRequest, viewer back, and viewer close; agent.Runtime.Message serves a pending card from persona.computer-requests before engine drafts so slimMessage's detail fetch resolves.
  • internal/worker exports Observation(service, name) for the bridge's read-only allowlist and accepts a PERSONA_COMPUTER_DRIVER_<SERVICE> JSON env override so fixtures can serve a scripted driver.

Fixture (go-server.ts + new browser-driver.mjs): takeover mode scripts the open/takeover/observe/final turns, the proxy serves /takeover-* endpoints on the service origin, and open-takeover-page navigates the Bot browser's streamed page through the driver CLI against the same session (as services.call, which is not a tool invocation and so is not counted in the takeover metrics). The driver proxies the real agent-browser mcp, records invocations for /takeover-metrics (excluding the handoff's service-internal agent_browser_get_url), and answers the composite agent_browser_observe itself via agent_browser_eval of 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: 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

Devin Review

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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Personed and others added 2 commits November 24, 2026 17:08
… 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>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@Personed
Personed merged commit ebd4b0e into main Nov 24, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant