Skip to content

backends: forward the four core Pi web tools over a constrained, recorded host bridge #3685

Closed

Description

@schlessera

Out of scope

The real upstream executor, provider credentials, egress routing, data-routing/taint/budget admission and subscription login (sibling slices of #2765). Persisting results across executor restart or resume (#2766), fork inheritance (#2767). No public plugin or transport seam: the host-side executor boundary is internal, with one production implementation (the trusted-executor slice) and test doubles.

Context

Part of #2765. Read that epic for the 2026-10-15 rulings, and docs/plans/host-owned-web-search.md, "Common bridge and governance design", items 1, 2, 5, 6 and 7.

The worker RPC schema has a bounded, grant-checked bridge but no web method (piWorkerMessage, packages/ui-backend-pi/src/worker-protocol.ts:71-87). The host dispatches worker RPCs in createPiWorkerRpcDispatcher (packages/ui-backend-pi/src/worker-rpc.ts:273). Curated tools are built in createBrainTools (packages/ui-backend-pi/src/tools.ts:224). web_search and fetch_content are still auto-allowed by name for the retired extension (DEFAULT_PI_ALLOWED_TOOLS, packages/ui-backend-pi/src/tools.ts:203-205). Managed workers refuse every loaded extension (unqualifiedResources, packages/ui-backend-pi/src/native-session-runtime.ts:134-137), so the forwarding tools must be curated tools whose results pass the input-safety collector (installPiToolSafety, packages/ui-backend-pi/src/tool-safety.ts:27) before the model receives them.

Scope

  • Curated forwarding tools web_search, fetch_content, get_search_content and source_check in ordinary governed and strict workers only. Restricted autonomous turns get none.
  • One additive worker-to-host bridge message for those four calls. The host binds each call to the admitted principal, session, turn, tool-call grant, profile, policy revision and cancellation signal; worker fields cannot choose them. Narrow per-tool schemas refuse unknown fields, endpoints, proxies, commands, local paths and providers outside the admitted subset.
  • An internal host executor boundary, driven in this slice by a fixture executor. Answer mode, automatic summaries, image/video processing, curator/review and browser/credential-command modes return an explicit unsupported result.
  • Server-owned opaque result handles scoped to session and principal for the executor's lifetime. An upstream ID is never an authorization.
  • Request/response byte, fan-out, concurrency, queue and deadline bounds. Cancel and drain on cancellation, deadline or executor death, with no late cross-turn result.

Acceptance criteria

  • The four tools are present in governed and strict workers and absent from restricted autonomous workers, and the curated roster is otherwise unchanged (provider-history guard passes).
  • Each forwarded result passes the input-safety collector's begin/result before the model receives it, proven with a real collector double and a mutation that skips recording.
  • Bridge tests cover forged identities, unknown fields, out-of-subset providers, and guessed and replayed handles across two concurrent sessions, plus cancellation, deadline and executor death with child exit and cleanup receipts.
  • Deferred workflows and excluded credential modes return an explicit unsupported result through the bridge.
  • Named forwarding, authority and cancellation mutations each fail their intended test and are restored, recorded in the PR.

Verification

bun run test packages/ui-backend-pi packages/ui-server packages/ui-sdk
bun run typecheck && bun run lint
bun run check:pr --base origin/main

Keyless, offline, fictional Odysseus inputs. Native worker tests need hosted proof.

Contract impact

The new worker/server wire message is additive: CONTRACT: prefix, integration contract updated in the same commit, contract label and a minor changeset.

Activity

  1. added
    type: featA new capability or a change in user-visible behaviour.
    area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    area: backendsAgentBackend implementations and the seam they share.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.
    securityAuth, isolation, egress, secrets, or anything in the threat model.
    on Nov 8, 2026
  2. 2 remaining items

  3. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    Readiness review, 2026-11-09: the citations in the body pointed a few lines off after recent merges, so I corrected them. createBrainTools is now tools.ts:224, the old auto-allowed web names are at tools.ts:203-205, and unqualifiedResources is at native-session-runtime.ts:134-137. The other citations still hold at fb999b8ba. No scope or ruling changed.

  4. added this to the 0.45.0 milestone on Nov 9, 2026
  5. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    Delivered by #3775, squash 297f6a7d1 on main (milestone 0.45.0). Candidate proof run 42666085561 passed every selected category at head f26cc5e96 on base 22a2a387e. The automatic main run for the squash was still in progress at closure.

    What landed:

    • The four tools are in ordinary interactive Pi sessions (typed and voice, governed and strict) and in no autonomous roster.
    • The SDK contract adds the tool contracts, parseWebToolInput, WebToolEnvelope, handleWebTool and BackendBridge.webAccess.
    • A ws slice binds each call to the turn.
    • The host broker issues session-scoped opaque handles and enforces the bounds.
    • The child-process executor kills its whole process group on cancel, deadline and death, and leaves receipts.
    • get_search_content and source_check now taint a session.

    The PR records the tests and the named mutation receipts.

    Open, by design: no host configures an executor until #3686, so the tools are listed and refused before they run. The bounds are provisional; #3687 owns the measured admission policy, egress and budgets.

  6. removed their assignment
    on Nov 9, 2026
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

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: backendsAgentBackend implementations and the seam they share.area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.securityAuth, isolation, egress, secrets, or anything in the threat model.type: featA new capability or a change in user-visible behaviour.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions