Skip to content

ui-react, ui-kit: render GitHub tool results as dedicated issue, PR, review, commit and merge components #3795

Closed

Description

@schlessera

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:

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

Out of scope

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, a javascript: link, an https: link and a fenced code block, rendered end to end through a tool result, shows no interpreted HTML and no content image, an inert javascript: link, a code block, and an https: 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

  1. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    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).

    Read first
    - schlessera/brain-kit#3791 (the host GitHub tools and their structured payloads) and this issue.
    - packages/ui-react/src/components/chat/renderers/bind.tsx:1-16 — how a tool contract binds to a renderer (D3).
    - packages/ui-react/src/components/chat/renderers/apify-tools.tsx:1-8 — the precedent: remote content is untrusted and renders as bounded plain text, never markdown or a link.
    - packages/ui-kit/src/ (component families with stories) — where the new github/ family lives.
    - packages/ui-sdk/src/tool-contracts/blocks.ts:1-23 and docs/decisions/design-kit/answer-blocks.md — answer blocks (show_block), which these components are NOT.
    - docs/decisions/design-kit.md and docs/decisions/design-kit/components-and-interactions.md, tokens-and-styles.md, links.md.
    
    The problem
    A hosted chat turn reads a pull request through brain_github_issue_read. The result has
    title, number, state (open/closed/merged/draft), author, labels, timestamps, body
    (untrusted markdown, possibly with links, images and HTML), comments (each untrusted),
    review decisions per reviewer (approved / changes requested / commented), checks summary,
    change size (files, additions, deletions), commits (sha, author, untrusted message) and
    merge info. Today it renders as raw tool output. The user should see a PR they can read
    at a glance and explore, as a purpose-built component.
    
    Design
    1. For each object (pull request, issue, comment/thread, review, commit, merge, result
       list): what it shows first, its full layout, and every interaction it offers (tabs,
       timeline, filters, in-place expansion, jump to GitHub, …). Collapsing may be one
       behaviour but is not the default assumption.
    2. Composition: how the components nest and reference each other. A PR contains reviews
       and commits; a thread contains comments; a search result opens into an issue or PR.
    3. Untrusted text. DECIDED (maintainer, 2026-11-09): a safe markdown subset (emphasis,
       code, lists/task lists, quotes, headings; no HTML, no images), and links clickable only
       through an interstitial that shows the full URL. Design: how the subset looks inside each
       component, whether tables survive at 320 px, the truncation bounds and the "show more"
       affordance, how a link reads before you activate it, and the interstitial itself
       (layout, the emphasised domain, wording, keyboard and focus behaviour).
    4. Identity. DECIDED (maintainer, 2026-11-09): avatars are served by the host proxy from
       the brain's origin, with an initials badge for loading, failure and absence. Design:
       avatar sizes per component, the badge, and how stacks of reviewers or participants read.
    5. State encoding (open, closed, merged, draft, approved, changes requested, checks
       failing or absent) without relying on colour alone.
    6. Several objects in one answer, e.g. a search returning 20 issues: density, grouping,
       and where the list caps.
    7. Inline vs on demand. Details may load on demand through the owner-only detail route
       (#3796; fixed parts: comments, reviews, review-comments, commits, files, checks; paged).
       For each component, say which parts ship in the tool result, which load when the user
       asks, and what the trigger is. Draw the loading, empty, error, rate-limited and
       unavailable states, and "load more". Loaded detail is display-only and never reaches
       the model, so the design must not imply the assistant "saw" it.
    8. List any payload field this design needs that #3791's structured payload doesn't
       carry (e.g. counts that tell a component more exists), so it can be added there additively.
    
    Requirements to hold
    - Data-only: components read the typed payload. The only fetches are user-triggered calls
      to #3796's route and avatar images from the brain's own origin. Nothing executes.
    - The canonical github.com URL of the fetched object opens directly. Every other link
      goes through the interstitial, and only https: proceeds.
    - 320 px legibility, accessible names, keyboard access to every interaction, 44 px touch targets.
    - Visual baselines asserted in CI. Odysseus-world fixtures only.
    - Honesty: an absent field (no checks, unknown review state) reads as absent, never as passing.
    - You may not change the #3791 security model or the answer-block contract.
    
    Deliverable
    A comment on this issue with the answers above and ASCII mocks of each component in its
    main states, plus the link interstitial, at 320 px and at desktop width.
    
  2. added
    type: feat
    area: ui-react
    area: ui-kit
    needs: design
    blocked
    on Nov 9, 2026
  3. changed the title [-]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[/+] on Nov 9, 2026
  4. added
    priority: p1
    on Nov 9, 2026
  5. added this to the 0.45.0 milestone on Nov 9, 2026
  6. 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.

  7. uploads-sh commented on Nov 9, 2026

    @uploads-sh

    3795-identity.png

    3795-issue-and-list.png

    3795-links-interstitial.png

    3795-pull-request.png

    3795-states.png

    3795-storybook-plan.png

    3795-write.png

    View on uploads.sh

    uploads put <file> --issue 3795 · docs

  8. 17 remaining items

  9. removed
    blocked
    on Nov 17, 2026
  10. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Unblocked: all four declared blockers (#3797, #3798, #3796, #3800) are closed, so the blocked label is removed.

  11. self-assigned this
    on Nov 17, 2026
  12. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-7f2ccd3a. Branch: feat/3795-github-tool-components.

    collisions: no path collisions on the chat tool-card paths

  13. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    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:

    The heavy proof runs on the squash's main run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-reactpriority: p1type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions