Repository navigation
CONTRACT: feat(ui-server): route the host GitHub reads under the provider policy (G2) (#4029) - #4124
Merged
Merged
Conversation
…ider policy (G2) (#4029) GitHub is now the provider-policy recipient `github`. Before any request, `brain_github_issue_read` and `brain_github_issue_search` refuse a conversation that has shown a provider folder the policy keeps from github (`policy_denied`, `recipient_restricted`), and, under a policy restricting github, one whose exposure cannot be judged (`recipient_unproven`). The rules are the web providers' and Apify's, shared through `recipientRouting`. The turn binds its frozen policy, type folders and the conversation's recorded exposures; a throw counts as unproven. Writes are not routed (maintainer ruling, 2026-11-16): the approval card and `outward.github.repositories` stay their gate, and a test pins that a write in a restricted conversation still reaches its card unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 17, 2026
Merged
Owner
Author
Independent reviewReviewed head 786ba74 against base 7dfadc2. Reviewer: agent. No findings. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4124,
"head": "786ba74f0434e35e0eb17a4f755563a0e546e6a9",
"base": "7dfadc217c406255935f7fc626594acf2c2e8b9a",
"reviewer": "agent",
"outcome": "no-findings",
"findings": []
} |
schlessera
marked this pull request as ready for review
November 17, 2026 02:52
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4029
Part of epic #3791.
What changed
The host GitHub read tools now follow the provider policy's data routing (G2). GitHub is the provider-policy recipient
github, besideapify, the web providers andtypesafe. Before any request,brain_github_issue_readandbrain_github_issue_searchcheck the turn's frozen policy, its type-to-folder map and the conversation's recorded provider exposures. A conversation that has shown a provider folder the policy keeps fromgithubis refused withpolicy_denied/recipient_restricted. Under a policy that restrictsgithub, a conversation whose exposure cannot be judged is refused withpolicy_denied/recipient_unproven: an unnamed conversation, an unreadable exposure record, a type selector without its folders, a turn with no frozen policy, or a routing check that throws. A refused call sends GitHub nothing, returns no GitHub text and taints nothing. Writes are not routed. Following the maintainer ruling of 2026-11-16, the card andoutward.github.repositoriesstay their gate, and a write in a restricted conversation still reaches its card unchanged.Why this shape
recipientRouting(packages/ui-server/src/web-tools/routing.ts) is the rulewebRoutingRefusalalready applied, now returning a coded verdict (recipient_restricted/recipient_unproven, the same reasons Apify'sroutingGateuses).webRoutingRefusalwraps it, so its messages are byte-identical for the web tools and the extraction judge.GithubToolsTurn.routingis a required field, so a caller cannot forget it. The bridge builds it from the turn's frozen policy and the recorded exposures. The governance bridge option now also carries the hold'stypeFolders, as the extraction judge already uses them, so type selectors are judged whether or not the turn's own inference recipient has masks. In the host, a throw from routing counts as unproven.Proof
New and updated tests:
packages/ui-server/tests/github-tools-host.test.ts, "data routing (G2, ui-server: apply provider-policy data routing (G2) to the host GitHub tools #4029)": restricted, unproven and a throwing check each refuse both read tools with the coded reason. Each asks the recipientgithub, and the loopback stand-in receives no request and no taint is recorded. An admitting check reads as before.packages/ui-server/tests/github-write-tools.test.ts, "data routing does not gate writes": under a routing that refusesgithub, create and comment return results equal to the unrouted baseline, with identical cards and identical POSTs, and routing is never asked.packages/ui-server/tests/ws-github.test.ts: realcreateAppClaude turns under a governance policyproviders: [{ paths: [journal/**], allow: [anthropic] }]. (1) With an earlier turn's recorded exposure showingjournal, read and search are refusedrecipient_restrictedand taint nothing. A write in the same turn still raises one card with the exact input, and the stand-in receives only that POST. (2) With an unreadable exposure record, read and search are refusedrecipient_unproven, and the stand-in receives nothing. (3) Withjournalshown but still masked, both read as before. The existing unrestricted read and write cases still pass.github-details.test.tsturns gainrouting.web-tools-admission,web-tools-broker,ws-web-accessandextraction-judgepass unchanged.Mutation receipts. Each source was restored from its backup afterwards and the tree checked clean:
routed = null):github-tools-host.test.tsfailsGITHUB_ROUTING_REFUSED_brain_github_issue_readfor restricted, unproven and the throwing check, plus the admitted case'sasked.ws-github.test.tsfailsGITHUB_APP_ROUTING_RESTRICTED brain_github_issue_readandGITHUB_APP_ROUTING_UNPROVEN brain_github_issue_read(6 fail, 20 pass).return nullinstead ofrecipientRouting):ws-github.test.tsfailsGITHUB_APP_ROUTING_RESTRICTEDandGITHUB_APP_ROUTING_UNPROVEN(2 fail, 7 pass).catch { shown = []; }):GITHUB_APP_ROUTING_UNPROVEN brain_github_issue_readfails (1 fail, 8 pass).GITHUB_WRITE_NOT_ROUTED brain_github_issue_createandGITHUB_APP_WRITE_NOT_ROUTEDfail (2 fail, 23 pass).bun run build,tsc --noEmitandbun run lintare clean.{"version":1,"kind":"brain-check-pr-receipt","head":"7559742b03e5a366220bbc6d57e21976477e5dec","base":"origin/main","mode":"focused","startedAt":"2026-11-17T00:41:30.393Z","finishedAt":"2026-11-17T00:42:24.818Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":20709.677197000005},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":146.27440700000443},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":121.58589100000245},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":23.967507000001206},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":33404.558419999994}]}Checklist
.changeset/4029-github-g2-routing.md, with the release-note effect on existing policies.)docs/integration-contract.mdindex entry,mcp.md#github-data-routing-additive-0450-4029,supported-inputs.md"Tool recipients (G2)". Additive: a new recipient name and two new refusal reasons on the read tools.)docs/reflect the change, or nothing documented moved.Proportionate-containment checklist (G2 routing on the GitHub reads)
providersrule keeps fromgithub. Under such a rule, it also triggers when the exposure cannot be judged. It does not cover the writes (ruled out: the card is their gate), rawcurl/ghconnections (theNetworkcard, ui-server, docs: prove the Network card for raw GitHub API connections and document the GitHub tools #3799), or content a turn read before a rule selected its folder (not tracked, as for every recipient).githubrestricts nothing. Nothing narrower exists: the query is model-written text that can quote anything the conversation was shown.githubto that rule'sallow. That is a policy decision, so it needs a human.recipient_restricted/recipient_unproven) and a message naminggithub, returned to the model and kept in the conversation's tool result. The exposures it is judged on are the server's durablesession_provider_exposurerecord.ws-github.test.tsrefuses the reads and files the write in the same turn.github-write-tools.test.tsshows writes unchanged under a refusing routing.Collisions
bun scripts/collisions.ts --json --pr 4124at head7559742b03e5a366220bbc6d57e21976477e5dec: nopathorunknowncollisions. There areclosure-only overlaps (shared test graph, no shared changed file) with #3056, #3059, #3069, #3581, #3622, #4002, #4036, #4102, #4106, #4112, #4113, #4115, #4118, #4122 and #4123.Anything left open
Nothing. The GitHub tools docs slice (#3799) has not landed yet, so the routing paragraph lives in the MCP contract's GitHub section, which #3799 can link from its docs.
🤖 Generated with Claude Code