Skip to content

fix(cost-map): drop the duplicate gemini/gemini-decision-1 entry that fails the root unit job on main - #51341

Merged
yuneng-berri merged 1 commit into
mainfrom
litellm_fix_duplicate_gemini_decision_1_key
Nov 12, 2026
Merged

yuneng-berri merged 1 commit into
mainfrom
litellm_fix_duplicate_gemini_decision_1_key

Conversation

@yuneng-berri

@yuneng-berri yuneng-berri commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Handwritten 1-3 sentence description

Removes a duplicate entry in the cost map

Details

TLDR

Problem this solves:

  • main's price map defines gemini/gemini-decision-1 twice
  • test_price_map_has_no_duplicate_keys fails in the root unit job
  • Every PR that merges current main inherits that red check

How it solves it:

  • Removes the earlier of the two identical entries
  • Same removal in the backup copy of the price map
  • The parsed price map is unchanged

User Flow

Before: a contributor's PR goes red on a test their change never touched

  1. They merge current main into their branch and push
  2. The root unit check fails on test_price_map_has_no_duplicate_keys[main] and [backup], naming gemini/gemini-decision-1

After: the same push no longer trips that test

  1. They merge current main into their branch and push
  2. The root unit check passes test_price_map_has_no_duplicate_keys for both files

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

E2E exception at e8e65a8.

Scope: 26 lines deleted from model_prices_and_context_window.json and the same 26 lines from litellm/model_prices_and_context_window_backup.json. No code changes.

Rationale: #51215 and #51220 each added gemini/gemini-decision-1. The two entries hold the same fields and values and differ only in key order and array formatting. JSON parsers keep the last occurrence, so the entry removed here was already being ignored, and the map every caller reads is the same before and after. There is no runtime behavior to show against a live proxy.

The failure on main, as seen on an unrelated PR that merged main at 7461a99, is in this root job, where test_price_map_has_no_duplicate_keys[main] and [backup] fail with assert ['gemini/gemini-decision-1'] == [].

The check below reads both files at the base and at this PR's tip, lists duplicate keys, and compares the parsed maps.

dup_check.py
import json
import subprocess
import sys
from collections import Counter

FILES = ("model_prices_and_context_window.json", "litellm/model_prices_and_context_window_backup.json")


def load(ref, name):
    return subprocess.run(["git", "show", f"{ref}:{name}"], capture_output=True, text=True, check=True).stdout


base, head = sys.argv[1], sys.argv[2]
for name in FILES:
    for ref in (base, head):
        pairs = json.loads(load(ref, name), object_pairs_hook=lambda p: p)
        dupes = [key for key, count in Counter(key for key, _ in pairs).items() if count > 1]
        print(f"{ref} {name}: {len(pairs)} entries, duplicate keys {dupes}")
    same = json.loads(load(base, name)) == json.loads(load(head, name))
    print(f"parsed map identical between {base} and {head}: {same}")
$ python3 dup_check.py 7461a996cc e8e65a844d
7461a996cc model_prices_and_context_window.json: 5921 entries, duplicate keys ['gemini/gemini-decision-1']
e8e65a844d model_prices_and_context_window.json: 5920 entries, duplicate keys []
parsed map identical between 7461a996cc and e8e65a844d: True
7461a996cc litellm/model_prices_and_context_window_backup.json: 5921 entries, duplicate keys ['gemini/gemini-decision-1']
e8e65a844d litellm/model_prices_and_context_window_backup.json: 5920 entries, duplicate keys []
parsed map identical between 7461a996cc and e8e65a844d: True

Both files also pass python3 -m json.tool <file> at the tip, and cmp reports the two files identical to each other.

I did not run test_price_map_has_no_duplicate_keys locally, because a fresh worktree needs a Rust build before the test module imports. This PR's root job is the run of that test.

Type

🐛 Bug Fix

Caveats (if any)

Low

  • The surviving entry sits at the end of the file
  • Local pytest not run, this PR's root job covers it

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Note

Low Risk
Configuration-only cleanup with no effective change to the parsed price map; fixes a duplicate-key test failure on main.

Overview
Removes the earlier duplicate gemini/gemini-decision-1 block from both model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json, so the cost map no longer defines the same model key twice.

The deleted entry was identical to the one still at the end of the file; standard JSON parsing already used the last definition, so pricing and capability metadata for this model are unchanged—only the redundant copy is gone.

This unblocks CI: test_price_map_has_no_duplicate_keys on main was failing because both files listed gemini/gemini-decision-1 twice.

Reviewed by Cursor Bugbot for commit e8e65a8. Bugbot is set up for automated code reviews on this repo. Configure here.

Two PRs each added gemini/gemini-decision-1 to the price map, so main defines the key twice and test_price_map_has_no_duplicate_keys fails in the root unit job for every PR that merges main. The two entries hold the same fields and values, so this removes the earlier one and leaves the one JSON parsers already keep. The parsed map is unchanged.
@veria-ai

veria-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@yuneng-berri
yuneng-berri enabled auto-merge (squash) November 12, 2026 03:07
@codspeed

codspeed Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 2 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 43 untouched benchmarks


Comparing litellm_fix_duplicate_gemini_decision_1_key (e8e65a8) with main (7461a99)

Open in CodSpeed

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Removes the earlier duplicate gemini/gemini-decision-1 entry from both price maps. The surviving entries preserve the model's prices and capabilities.

  • The cost maps no longer list Gemini Decision 1 twice.

Reviews (1) · Last reviewed commit: "fix(cost-map): drop the duplicate gemini..." · Reviewed by Greptile

@mateo-berri

Copy link
Copy Markdown
Contributor

Both parsed maps remain identical. The duplicate is removed from each file, and all 97 checks pass at e8e65a8

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e8e65a8. Configure here.

@yuneng-berri
yuneng-berri merged commit 2d8fd9b into main Nov 12, 2026
113 of 116 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_fix_duplicate_gemini_decision_1_key branch November 12, 2026 03:42
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.

3 participants