Repository navigation
feat(site/src/pages/AgentsPage/components): simplify the git panel header - #29699
Closed
tracyjohnsonux wants to merge 22 commits into
Closed
tracyjohnsonux wants to merge 22 commits into
tracyjohnsonux wants to merge 22 commits into
Conversation
chat_diff_statuses held one row per chat, so a chat could only track one pull request at a time and a branch switch carried the previous PR's URL onto the new branch's data. Re-key the table to (chat_id, git_remote_origin, git_branch) so every ref the agent reports keeps its own row. Existing rows satisfy the new key without a rewrite: both columns are NOT NULL with '' defaults and the old key capped rows at one per chat. The worker claims stale rows by the full key. Retained refs keep polling on their own schedule, so no pause state or resume protocol is needed. Telemetry reports one diff row per chat via DISTINCT ON. The diff GET's discovery write now keys its upsert to the stored ref. Under the old single-row key an empty ref key was safe; under the composite key it would create a stray row the worker ignores. Old coderd instances must finish before this migration runs: their ON CONFLICT (chat_id) writes have no arbiter under the new key.
The primary ref is the most recently reported one, but its ordering column was updated_at, the generic mutation time. A discovery GET that resolves a changed PR URL late could bump the old ref's updated_at past a newer report and steal the primary back. The table now tracks reported_at, set only by reports. Primary ordering, the chat-list tiebreak, and telemetry dedup read it. Refreshes, claims, backoffs, and URL writes cannot reorder the primary anymore. The discovery write uses a dedicated query that never touches ordering columns.
The chat diff client and query cache now track every ref the chat follows, not only the primary. The GET diff client accepts a ref selector. The diff-contents query key includes the ref, so each ref keeps its own cache entry. The watch merge keys rows by ref, so a changed row for one ref leaves the other refs' rows intact, and a tombstone row removes its ref. The diff-contents invalidation prefix-matches every ref.
The factory took positional git_branch and additions arguments. A const base with object spread states every field at each call site, matching the mock fixture convention.
Single-letter loop variables now name their rows. The tombstone and changed-row arguments are built before the merge call instead of nested ternaries inside it. The diff-contents key prefix gets a named family key that the invalidation reuses.
The merge phases and the event derivation groups ran together without separation. Each phase and group now has its own comment with a blank line between them.
The git panel now shows one view per tracked ref. Selecting a ref loads that ref's diff. A chat tracks one status row per ref, and the first row is the primary. The view switcher lists one entry per ref from diff_statuses. Each entry shows the PR state and number, or the branch name when no PR exists. Selecting an entry fetches that ref's diff with its origin and branch selector. The diff body, PR title, and stats follow the selection. A selection that resolves to nothing falls back to the newest ref. The inline comment box resets when the ref switches, so a comment draft cannot leak from one PR into another.
Every mock data fixture now starts with mock: mockDiffStatus, mockChatWithDiffStatus, and mockDiffContents. Factory helpers keep their make prefix: makePrStatus and makeRepo.
Every call site passed the same chat id. A const removes the argument that no caller varied.
The effective view was a four-level ternary chain. It is now a reconcile function whose branches read in order: hidden remote tab, untracked ref, gone repo root, then the fallbacks. The selector object for the selected ref is a named variable instead of an inline JSX object, and the closure predicates use named variables instead of re-narrowing the union.
The query enable conditions are named variables: hasPrUrl and hasRefSelector state what the enable rule checks.
The component mixed its derivation logic inline: diff line counting, repo set unions, switcher item building, view reconciliation, and the selected-ref lookup each lived as nested code inside the component body. Each is now a module-level helper with a name, and the component reads as wiring between them. The diff fetch enable check states its contract in one line.
The view selection, the selected row, and its PR metadata were one unbroken run of declarations. Each group now sits under its own comment with a blank line between groups.
…ader A lone view (one PR, one branch, or one working repo with nothing else) renders as a plain label instead of a bordered menu trigger. The primary action moves into the toolbar and follows the view: a PR shows a View PR link, a working repo shows a Commit button. The per-view sub-headers keep the branch and stats but drop their buttons.
…er with the summary tab The refresh control sits beside the view switcher, the primary action takes the far right, and the unified/split toggle moves into the branch/stats sub-header as a shared DiffStyleToggle. The toolbar's padding puts the switcher text on the same 16px gutter and first-line center as a summary paragraph. The plain single-view label keeps the trigger's border box so text does not shift when a second view appears. The switcher now follows the other agents dropdowns: a rotating chevron, radio items with a check mark on the active view, compact item sizing, and a separator between remote and working entries.
…ke the terminal selector The trigger is h-8 in a px-3 gutter with the terminal selector's padding, chevron size, and w-56 menu. The refresh button and Commit button scale up with it. pt-3 keeps the control centered on the summary tab's first line.
DanielleMaywood
force-pushed
the
feat/chat-diff-ref-gitpanel
branch
7 times, most recently
from
September 24, 2026 08:32
96fbdeb to
93f2d37
Compare
DanielleMaywood
force-pushed
the
feat/chat-diff-ref-gitpanel
branch
10 times, most recently
from
October 1, 2026 09:59
8994071 to
a9210b7
Compare
DanielleMaywood
force-pushed
the
feat/chat-diff-ref-gitpanel
branch
3 times, most recently
from
October 6, 2026 10:14
045fbb8 to
2ade5e8
Compare
DanielleMaywood
force-pushed
the
feat/chat-diff-ref-gitpanel
branch
from
October 9, 2026 09:36
2ade5e8 to
cb0dbd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simplifies the git panel header. Stacked on #29544 (per-ref views in the git panel) so the multi-PR switcher and this header change do not collide.
[switcher] [refresh] ... [action]. The action follows the active view: a PR shows a small View PR link, a working repo shows a small Commit button. The unified/split toggle moves into the branch/stats sub-header as a sharedDiffStyleToggle.Header states
⑂ PR #4847label, refresh, View PR on the right● coderlabel, refresh, Commit on the rightOpen | PR #4847 ▾dropdown, action swaps with the selected view⑂ feat/branchlabel, no actionDecision log
/tree/<branch>URLs for them, so the link requires a PR number, not just a URL.DiffStyleTogglelives inDiffViewer.tsxnext toDiffStyleso both sub-headers can render it without a GitPanel/RemoteDiffPanel import cycle.LocalDiffPanelis mocked in the header tests because the@pierre/diffsweb component cannot be constructed under jsdom.Generated by Coder Agents on behalf of @tracyjohnsonux.