refactor(ai-gateway): stop writing obsolete models_by_provider table#2818
Open
kilo-code-bot[bot] wants to merge 2 commits intomainfrom
Open
refactor(ai-gateway): stop writing obsolete models_by_provider table#2818kilo-code-bot[bot] wants to merge 2 commits intomainfrom
kilo-code-bot[bot] wants to merge 2 commits intomainfrom
Conversation
The canonical storage is now Redis; the SQL table is no longer read or written by any runtime code. Mark the Drizzle schema entry as obsolete and repoint the remaining readers at the existing Redis keys.
| return results[0]; | ||
| }); | ||
|
|
||
| await mirrorToRedis({ |
Contributor
Author
There was a problem hiding this comment.
WARNING: Sync can silently succeed without storing a snapshot
redisSet() returns false when REDIS_URL is unset, and mirrorToRedis() ignores those return values. Now that the SQL write is gone, this mutation can report success while persisting nothing, which leaves /api/openrouter/models-by-provider and the Redis-backed readers with no data immediately afterward. Consider failing the sync when any Redis write returns false, or keeping the existing SQL fallback until Redis is guaranteed in every environment.
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by gpt-5.4-20260305 · 367,014 tokens |
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.
Summary
models_by_providerSQL table has been fully superseded by Redis storage (GATEWAY_METADATA_REDIS_KEYS). This PR removes the last runtime code that still wrote to or read from it.syncAndStoreProvidersno longer opens a DB transaction; it only mirrors to Redis./api/openrouter/models-by-providerroute andmodels-by-provider-index.server.tsloader now read the snapshot from Redis (allProviderskey) instead of Postgres.Verification
/api/openrouter/models-by-providerand org defaults lookups resolve via Redis.Visual Changes
N/A — admin page drops the "Row ID" line since there is no SQL row anymore.
Reviewer Notes
DROP TABLE models_by_provideronce we're confident nothing external depends on it.MODELS_BY_PROVIDER_ADMIN_URLis retained because other code (byok-router, this route's error message) still references it as the admin panel link.