Skip to content

refactor(codersdk): move chat settings client methods onto request helpers - #30962

Draft
ibetitsmike wants to merge 3 commits into
mike/codersdk-chat-request-helpersfrom
mike/codersdk-chat-request-helpers-settings
Draft

ibetitsmike wants to merge 3 commits into
mike/codersdk-chat-request-helpersfrom
mike/codersdk-chat-request-helpers-settings

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Moves the 33 chat settings client methods in codersdk/chats.go onto the requestJSON and requestNoContent helpers from #30961: the deployment, organization, and user settings under /chats/config, and the organization model overrides. Each method drops its own request, status check, and decode block, so the file loses 283 lines.

Why it is safe: the script from #30961 did the conversion, and this diff is exactly its output. It rewrites a method only when its body ends in the standard block, with a zero value that matches the decoded type, and it keeps the HTTP method, path, body, and expected status. #30961 shows that the helpers return the same errors as the code they replace.

  • The 776 tests in test files that call a chat client method (12 packages) pass here. With -coverpkg=./codersdk, every converted method's success path runs.
  • Call-site mutants (go test -overlay) fail existing coderd tests: UpdateOrganizationChatModelOverride without a body (TestChatModelOverrides), DeleteUserChatCompactionThreshold sending GET (TestUserChatCompactionThresholds), GetChatAdvisorConfig expecting 201 (TestChatAdvisorConfig_GetDefault), and GetChatRetentionDays reading the debug retention path (TestChatRetentionDays).

Review focus: each hunk swaps one block for one call, so check the status argument against the deleted check. UpdateOrganizationChatModelOverride, UpdateUserChatCustomPrompt, and UpdateUserChatCompactionThreshold return a body with 200. The other updates expect 204.

Validation: go test ./codersdk -count=1 passes, golangci-lint run ./codersdk/ reports 0 issues, and the pre-commit hook passed.

Stack

This stack removes two unused chat exports from codersdk and moves 72 chat client methods in codersdk/chats.go onto two shared request helpers. Client behavior does not change.

  1. refactor: remove unused chat exports from codersdk #30959 Remove unused chat exports from codersdk
  2. test(codersdk): cover chat client request errors and options #30960 Cover chat client request errors and options
  3. refactor(codersdk): add chat client request helpers #30961 Add chat client request helpers, for the project and model methods
  4. refactor(codersdk): move chat settings client methods onto request helpers #30962 Move the chat settings methods onto the request helpers
  5. refactor(codersdk): move chat client methods onto request helpers #30963 Move the chat methods onto the request helpers

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

…lpers

Move the 33 chat settings client methods (the /chats/config endpoints
and the organization model overrides) onto requestJSON and
requestNoContent. Each converted method keeps its signature, HTTP
method, path, body, and expected status. Error results are unchanged.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-18T17:18:02.700724Z 65dcde4 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: aaabee3b3a

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

Copy link
Copy Markdown
Collaborator Author

@codex review

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 65dcde408b

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

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