Skip to content

fix(budgets): declare the auth cache key family for the rust spend counter host - #53286

Closed
kerry-berri wants to merge 1 commit into
mainfrom
litellm_declare_key_family_rust_spend_counters
Closed

kerry-berri wants to merge 1 commit into
mainfrom
litellm_declare_key_family_rust_spend_counters

Conversation

@kerry-berri

Copy link
Copy Markdown
Contributor

Handwritten 1-3 sentence description

Main's root check has been red since the rust spend counter step landed, because its budget window lookup reads the shared auth cache without saying which key family it belongs to. This tags that lookup as an auth object read, the same as the other budget lookups, so the check passes again.

Details

Link to Devin session: https://app.devin.ai/sessions/27bb2c9b5bd5448f9fe49ac839d9747d
Open in Devin Desktop: https://app.devin.ai/desktop/session/27bb2c9b5bd5448f9fe49ac839d9747d?variant=devin
Requested by: @kerry-berri

TLDR

Problem this solves:

How it solves it:

  • _CounterHost.budget_windows is wrapped in with_service_target(AUTH_OBJECTS_TARGET)
  • Same target budget_reservation.py uses for the same cache

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 4e5888c. The diff is one decorator and two imports, it changes no request or response, and the existing guard test that is red on main is the regression test, so no new test is added.

On main at 746f839 the root job fails with

FAILED tests/unit/test_internal_context.py::test_every_redis_producer_declares_a_key_family
AssertionError: assert ('litellm/proxy/spend_tracking/rust_spend_counters.py',) == ()

On this branch

$ uv run --no-sync pytest tests/unit/test_internal_context.py tests/unit/proxy/spend_tracking/test_rust_spend_counters.py tests/unit/proxy/hooks/test_proxy_track_cost_callback_ledger.py -q
251 passed, 15 warnings in 49.69s
$ uv run --no-sync ruff check litellm/proxy/spend_tracking/rust_spend_counters.py
All checks passed!

Type

🐛 Bug Fix

Caveats (if any)

Low

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

…unter host

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@veria-ai

veria-ai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@devin-ai-integration devin-ai-integration Bot added the autoapprove This PR may be autoapproved by greptile. The author thinks that it does not need human review. label Nov 21, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

@greptileai

1 similar comment
@kerry-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Adds AUTH_OBJECTS_TARGET to _CounterHost.budget_windows so its shared auth-cache reads carry the auth_objects label.

  • The Rust spend-counter host labels budget-window reads as auth-object work.

Reviews (1) · Last reviewed commit: "fix(budgets): declare the auth cache key..." · Reviewed by Greptile

@kerry-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor

cursor Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — your team has an unpaid invoice

Bugbot is paused because your team has an unpaid invoice.

Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically.

(requestId: 3b9a3ab9-80ad-448a-b891-b954eea7505b)

@mateo-berri

Copy link
Copy Markdown
Contributor

Closing as a duplicate, #53287 just landed the same budget_windows auth objects decorator on main with a regression test, so this diff is now empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autoapprove This PR may be autoapproved by greptile. The author thinks that it does not need human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants