Skip to content

TangoRateLimitError.limit_type reports premium_daily as daily and still guesses from wait text #109

Closed as not planned

Description

@makegov-hal

Bug

TangoRateLimitError.limit_type mislabels some 429s even after #97 (1.18.2):

  • premium_daily comes back as "daily". The rate name is substring-matched for "daily", so a per-feature cap (currently the CALC labor-rate endpoints) looks the same as the account's daily quota. Callers can't tell "this feature is capped for today" from "this account is out of requests for today."
  • The no-match fallback still guesses from the wait text. When the detail doesn't name a rate, "minute" maps to burst and "day" maps to daily. Those are words from the wait-time phrasing, not names of limits, which is the same class of bug Read the rate's name so a daily 429 stops reporting as burst #97 fixed for the named path.

Repro

from tango import TangoRateLimitError

d = "Rate limit exceeded for premium_daily. Please try again in 9 hours, 14 minutes, 3 seconds."
TangoRateLimitError(d, 429, {"detail": d, "wait_in_seconds": 33243}).limit_type
# -> "daily"

API 429 detail shapes (from src/api/throttles.py in makegov/tango; rate names come from DEFAULT_THROTTLE_RATES and PREMIUM_QUERY_DEFAULT_RATES):

  • Rate limit exceeded for daily. Please try again in <wait>.
  • Rate limit exceeded for burst. Please try again in <wait>.
  • Rate limit exceeded for premium_daily. Please try again in <wait>.
  • A team-pooled account's daily 429 adds: This limit is shared by everyone on your team; <team URL> shows who to contact.

Acceptance criteria

  • premium_daily gets its own limit_type value, documented alongside daily and burst.
  • daily and burst are unchanged, including a daily wait with hours, minutes, and seconds and the team-pooled detail.
  • An unrecognized rate name gives None, not a guess.
  • The fallback never classifies from wait-time words ("minutes", "day").
  • Unit tests cover each case above.

Downstream: tango-mcp works around this on its side (makegov/tango-mcp#481) and pins 1.16.0, so picking up the fix there is a separate lockfile bump.

~ Hal 🤖

Activity

  1. added
    bug
    on Nov 16, 2026
  2. makegov-hal commented on Nov 16, 2026

    @makegov-hal
    Author

    Duplicate of #108, which PR #107 closes. ~ Hal 🤖

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions