Repository navigation
Description
Outcome
A hosted chat turn can read and search GitHub issues and pull requests, and file issues and comments after your approval. It does this through governed host tools that hold the credential, so the worker never does. You see the results as dedicated GitHub components and can load deeper detail on demand, without that detail entering the model's context.
Why now
Hosted turns routinely need GitHub ("look up the epic", "file an issue for this"). In the original report, gh was never authenticated in a worker, an approved write could not succeed, and the WebFetch workaround tainted the session and had ended turns (#3725, #3787). The host read/write/detail foundations are now delivered below; G2 read/search routing is also delivered. The kit component family and raw-connection proof are now delivered too; app integration and its per-review count follow-up remain open.
Shared context
Historical pre-delivery context: users routinely requested issue lookup and filing, while unauthenticated worker gh and HTML scraping did not supply a governed supported path. Current production host tools are delivered by #3797/#3798, with the separately scoped G2 read/search routing delivered by #4029/#4124 as recorded below.
- No credential in the worker, by design. Generic Git and GitHub credentials are stripped from workers (
HOST_GIT_CREDENTIAL_ENV,packages/ui-sdk/src/server/subprocess-env.ts:247-255). Per the ui-server: a module cron job in a maintenance worker has no durable state area and no credential for another repository #3380 ruling indocs/decisions/governed-writable-workers.md, the worker never holdsGITHUB_TOKEN, soghin a turn is never authenticated. - Outward actions assume a credential that isn't there. backends: ask before an agent acts outside the brain in the user's name, unless the policy allows it #1664 classifies
ghand GitHub API writes as outward, and gates them behind approval cards (Outward actions). With no credential, an approvedgh issue createstill cannot succeed. - Unclassified reads wait on a card. The GitHub API hosts are outward by default (
GITHUB_API_HOSTS,packages/ui-server/src/brain/turn-egress.ts:17). An unclassified connection to them raises aNetworkpermission card (approveOutward,turn-egress.ts:256-263).
Observed on a hosted 0.44.0 install (2026-11-05 to 2026-11-09).
- A compound shell command ending in
curl -s https://api.github.com/repos/…/issues?per_page=1held itsCONNECT api.github.com:443for 68 s. It was then refused (egress_connection,outward_not_approved). The 120 s Bash timeout moved the command to the background, and it failed with curl exit 56. Whether the user ever saw the card is not recorded. The model then fetched issue pages with WebFetch, which tainted the session, and the next model request was refused (ui-server: join announced session binding before relay admission snapshots #3725, which surfaced as backends: a host inference-relay refusal is reported as "Failed to authenticate" and asks for a subscription re-login #3787). - Asked to file an issue for a defect it had just diagnosed, the model drafted the body, ran the leakage check, and stopped: "This sandbox doesn't get
GITHUB_TOKENthis turn, soghisn't logged in". - One
shell_nonzeroroadblock in familyshell:gh api(exit 4: not authenticated).
Compute and Apify solved the same problem with host-side tools. Their fixed contracts are in packages/ui-sdk/src/tool-contracts/compute.ts:146 and tool-contracts/apify.ts. They run as mcp__brain-ui__brain_compute_* and mcp__brain-ui__brain_apify_*: the host holds the credential and binds caller, policy and approval, and the worker never sees the secret.
Rulings (maintainer, 2026-11-09)
- Host GitHub tools. A hosted turn reaches GitHub only through a small, fixed set of host MCP tools backed by a host credential. A relayed
ghand a documented no were both rejected. - Unclassified GitHub API connections keep the approval card. A raw
curl/script connection to an outward GitHub host continues to raise theNetworkcard rather than being refused outright. The card must actually reach the user and name what is waiting. - Dedicated credential (2026-11-09). A new host-only variable,
BRAIN_UI_GITHUB_TOOLS_TOKEN(final name in the PR), with no fallback toGITHUB_TOKENor any other token. ReusingGITHUB_TOKENand reference-grant credentials were rejected. - Writes are limited by a policy allow-list (2026-11-09). The governance policy lists the repositories, or owner prefixes, open to GitHub writes. A write to any other repository is refused before a card is shown. Writing to any repository the token reaches was rejected. Reads are bounded by the token's own permissions.
Rulings (maintainer, 2026-11-10)
- D2, search beyond the returned results: the truthful count footnote plus a link to a host-constructed, validated GitHub search URL. The footnote-only recommendation was not taken.
- D3, direct deep links: besides the canonical fetched object, independently validated canonical comment, review and commit URLs may render as direct links. Keeping the canonical-object-only boundary was not taken.
- D4, split: approved. ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800 holds the ui-kit presentational components and stories; ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components #3795 is narrowed to the payload/detail-route integration in ui-react and is blocked by ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800.
- Design sign-off: design revision 2 (2026-11-09 15:56) is approved, including the §8 payload field list of the 15:08 proposal.
Payload contract (shared by every child)
- Structured payloads. Every result is typed data in the contract, never pre-formatted text, so the dedicated GitHub chat components can bind to it (ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components #3795). For an issue: number, state, author, labels, timestamps, body and comments, with each untrusted string marked as such. For a PR, additionally: draft/merged state, per-reviewer review decisions, checks summary, change size (changed files, additions, deletions), bounded commits (sha, author, message) and merge commit. Each bounded list also carries its total count and whether more exists, so the components can offer the rest on demand through the display-only detail route (ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796), which reuses these types. The canonical
html_urlcomes from the API response. The shape becomes contract when it ships, so it is designed complete now and extended only additively. - Approved design fields (§8, 2026-11-10), pinned by ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797:
total_count/has_moreon every bounded list (comments, reviews, commits, labels);fetched_at; issuestate_reasonandlocked; PRhead_ref,base_ref,merged_by,merged_at,merge_commit_sha,requested_reviewersand the latest review state per reviewer includingdismissed; checks as counts{passed, failed, running, skipped}ornullwhen not reported (nulldistinct from zero); per author/comment/reviewauthor_association,is_botand a nullable login;body_length/body_truncated; searchtotal_count,incomplete_resultsand per-itemkind,state,state_reason,draft,merged_at, comment count,updated_at, labels and an optional bounded excerpt. No merge-method field: the API does not expose it. - Direct-link boundary (D2/D3, 2026-11-10). Three kinds of URL may open directly, each nullable and each passed by one host validator that ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797 owns and exports (ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796 and ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components #3795 reuse it): the canonical object
html_url; comment, review, review-comment and commithtml_urltaken from the API, never constructed; and a search URL the host constructs from a fixedhttps://github.comorigin with the search text only as the encodedqvalue. Every one must behttps:on host exactlygithub.com, with no userinfo or port, the expected path (and fragment) shape for its kind, and the same owner/repo/number as the fetched object. A failing URL becomesnulland is never repaired. Links inside untrusted text stay behind the interstitial. - Tool names (final in ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797):
brain_github_issue_read,brain_github_issue_search,brain_github_issue_create,brain_github_issue_comment, visible asmcp__brain-ui__brain_github_*on Claude and barebrain_github_*on Pi, through the existing contract adapter naming, with the tool list fixed whatever the configuration (provider history).
Constraints and non-goals
- No credential in any worker environment, and no general
ghpassthrough. - Reads are untrusted input and taint like any other remote content.
- Writes only to allow-listed repositories, each behind a per-call approval card. Voice never approves, and autonomous turns never write.
- Display-only data (ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796) never enters the provider-facing conversation.
- No scheme, host or path of a directly opened GitHub URL ever comes from model input or untrusted GitHub text.
- Out of scope:
git pushand repository source reads (backends: ask before an agent acts outside the brain in the user's name, unless the policy allows it #1664, Epic: repository trust is bound to verified Git acquisition and actual source bytes #3598, ui-server: bind trusted Git reads to the qualified host acquisition transport #3613), PR creation and merge, project boards, live updates.
Plan
- ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797: tool contract (all four schemas and payload types, including the approved §8 fields and the direct-link URL validator), dedicated credential, read tools.
- ui-server: GitHub write tools behind a policy repository allow-list and approval cards #3798: write tools, the
outward.github.repositoriesallow-list, approval cards. Blocked by ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797. - ui-server, docs: prove the Network card for raw GitHub API connections and document the GitHub tools #3799: raw
Network-card proof, fixed backend brief and capability/credential/contract documentation delivered through CONTRACT: test(ui-server): prove the Network card for raw GitHub API connections and document the GitHub tools (#3799) #4132 (1140799f2f13a37b1fee8f1fa8fe46c171966789). - ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796: owner-only on-demand detail pages and avatar proxy, display-only; detail-page URLs pass ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's validator. Blocked by ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797.
- ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800: presentational GitHub components, UntrustedText, stories and browser baselines delivered through CONTRACT: feat(ui-kit): GitHub component family and UntrustedText (#3800) #4102 (
edca9906bb1ddcbb00aa578aa66b8ab06bb36263), including D2/D3 links and the approved FilterRow reach. The components use props/callbacks, without a host client or store. - ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components #3795: remaining ui-react integration binding payloads and ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796 detail calls to the delivered ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800 components unchanged. Its foundation outputs are delivered; implementation and end-to-end acceptance remain its own task.
- ui-sdk, ui-server, ui-react: per-review line-comment count, so each review gets its own "Show n line comments" #4147: additive per-review line-comment counts across the SDK/host/renderer, truthful bounded totals and the existing on-demand review control. It consumes ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components #3795's delivered renderer and keeps detail bodies display-only; full scope directly advances this epic's approved outcome.
Definition of done
- Every native child is closed with its acceptance criteria met: the presentational component/story work in ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800, integration in ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components #3795 and per-review count/detail follow-up ui-sdk, ui-server, ui-react: per-review line-comment count, so each review gets its own "Show n line comments" #4147, per the approved D4 split and design revision 2.
- The ruling is recorded in
docs/decisions/governed-writable-workers.md, and the integration contract, policy reference and environment reference describe the shipped behaviour. - On a hosted install with the credential and an allow-listed repository: a turn reads an issue without WebFetch, files one after one approval card, and the chat shows both as GitHub components.
Converted from a task to an epic on 2026-11-09 (maintainer). The former task body's scope and acceptance criteria now live in #3797, #3798 and #3799.
Triage 2026-11-09 at main 9c7eb25825fdad5f4485db0df472188805edb450: Included #3800’s full visual outcome in the epic and preserved the outstanding design/split questions. Corrected backend-visible naming against the actual contract adapter (visibleToolName) rather than assuming Claude’s MCP prefix on Pi. Epics remain outside agent-ready; children keep their own readiness, blockers and milestones.
Triage 2026-11-09 area audit: Added ui-sdk for the shared tool/payload contracts and ui-react/ui-kit for the dedicated component and integration deliverables. These are explicit parts of the epic outcome and its native children; design/split questions and child dependencies remain unchanged.
Triage 2026-11-10 at main 3aadc8df5: Decision (maintainer, 2026-11-10): recorded rulings 5–8 (D2 search link, D3 sub-object links, D4 split, design revision 2 with §8 approved). Folded the §8 fields and the direct-link URL boundary into the payload contract; #3797 pins them and owns the validator. Updated the plan and definition of done for the approved split. Epic labels 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-15 triage at main 3f8ff29341fbe25665cea42659f92e6f3d3ccef0: Corrected current-source navigation by inspecting the named declaration or guard. Existing decisions, historical receipts and remaining prerequisites are unchanged; no new runtime qualification is claimed.
Current delivery and remaining outputs — 2026-11-20
#3797 read/tool-contract foundation is delivered through #4028 (cc326cc643), #3798 writes through #4076 (ee55de168), and #3796 owner-only detail/avatar routes through #4077 (4c541adac). All three squashes are ancestors of inspected main 3b104890f8; their recorded receipts retain candidate/post-merge proof ownership and limits. The current host entry point is async call (packages/ui-server/src/github/host.ts:637), inspected at main bd751d434.
Eleven native children exist, ten closed. #3795 app integration landed in #4146 (8da718259), #4147 per-review line-comment counts in #4196 (ade18f34f), #4154 verified poster and target facts in #4198 (969a020c2), and #4197 complete not-posted previews in #4199 (51d0f6de6). The sole open native child is #4256 for owner-reviewed adoption of incoming governance-policy changes on hosted sync. The epic also retains its definition of done. The original plan's dependency lines describe child sequencing, not fresh blockers on this epic. The 2026-11-16 maintainer ruling on #4029 selects recipient github, makes the read/search routing fix a 0.45.0 p1 release gate, and explicitly exempts writes from G2 routing because their exact-body owner approval card and repository allow-list remain their gate. Read/search must refuse disallowed or unknown exposure without sending a request; the provider reference and tests must pin that write exemption. The implementation is delivered by #4029 through merged #4124, squash 3714b7ff24bb137f038fd5713a6cd26455adc885, an ancestor of inspected main 764d8d22763a8f925dc29da0b2bd1c6eba5775ac. The host now checks turn.routing(GITHUB_RECIPIENT) before read/search requests (call, packages/ui-server/src/github/host.ts:527-546): restricted or unproven exposure returns a coded refusal without sending a request, while writes take the separate approval/allow-list path. The delivered provider reference and tests pin the write exemption. This source and recorded-receipt review does not independently qualify hosted feature behavior or the squash main run. Preserve the approved D2/D3/D4 design and all original definition-of-done criteria.
2026-11-16 concurrent-ruling reconciliation: Folded #4029’s later maintainer decision into the active delivery scope; it is now agent-ready for the ruled reads-only release gate, with writes explicitly exempt. No new routing policy is selected by triage.
2026-11-16 second triage at main 05bf0d6a02: Verified #4087’s merged default-reach decision record and #3800’s canonical runtime prerequisite, #4086. Corrected the parent plan so closure of the design-record task #3531 does not imply that touch-target behavior has shipped. No child blocker, visual acceptance or epic readiness is cleared.
2026-11-17 triage at main 9e7429a914a8aaf5967f074fa9e09984968fc9dc: Refreshed verified active source navigation; historical receipts retain their source identities. No new runtime qualification or readiness is claimed.
2026-11-17 delivery reconciliation at main 764d8d22763a8f925dc29da0b2bd1c6eba5775ac: Folded #4029/#4124 into the active context, source navigation and native breakdown. Four of seven children are closed; #3799/#3800/#3795 retain their original proof, presentation and integration criteria. No real hosted GitHub feature request, new policy choice, child closure or epic readiness is supplied by this triage.
Network-card and kit deliveries — 2026-11-17
#3799/#4132 and #3800/#4102 are closed, with their squashes ancestors of inspected main d974052166f335cbf57b385fddc13875da1b98de. Source now includes the real-app github-network-card.test.ts, the fixed backend-visible host-tool brief, the recorded GitHub-tools ruling/hosting credential guidance, and the kit GitHub/UntrustedText exports with stories and browser baselines. The Network card is held and resent on reconnect; no separate notification is claimed. The untrusted-text subset, interstitial, avatar/direct-link boundaries and approved D2/D3/D4 design remain.
At the time of the kit delivery, #3795 app integration, #4147 per-review line-comment counts and #4154 W4 preview metadata/fallbacks still remained open. Their subsequent delivery is recorded above. #4147 is attached natively because its complete payload/detail/component deliverable advances this epic; it depends on the renderer output currently in draft #4146. Kit delivery does not wire the chat app or supply the missing count, and candidate/automatic-main proof retain their original receipts and limits. The approved per-review control and #3795's original criteria remain binding; the draft's PR-wide fallback does not complete #4147. Source/membership reconciliation at main 564a1d57f547e64f8c7f4de0ca57d362fdfc8ac3 supplies no new hosted qualification.
W4 preview ruling — 2026-11-17
The #4154 maintainer ruling selects the host credential's verified posting identity with The host's GitHub account when unknown, and verified Issue/PR target type with neutral repository #number when unknown. Both are host-owned display metadata, excluded from model inputs/results and provider history. Kit-owned neutral states keep W4 on the reusable target/comment components without invented facts. #4154 is attached because its complete deliverable advances this epic's governed-write preview outcome; its renderer integration followed #3795. The ruling adds no posting authority and delivers no runtime change.
2026-11-17 decision reconciliation: Attached #4154 and reconciled the active native breakdown with its settled author/target choices. All three open child deliverables retain their own implementation, contract and proof obligations.
2026-11-20 triage — Reconciled closed implementation children and the existing #4256 relationship with source and native child status.
Activity
schlessera commentedon Nov 9, 2026
Decision (maintainer, 2026-11-09): option 1, host GitHub tools. A hosted turn reaches GitHub only through a fixed set of host MCP tools (
mcp__brain-ui__brain_github_*: issue read, search, create and comment) backed by a host credential that never enters a worker. Writes raise the existing outward approval card. Reads follow the untrusted-input rules. A relayedghand a documented no are rejected.Follow-up ruling: an unclassified shell connection to an outward GitHub host keeps the
Networkapproval card (approveOutward,packages/ui-server/src/brain/turn-egress.ts:233-240) rather than being refused at once. The card must reach the live client and name what is waiting.The body now follows these rulings, and the ruling goes into
docs/decisions/governed-writable-workers.mdwith the implementation. Additive contract change (new tool names).schlessera commentedon Nov 9, 2026
Decision (maintainer, 2026-11-09):
BRAIN_UI_GITHUB_TOOLS_TOKEN(final name in the PR), with no fallback toGITHUB_TOKENor any other token, stripped from every worker. It serves Epic: hosted turns read and file GitHub issues through governed host tools #3791's tools and ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796's routes. ReusingGITHUB_TOKENand reference-grant credentials were rejected.outward.github.repositories). A write outside it is refused before any approval card. Writing to any repository the token reaches was rejected.https:proceeds.The bodies of #3791, #3795 and #3796 and the #3795 design prompt now follow these rulings.
[-]ui-server: hosted turns have no governed way to read or file GitHub issues[/-][+]Epic: hosted turns read and file GitHub issues through governed host tools[/+]15 remaining items
schlessera commentedon Nov 16, 2026
Concurrent ruling reconciled — 2026-11-16. #4029’s maintainer decision now selects
github, gates 0.45.0 at p1, and applies G2 to reads/searches only. Writes retain their exact-body owner approval card and repository allow-list, with the exemption documented and tested. The active epic brief now reflects that decision; its implementation remains an open child.schlessera commentedon Nov 16, 2026
Epic dependency reconciliation — 2026-11-16 (inspected main
05bf0d6a02). #3531’s default-FilterRow decision/scoping record is delivered through #4087; runtime reach and the caller audit remain #4086. #3800 canonically waits on #4086, and #3795 still waits on #3800. The parent plan now names the actual runtime output. Closing the design-record task supplies no touch-target or full epic qualification.schlessera commentedon Nov 17, 2026
Epic state — 2026-11-17 (routing delivery). #4029 is delivered through #4124, squash
3714b7ff24bb137f038fd5713a6cd26455adc885, an ancestor of inspected main764d8d22763a8f925dc29da0b2bd1c6eba5775ac. The read/search path checks G2 recipientgithubbefore a request, refusing restricted or unproven exposure; writes keep their ruled approval-card/repository-allow-list gate. The active context, source pointers and breakdown now reflect delivery.Four of seven native children are closed. #3799 raw Network-card/documentation proof, #3800 kit presentation and #3795 app integration remain open. No real hosted feature request, independent post-merge proof qualification or full epic completion is claimed.
CONTRACT: test(ui-server): prove the Network card for raw GitHub API …
schlessera commentedon Nov 17, 2026
Epic state — 2026-11-17 (kit and Network-card delivery). #3799 landed through #4132 (
1140799f2), and #3800 through #4102 (edca9906b); both are ancestors of inspected maind974052166f335cbf57b385fddc13875da1b98de. The fixed backend brief/Network-card proof and GitHub/UntrustedText kit family are delivered. Six of seven native children are closed; #3795 is the sole open app-integration child, with its own end-to-end criteria. Component and source delivery do not independently requalify hosted behavior or complete the epic.schlessera commentedon Nov 17, 2026
2026-11-17 epic reconciliation at main
564a1d57f547e64f8c7f4de0ca57d362fdfc8ac3: attached #4147 because its full SDK/host/renderer deliverable supplies the approved per-review count and on-demand control within this epic's outcome. Native inventory: eight children, six closed and two open (#3795, #4147). #4147 consumes #3795's renderer output currently in draft #4146; the approved design and existing child acceptance criteria remain binding. Updated the active plan and definition of done; assignments, release commitments and historical receipts are preserved. No hosted feature qualification is claimed.feat(ui-react): render the host GitHub tools as the ui-kit GitHub com…
schlessera commentedon Nov 20, 2026
Epic state — 2026-11-20. #3795/#4146, #4147/#4196, #4154/#4198 and #4197/#4199 are on main. #4256 remains the open native task. The epic retains the hosted outcome check in its definition of done.
schlessera commentedon Nov 20, 2026
Epic state — 2026-11-20. #4256, the last open child, is delivered through #4266 (squash
a94e8f05f). A hosted sync whose pull changesgovernance.mdnow pauses for the owner's review instead of failing, so an owner can adopt an upstreamoutward.github.repositorieschange with one approval. Chat'spropose_policy_changeremains the in-app way to edit it. All native children are now closed.The definition of done's hosted check is still open, and it needs a human on a hosted install with
BRAIN_UI_GITHUB_TOOLS_TOKENand an allow-listed repository: a turn reads an issue without WebFetch, files one after one approval card, and the chat shows both as GitHub components. No hosted run of that check is claimed here, so the epic stays open.schlessera commentedon Nov 23, 2026
2026-11-23 0.45.0 release reconciliation: all 11 sub-issues are closed and delivered under milestone 0.45.0. Closing the epic as complete for 0.45.0.