Repository navigation
Description
Context
#3791 gives hosted turns host GitHub tools (mcp__brain-ui__brain_github_*). Their results are structured GitHub objects: issues, pull requests, comments, reviews and approvals, merges, commits. Rendered as raw tool output they read as JSON or as a wall of quoted text. They should render as dedicated GitHub components, one per object, not as a generic collapsible detail row.
Decision (maintainer, 2026-11-10): the D4 split is approved. The presentational components and their stories are #3800 (ui-kit). This issue is the integration in ui-react: it binds #3797's tool payloads and #3796's detail-route calls to the #3800 components, unchanged. The design is revision 2 of the 15:08 proposal, approved on 2026-11-10 including the §8 payload field list (now pinned by #3797). Its §7 table fixes what ships in the tool result and what loads on demand, and its "Write tools" section fixes W1–W4.
Rulings this brief follows:
- Untrusted text (2026-11-09): a safe markdown subset; links in untrusted text open only through the full-URL interstitial, and only
https:proceeds (rendered by ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800'sUntrustedText). - Avatars (2026-11-09): through ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796's host avatar proxy, from the brain's own origin, with an initials fallback. The browser never contacts GitHub.
- D2 (2026-11-10): beyond the returned results, the truthful count footnote plus a link to a host-constructed, validated GitHub search URL.
- D3 (2026-11-10): besides the canonical fetched object, independently validated canonical comment, review and commit URLs open as direct links.
What exists:
- Host tool results already get typed chat renderers, bound to their contract (
bind,packages/ui-react/src/components/chat/renderers/bind.tsx:56-68, D3). One contract registers the Claude, Pi and legacy spellings of the name. - The Apify renderer is the closest precedent for remote content (
packages/ui-react/src/components/chat/renderers/apify-tools.tsx:1-8). - Answer blocks (
SHOW_BLOCK_TOOL_NAME,packages/ui-sdk/src/tool-contracts/blocks.ts:715-734, D41) are a different path: GitHub components render tool results the host fetched, not content the model composed.
Blocked by #3797
Blocked by #3798
Blocked by #3796
Blocked by #3800
Scope
- One bound renderer per Epic: hosted turns read and file GitHub issues through governed host tools #3791 tool in
packages/ui-react/src/components/chat/renderers/, mapping each tool payload to ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800's components, registered for every backend spelling. The write tools' approval and result views (W1–W4) use the same components, so the user approves exactly what they will see posted. - Mapping is honest. A
nullor absent field maps to the component's absent state (checksnull→ "None reported", unknown review state → "Not reported"), never to zero or passing. The "Brain read" line is built from what the tool result contained and never grows when the user loads detail. - Direct-link URLs. The renderer passes the payload's canonical-object, sub-object (comment, review, review comment, commit) and search URLs to ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800's slots only after re-checking them with ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's exported validator. A URL that fails, or a
null, is passed as absent, so the slot shows no link. The renderer never constructs, rewrites or repairs a GitHub URL, and never turns a link from untrusted text into a direct link. - Avatars. The renderer passes
avatarSrconly as a brain-origin ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796 avatar-route URL for a login present in that result; otherwise none, so initials show. - On-demand sections load through ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796's client function only, wired to
GitHubDetailSection'sstate,onLoad,onLoadMoreandonRetry, with the triggers from §7 (Load more in a tab; Files and Checks on first open; "Show n line comments" on a review). The route's typed errors map to the S4–S7 states, including the rate-limit reset time. Loaded detail is display-only. - Payload fields the components need are ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's contract. If one turns out to be missing, it is added there additively, never parsed out of text.
Out of scope
- Any visual change: layouts, states and stories belong to ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800. A visual change goes back to ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800 and its stories.
- Live updates, polling or webhooks: the components show what the tool returned.
- Write actions from the components (approve, merge, comment buttons). That would be a separate outward-action design.
- GitHub content that arrives through WebFetch or other tools.
- URL construction and shape validation (ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797) and the detail/avatar routes (ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796).
Acceptance criteria
- Each Epic: hosted turns read and file GitHub issues through governed host tools #3791 read tool's result renders through its dedicated ui-kit: GitHub component family (PR, issue, thread, review, commit, merge, results) with stories #3800 component on both backends, and the write tools' approval and result views render W1–W4. A result that fails to parse falls back to the generic tool view. Renderer tests cover both backends, every registered spelling and the fallback.
- Uses the ui-kit components unchanged; no new visual design here.
- An absent field (no checks, unknown review state, deleted author) reads as absent, never as passing or zero. A renderer test covers each.
- Direct links: a payload whose canonical, comment, review, commit and search URLs pass ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's validator renders each as a direct link in its slot. The same payload with each URL replaced by a non-conforming one (another host such as
github.com.evil.example, another owner/repo/number,http:) renders no direct link in that slot, and the rest of the component is unchanged. A test asserts both. - A body containing raw HTML,
<script>, an image, ajavascript:link, anhttps:link and a fenced code block, rendered end to end through a tool result, shows no interpreted HTML and no content image, an inertjavascript:link, a code block, and anhttps:link that opens only after the interstitial shows its full URL. - No request leaves the browser for any host other than the brain's own origin while components render, including avatars and on-demand sections. A real browser test with request interception proves it.
- Each on-demand section fetches only after the user acts, renders the S0–S7 states from ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796's real typed errors, and sends nothing to the model. A test asserts the session's provider history is unchanged after loading details, and the keyless provider-history guard passes.
- Mutation receipt: skip the renderer's validator re-check, and the non-conforming-URL test fails on its "no direct link" assertion.
Verification
bun run test packages/ui-react/tests, real browser tests for request interception, the interstitial and on-demand loading, and the provider-history guard.
Contract impact
None of its own. It consumes #3797's tool payloads and #3796's internal routes. Any field it needs is an additive change to #3797's contract.
Updated 2026-11-09: these are dedicated per-object components, not collapsible detail rows. Details may load on demand through #3796 (maintainer). Later the same day (maintainer): a safe markdown subset with links behind an interstitial, and avatars through the host proxy.
Triage 2026-11-09 and 2026-11-10 (earlier passes): folded revision 2 into the specification, retired the resolved link/avatar conflict, recorded that §8 awaited sign-off.
Triage 2026-11-10 at main 3aadc8df5: Decision (maintainer, 2026-11-10): D2 footnote plus a constructed, validated search URL; D3 validated sub-object direct links; D4 split approved; revision 2 approved including §8. Narrowed this issue to the ui-react integration, moved component and story criteria to #3800, dropped area: ui-kit, added Blocked by #3800. The §8 fields and the URL validator now live in #3797; #3796 validates detail-page URLs. Removed needs: decision and needs: design; brief complete, so agent-ready alongside blocked.
Activity
schlessera commentedon Nov 9, 2026
Design needed: a dedicated component for each GitHub object, and how its untrusted text is shown.
Already decided: the host fetches GitHub objects through #3791's tools, and each tool result gets a bound chat renderer, as Apify's does. The maintainer has ruled that these are dedicated components per object (pull request, issue, comment/thread, review, commit, merge, result list), not generic collapsible rows. Also decided: untrusted text renders as a safe markdown subset with links behind an interstitial, and avatars come through a host proxy. Still open: what each component shows and how it behaves, how they compose, and how the decided text, link and avatar rules look.
Updated 2026-11-09: reframed from collapsible cards to dedicated components; details may load on demand (#3796).
[-]ui-react: render GitHub tool results as explorable issue, PR, review and commit cards[/-][+]ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components[/+]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.
uploads-sh commentedon Nov 9, 2026
uploads put <file> --issue 3795· docs17 remaining items
CONTRACT: feat(ui-kit): GitHub component family and UntrustedText (#3800
schlessera commentedon Nov 17, 2026
Unblocked: all four declared blockers (#3797, #3798, #3796, #3800) are closed, so the
blockedlabel is removed.schlessera commentedon Nov 17, 2026
Claimed for implementation. Claim token:
claim-7f2ccd3a. Branch:feat/3795-github-tool-components.collisions: no path collisions on the chat tool-card paths
fix(ui-react): answer review of the GitHub tool cards (#3795)
fix(ui-react): name the GitHub write's target on its approval, and re…
fix(ui-react): show the host's own detail refusals in its words (#3795)
fix(ui-react): keep detail sections retryable and counts honest (#3795)
fix(ui-react): never blame GitHub for the host's own failures (#3795)
fix(ui-react): S4 only for GitHub's own failures; honest comment targ…
fix(ui-react): follow empty detail pages; keep rows past a refusal (#…
feat(ui-react): render the host GitHub tools as the ui-kit GitHub com…
schlessera commentedon Nov 17, 2026
Delivered in #4146 (squash 8da7182). The four host GitHub tools now render as the ui-kit GitHub components on every backend and under every tool-name spelling. On-demand detail loads through #3796 only after the reader acts. Every direct link passes #3797's validator. Failures the host made itself read in the host's words, and only GitHub's own failures use S4–S7.
Two criteria are carried by follow-ups, both milestoned 0.45.0:
GitHubCommentin preview, with a full target row. The comment tool's approval names neither the posting account nor whether the target is an issue or a pull request, and the renderer won't invent either. Until then the preview shows the target asowner/repo #nand the draft as untrusted text.The heavy proof runs on the squash's main run.