Chats page — a thread's pull requests and their outcomes, stage progress, the sidebar row, and the changes chip and review screen. A repository rule for apps/ui/src/renderer/chats/use-thread-pull-requests*, apps/ui/src/renderer/chats/pull-request-*, apps/ui/src/renderer/chats/run-outcome*, apps/ui/src/renderer/chats/use-run-outcomes*, apps/ui/src/renderer/chats/use-run-daemon-read*, apps/ui/src/renderer/chats/timeline-tab*, apps/ui/src/renderer/chats/stage-*, apps/ui/src/renderer/chats/stages...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rule Ui Chats Pull Requests?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/geniro-io-rule-ui-chats-pull-requests)
---
name: rule-ui-chats-pull-requests
description: "Chats page — a thread's pull requests and their outcomes, stage progress, the sidebar row, and the changes chip and review screen. A repository rule for apps/ui/src/renderer/chats/use-thread-pull-requests*, apps/ui/src/renderer/chats/pull-request-*, apps/ui/src/renderer/chats/run-outcome*, apps/ui/src/renderer/chats/use-run-outcomes*, apps/ui/src/renderer/chats/use-run-daemon-read*, apps/ui/src/renderer/chats/timeline-tab*, apps/ui/src/renderer/chats/stage-*, apps/ui/src/renderer/chats/stages-section*, apps/ui/src/renderer/chats/use-chat-run*, apps/ui/src/renderer/chats/chat-list-item*, apps/ui/src/renderer/chats/changes-review-dialog*, apps/ui/src/renderer/chats/review-*, apps/ui/src/renderer/chats/use-review-comments*, apps/ui/src/renderer/chats/use-chat-changes*, apps/ui/src/renderer/chats/changes-tree*, apps/ui/src/renderer/chats/use-run-work-folders*, apps/ui/src/renderer/components/stage-graph*; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/ui-chats-pull-requests.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->
# Chats — pull requests, stage progress and changes
**Pull requests and changes:**
- A thread's pull requests are only those it opened or its CLI recorded it touching (the run wire's `pullRequests`, each marked `opened`; a task card shows only the opened ones), addressed by URL (`use-thread-pull-requests.ts` over `readPullRequestsByRef`), GitHub pull requests and GitLab merge requests alike (`shared/pull-request-ref.ts`; a merge request is labelled `!N`, a pull request `#N`). That hook is the only source for the panel, the sidebar and the shelf.
- A pull request's recorded outcome (`record_outcome`) is the daemon's `DisplayedPullRequest.outcome`, never folded from the window: the shelf chip draws its acceptance mark beside the number from it, and a `run_outcome` transcript row reads superseded once that outcome's seq is newer than its own (`RunOutcomesContext`). The row opens on a press into the agent's summary, every figure and the pull request's link row; its title and state come from the same `use-thread-pull-requests.ts` answers the panel draws (`RunOutcomes.resolved`), so a surface that asks none draws the number alone. `daemon-client.ts` carries it through every run-status announce. The inspector's Timeline tab opens with the thread's Pull requests section (`ThreadPullRequestsSection`, drawn while the thread has one), which draws a pull request's whole outcome history under its row (`chats/pull-request-outcome-history.tsx`, folded per thread to the newest verdict), read from the daemon (`GET /v1/chats/:runId/outcomes`, `use-run-outcomes.ts` over `use-run-daemon-read.ts`, the one whole-run read the artifacts and team-notes lists share) and re-read when the newest outcome seq on the run's list moves.
- A team run's stage progress is the daemon's `RunDto.stages` (`StageProgress`), replaced whole by every `run_status.stages` (`run-status-row.ts`) — never folded from `stage_change` rows, so `n/m` and every status hold past the loaded window. The inspector's Timeline tab (`TimelineTab` in `timeline-tab.tsx`, its Stages view the Stages section; stage rows are `stage-entry.tsx`) and the Stages section (moves through `moveTeamRunStage` with `expectedRev` from `stage-action-dialog.tsx`; a `409 STAGE_PROGRESS_CHANGED` keeps that move dialog open, re-bases it on the newer stages and shows "stages moved" for the user to confirm again) and the transcript row (`stage-change-row.tsx`, next-stage titles from `RunStagesContext`, provided once with the transcript's values (`TranscriptContexts`); a move's row reads superseded once its stage's `StageProgressEntry.rev` names a later move, a nudge's once the run's `rev` moved on) all draw it, and every stage graph is the one `components/stage-graph.tsx`: React Flow nodes laid out and routed by ELK (`stage-graph-layout.ts`, orthogonal wires, so a wire that skips stages runs beside them and never across a pill), drawn once its lazy chunk and the layout land, so a spec reading its pills awaits `__tests__/settle-stage-graphs.ts`. The board card's line reads `TaskDto.stage`; `use-board.ts` reloads on a stages-only announce for a run it holds.
- A sidebar row names the thread's newest resolved pull request among those it opened, and a touched one only for a thread that opened none — never in place of an opened one that did not resolve (`rowPullRequestOf`).
- A ref the host could not answer still draws a row. When the reason is a missing `gh`/`glab`, a missing login or no access (`PullRequestRefResult.access`), the panel and the task report draw the explanation under the row and the chip's tooltip carries the same sentence (`chats/pull-request-access.tsx`), with a button that opens Terminal with the fixing command — never on a paired device.
- The renderer replaces the run's list wholesale on each announce.
- Do not reintroduce a branch-scoped pull-request list.
- `keepFresherRows`: a pin, colour or pull-request list written without moving `updatedAt` is decided by the listing. So are the live readings (`awaiting`, `holdingFor`, the shell/sub-agent/call counts), unless an announce of them arrived while the listing was in flight: no write stamps them, and an announce's `at` always postdates the row's `updatedAt`.
- "Changed since this chat started" uses `upstreamBaseSince` and excludes what a pull brought in. The header names the ref and claims no cause.
- A folder on one of the thread's open pull requests is measured from that pull request's base branch, so a stacked branch lists what GitHub lists (`changesPullRequestsOf` → `getChangesSince`'s fourth argument, re-read when GitHub's answer lands; `folderPullRequest` in main keeps those of the `origin` repository and matches the checked-out branch, else the head commit, else, for a detached worktree, a commit behind or past that head that is not already on its base). Without a match, a fetched base ref or a base past the start, the read falls back to the default branch, then the start. A worktree's dialog section names its own ref. A read past `MAX_CHANGES` draws `N+` on the chip, and its line counts cover only the files read.
- The changes chip and dialog also count the worktrees the thread's agents made (`use-run-work-folders.ts`). A worktree is the thread's only if all three hold: main lists it (`listWorktrees(cwd, startedAtMs)`: a linked worktree made after the thread started — birth of its `.git` link file — never the main checkout and never a geniro task worktree, the direct children of `worktreesRoot()`), and the run's own tool calls name it (`POST /v1/chats/:runId/named-paths`). Each is read as a work folder (`getChangesSince(…, true)`: from where its history meets the start, past what upstream already has, its commits and edits to tracked files only — a file it never added, such as an agent's log, is not listed; the thread's own folder still lists those). Found folders are only ever added; each lists in its own dialog section. Listings go through `worktree-list.ts` (see _Git_ in `apps/ui/src/main/AGENTS.md`).
- The changes chip, and its row in the phone's actions sheet, count the review comments not sent yet (`unsentCommentCount`, drafts of `use-review-comments.ts`). The changes chip opens the review screen (`changes-review-dialog.tsx`, a full-window `Dialog` over the chat), fed by the same `useChatChanges` reading, re-read past the freshness floor when it opens and whenever the window regains focus while it is open. It stays read-only toward the tree: it never stages, reverts or writes to git. Each file is a card (`review-file-card.tsx`) drawn from git's unified text by `review-diff-model.ts` (`parseFileDiff`, word marks shared with `UnifiedDiff` through `diff-word-spans.ts`, highlighting through `components/ui/highlight-lines.ts`); `UnifiedDiff` keeps its own callers unchanged. "Show N more lines" reads the worktree file through `readFileLines` (desktop only, absent on a paired device). Code rows, revealed lines and quotes wrap to the card's width and show every invisible or bidi character as a `<U+XXXX>` mark (`hidden-char-marks.ts`, over `text-hazards.ts`'s `hiddenCharHits`, passed to `highlightLines` as its `renderText`), so the reviewer reads what the file holds; anchoring still compares without them.
- Viewed is per device, in thread UI memory, as two flags per file: `review-viewed:<folder>\0<path>\0<hash of body>` and `review-viewed-any:<folder>\0<path>`; a set `-any` beside an unset body key reads "Changed since you viewed it". The hash is FNV-1a in the renderer, never `crypto.subtle` (the phone's page is not a secure context).
- Review comments live in the daemon (`review_comments`, `use-review-comments.ts` re-read on `review_comments_changed` and on reconnect), never in git. Comments are written in the diff itself, GitHub's way, never in a popup: the editor opens under the line, range or file header it belongs to (`ReviewCommentEditor`, `expandable={false}` so its field has no ⤢ editor dialog), and a draft stays there as a block. Send review in the header opens "Finish your review" (`FinishReview`), a panel in the screen under the header with the drafts and an optional note, never a dialog over it; Cmd/Ctrl+Enter sends and Esc closes either one without closing the screen (`reviewFieldKeys`). Drafts go to the agent only through Send review, as ONE message (`sendChatReview` / `sendTeamReview`) carrying `payload.review`, which the transcript draws as a review card (`review-message-card.tsx`, twin parser `review-payload.ts`). A send while the agent works waits for the turn to end (a chat: no open turn; a team: `followUpDelivery` no longer queues) and a `RUN_BUSY` retries with the same `clientMessageId`; both routes answer `RUN_BUSY` while the agent's (a team: a lead's) turn runs, so a review is never delivered mid-turn. A comment is placed by `anchorComment` (its quote near its stored line, else anywhere in the file's rows: the hunks and the lines read around them, in line order), comparing lines without the hidden characters the daemon strips from a stored quote (`withoutHiddenText`, twin of the daemon's `hidden-text.ts`). One it cannot place is read from the file on disk at its stored lines (`quoteMatches`) and is Outdated only when those differ too; the agent answers each through `answer_review_comment`.