refactor(coderd/x/chatd): carry the resolved OpenAI transport on a model wrapper - #27703
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
6f8e920 to
e39a87f
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
e39a87f to
135919a
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
135919a to
03e2109
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
03e2109 to
09913d5
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
09913d5 to
91a45b7
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91a45b785d
ℹ️ 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".
91a45b7 to
cc87ed6
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc87ed6c48
ℹ️ 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".
cc87ed6 to
3fd9597
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
3fd9597 to
90332b4
Compare
…del wrapper The OpenAI wire format is decided when the client is built, then thrown away, so four downstream sites recompute it from (provider, modelID, override). Any disagreement fails silently: provider options are discarded by an SDK type assertion, and text attachments are dropped. Introduce chatprovider.Model, pairing a fantasy client with the transport resolved from that client's own identity. Its fields are unexported, so no other package can mint a Model whose transport disagrees with its client. chatopenai.Transport's zero value is invalid and panics when read rather than defaulting to a wire format, following chatdebug.WrapModel's precedent for construction invariants. Thread Model through construction, the resolve paths, and the four struct fields that store a model for later request preparation. Terminal call sites keep taking fantasy.LanguageModel and receive LanguageModel(), which avoids a new package edge from chatloop and chatadvisor to chatprovider. No decisions move yet: the four consumers still recompute the transport. UsesResponsesAPI now delegates to TransportFor so both agree by construction.
90332b4 to
05e2700
Compare

Stacked on #27683.
The OpenAI wire format is decided when the client is built, then thrown away, so downstream sites recompute it from
(provider, modelID, override). Any disagreement fails silently: the SDK type-asserts the concrete provider options struct and discards every OpenAI option, and text attachments are dropped because Responses natively accepts only images and PDFs.This adds
chatprovider.Model, which pairs a fantasy client with the transport resolved from that client's own identity. Its fields are unexported and only the constructor sets the transport, deriving it from the client, so no caller can pick a transport that disagrees with the client it wraps.chatopenai.Transport's zero value is invalid and panics when read rather than defaulting to a wire format, following the existing precedent for construction invariants.Modelis threaded through construction, the resolve paths, and the four struct fields that store a model for later request preparation. Terminal call sites keep takingfantasy.LanguageModeland receiveLanguageModel(), which avoids a new package edge fromchatloopandchatadvisorintochatprovider.No decisions move yet. The consumers still recompute the transport, and
UsesResponsesAPInow delegates toTransportForso the two agree by construction. #27704 makes the consumers read it from the model.