feat(mobile): surface and resolve PR review threads on the Changes screen
Reading review feedback and clearing it from a phone is one of the strongest mobile use cases we have, and the host-service APIs for it already existed with nothing in apps/mobile calling them. This wires them up on the Changes screen.
What you get
A Review comments section under Status on workspace/[id]/diff, ported from the desktop review tab (WorkspaceSidebar/hooks/useReviewTab) rather than reinvented:
- Unresolved threads first, one card each: file + line anchor, author avatar and login, relative time,
Outdatedbadge, reply count. - Resolved threads are never hidden — they sit behind a collapsed
Resolved (n)group, dimmed, with aRESOLVEDbadge and anUnresolvebutton. - PR-level
Conversation (n)comments in a third collapsed group, matching desktop's third grouping. Tapping one opens it on GitHub. - Resolve / unresolve inline, optimistic: the card moves groups immediately, and a failure rolls the query cache back and raises an alert instead of leaving a thread looking cleared.
- Open in diff reuses the existing
diffViewStore.requestJumpplumbing, so it lands on the file in Files changed exactly like Jump to file does.
Ordering within each group is oldest-first, like desktop. Desktop leads with Conversation; on a phone the actionable threads earn the top, so Conversation moved last.
How this relates to the comment surfaces mobile already had
They're opposite directions of the same review loop, and they stay separate on purpose:
line-comment/+stores/draftCommentsStoreare outbound: you compose drafts against diff lines, and Finish review sends them to an agent as a prompt. Nothing there reaches GitHub.- This section is inbound: threads reviewers (human or bot) left on the PR, resolved back to GitHub via
git.setReviewThreadResolution.
So no draft-comment code is touched, and no duplicate composer was added. The shared piece is navigation — requestJump — which both use to land on a file in the diff.
Data path
git.getPullRequestThreads / git.setReviewThreadResolution on the host service, over getHostServiceClientByUrl(hostUrl) like every other host call. The router's real shapes are re-exported as PullRequestThreads / PullRequestReviewThread / PullRequestConversationComment from lib/host-service/client, so the UI has no hand-written duplicates of the wire types. Query gated on the workspace's host being online; refetch on interval and on pull-to-refresh.
Readability of bot comments
Verified against a real CodeRabbit-reviewed PR, which changed the design: each comment is a page of markdown wrapped in <details>. Cards therefore stay collapsed by default showing a plain-text preview (badge strip, disclosure reasoning, fences and HTML comments stripped), with resolve reachable without expanding. Expanding renders GitHub markdown via the existing MessageResponse, minus the <details> block — GitHub keeps that collapsed and the RN renderer would otherwise print its raw tags.
Verification
Driven on the iOS simulator against PR #6476 (4 real CodeRabbit threads, 2 unresolved) through the workspace's live host:
- Section renders both unresolved threads with correct anchors, authors and previews;
Resolved 2andConversation 3groups populate. - Tapped Resolve on
eventBus.ts:343→ card moved to Resolved instantly, and the GitHub GraphQL API confirmedisResolved: true. - Tapped Unresolve → card moved back, API confirmed
isResolved: false. The PR was left in exactly its original state. - Forced the mutation to fail (temporary local throw, since removed): alert shown and the thread stayed unresolved — rollback confirmed.
- Open in diff landed on
packages/workspace-client/src/lib/eventBus.tsin Files changed. - No-PR workspace still shows only the existing "PR not opened yet" card — no orphan empty section.
The zero-thread empty state ("No review comments", with a Review on GitHub action) was not reachable live — every open PR I could point at had picked up bot comments — so that one card is code-reviewed only.
Root ./scripts/lint.sh and apps/mobile typecheck are clean. iOS-only, no tests per repo preference.
Summary by cubic
Surface PR review threads on the Changes screen in apps/mobile with inline resolve/unresolve. Previously mobile showed no inbound review threads; now unresolved threads appear first, resolved threads stay visible behind a collapsed group, and PR-level Conversation comments are collapsible.
- Data: fetch via host service
git.getPullRequestThreads; resolve/unresolve viagit.setReviewThreadResolutionusinggetHostServiceClientByUrl. Wire types re-exported inapps/mobile/lib/host-service/client. - Hook: new
useReviewThreadsgates on host online, sorts oldest-first, polls every 60s, supports pull-to-refresh, tracks per-thread pending state, and applies optimistic resolution with cache rollback and alert on failure. - UI: new
ReviewThreadsSectionrenders cards collapsed by default with a plain-text preview; expanding usesMessageResponseandreadableBodyto strip<details>/HTML. Shows Outdated/Resolved badges and reply count when collapsed. - Navigation: “Open in diff” uses
diffViewStore.requestJumpand routes to Files changed. - States: handles host offline, load/error, and empty (“No review comments”) states; only renders when a workspace PR exists.
- Screen wiring:
WorkspaceDiffScreennow includes the section and refreshes both changes and review threads;SectionLabelextracted.
Summary by CodeRabbit
- New Features
- Added pull request review threads and conversation comments to the mobile workspace diff view.
- Grouped unresolved, resolved, and general comments with collapsible sections and previews.
- Open comments directly in the diff or on GitHub.
- Added controls to resolve and reopen review threads, with loading and error feedback.
- Added automatic refresh and pull-to-refresh support for review discussions.