Skip to content

Epic: ordinary Pi web tools execute on the host with isolated, resumable results #1863

Open
1 of 3 issues completed

Description

@schlessera

Outcome

Ordinary governed and strict Pi workers use web_search, fetch_content, get_search_content and source_check through a constrained bridge to a host-owned executor that runs the pinned upstream extension in a trusted Pi session, including subscription/current-model search. Provider configuration and credentials never reach the worker. Each session's results are its own, survive executor restart and chat resume within finite retention, and a fork inherits an owned snapshot of the results referenced before its fork point.

Why now

Ordinary Pi workers initialize bounded private state without the host's web-search.json (initialize, packages/ui-backend-pi/src/worker-entry.ts:100). Current launch admission copies only settings.json for relayed ordinary workers; the host retains credentials and endpoints. The non-relayed branch can select auth.json, models.json and settings.json, while restricted autonomous workers receive no native state (if (!envelope), packages/ui-backend-pi/src/worker-launch.ts:101-104). The host resolves web-search configuration from PI_CODING_AGENT_DIR, XDG or HOME (resolveWebSearchConfigPath, packages/ui-sdk/src/server/web-search.ts:189-193); worker and host can therefore select different web-search configuration. This current credential split supersedes the former blanket statement that every ordinary worker copies auth/models. A 2026-10-14 runtime comparison with pi-web-access@0.27.0 showed SearXNG search succeeding in the parent while a private-state worker reported a missing base URL. Copying provider credentials into the worker is ruled out, so search has to execute on the host.

#1969 (closed by #1985) delivered the pinned executor comparison and offline prototypes. The issue was converted to an epic on 2026-10-24 because its acceptance criteria were three separately provable deliverables: the four-tool executor, same-session restoration, and fork snapshots.

Shared context

Maintainer rulings, all 2026-10-15 and recorded in the comments:

  • Architecture C: host-owned web search. Workers invoke constrained forwarding tools; configuration, credentials and authenticated execution stay outside the untrusted worker. Centralized configuration does not imply shared results or authority. Supersedes the earlier worker configuration-snapshot direction.
  • Executor A: the full upstream extension in an actual trusted Pi session, preserving subscription/current-model search through real host-owned auth/model integration. It selects the executor, not unrestricted extension commands, browser/profile access, credential-command execution or every optional workflow.
  • Subscription/current-model search is required. Standalone pi-web-access MCP, or API-key-only search, does not meet it.
  • Workflow A: the initial roster is the four core tools. Answer mode, automatic summaries, model-dependent image/video processing and curator/review workflows are disabled or refused honestly. Follow-ups: backends: add noninteractive model workflows to host-owned web execution #1987 (noninteractive model workflows), ui-server: adapt curator and review workflows to host-owned web execution #1988 (curator/review UI).
  • Credential exclusion A: no browser-cookie/profile/keyring acquisition or credential commands initially, no discovery or fallback. Literal/API/environment credentials under trusted host policy remain allowed. Follow-up: backends: specify opt-in browser and command credential adapters for web execution #1989 (opt-in adapters).
  • Retention A: same-session results are restored after executor shutdown/restart or chat resume within finite storage and retention; expired results are reported, never silently searched again.
  • Fork A: a fork gets a snapshot of still-retained results referenced before the fork point, with fork-owned authorization, shared immutable bytes under reference accounting, no live parent-store access, and honest incomplete-inheritance reporting.
  • Numerical defaults, process idle timeout and schema details follow existing configuration and contract conventions and implementation evidence; they are not further policy decisions.

Binding direction: docs/decisions/governed-writable-workers.md:5065-5088. The bridge governance every child applies: "Common bridge and governance design" items 1-7 of the comparison.

Constraints and non-goals

Breakdown

  1. Epic: the four core Pi web tools run in a trusted host executor behind a constrained bridge #2765 is delivered and closed after backends: forward the four core Pi web tools over a constrained, recorded host bridge #3685–backends: support subscription and current-model search through host-owned Pi auth #3688: trusted Pi executor, the four-tool bridge, admitted auth modes, roster and credential exclusions, and process-lifetime result handles. Its November 13 completion receipt keeps live-login subscription/current-model qualification explicitly outstanding.
  2. backends: restore same-session web results across executor restart and chat resume within bounded retention #2766: bounded same-session result persistence, restoration, expiry and cleanup. The Epic: the four core Pi web tools run in a trusted host executor behind a constrained bridge #2765 implementation prerequisite is delivered; backends: restore same-session web results across executor restart and chat resume within bounded retention #2766 retains its own complete runtime and recovery proof.
  3. backends: give forks an owned snapshot of retained web results with independent lifecycle #2767: fork-owned result snapshots, reference accounting, capacity refusal and independent lifecycle. Blocked by backends: restore same-session web results across executor restart and chat resume within bounded retention #2766.

