GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: expose per-ref diff statuses by DanielleMaywood · Pull Request #29082 · coder/coder

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Sep 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@DanielleMaywood DanielleMaywood added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 8, 2026
@DanielleMaywood DanielleMaywood mentioned this pull request Sep 8, 2026
feat(coderd): key chat diff statuses by ref #29081
Merged
@github-actions github-actions Bot assigned DanielleMaywood Sep 8, 2026
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from 9169278 to 5cb2c01 Compare September 8, 2026 12:47
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from 5cb2c01 to 064d2a7 Compare September 8, 2026 13:10
@DanielleMaywood DanielleMaywood changed the title feat(coderd): expose per-ref diff statuses feat: expose per-ref diff statuses Sep 8, 2026
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from 064d2a7 to f7f3b28 Compare September 8, 2026 13:40
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from f7f3b28 to 7def130 Compare September 8, 2026 15:18
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch 2 times, most recently from e55688b to eae5fbe Compare September 10, 2026 09:14
This was referenced Sep 10, 2026
docs(readme): DO NOT MERGE UAT fixture beta #29172
Closed
docs(readme): DO NOT MERGE UAT fixture alpha #29173
Closed
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from eae5fbe to c66b95b Compare September 10, 2026 13:09
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from c66b95b to d86382c Compare September 11, 2026 10:06
@DanielleMaywood

DanielleMaywood commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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-23T08:59:19.721047Z b3168bd 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Sep 11, 2026
View reviewed changes

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

Copy link
Copy Markdown

There was a problem hiding this comment.

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: 10e9ca4d69

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/database/db2sdk/db2sdk.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread coderd/exp_chats.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch 2 times, most recently from 4c58154 to e81202d Compare September 15, 2026 11:12
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch 2 times, most recently from 5344c6c to fdbbdf2 Compare September 15, 2026 14:01
@DanielleMaywood
DanielleMaywood added this pull request to stack #29833 September 24, 2026 08:37
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from 543e51e to d0e4266 Compare September 24, 2026 12:03
@DanielleMaywood

DanielleMaywood commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Re the documentation check: we will not add @Failure annotations here. Other chats endpoints that return 400 for bad query parameters do not annotate it, and this endpoint's existing 404 and 500 responses are not annotated either. Nothing in the repo requires them.

This reply was generated by Coder Agents.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch 2 times, most recently from 2ae28cc to e50e145 Compare September 25, 2026 08:59
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from e50e145 to 6f60ed0 Compare September 25, 2026 09:15
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from 6f60ed0 to 19afa16 Compare September 28, 2026 12:11
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch 2 times, most recently from 7c4c61b to 8795d37 Compare September 30, 2026 14:37
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from 8795d37 to 0e4de64 Compare October 1, 2026 09:10
Base automatically changed from feat/chat-diff-ref-key to main October 1, 2026 09:59
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from 0e4de64 to a9226da Compare October 1, 2026 09:59
@DanielleMaywood
DanielleMaywood requested a review from ibetitsmike October 1, 2026 10:04
@DanielleMaywood
feat: expose per-ref diff statuses
ef531c0
@DanielleMaywood
DanielleMaywood force-pushed the feat/chat-diff-ref-api branch from a9226da to ef531c0 Compare October 5, 2026 09:06
mafredri
mafredri reviewed Oct 5, 2026
View reviewed changes
Comment thread coderd/x/chatd/chatd.go Outdated

var sdkStatus *codersdk.ChatDiffStatus
var changed *codersdk.ChatDiffStatus
var primarySDK *codersdk.ChatDiffStatus

@mafredri mafredri Oct 5, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Maybe we could drop "SDK" here? It's a bit confusing, considering changed doesn't have it, etc.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@DanielleMaywood DanielleMaywood Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Dropped it

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/exp_chats.go Outdated
}
if (selector.RemoteOrigin == "") != (selector.GitBranch == "") {
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
Message: "The origin and branch query parameters must be set together.",

@mafredri mafredri Oct 5, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Set together, or omitted.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@DanielleMaywood DanielleMaywood Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Updated it

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mafredri
mafredri reviewed Oct 5, 2026
View reviewed changes

@mafredri mafredri left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

One design question here and two points inline, all about how diff_statuses is ordered. I only looked at ordering; didn't review tests or the rest of the diff.

The primary is the last ref the git credential helper reported, so it moves on every authenticated git operation in a different branch. An agent pushing a stack (push A, push B, push A) flips diff_status and reorders diff_statuses three times. A git fetch on main, or from a detached HEAD (branch "HEAD"), becomes the primary. Is "last git operation wins" the intended policy?

🤖 This review was automatically generated with Coder Agents.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread codersdk/chats.go
// Deprecated: use DiffStatuses, which lists every pull request
// the chat tracks.
DiffStatus *ChatDiffStatus `json:"diff_status,omitempty"`
DiffStatuses []ChatDiffStatus `json:"diff_statuses,omitempty"`

@mafredri mafredri Oct 5, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggestion: the stack's frontend treats this order as contract ("the first row is the primary" in site/src/api/queries/chats.ts, #29543), but the field has no doc comment, so Swagger and typesGenerated.ts don't say so. ChatDiffStatus also lacks the sort key, so clients can't sort the list or tell which of two events is newer.

Could we document the order here and expose the report time on ChatDiffStatus? Alternatively: a stable list order (e.g. created_at) with an explicit primary marker would also stop the top bar and sidebar PR menus from reshuffling on every report.

PS. DiffStatusRef and ChangedDiffStatus need doc comments too.

🤖

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@DanielleMaywood DanielleMaywood Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Made the order stable

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/x/gitsync/worker.go
// branch info even before the worker refreshes PR data.
if w.publishDiffStatusChangeFn != nil {
if pubErr := w.publishDiffStatusChangeFn(ctx, chatID); pubErr != nil {
if pubErr := w.publishDiffStatusChangeFn(ctx, chatID, codersdk.DiffStatusRef{RemoteOrigin: origin, GitBranch: branch}); pubErr != nil {

@mafredri mafredri Oct 5, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Check: the broadcast path in MarkStale also reaches this. Git run outside a chat process (terminal, IDE, startup script) has no CODER_CHAT_ID, so the ref is upserted into every non-archived chat on the workspace. Before #29081 that overwrote one row; now it adds a row and makes it primary, and rows are never pruned. A terminal git pull on main over HTTPS makes main the primary of every chat on the workspace, and this PR returns it in diff_statuses. Should the broadcast path still write refs now that chats keep several?

🤖

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
DanielleMaywood added 3 commits October 5, 2026 14:06
@DanielleMaywood
refactor(coderd): rename primarySDK and reword the diff selector error
1d962dc
The primary status in PublishDiffStatusChange is now named primary,
the same as the changed status next to it. The 400 error for an
incomplete ref selector now tells the user to set both query
parameters or omit both.
@DanielleMaywood
feat: keep diff_statuses in a stable order
780748f
diff_statuses now lists refs by first report, so the list does not
change order when a ref gets a new git report. diff_status is still
the ref with the most recent git report. One helper picks it, with
the same tie order as before. diff_status is the primary marker and
is no longer deprecated.

The SDK types for the ref list, the ref selector, and the changed
ref event now have doc comments.
@DanielleMaywood
fix(coderd/x/gitsync): refresh only chats that track a broadcast ref
77ee723
A git report without a chat ID comes from outside a chat process,
for example a terminal. MarkStale added the ref to every chat on
the workspace, and the ref became the primary of each chat. Rows are
not pruned, so the chats collected refs they never used.

MarkStale now refreshes only the chats that already track the
reported ref, and adds no rows. Reports with a chat ID do not change.
@DanielleMaywood
DanielleMaywood requested a review from mafredri October 5, 2026 14:55
mafredri
mafredri approved these changes Oct 6, 2026
View reviewed changes
@DanielleMaywood
DanielleMaywood merged commit 49b1a2c into main Oct 6, 2026
36 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@mafredri mafredri mafredri approved these changes
@ibetitsmike ibetitsmike Awaiting requested review from ibetitsmike

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@DanielleMaywood DanielleMaywood

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@DanielleMaywood @mafredri
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.