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

Skip to content

fix: only write AI model prices that changed (#27923) - #28105

Merged
mtojek merged 1 commit into
release/2.36from
ssncf/2.36-backport-27923
Aug 17, 2026
Merged

fix: only write AI model prices that changed (#27923)#28105
mtojek merged 1 commit into
release/2.36from
ssncf/2.36-backport-27923

Conversation

@ssncferreira

@ssncferreira ssncferreira commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Backport of #27923

Original PR: #27923 - only write AI model prices that changed
Merge commit: 5efa7ab
Requested by: @ssncferreira

Previously, the AI Gateway price seeder rewrote every row of
`ai_model_prices` on each server start, because `ON CONFLICT` fires on a
key conflict rather than on a value difference. `updated_at` therefore
recorded when the server last restarted rather than when a price last
changed.

Guard the `DO UPDATE` branch so a conflicting row is only rewritten when
one of its four prices differs. The comparison uses `IS DISTINCT FROM`
rather than `<>` because the price columns are nullable, and `<>` yields
NULL when either side is NULL, which would skip the update and leave a
stale price in place.

Related to
https://linear.app/codercom/issue/AIGOV-567/experimental-cli-command-to-set-prices-for-unpriced-ai-models

> [!NOTE]
> Initially generated by Claude Opus 5, modified and reviewed by
@ssncferreira

(cherry picked from commit 5efa7ab)
@ssncferreira
ssncferreira requested a review from mtojek August 13, 2026 10:46
@ssncferreira ssncferreira added the backport/v2.36 Backport PR targeting release/2.36 label Aug 13, 2026
@mtojek
mtojek merged commit d295caf into release/2.36 Aug 17, 2026
54 of 55 checks passed
@mtojek
mtojek deleted the ssncf/2.36-backport-27923 branch August 17, 2026 07:23
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v2.36 Backport PR targeting release/2.36

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants