Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: multi-provider pull requests page with in-app reviews #4849

MergedBil0000(GitHub profile, opens in a new tab)merged 223 commits intomain fromrefs/pull/4849/headmerged by juliusmarminge View on GitHub

Adds a dedicated Pull Requests page: browse, read, review, and act on change requests from every host a workspace uses, without leaving T3 Code.

Summary

A sidebar entry opens a full page listing pull requests across all projects in the environment, with a detail panel beside it for reading, reviewing and acting on one. Four hosts are supported — GitHub, GitLab, Bitbucket and Azure DevOps — behind a single provider interface.

Each host runs through a wrapper that already existed in this repo (gh, glab, the Bitbucket HTTP client, az), so there is no new authentication story and nothing new to configure.

Design

One interface per host. PullRequestProviderApi defines the operations; the service knows only the registry, so no adapter knows another exists. Adding a host is one file.

Capabilities are declared, not assumed. Each provider states what it supports — patch, comment, actions, merge strategies, review verdicts — and the surface follows it. Nothing renders a control that would fail: Azure DevOps has no Code tab because az exposes no patch, GitLab offers no Request changes because GitLab has no such verdict, and Bitbucket offers no Reopen because Bitbucket has no such endpoint. The server refuses an undeclared operation independently of the UI.

A review is one request. The summary, every line comment and the verdict travel together, so a half-written review is invisible to everyone else. GitHub takes that natively; GitLab and Bitbucket have no pending review, so the provider replays it as the requests it is made of, with the verdict last — a review that fails part-way is never an approval.

Hosts, not provider kinds. github.com and a GitHub Enterprise install are the same kind and different accounts, so the viewer, de-duplication and every row key are scoped by host.

Degrade, never blank. One unreachable repository becomes an entry in errors while the rest render. A malformed row is skipped rather than failing its batch. Enum-like fields decode as strings and are normalised, so a host adding a new status cannot break a payload.

Scope

  • List — involvement (All / Reviewing / Authored) × state (All / Open / Closed / Merged), free-text search, project and host filters, infinite scroll.
  • Detail — Summary, Timeline and Code tabs; description and conversation as markdown with inline images and video; comment composer.
  • Review — conversations already on the pull request sit under the line they were written against, with reply and resolve; selecting lines opens a comment that joins a draft review, submitted as Comment, Approve or Request changes.
  • Actions — merge (with the repository's allowed strategies), ready, draft, close, reopen, comment, copy link, open on host.
  • In-thread — a thread's own pull request opens in the panel beside it, alongside the browser, diff and files. Handing one to a thread checks it out into a worktree and writes the task into that thread's composer.

What each host allows

Line commentsReplyResolveVerdicts
GitHubyesyesyesComment · Approve · Request changes
GitLabyesyesyesComment · Approve
BitbucketyesyesyesComment · Approve · Request changes
Azure DevOps————

Azure DevOps exposes no patch through az, so it has no lines to write against.

Testing

Repo-wide typecheck and lint clean. ~450 tests cover the service, the four decoders, and the invocations each wrapper makes — including the exact request body a review submission produces on each host.

Response shapes for GitHub, GitLab and Bitbucket were verified against the live APIs rather than documentation, which is what caught Bitbucket's page ceiling of 50 (above it the API returns an empty page and no error), its redirect-served diff endpoints, and the absence of a reopen endpoint in its published OpenAPI spec. GitHub's review-submission payload was verified against the live endpoint using a pending review, which was then deleted. Azure DevOps refuses anonymous REST, so its decoding follows the schema already in this repo and stays tolerant of missing fields.

Not exercised end to end: Bitbucket and Azure DevOps write operations, and GitLab's discussion endpoints. No credentials for any of them were available while building; reads are shape-verified where the API allows it and writes are unit-tested at the invocation level only.

Notes for reviewers

  • Untrusted input is treated as such: comment and review bodies travel over stdin rather than argv, a client-supplied repository is checked against the project's own remote, response-supplied URLs are validated against the configured API origin before credentials are attached, and every response body is bounded as it is read.
  • Bitbucket credentials come from the server environment (T3CODE_BITBUCKET_EMAIL + T3CODE_BITBUCKET_API_TOKEN), which are pre-existing and server-wide rather than per user.
  • A draft review lives in memory for the tab that is writing it. It is deliberately not persisted: nothing is on the host until the verdict is sent, and a stale draft restored days later would be worse than retyping one.

Note

Add multi-provider pull requests page with in-app reviews to the chat interface

  • Introduces a /pull-requests route with a filterable, searchable list supporting GitHub, GitLab, Bitbucket, and Azure DevOps via dedicated CLI/API adapters and a unified PullRequestService with caching and pagination.
  • Adds a right-panel PullRequestDetailPanel with Summary, Timeline, and Code tabs; PR links in chat and sidebars now open the panel in-app instead of launching a browser tab.
  • Implements inline diff review: pending comment drafts are managed in a Zustand store, a floating PullRequestReviewBar submits reviews with verdicts, and a ReviewThreadCard supports reply and resolve.
  • Adds 13 new WebSocket RPC methods and a POST /api/pull-requests/diff HTTP endpoint, all scope-gated; PullRequestProviderRegistry wires each provider to its transport layer.
  • GitManager now attempts to fetch and fast-forward an existing PR worktree to the current PR head on reuse, running the setup script only if the branch moved; GitPreparePullRequestThreadResult gains isOnPullRequestHead.
  • Adds remarkGithubAlerts plugin to chat markdown so [!NOTE]/[!TIP]/etc. blockquotes render as styled callout cards.
  • Risk: storage version bumped to 11 with a migration that drops persisted pull-requests panel state and converts legacy pull-request surface ids to the new keyed scheme; existing persisted right-panel state will be migrated on first load.
Macroscope summarized e634139.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 97da5f22-0528-4dbb-b587-0287e365dd84

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Reviewed the new Effect services (GitHubPullRequestCli, PullRequestService), the new contract errors, and the touched call sites. Module layout, namespace imports, Context.Service + inline interface, make/layer, and dependency acquisition via yield* Foo.Foo all follow the conventions. The findings below are all in error modelling.

      Posted via Macroscope — Effect Service Conventions
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High pullRequest/pullRequestDetail.logic.ts:104

      The PR title is interpolated directly into the task instruction on line 104, so an attacker-controlled title like Ignore all instructions and … is presented as a trusted directive rather than quoted data. The prompt's injection warning only covers "quoted finding[s] below," leaving the title outside that trust boundary. boundedField collapses and truncates but does not delimit the value as untrusted. Consider quoting the title (e.g. wrapping it in backticks or a labeled block) and extending the untrusted-data warning to cover it.

      ✅ Resolved in e1fca58b55dc1f54485b65310c612414e2c24c7f

    5. Fixed in e1fca58b5. The title, URL and branch names are quoted, and the untrusted-data warning now names them explicitly instead of covering only the findings below it.

    6. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    7. One residual convention issue from the previous pass: the readError alias in GitHubPullRequestCli.ts. The operation misreporting and the synthetic viewer-login cause are both resolved.

      Posted via Macroscope — Effect Service Conventions
    8. One convention issue found: a pure error-construction alias (providerError) in apps/server/src/pullRequest/PullRequestProvider.ts. Everything else in the new pullRequest service tree (inline Context.Service interfaces, make/layer exports, namespace imports, dependency acquisition through the Effect environment, inline Schema.TaggedErrorClass construction at each failure boundary) reads as conformant.

      Posted via Macroscope — Effect Service Conventions

Sign in to join this conversation.