Repository navigation
Description
Context
The dedicated GitHub chat components (#3795) show what a #3791 tool returned, and they can load more when the user asks: the rest of a long comment thread, a PR's full commit list, its changed files, a review's comments, check-run details. Putting all of that in every tool result would bloat the model's context and the provider history for detail nobody opened. Leaving it out entirely means a "show all commits" control has nothing to call.
Today there is no path for a client to read GitHub data. #3791 gives the model host tools, and the host credential never enters a worker. The client needs a matching host read path for display, under the same credential and the same structured schemas.
Binding constraints:
- Provider history: display data stays in internal storage and never enters the provider-facing conversation. Details loaded on demand are display data. If the user wants the model to see them, the model reads them through a Epic: hosted turns read and file GitHub issues through governed host tools #3791 tool, which follows that tool's rules.
- HTTP API: every route is declared in the inventory as supported (
S) or internal (I), with its authentication. Route modules live inpackages/ui-server/src/routes/, e.g. the per-session readpackages/ui-server/src/routes/attachment-reads.ts.
Blocked by #3797
Scope
- One owner-authenticated,
no-store, read-only route family, marked internal (I), for detail pages of a GitHub object already shown in a session, e.g.GET /api/sessions/:id/github/:ref/:part?cursor=(final shape decided in the PR).partis a fixed set:comments,reviews,review-comments,commits,files,checks. - Bounded authority. It serves only objects (
owner/repo#number) that a Epic: hosted turns read and file GitHub issues through governed host tools #3791 tool result in that session returned. It is not a general GitHub proxy. An object not in the session's results is 404. The caller must own the session. - Avatar proxy (maintainer, 2026-11-09). A second internal route, e.g.
GET /api/sessions/:id/github/avatar/:login?size=, serves the avatar of a user who appears in one of that session's GitHub results, from the brain's own origin, so the browser never contacts GitHub.- The host fetches only from GitHub's avatar host, without credentials.
- It accepts only PNG, JPEG, GIF or WebP, checked by magic bytes, not by the upstream content type, and serves them with
X-Content-Type-Options: nosniff. - It caps response bytes and pixel dimensions, and caches in a bounded, disposable area outside the brain, so it never writes
brain.dbor Markdown. - Any failure answers 404, and the component falls back to initials.
- Same credential, same schemas. It uses Epic: hosted turns read and file GitHub issues through governed host tools #3791's dedicated
BRAIN_UI_GITHUB_TOOLS_TOKEN(no fallback) and returns pages in Epic: hosted turns read and file GitHub issues through governed host tools #3791's structured contract types (untrusted strings marked as such), with a cursor. Page size has a fixed upper bound. - Validated direct-link URLs (D3, maintainer 2026-11-10). Page items carry the same nullable sub-object
html_urlas ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's types (comment, review, review comment, commit). Each passes ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's exported validator before it is returned:https:, host exactlygithub.com, no userinfo or port, the kind's path and fragment shape, and the same owner, repo and number as the session's object (and the item's own id or sha). A failing URL is returned asnull, never repaired. The route never constructs a GitHub URL. - Not model input. Responses are never added to the session's provider conversation, are not journaled as turn input, and do not taint the session.
- Honest failures. Missing credential, rate limit (with reset time), not found or access revoked, and upstream errors each return a distinct, typed error the components can render.
- A thin client function in ui-react for the components to call, with no caching beyond the component's lifetime.
- Inventory row and spec in
docs/http-api.md.
Out of scope
- Writes of any kind. Those stay Epic: hosted turns read and file GitHub issues through governed host tools #3791 tools behind approval cards.
- Polling, live updates, webhooks or GitHub detail-response caching. The bounded disposable avatar cache explicitly required above is the sole caching scope here.
- Diff hunks or file contents beyond the
filessummary. Add them later, additively, if the design asks.
Acceptance criteria
- For an object returned by a Epic: hosted turns read and file GitHub issues through governed host tools #3791 tool in session S, the owner of S can page its
commentsandcommitswith cursors. A keyless test against a loopback stand-in for the GitHub API proves it, including the page-size bound. - The same request for an object not returned in S, for a session the caller does not own, or for a
partoutside the fixed set, is refused (404 / 403 / 400). Tests cover each. - After any number of detail reads, the session's next provider request is byte-identical in its earlier history, and no
taintevent is recorded. Tests prove both, and the keyless provider-history guard passes. - Without a configured credential, and on a rate-limit response, the route returns its typed errors (the rate limit includes the reset time).
- The avatar route serves a cached avatar for a login present in S's results, and 404s for a login not present. It refuses an upstream response that is not an allowed image by magic bytes, such as SVG or HTML labelled
image/png, and one over the byte or pixel cap. It sends no credential upstream. It keeps its cache bounded: a full cache evicts, never grows. A test against a loopback stand-in covers each. - A page item whose upstream
html_urlfails ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's validator (another host such asgithub.com.evil.example, another owner/repo/number, a mismatched id or sha) is returned withhtml_url: null, while a conforming one is returned unchanged. A test against the loopback stand-in covers both. - Mutation receipt: drop the session-membership check, and the "not returned in S" test fails.
Verification
bun run test packages/ui-server/tests(new route tests) and the provider-history guard.
Contract impact
Two internal HTTP routes (I), the detail pages and the avatar proxy: listed in the inventory, with no compatibility guarantee.
Updated 2026-11-09: the avatar proxy and the dedicated credential added (maintainer). The payload types are #3791's contract types.
Triage 2026-11-09 at main 9c7eb25825fdad5f4485db0df472188805edb450: Reconciled the caching exclusion with the already-approved bounded avatar cache. The dedicated credential, owner/session membership, display-only history boundary and typed failure requirements are settled; #3797 is the active implementation prerequisite. Readiness describes the brief and does not clear its dependency.
Triage 2026-11-10 at main 3aadc8df5: Decision (maintainer, 2026-11-10): D3 permits independently validated comment/review/commit URLs as direct links. Detail pages return those URLs only after #3797's validator passes them, and null otherwise; added the scope line and a test criterion. Still agent-ready and blocked by #3797.
Activity
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.
schlessera commentedon Nov 10, 2026
Decision (maintainer, 2026-11-10):
2026-11-10 triage at main
3aadc8df5: detail-page items carry the same nullable sub-objecthtml_urlas #3797's types. Each URL passes #3797's validator before it is returned, and a failing one comes back asnull. The route never constructs a GitHub URL. Added that scope line and a test criterion. Labels unchanged (agent-ready,blockedby #3797).schlessera commentedon Nov 15, 2026
Claimed for implementation. Claim token:
claim-f9731b85. Branch:feat/3796-github-detail-pages.path collisions with open PRs #3622, #4002, #4068 (app.ts, docs/http-api.md); #3798 runs in parallel
CONTRACT: feat(ui-sdk,ui-server,ui-react): serve on-demand GitHub det…
schlessera commentedon Nov 16, 2026
Merged in #4077 as
4c541adacthrough the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.feat(ui-react): render the host GitHub tools as the ui-kit GitHub com…
CONTRACT: feat(ui-sdk, ui-server, ui-react): per-review line-comment …