Repository navigation
CONTRACT: feat(backends,ui-sdk,ui-server): admit each web provider request for the calling turn - #3991
Conversation
…quest for the calling turn Every external recipient a Pi web call reaches is admitted for its turn: a named provider before dispatch, and every request the executor sends to a provider's API host while the call runs, extraction fallbacks and nested model calls included. Data routing follows Apify consent's rules over the conversation's recorded exposures, a blocked budget scope refuses, and each admitted request counts as unknown spend, never zero. A connection with no call in flight is refused, and the executor opens one connection per request so a reused tunnel carries nothing unadmitted. Adds the web tool error codes policy_denied and budget_exceeded. Closes #3687 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mission Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
CI failure triage for exact head
The source exposes a concrete fixture mismatch: The same hash-only real-web composition appears in This is a log/source diagnosis. I have not edited this branch, rerun native proof, or established the full runtime cause beyond the recorded assertion and missing fixture input. #3662 remains draft while this candidate owns the integration reservation. |
Admission now routes each web recipient under the turn's frozen provider policy (#3687), so a stand-in governance without policy.providers refused every call. The Pi worker runtime proof (PI_HOST_WEB_FOUR_TOOLS_EXECUTE) went red on CI; the three ui-server stand-ins get the same real shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #3687 (part B; part A, the mandatory egress route, landed in #3990). Part of #2765.
What changes
Every external recipient a Pi web call reaches is now admitted for the calling turn, using the admission the turn already has.
createWebAccess). Nothing the worker or the executor says goes into it, and it is never sent to the executor.broker.ts).admittedhook (admitConnection,web-tools/host.ts).denied/call_not_admitted(newEgressAdmissionRefused). The call answers with the authority's code, not whatever the extension made of the failed connection.keepalive: false, so a reused TLS tunnel cannot carry a request the host did not admit. The first test run proved this was needed: one tunnel carried two Exa requests.web-tools/recipients.ts). Curated ids and the pinned extension's API hosts map to provider-policy names. Gemini isgoogleand OpenAI isopenai, matching the inference recipients. A host-configuredexaBaseUrlorfirecrawlBaseUrlnames its provider.web-tools/routing.ts). It applies Apify consent's rules: nothing goes to a recipient from a conversation that has shown it a folder the policy keeps from it, and an exposure the host cannot judge is refused. This extends ruling 3 of ui-server: let a proven allowed recipient's turn see its provider folders #2695, under which G2 governed only the inference recipient. The decision record says why.observeWebProvider). It shows inunknownRunsfor the turn, conversation and day, never as zero.policy_deniedandbudget_exceeded, documented indocs/integration-contract/mcp.md.SafetyHistory, and the session as restricted.Disclosed gaps, also in the decision record
coveragetext is unchanged. It is a closed enum on the wire, and it already says other tool spend is not metered.Proof
packages/ui-server/tests/web-pi-executor.test.ts, 4 new tests on the real executor, egress route and pinned extension:notes/from web providers and an exposure that showednotes/, the automatic chain is refused at the connection withpolicy_denied. Exa receives nothing, the egress record iscall_not_admitted, and the page still works.budget_exceededwith nothing sent.packages/ui-server/tests/web-tools-admission.test.ts, 3 tests:packages/ui-server/tests/web-tools-broker.test.ts: in-flight lifecycle, per-owner scoping, the first refusal wins, and the refusal becomes the answer and the receipt.packages/ui-server/tests/provider-relay-budgets.test.ts: a web attempt adds one unknown run to each scope, costsnull(not 0), counts once, and does not block by itself.packages/ui-server/tests/web-pi-delivery.test.ts:WEB_TAINT_IN_SAFETY_HISTORYandWEB_TAINT_RESTRICTS_THE_SESSIONthroughSafetyHistory.read.Mutations, each restored:
WEB_PROVIDER_REQUESTS_COUNTED,WEB_ROUTING_REFUSED_AT_CONNECTION,WEB_BUDGET_REFUSEDkeepalive: falseabsent (the first run)WEB_PROVIDER_REQUESTS_COUNTED(one request fewer than the provider saw)web_searchdropped from the taint tableWEB_RESULT_RECORDED_BEFORE_PROVIDER, before the new history assertion runsBroader runs:
tsc --noEmitpasses,bun run buildpasses, and the API report is regenerated.CI fix (4e46e0d): the first ready run went red on
tests/pi-worker-runtime.test.ts(PI_HOST_WEB_FOUR_TOOLS_EXECUTE: all four toolsok:false). Its governance stand-in had nopolicy.providers, so the new per-recipient routing refused every call. The fixture and three ui-server stand-ins now carry a frozen provider policy. That test needs unprivileged user namespaces, which this host lacks, so its red→green receipt is CI run 43418819750 (red) and the next run (green).{"version":1,"kind":"brain-check-pr-receipt","head":"4e46e0dacb21c122696f24d3004912cebfaff102","base":"origin/main","mode":"focused","startedAt":"2026-11-13T12:01:53.929Z","finishedAt":"2026-11-13T12:03:22.762Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12248.097302},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":99.0223590000005},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":67.45828799999981},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":19.91307500000039},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":76381.035523}]}🤖 Generated with Claude Code