Part 2 of 6. Depends on #29081.
The API now exposes every ref a chat tracks. All API changes are
additive.
- `Chat.diff_statuses` lists every ref on the chat GET and in chat lists
(including child chats). The order is stable: refs are listed by first
report, so the list does not change order when a ref gets a new git
report.
- `Chat.diff_status` is the primary: the ref with the most recent git
report. It is the same rule as before. Use it to find the primary, not
the list position.
- `ChatDiffStatus` gains `remote_origin` and `git_branch`.
- `diff_status_change` watch events carry `changed_diff_status` (`{ref,
status}`) naming the ref that changed. If that ref's row is gone,
`status` contains only `chat_id`.
- `GET /chats/{chat}/diff` accepts optional `origin` and `branch` query
parameters. Set both or omit both (otherwise 400). A selector that
matches no stored ref returns 404. Without a selector the endpoint
returns the primary, as before. The Go SDK adds `WithChatDiffStatusRef`
for this.
- A git report without a chat ID (for example, from a terminal or an
agent older than v2.32) now refreshes only the chats that already track
that ref. It does not add the ref to other chats. Such a report can no
longer give a chat its first ref.
Generated by Coder Agents.