Skip to content

Epic: hosted turns read and file GitHub issues through governed host tools #3791

Closed
11 of 11 issues completed
Closed

Description

@schlessera

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.

Observed on a hosted 0.44.0 install (2026-11-05 to 2026-11-09).

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)

  1. 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 gh and a documented no were both rejected.
  2. Unclassified GitHub API connections keep the approval card. A raw curl/script connection to an outward GitHub host continues to raise the Network card rather than being refused outright. The card must actually reach the user and name what is waiting.
  3. Dedicated credential (2026-11-09). A new host-only variable, BRAIN_UI_GITHUB_TOOLS_TOKEN (final name in the PR), with no fallback to GITHUB_TOKEN or any other token. Reusing GITHUB_TOKEN and reference-grant credentials were rejected.
  4. 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)

  1. 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.
  2. 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.
  3. 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.
  4. 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)

Constraints and non-goals

Plan

  1. 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.
  2. ui-server: GitHub write tools behind a policy repository allow-list and approval cards #3798: write tools, the outward.github.repositories allow-list, approval cards. Blocked by ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797.
  3. 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).
  4. 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.
  5. 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.
  6. 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.
  7. 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

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

  1. added
    type: featA new capability or a change in user-visible behaviour.
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    area: backendsAgentBackend implementations and the seam they share.
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    priority: p1Scheduled into the current or next milestone.
    on Nov 9, 2026
  2. added this to the 0.45.0 milestone on Nov 9, 2026
  3. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    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 relayed gh and a documented no are rejected.

    Follow-up ruling: an unclassified shell connection to an outward GitHub host keeps the Network approval 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.md with the implementation. Additive contract change (new tool names).

  4. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.
    and removed
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 9, 2026
  5. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-09):

    The bodies of #3791, #3795 and #3796 and the #3795 design prompt now follow these rulings.

  6. added
    epicA tracking issue. The work lives in its sub-issues; this one is never coded directly.
    on Nov 9, 2026
  7. changed the title [-]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[/+] on Nov 9, 2026
  8. 15 remaining items

  9. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    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.

  10. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    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.

  11. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Epic state — 2026-11-17 (routing delivery). #4029 is delivered through #4124, squash 3714b7ff24bb137f038fd5713a6cd26455adc885, an ancestor of inspected main 764d8d22763a8f925dc29da0b2bd1c6eba5775ac. The read/search path checks G2 recipient github before 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.

  12. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    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 main d974052166f335cbf57b385fddc13875da1b98de. 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.

  13. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    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.

  14. schlessera commented on Nov 20, 2026

    @schlessera
    OwnerAuthor

    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.

  15. schlessera commented on Nov 20, 2026

    @schlessera
    OwnerAuthor

    Epic state — 2026-11-20. #4256, the last open child, is delivered through #4266 (squash a94e8f05f). A hosted sync whose pull changes governance.md now pauses for the owner's review instead of failing, so an owner can adopt an upstream outward.github.repositories change with one approval. Chat's propose_policy_change remains 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_TOKEN 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. No hosted run of that check is claimed here, so the epic stays open.

  16. schlessera commented on Nov 23, 2026

    @schlessera
    OwnerAuthor

    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.

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: backendsAgentBackend implementations and the seam they share.area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.area: ui-reactReact chat/files/voice components, stores, WebSocket transport.area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.epicA tracking issue. The work lives in its sub-issues; this one is never coded directly.priority: p1Scheduled into the current or next milestone.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