Definition of done

  • All three children closed.
  • A real keyless Pi-worker run shows the four tools executing on the host, a result retrieved again after executor restart and chat resume, and a fork retrieving its pre-fork results but not the parent's later ones, with cross-session handle replay refused throughout.
  • docs/decisions/governed-writable-workers.md records the executor, workflow, credential, retention and fork rulings, and the integration contract documents every supported surface the children added.
  • Any live-login qualification still outstanding is named on Epic: the four core Pi web tools run in a trusted host executor behind a constrained bridge #2765 or a follow-up issue, not claimed.

2026-10-24: converted to an epic. The single task's scope, acceptance criteria and verification moved into #2765, #2766 and #2767; the stacked decision handoffs were consolidated into Shared context. Citations refreshed to current main. #1987, #1988 and #1989 now name #2765 as their blocker.

2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Verified moved current-source anchors and refreshed navigation; historical receipts and unresolved prerequisites retain their identities. No new runtime proof is claimed.

2026-10-25 triage at main ab746a434c4ada11734ffea4e208d1d6211f1aca: Verified moved current-source anchors and refreshed navigation. Historical failed receipts, existing rulings and unresolved prerequisites are unchanged; this is not a new runtime qualification.

2026-10-25 triage at main 541b8d98328a760290ac6dd4a7f065af76153408: Verified the moved current-source anchors after the off-loop writer slices and refreshed their pointers; historical failed-source receipts, scope and unresolved prerequisites remain unchanged. No new runtime qualification is claimed.

2026-10-25 triage at main dcd3b336dbade5e29e8a131eeeb5a0d9cffe60ff: Verified the moved native-stale-write decision anchor and refreshed this current-source pointer. Existing executor/restoration scope, rulings and proof remain unchanged.

2026-10-25 triage at main c670449d3bf1b0639e50ce554d728961f4313add: Verified the moved named current-source anchors and refreshed navigation. Historical evidence keeps its source identity; scope, decisions, native membership and unresolved prerequisites are preserved.

2026-10-29 triage at main cb5db6e901e9d3d312bd3a125e03be6140faf98f: Verified the current named source anchors and repaired navigation; historical receipts and unresolved prerequisites retain their source identities. No runtime qualification or epic completion is inferred.

2026-11-05 triage at main 35217d283b849b5ef81700d5d4c2ec7486405d12: Corrected current ordinary-worker configuration/credential facts against launch admission and moved the binding host-search direction pointer. Existing rulings, historical receipts and remaining qualification requirements are preserved; no runtime result or causal repair is claimed.

Triage 2026-11-08 at main 8752570331ffebdbb9233196412781f6cd71f3d9: Verified the moved active source anchors and refreshed navigation. Historical measurements and source-bound failure receipts keep their identities; existing scope, rulings, needs, priority, assignment and release attribution are preserved. This source review supplies no new runtime qualification or epic completion.

2026-11-10 triage at main 3aadc8df5: repaired the binding-direction citation (it already missed the section at 8752570) and noted that #2765 is now an epic (#3685 done in #3775). Scope, rulings and readiness unchanged.

2026-11-14 triage at main faa480e8c864d547cd8b4eb75965b7d609284770: Refreshed verified current-source pointers; historical receipts, decisions and remaining qualification requirements retain their identities.

2026-11-16 triage at main 3b104890f84e2eeca687d3c4fbdd1dbb02fb3ae9: Reconciled #2765’s completed executor/bridge/auth outputs and refreshed the named host-search direction. #2766 and #2767 remain open; live-login qualification is not inferred.

2026-11-17 triage at main 9e7429a914a8aaf5967f074fa9e09984968fc9dc: Refreshed the verified current-source pointer. Binding rulings, historical receipts and remaining native outcomes are unchanged; no new runtime qualification is claimed.

2026-11-17 triage at main d974052166f335cbf57b385fddc13875da1b98de: Verified the named current declaration and refreshed its moved navigation. Historical source-bound receipts, scope and prerequisites retain their identities.

