refactor(coderd): resolve bedrock profiles before the provider write - #29179
Merged
evgeniy-scherbina merged 3 commits intoSep 10, 2026
Conversation
evgeniy-scherbina
marked this pull request as ready for review
September 10, 2026 16:51
evgeniy-scherbina
merged commit Sep 10, 2026
11ba473
into
yevhenii/aigov-488-resolve-inference-profiles-at-write-time
31 of 33 checks passed
evgeniy-scherbina
deleted the
yevhenii/aigov-488-resolve-before-write
branch
September 10, 2026 16:51
Contributor
Documentation CheckUpdates Needed
Automated review via Coder Agents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #29112, which writes the provider first and stores the resolution in a second update. That leaves a window where a provider exists with an unresolved profile ARN, which then has to be explained everywhere: the gateway serves the ARN as its own identity, the audit entry records a pre-resolution row, and the publish is skipped so the provider only reaches the gateways after a restart.
Resolving before the write removes the state instead of describing it. A failed lookup now rejects the save and stores nothing, on create and on update alike.
Create resolves its own request, since a create carries the complete configuration. Update cannot: a
PATCHsupplies the model identifiers but inherits credentials and the external ID from the stored row, so the config to resolve is stored + patch. That merge now lives inlookupAndMergeSettingsand is called twice, once before the transaction to resolve against and once inside it against the row being written. The two cannot disagree on the model identifiers, because both take them from the patch, so no reconciliation or conflict handling is needed.The server-owned STS external ID is still generated inside the transaction, as before. A value generated for the preview would be one the operator's role trust policy could not reference yet either way, so resolution assumes the role with the stored value.
Net effect against the base branch: the second
UpdateAIProvideris gone,clearBedrockModelResolutionis gone (the resolution result is always assigned, which discards anything a client sent), and the update transaction is shorter than before this PR series started.Relates to https://linear.app/codercom/issue/AIGOV-488
Created by Coder Agents on behalf of @evgeniy-scherbina.