Skip to content

Read gateway model metadata from Postgres replica#4457

Open
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
session/agent_ce4c7277-f8f7-4af2-9a2e-b807660c9c0e
Open

Read gateway model metadata from Postgres replica#4457
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
session/agent_ce4c7277-f8f7-4af2-9a2e-b807660c9c0e

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • read Vercel and OpenRouter model metadata from the latest models_by_provider snapshot through readDb
  • rename metadata and model-ID getters to expose database or Redis connectivity at call sites
  • retain the ten-minute in-memory caches and add a seven-day TTL to the now-unused full-catalog Redis mirrors
  • reduce Redis bandwidth usage by reading full model catalogs from Postgres while keeping lightweight Redis model-ID and per-model provider caches on request paths

Validation

  • git diff --check
  • focused Jest suites attempted but could not start within the 120-second sandbox limit because pnpm bootstrap ran first
  • pnpm format:changed attempted but exceeded the 120-second sandbox limit during dependency bootstrap

@kilo-code-bot

kilo-code-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (11 files)
  • apps/web/src/app/api/openrouter/[...path]/route.test.ts
  • apps/web/src/lib/ai-gateway/auto-model/resolution.test.ts
  • apps/web/src/lib/ai-gateway/auto-model/resolution.ts
  • apps/web/src/lib/ai-gateway/byok/index.ts
  • apps/web/src/lib/ai-gateway/providers/gateway-models-cache.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.test.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/sync-providers.ts
  • apps/web/src/lib/ai-gateway/providers/vercel/index.ts
  • apps/web/src/lib/cached-fetch.ts
  • apps/web/src/routers/byok-router.ts
Previous Review Summary (commit 5416cd6)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 5416cd6)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Mechanical refactor moving OpenRouter/Vercel model metadata reads from Redis to the models_by_provider Postgres replica (readDb), with consistent renames across all call sites and a sensible 7-day TTL added to the now-secondary Redis mirrors; no correctness, security, or migration issues found in the changed lines.

Files Reviewed (11 files)
  • apps/web/src/app/api/openrouter/[...path]/route.test.ts
  • apps/web/src/lib/ai-gateway/auto-model/resolution.test.ts
  • apps/web/src/lib/ai-gateway/auto-model/resolution.ts
  • apps/web/src/lib/ai-gateway/byok/index.ts
  • apps/web/src/lib/ai-gateway/providers/gateway-models-cache.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.test.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/sync-providers.ts
  • apps/web/src/lib/ai-gateway/providers/vercel/index.ts
  • apps/web/src/lib/cached-fetch.ts
  • apps/web/src/routers/byok-router.ts

Reviewed by claude-sonnet-5-20260630 · Input: 44 · Output: 10.9K · Cached: 1.2M

Review guidance: REVIEW.md from base branch main

@chrarnoldus chrarnoldus self-assigned this Jul 8, 2026
@chrarnoldus chrarnoldus force-pushed the session/agent_ce4c7277-f8f7-4af2-9a2e-b807660c9c0e branch from 5416cd6 to 47fb4fc Compare July 10, 2026 11:45
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