Skip to content

backends: prove an extension-free pi worker from what it actually loaded, so default pi turns can skip proven-read observations #2874

Closed

Description

@schlessera

Blocked by #2834

Context

#2834 lets a governed or strict pi turn skip the journal observation after a call proven read-only in its actual execution path. The pi backend reports that evidence only for a worker that loads no extension code (the proposed extensionFree classification in packages/ui-backend-pi/src/worker-session.ts on the #2834 implementation branch), because extension handlers run in the worker on every tool event, host bridge reads included, and can write at any time. Pi loads extensions by default (loadExtensions: options.loadExtensions ?? true, packages/ui-backend-pi/src/backend.ts:111), so a default pi deployment gets no skips: every result is observed as before #2834.

Many workers that are allowed to load extensions actually load none: no installed pi package and no repo-local extension. The worker could prove that from its own loader before any model-directed code runs, but the proof has to cover reloads and any extension a turn's own writes could add.

Scope

  • Establish whether pi can load or reload an extension after the worker's session starts (a /reload, a settings change, a repo-local extension written during the turn).
  • If the loaded set is fixed for the worker's lifetime, report it from the worker before the prompt (an internal worker-protocol field) and treat a worker that loaded none as extension-free.
  • Any worker that loaded an extension, or whose set could change mid-turn, stays unproven.

Out of scope

  • Proving anything about a worker that runs extension code.
  • The Claude backend's evidence (filed separately).

Acceptance criteria

  • A worker that reports no loaded extension proves the same calls a loadExtensions: false worker proves, shown by the existing evidence test cases.
  • A worker with one installed or repo-local extension proves nothing, by a test that fails if its evidence is reported.
  • A worker whose extension set can change during the turn proves nothing, with the mechanism named in the decision record.

Verification

bun run test packages/ui-server packages/ui-backend-pi packages/ui-backend-claude, and bun scripts/prove-native-host.ts --observation-timing for the backend changed.

Contract impact

None expected: the evidence travels in the existing @internal StartTurnRequest.toolExecution.

Follow-up from #2834.

Evidence and conservative completion

#2834 is open: StartTurnRequest.toolExecution and the proposed evidence schedule are implementation-branch inputs, not a current-main API claim. Start from its delivered classification and verify the exact installed runtime/loader source; model documentation or a configured flag alone is not proof. Cover all settings sources, reload paths and code introduced during a turn. Missing or mutable evidence conservatively retains observation.

If the runtime cannot prove a stable empty code/hook set, a documented negative conclusion with source evidence is an acceptable investigation outcome; do not emit read evidence or weaken capture to meet latency targets. Any qualifying implementation must include a negative mutation proving configured or later-loadable code cannot be classified as a proven read. No provider-facing history change or new public seam is authorized.

2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Completed the conservative, source-verifiable investigation/conditional implementation brief and documented a valid negative outcome. Added the real #2834 prerequisite; no capability or hook-free runtime proof is assumed. Preserve the existing priority.

2026-11-15 readiness review at main eb3c53ac296808291e4aded36c9e4aa65a7e8aae: the Context's "Pi loads extensions by default" (backend.ts:111) is out of date. Since #3673 (#3658) the default is curated (export function discoversPiExtensions, packages/ui-backend-pi/src/extension-inspection.ts:64-66: only an explicit loadExtensions: true discovers), so a default worker is already extension-free and proves its curated calls. The managed worker also refuses any loaded extension or load error (function unqualifiedResources, packages/ui-backend-pi/src/native-session-runtime.ts:134-137). The remaining gap this issue covers is a worker with discovery on that loads none. The extensionFree classification #2834 delivered is at packages/ui-backend-pi/src/worker-session.ts:139. Scope and acceptance criteria are unchanged. In installed pi 0.99.2 the loaded set changes only in AgentSession.reload(), which a managed worker reaches only through a loaded extension's ctx.reload().

Activity

  1. added
    type: featA new capability or a change in user-visible behaviour.
    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.
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Oct 25, 2026
  2. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Completed the conservative, source-verifiable investigation/conditional implementation brief and documented a valid negative outcome. Added the real #2834 prerequisite; no capability or hook-free runtime proof is assumed. Preserve the existing priority.

  3. added this to the 0.45.0 milestone on Oct 25, 2026
  4. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #2834 is closed, so scripts/sync-project.ts is removing the blocked label.

  5. removed
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Oct 25, 2026
  6. self-assigned this
    on Nov 15, 2026
  7. schlessera commented on Nov 15, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-7c833c3a. Branch: feat/2874-pi-loaded-extension-proof.

    path overlap on docs/decisions/governed-writable-workers.md with open PRs 4002, 4008, 4018, 4024; closure overlaps only otherwise

  8. schlessera commented on Nov 15, 2026

    @schlessera
    OwnerAuthor

    2026-11-15 readiness review at main eb3c53ac296808291e4aded36c9e4aa65a7e8aae: the Context's "Pi loads extensions by default" (backend.ts:111) is out of date. Since #3673 (#3658) the default is curated (export function discoversPiExtensions, packages/ui-backend-pi/src/extension-inspection.ts:64-66: only an explicit loadExtensions: true discovers), so a default worker is already extension-free and proves its curated calls. The managed worker also refuses any loaded extension or load error (function unqualifiedResources, packages/ui-backend-pi/src/native-session-runtime.ts:134-137). The remaining gap this issue covers is a worker with discovery on that loads none. The extensionFree classification #2834 delivered is at packages/ui-backend-pi/src/worker-session.ts:139. Scope and acceptance criteria are unchanged. In installed pi 0.99.2 the loaded set changes only in AgentSession.reload(), which a managed worker reaches only through a loaded extension's ctx.reload().

  9. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Merged in #4056 as ef37644aa through the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: backendsAgentBackend implementations and the seam they share.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.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