Skip to content

refactor(coderd): drop pass-through chat message conversion wrappers - #31023

Open
ibetitsmike wants to merge 1 commit into
mainfrom
mike/chat-settings-shared-handlers-db2sdk-wrappers
Open

ibetitsmike wants to merge 1 commit into
mainfrom
mike/chat-settings-shared-handlers-db2sdk-wrappers

Conversation

@ibetitsmike

Copy link
Copy Markdown
Collaborator

Deletes six helpers in coderd/exp_chats.go that only forwarded to db2sdk or the store: convertChatMessage, convertChatMessages, convertChatQueuedMessage, convertChatQueuedMessagePtr, convertChatQueuedMessages, and lookupEnabledChatModelConfigByID. Their callers now call db2sdk.ChatMessage, db2sdk.ChatQueuedMessages, and GetEnabledChatModelConfigByID directly, and convert message lists with slice.List. It adds 8 lines and removes 46.

Why it is safe: each call site now runs the function the wrapper called. slice.List and db2sdk.ChatQueuedMessages return an empty, non-nil slice for no rows, as the wrappers did, so empty lists still encode as []. A repository-wide search finds no other references to the deleted names.

Review focus: the two pointer results use new(db2sdk.ChatMessage(...)) and new(db2sdk.ChatQueuedMessage(...)), the Go 1.26 form of new that takes an expression. coderd/provisionerdaemons.go already uses it.

#29662 edits the same ChatMessagesResponse literal in getChatMessages, so the two conflict in that one hunk.

Validation: on main and on this branch, go test ./coderd -run '^(TestPostChatMessages.*|TestGetChatMessages_.*|TestPatchChatMessage|TestChatMessageWithFile.*|TestDeleteChatQueuedMessage|TestPromoteChatQueuedMessage|TestQueuedMessageWithoutOverrideCapturesEnqueueTimeModel|TestSendMessage.*|TestSubsequentSendWithoutOverrideUsesPersistedModel|TestChatModelOverrides)$' -count=1 passes (20 tests, 149 with subtests). The pre-commit hook passed (make gen, formatting, golangci-lint, slim build).

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

convertChatMessage, convertChatMessages, convertChatQueuedMessage,
convertChatQueuedMessagePtr, convertChatQueuedMessages, and
lookupEnabledChatModelConfigByID only forwarded to db2sdk and the store.
Call those directly.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, requested this review for @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-10-19T22:49:53.621370Z 69127f4 Draft marked ready
ℹ️ 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 69127f4b85

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

@ibetitsmike
ibetitsmike marked this pull request as ready for review October 19, 2026 22:48

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant