Skip to content

ui-server: serve on-demand GitHub detail pages to the chat components, outside the model's context #3796

Closed

Description

@schlessera

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 in packages/ui-server/src/routes/, e.g. the per-session read packages/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). part is 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.db or 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_url as 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 exactly github.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 as null, 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 files summary. 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 comments and commits with 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 part outside 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 taint event 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_url fails ui-sdk, ui-server: GitHub tool contract, dedicated credential and host read tools #3797's validator (another host such as github.com.evil.example, another owner/repo/number, a mismatched id or sha) is returned with html_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

  1. added
    type: feat
    area: ui-server
    area: ui-react
    blocked
    on Nov 9, 2026
  2. added this to the 0.45.0 milestone on Nov 9, 2026
  3. added
    priority: p1
    on Nov 9, 2026
  4. 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.

  5. added
    agent-ready
    on Nov 9, 2026
  6. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-10):

    2026-11-10 triage at main 3aadc8df5: detail-page items carry the same nullable sub-object html_url as #3797's types. Each URL passes #3797's validator before it is returned, and a failing one comes back as null. The route never constructs a GitHub URL. Added that scope line and a test criterion. Labels unchanged (agent-ready, blocked by #3797).

  7. removed
    blocked
    on Nov 15, 2026
  8. self-assigned this
    on Nov 15, 2026
  9. schlessera commented on Nov 15, 2026

    @schlessera
    OwnerAuthor

    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

  10. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Merged in #4077 as 4c541adac through 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.

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-reactarea: ui-serverpriority: p1type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions