ISSUE DESCRIPTION no warning when api-key in arrearage There is no response for chat…
- User
ISSUE DESCRIPTION
no warning when api-key in arrearage There is no response for chat when api-key in arrearage, please give me a warning
Evaluation contract
Treat HTTP 402, normalized billing/quota tokens such as
insufficient_quota,quota_exceeded,quota_exhausted,billing_hard_limit_reached, andpayment_required, and unambiguous billing text such as “exceeded your current quota”, “insufficient balance”, or “payment required” as account-arrearage failures. Surface a non-empty billing-specific message that does not expose the raw provider dump and takes precedence over a configured generic error message. A plain HTTP 429rate_limit_exceeded, timeouts, connection failures, HTTP 5xx responses, successful responses, and ordinary text that merely mentions a quota are not arrearage. Persist only the existing model-error placeholder in session history.Interface
Type: Function Name: is_arrearage_response Path: nanobot/providers/base.py Input: cls, response: LLMResponse Output: bool Description: Detects API-key arrearage, quota, or billing errors that won't clear on retry. Returns True for HTTP 402 status, billing semantic tokens (e.g., 'insufficient_quota'), or matching text markers in the response content.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- Assistant
I’ll first inspect the provider abstractions, response/error flow, and test layout to identify where provider failures are classified, surfaced, and persisted. Then I’ll reproduce the missing arrearage warning, implement classification and precedence, and run the relevant existing tests.
- Assistant
The base response already carries structured error metadata and distinguishes quota-like 429s for retry policy, but there is no public arrearage classifier yet. I’ll locate all error response construction, retry decisions, user-facing generic error configuration, and session placeholder handling so the fix integrates at the correct layer without persisting provider details.
- Assistant
The current runner exposes raw provider error content (
clean) before the configured generic message, which explains both the absent billing-specific warning and leakage risk. I’ll inspect the exact classifier-adjacent methods and runner’s response loop, including streaming behavior, before making a narrowly scoped change. - Assistant
The classifier must require
finish_reason == "error"so successful prose mentioning billing/quota is never misclassified. It should prioritize structured HTTP 402 and exact normalized semantic tokens, then only unambiguous bounded text phrases—not broad mentions such as “quota exceeded yesterday.” The runner should replace raw arrearage content with a fixed billing-specific warning, ahead ofspec.error_message, while retaining the existing history placeholder. I’ll inspect hook finalization to ensure no provider dump is emitted earlier in streamed error handling. - Assistant
Error bodies returned by providers are not emitted as normal model deltas in the runner’s final path; they are finalized and then exposed only through
final_content. I’ll now implement the required classmethod inbase.py, using exact token normalization plus conservative phrase matching, and select a sanitized billing warning in the runner before generic configuration or raw content. - Assistant
A review of likely legacy-provider shapes reveals one gap: plain error strings containing canonical semantic identifiers (for example,
Error code: insufficient_quota) are not necessarily JSON and should still classify. I’ll add bounded canonical-token matching while keeping ordinary natural-language quota mentions excluded, then run a direct classification matrix and an end-to-end runner reproduction that verifies warning precedence, raw-dump suppression, and placeholder-only persistence. - Assistant
The reproduction now passes: structured and legacy arrearage forms produce the sanitized billing warning, a normal 429 rate limit and transient/server cases do not, the configured generic message is overridden, and session messages contain only the established model-error placeholder. I’ll run the focused provider retry/error metadata and runner error suites next.
- Assistant
The focused suites pass (167 tests). On checking the contract’s negative cases more strictly, explicit timeout/connection metadata and HTTP 5xx must remain non-arrearage even if incidental text contains billing words. I’ll add those structured exclusions (while retaining HTTP 402 as definitive), improve semantic token normalization for separator variants, and inspect fallback error aggregation to ensure metadata is not discarded before the runner sees it.
- Assistant
Fallback preserves the final provider response and its metadata, so no change is needed there; it may legitimately succeed via a separately configured account. I’ll validate the new precedence rules with contradictory/transient cases, rerun focused tests, then run the repository’s configured lint/type tooling if available and review the final diff/status.
- Assistant
The stricter edge-case matrix and focused fallback/provider/runner tests pass. The final diff is limited to the public classifier and user-facing selection logic. I’ll run Ruff and the complete test suite now to catch unrelated integration assumptions before submission.
- Assistant
Ruff passes. The full suite reached 3,678 passing tests (3 skipped) and then failed one WebUI MCP preset test unrelated to these files; I’ll rerun that test in isolation to distinguish suite-state/environment flakiness from a genuine regression, then perform final diff checks.
- Assistant
The unrelated MCP test also fails in isolation, confirming it is a pre-existing/environmental issue rather than suite contamination. I’ll inspect its returned diagnostic once (without changing unrelated code), verify repository status and the exact patch, and then submit with the checklist assessment.
- Assistant
Before submission, I’m broadening only the unambiguous billing phrase fallback to cover common legacy wording already recognized by retry policy (“insufficient quota,” “credit balance too low,” “billing not active,” and exhausted/out-of-quota forms). These remain error-only and bounded, so generic quota mentions and successful explanatory text stay negative.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.