Skip to content

feat(site): per-ref views in the git panel - #29083

Draft
DanielleMaywood wants to merge 19 commits into
feat/chat-diff-ref-apifrom
feat/chat-diff-ref-ui
Draft

DanielleMaywood wants to merge 19 commits into
feat/chat-diff-ref-apifrom
feat/chat-diff-ref-ui

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The git panel now shows one view per tracked ref. Selecting a ref loads that ref's diff. This is part 3 of 3, stacked on the API change in part 2.

Fix

  • 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 all follow the selection. A selection that resolves to nothing falls back to the newest ref.
  • The watch merge keys statuses by ref. A changed_diff_status event updates only its own entry, so the other refs' cached statuses survive.
  • The diff contents query key includes the ref, so each ref caches its own diff.

Notes for review

  • The top bar pill reads diff_status, the primary the server picks. It does not pick the primary on the client, so the two can never disagree.

Generated by Coder Agents.

@DanielleMaywood DanielleMaywood added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 8, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-ui branch 2 times, most recently from 4fe2414 to 8533fe8 Compare September 11, 2026 08:57
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-ui branch 2 times, most recently from b3077f7 to d0cddef Compare September 11, 2026 11:12
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-17T10:04:58.137834Z 2697edb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0cddeffbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx Outdated
Comment thread site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx
Comment thread site/src/pages/AgentsPage/components/DiffViewer/RemoteDiffPanel.tsx Outdated
Comment thread site/src/api/queries/chats.ts Outdated
Comment thread site/src/pages/AgentsPage/components/GitPanel/GitPanel.stories.tsx Outdated
Replace the per-file PR status factories in the multi-PR tests and
stories with a MockChatDiffStatus fixture and a spread factory in
testHelpers, following the shared Mock* convention. Branch-only
fixtures now clear the PR fields explicitly, since the shared base
represents a full PR.
Stop deriving PR display metadata from diff_statuses[0]. The search
results render the shared PR icon component and pair line stats with
the sole PR only. The multi-PR sidebar badge and the top bar trigger
show the PR count with a neutral glyph, and the PR tab applies only
when the chat tracks exactly one pull request.

Remove the prIcon and diffStatus picks from the chat display config;
the tree already consumed only the full PR list.
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7fd9d0f8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/queries/chats.ts Outdated
Comment thread site/src/pages/AgentsPage/AgentChatPageView.tsx Outdated
Comment thread site/src/pages/AgentsPage/components/GitPanel/GitPanel.test.tsx Outdated
The PR filter closure between hook calls disabled memoization for the
panel handlers, so the compiler check failed. Hoist the PR predicate
to module scope and derive the sole PR after the hooks. Also unexport
the unused MockChatDiffStatus fixture constant.
The watch merge now inserts the event's embedded primary when the
cache lacks that row, so a client that missed the primary's push no
longer keeps an older ref at the head of the list. A cached row always
wins over the embedded snapshot, which can be older by delivery delay.

Populate diff_statuses in the chat page story fixtures, which still
seeded only the deprecated field, and assert the first arriving ref
drives the git panel's default diff fetch.
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 618248c436

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/queries/chats.ts Outdated
Unify the diff-status merge into a single map path so the embedded
primary is adopted and promoted even when the cache is empty. The
tombstone removal runs after the adoption, so a removed primary
cannot re-enter through the embedded snapshot.

Add pull_request_state to the diff-stat story fixtures, which the
PR filter requires, so the stories cover the counters again.
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7dcdd13653

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/queries/chats.ts
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25eedf469c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/AgentsPage/components/ChatTopBar.test.tsx Outdated
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8b55e58ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8e13faf8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/AgentsPage/components/DiffViewer/RemoteDiffPanel.tsx
Comment thread site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx
Comment thread site/src/pages/AgentsPage/components/GitPanel/GitPanel.test.tsx Outdated
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76ed8669b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


// The title row must carry the selected PR's title, not the
// branch-only primary's.
screen.getByText("fix: second change");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Move the selected-title presence check to Storybook

This test ends with a throwing getByText lookup, so its only outcome is that the selected title exists in the DOM. The branch-primary/older-PR state is visual coverage and should be captured in a Storybook story; keep Vitest focused on the already-covered ref-specific API request or another non-visual outcome.

AGENTS.md reference: site/AGENTS.md:L7-L7

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 42b57ea11e. The presence test is removed. The branch-primary state moves to a new BranchPrimarySelectedPr story whose play selects the older PR, so Pixel captures the title row following the selection. The title row has no role or accessible name, so no compliant Vitest query can target it.

Comment on lines +343 to +345
<span className="truncate">
{status.pull_request_title ||
(number ? `#${number}` : "PR")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include PR numbers in multi-PR menu labels

When two tracked PRs share the same title, which is common for repeated fixes or dependency updates, both menu items render with identical visible and accessible names because the unique PR number is used only as a fallback. Users cannot determine which PR each item opens; include the number alongside the title so every action is distinguishable.

AGENTS.md reference: site/AGENTS.md:L12-L12

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 42b57ea11e. Every menu item now renders PR #<number> <title>, matching the sidebar popover and the Git view switcher. The number is always present because branch-only rows are filtered out before classification. The selection test queries by the full name, and a new regression test selects by number alone when two PRs share a title.

@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42b57ea11e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +653 to +656
} else if (hasGitContext) {
title = "No pushed changes yet";
body = "Once commits are pushed, the branch diff will appear here.";
} else if (hasPullRequest) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prioritize the PR-only empty state

When prTab exists but remoteDiffStats has no row, showRemoteTab makes hasGitContext unconditionally true, while it also makes the passed isGitStatusLoading false. Fresh evidence beyond the earlier resolved empty-state thread is that this ordering therefore makes the following hasPullRequest branch unreachable, so a chat with a known PR always shows the misleading “No pushed changes yet” state instead of the dedicated pending-PR state. Check hasPullRequest before the generic Git-context branch and derive loading independently.

AGENTS.md reference: site/AGENTS.md:L11-L11

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2697edb539. Both halves: RemoteContent now checks hasPullRequest before the generic Git-context branch, so a known PR with no status row shows the pending-PR state, and the panel passes the raw watcher isGitStatusLoading flag instead of the collapsed derivation that could never be true when a PR was known. Precedence is now loading, then pending PR, then generic no-changes. The EmptyState story screenshots the pending-PR state, and the settle test exercises both flags uncollapsed.

@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2697edb539

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +80 to +83
expect(link).toHaveAttribute(
"href",
"https://github.com/coder/coder/pull/123",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Replace attribute-only link assertions

These new single-PR tests, including the similar checks in the no-PR and branch-only cases, end by asserting only the rendered href. FE1 explicitly prohibits attribute-presence assertions because they duplicate visual DOM coverage rather than exercising a non-visual outcome; keep these states in Storybook and retain a Vitest only if it drives an interaction and verifies navigation or another observable behavior.

AGENTS.md reference: site/AGENTS.md:L7-L7

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental Changes that might not necessarily be merged, until its approved to proceed with.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant