Skip to content

feat(price-sync): drop friendliai entries the catalog no longer returns - #41001

Open
Lee-Si-Yoon wants to merge 3 commits into
BerriAI:mainfrom
Lee-Si-Yoon:feat/friendli-metadata-deletion
Open

Lee-Si-Yoon wants to merge 3 commits into
BerriAI:mainfrom
Lee-Si-Yoon:feat/friendli-metadata-deletion

Conversation

@Lee-Si-Yoon

@Lee-Si-Yoon Lee-Si-Yoon commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Follow-up to #35918 (merged). The weekly Friendli metadata sync only updates and adds registry keys — it has no deletion path, so a model Friendli delists from https://api.friendli.ai/serverless/v1/models stays in model_prices_and_context_window.json forever.

sync_local_data_with_remote only updated and added keys, so a model Friendli
delists from /serverless/v1/models stayed in the registry forever (e.g. the
stale llama-3.1 and K-EXAONE rows). Absence from the live catalog is now a
delete signal, scoped to the friendliai/ prefix and gated on a non-empty
transform result so a failed or empty fetch can never wipe entries; legacy
pre-sync rows without a source field are cleaned up too. OpenRouter and
Vercel entries are exempt — their catalogs can delist rows users still route
to.
@Lee-Si-Yoon
Lee-Si-Yoon requested a review from a team September 13, 2026 11:37
@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds automatic removal of Friendli registry entries absent from the provider catalog

  • Introduces a helper that identifies stale friendliai/ keys
  • Extends synchronization to delete those keys while preserving other providers
  • Adds regression coverage for delisted, legacy, failed-fetch, and empty-catalog cases

Confidence Score: 4/5

This PR is not safe to merge because a transient Friendli fetch failure can remove every Friendli registry entry

The production path passes a merged provider map, so successful OpenRouter or Vercel data defeats the intended empty Friendli guard and enables destructive cleanup

Files Needing Attention: .github/scripts/auto_update_price_and_context_window_file.py, tests/test_litellm/test_auto_update_price_and_context_window_file.py

Important Files Changed

Filename Overview
.github/scripts/auto_update_price_and_context_window_file.py Adds Friendli cleanup, but the empty-catalog guard checks the merged provider map and can wipe all Friendli entries after a failed fetch
tests/test_litellm/test_auto_update_price_and_context_window_file.py Adds focused cleanup tests, but the failed-fetch case bypasses the merged catalog shape used by the production caller

Reviews (1): Last reviewed commit: "feat(price-sync): drop friendliai entrie..." | Re-trigger Greptile

Comment thread .github/scripts/auto_update_price_and_context_window_file.py Outdated
Comment thread .github/scripts/auto_update_price_and_context_window_file.py Outdated
Comment thread .github/scripts/auto_update_price_and_context_window_file.py Outdated
@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Deletion keyed off the merged remote map, so a Friendli fetch failure
alongside a successful OpenRouter/Vercel fetch left the map non-empty and
wiped every local friendliai entry. The sync now tracks whether the Friendli
catalog itself came back and only computes drops from it; sync takes the
precomputed dropped keys instead of deriving them internally.

Also: precise types (dict[str, dict[str, object]]) on the sync signature,
drop-by-pop instead of mutating iteration, and tests cover the failed-fetch
with successful-other-catalogs case
Comment thread .github/scripts/auto_update_price_and_context_window_file.py Outdated
@veria-ai

veria-ai Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@Lee-Si-Yoon

Copy link
Copy Markdown
Contributor Author

Fixed in 4d2314d: deletion now uses raw Friendli catalog ids and skips cleanup for empty fetches

This branch has not been deployed

No deployments
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