Activity

  1. added
    type: fix
    area: backends
    needs: decision
    needs: repro
    priority: p2
    and removed
    needs: repro
    on Oct 14, 2026
  2. schlessera commented on Oct 14, 2026

    @schlessera
    OwnerAuthor

    Reproduction — 2026-10-14

    A new runtime comparison establishes a concrete configuration effect, rather than repeating the earlier source-path inspection. Used Bun 1.4.2/Linux, fictional Odysseus data, the real ordinary Pi worker and the unchanged public pi-web-access@0.27.0 SearXNG provider module. A minimal installed fixture extension calls its actual isSearXNGAvailable() and searchWithSearXNG(); the full web-access extension UI/routing is outside this probe.

    Parent web-search.json contained only a loopback searxngBaseUrl and ssrf.allowRanges: ["127.0.0.0/8"]. No provider keys or paid calls. Both inference and SearXNG transport were fictional loopback servers, inside bwrap --unshare-net, with the repository network preload retained.

    • Main ca1facc1e7086bd2119c260150e9f091e16817f1: parent provider available/search succeeds; worker provider available/search succeeds; two search requests total. This main revision still inherits the parent agent directory, so the earlier handoff's claim that this SHA selects private Pi state was incorrect.
    • Pending PR Keep Pi worker state private and reuse prepared npm packages #1848 head 5975cb6c42ddfc4f28b56939c822feed38f43565: parent provider/search still succeeds, but worker reports available: false and SearXNG base URL is invalid or missing, naming /tmp/brain-worker-scratch/pi-state/web-search.json. Only one search request occurs, from the parent control. This is an actual provider refusal before its request, not an injected error or module-load failure.
    • Both harness processes exit 0; both worker turns finish successfully; parent config bytes remain unchanged; no worker PID remains. Missing configuration does not crash worker initialization in this experiment.

    Commands in the isolated checkout: bwrap --unshare-net --bind / / --proc /proc --dev /dev bun --preload ./scripts/test-network-child-preload.ts ./tests/fixtures/pi-worker-probe.ts config-search "$PWD/fixture-root-fresh" on main, and the same command with fixture-root-pr on the pending PR head; python3 assert-repro.py passes all the assertions above. The temporary harness replaces the existing probe's attack extension with the two actual SearXNG calls, adds a parent-provider control and a loopback JSON-result server, leaving production sources untouched. Public provider provenance: searxng.ts SHA256 0b96a55a7abcc3992ecabbcfec6490f9462e85e9fdb7373c8db48fcb92240a42; utils.ts matches the issue's recorded hash.

    Limitations: #1848 remains open, so this establishes behavior on its proposed head, not shipped main. This fixture's parent config is outside HOME and its explicit parent-path read is not denied; it does not qualify the private-path-denial acceptance criterion. It also does not test full extension registration, host catalog agreement, environment fallback, restricted turns or every provider. Those remain implementation/verification work after the decision.

    Removing needs: repro: the selected parent-file input now has a real provider before/after effect. Retaining needs: decision, p2 and no agent-ready: the maintainer still must choose A/B in the body and explicitly approve any allowed fields, credential treatment, bounds and unsupported-field behavior. No transport/authority decision is inferred from this experiment.

  3. schlessera commented on Oct 14, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-10-14): Choose A: transfer a validated allowlist snapshot of supported web-search configuration into bounded private ordinary Pi worker state through the existing initialization transport.

    Construct a fresh allowed snapshot rather than copying the complete parent file or directory. Preserve parent bytes, private-path denial, host/worker catalog agreement and restricted autonomous authority. This does not approve copying provider keys, credential-bearing URLs/headers, SSRF exceptions or unknown fields, and does not select a new server search relay or generic extension seam.

    Scope now selects this branch. Remaining questions: credential handling; precise nonsecret settings/endpoint authority; source/snapshot byte bounds and invalid/unsupported-field behavior. Retain needs: decision and no agent-ready until the complete ruling is recorded. The existing SearXNG receipt remains attributed to its measured revisions; no new qualification was run in this decision review.

  4. changed the title [-]backends: investigate missing web-search config in private Pi workers[/-] [+]backends: route ordinary Pi web search through a host-owned executor[/+] on Oct 15, 2026
  5. added
    type: feat
    area: ui-sdk
    area: ui-server
    security
    blocked
    and removed
    type: fix
    on Oct 15, 2026
  6. 20 remaining items

  7. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Verified moved current-source anchors and refreshed navigation; historical receipts and unresolved prerequisites retain their identities. No new runtime proof is claimed.

  8. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main ab746a434c4ada11734ffea4e208d1d6211f1aca: Verified moved current-source anchors and refreshed navigation. Historical failed receipts, existing rulings and unresolved prerequisites are unchanged; this is not a new runtime qualification.

  9. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main 541b8d98328a760290ac6dd4a7f065af76153408: Verified the moved current-source anchors after the off-loop writer slices and refreshed their pointers; historical failed-source receipts, scope and unresolved prerequisites remain unchanged. No new runtime qualification is claimed.

  10. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main dcd3b336dbade5e29e8a131eeeb5a0d9cffe60ff: Verified the moved native-stale-write decision anchor and refreshed this current-source pointer. Existing executor/restoration scope, rulings and proof remain unchanged.

  11. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main c670449d3bf1b0639e50ce554d728961f4313add: Verified the moved named current-source anchors and refreshed navigation. Historical evidence keeps its source identity; scope, decisions, native membership and unresolved prerequisites are preserved.

  12. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Epic state, 2026-11-10 (inspected main 3aadc8df5)

    Item 1 of the breakdown, #2765, became an epic on 2026-11-08 at the maintainer's request. It now has four children:

    I also repaired the binding-direction citation. It is now governed-writable-workers.md:4644-4667, "Host-owned web-search direction"; it already missed that section at 8752570. Scope, rulings and readiness are unchanged.

  13. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Epic state — 2026-11-16. #2765 closed after all four implementation children completed; its completion receipt explicitly leaves live-login qualification outstanding. Remaining native implementation is #2766 (same-session restoration), then #2767 (fork-owned snapshots). The body now follows that order; no live credentialed search or full-epic result is claimed.

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

    area: backendsarea: ui-sdkarea: ui-serverepicpriority: p2securitytype: feat

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions