Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor(coderd): resolve bedrock profiles before the provider write - #29179

Merged
evgeniy-scherbina merged 3 commits into
yevhenii/aigov-488-resolve-inference-profiles-at-write-timefrom
yevhenii/aigov-488-resolve-before-write
Sep 10, 2026
Merged

refactor(coderd): resolve bedrock profiles before the provider write#29179
evgeniy-scherbina merged 3 commits into
yevhenii/aigov-488-resolve-inference-profiles-at-write-timefrom
yevhenii/aigov-488-resolve-before-write

Conversation

@evgeniy-scherbina

@evgeniy-scherbina evgeniy-scherbina commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

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 PATCH supplies 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 in lookupAndMergeSettings and 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 UpdateAIProvider is gone, clearBedrockModelResolution is 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.

@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

AIGOV-488

@evgeniy-scherbina
evgeniy-scherbina marked this pull request as ready for review September 10, 2026 16:51
@evgeniy-scherbina
evgeniy-scherbina merged commit 11ba473 into yevhenii/aigov-488-resolve-inference-profiles-at-write-time Sep 10, 2026
31 of 33 checks passed
@evgeniy-scherbina
evgeniy-scherbina deleted the yevhenii/aigov-488-resolve-before-write branch September 10, 2026 16:51
@coderagents

coderagents Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • docs/ai-coder/ai-gateway/providers.md (line 269, "Application inference profiles") - The page states "If resolution fails, the provider is skipped." This PR changes that behavior: a failed inference-profile resolution now rejects the save and stores nothing, on create and on update alike (the provider is no longer stored-then-skipped). Update this sentence to reflect that a failed resolution rejects the request instead of skipping the provider.

Automated review via Coder Agents

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