Repository navigation
Conversation
A relay that answered `400 {"code":"BAD_REQUEST"}` with "You have
insufficient credits to make this request." matched none of the
`NO_BALANCE` phrases: the list knew "insufficient balance" and "credit
balance is too low", not "insufficient credits". The verdict fell through
to `ClientError`, so the request went back to the client, the upstream was
never swapped and never paused — the client retried the same dead
upstream until the operator disabled it by hand.
Add the credit phrasings, including "don't have enough credits" (the
contracting variant a phrase starting with "not enough" misses).
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
NO_BALANCEincrates/tw-gateway/src/failure.rsnow recognises "insufficient credits".Why
Reported in #378: an ordered strategy group never failed over. The upstream (a relay) answered:
classify()checked the body againstNO_BALANCEfirst — but the list knewinsufficient balanceandcredit balance is too low, notinsufficient credits. Nothing matched, so the 400 fell through toClientError: the error went back to the client as-is, the upstream was neither swapped for the next one nor paused, and every retry hit the same dead upstream until it was disabled by hand.With the new phrases the same body is
Failed(Cause::NoBalance)→ next candidate, plusno_balance_pause_secson the used-up one.The three phrases are
insufficient credit,not enough creditandhave enough credit— the last one because the contracted form ("you don't have enough credits") misses a phrase starting with "not".Tests
a_missing_balance_is_recognised_whatever_the_statusgains the exact 400 body from the report and a "don't have enough credits" variant.Note
I could not run
cargo test/clippylocally (no wasm clang on this machine,tw-plugin's build script stops the workspace build).cargo fmt --all -- --checkpasses. CI is the real check here.