Skip to content

refactor(coderd/x/chatd): delete the test-only advisor runtime getters - #30952

Draft
ibetitsmike wants to merge 2 commits into
mainfrom
mike/chatadvisor-test-getters
Draft

ibetitsmike wants to merge 2 commits into
mainfrom
mike/chatadvisor-test-getters

Conversation

@ibetitsmike

Copy link
Copy Markdown
Collaborator

Deletes chatadvisor.Runtime.MaxOutputTokens and Runtime.ProviderOptions, which only tests called. The two TestNewAdvisorRuntime subtests that read them now run one advisor call against a provider that rejects it, and check the request body: max_output_tokens, user, and reasoning.effort. The PR also deletes TestNewRuntimeDeepClonesOpenAIResponsesProviderOptions, a one-call copy of TestAdvisorRunDisablesStoreAndIsConsistentAcrossCalls.

Why it is safe

git grep finds no other caller of the getters. The rewritten subtests read what the provider receives instead of the runtime's stored config, so they catch more:

Mutant main This branch
a zero output cap defaults to half of defaultAdvisorMaxOutputTokens fails fails
NewRuntime drops the call template's MaxOutputTokens passes fails
the per-call option reset also clears ReasoningEffort passes fails
the per-call option reset also clears User passes fails

The deleted clone test checked that NewRuntime succeeds, that one call returns advice, and that the parent's Store stays true. TestAdvisorRunDisablesStoreAndIsConsistentAcrossCalls makes the same checks over two calls. With cloneProviderOptions sharing the ResponsesProviderOptions pointer instead of copying it, both tests fail on main, and the remaining one fails on this branch.

Review focus

The subtests decode the OpenAI Responses request shape. The old helpers accepted both OpenAI option types, so if the transport moved this fixture to Chat Completions, these subtests would fail on the renamed fields instead of passing.

Validation

  • go test ./coderd/x/chatd/ -race -count=1 -run '^TestNewAdvisorRuntime$': pass.
  • go test ./coderd/x/chatd/chatadvisor/ -race -count=1: pass, with one test fewer on this branch.
  • Mutants (go test -overlay): results as listed. A copy with a syntax error fails to build, so the overlay applies.
  • The pre-commit hook (make pre-commit) passed.

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

chatadvisor.Runtime.MaxOutputTokens and Runtime.ProviderOptions had no
production callers. The two TestNewAdvisorRuntime subtests that used
them now check the request the advisor sends to the provider:
max_output_tokens, user, and reasoning effort.

Delete TestNewRuntimeDeepClonesOpenAIResponsesProviderOptions. It is a
one-call copy of TestAdvisorRunDisablesStoreAndIsConsistentAcrossCalls.
@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:17:51.954535Z 0a52516 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. Already looking forward to the next diff.

Reviewed commit: e54c776d5a

ℹ️ 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. More of your lovely PRs please.

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

Reviewed commit: 0a525163a6

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