Handle tag model provider failures safely #1

Merged
backmeupplz merged 2 commits from fix/tag-bot-rate-limit-20260922 into main 2026-09-22 17:53:42 +00:00
backmeupplz commented 2026-09-22 17:18:49 +00:00 (Migrated from github.com)

Summary

  • disable optional OpenRouter reasoning for this compact JSON-only tagging request so reasoning cannot consume the visible-output budget
  • classify account quota, auth/billing/permission, stale model, transient provider, malformed/empty, and timeout failures without logging provider bodies
  • allow one bounded transient retry across the whole fallback chain, honoring short Retry-After, then continue to configured fallbacks
  • keep per-chat retags single-flight and return truthful user-facing messages instead of labeling every failure as rate limiting

Production diagnosis

At 2026-09-22 16:42:42Z the deployed fallback chain produced:

  1. openrouter/free: HTTP 200 with empty content
  2. nvidia/nemotron-3-super-120b-a12b:free: HTTP 200 with empty content
  3. google/gemma-4-31b-it:free: HTTP 429, no logged retry/reset metadata
  4. minimax/minimax-m2.7:free: HTTP 404

The fourth slug is absent from the current OpenRouter catalog. The screenshot therefore captured a mixed all-model failure that the old bot mislabeled as rate limiting. Empty content is consistent with OpenRouter's documented reasoning-token exhaustion mode, but old logs did not preserve finish reason/usage, so that sub-cause remains medium confidence.

Validation

  • red-first focused matrix: 8 failures before implementation
  • bun test: 23 passed, 0 failed
  • bun run typecheck: passed
  • git diff --check: passed
  • coverage includes deployed mixed chain, transient 429/402-in-flight/503 recovery, long Retry-After skip, account-wide quota, 401/402/403, malformed/empty/HTTP-200 provider errors, 404, 5xx, timeouts, one global retry bound, raw-body non-disclosure, and same-chat one-call/one-write/one-completion-reply behavior

Release requirements

  • live service is unchanged and remains on c15eecb08cad2e2a5c6c5e1aa31e3317dfc40bcf
  • after merge, remove stale minimax/minimax-m2.7:free from the existing LLM_MODELS value while preserving other env values and /app/data
  • deploy through Easypanel, confirm the running merge SHA, then perform real-account Telegram Web /retag QA
  • no paid fallback, credential rotation, or other bot changes

Tracker: GEN-KANEO-23 — Fix Tag Smart Bot model rate-limit failures

## Summary - disable optional OpenRouter reasoning for this compact JSON-only tagging request so reasoning cannot consume the visible-output budget - classify account quota, auth/billing/permission, stale model, transient provider, malformed/empty, and timeout failures without logging provider bodies - allow one bounded transient retry across the whole fallback chain, honoring short `Retry-After`, then continue to configured fallbacks - keep per-chat retags single-flight and return truthful user-facing messages instead of labeling every failure as rate limiting ## Production diagnosis At 2026-09-22 16:42:42Z the deployed fallback chain produced: 1. `openrouter/free`: HTTP 200 with empty content 2. `nvidia/nemotron-3-super-120b-a12b:free`: HTTP 200 with empty content 3. `google/gemma-4-31b-it:free`: HTTP 429, no logged retry/reset metadata 4. `minimax/minimax-m2.7:free`: HTTP 404 The fourth slug is absent from the current OpenRouter catalog. The screenshot therefore captured a mixed all-model failure that the old bot mislabeled as rate limiting. Empty content is consistent with OpenRouter's documented reasoning-token exhaustion mode, but old logs did not preserve finish reason/usage, so that sub-cause remains medium confidence. ## Validation - red-first focused matrix: 8 failures before implementation - `bun test`: 23 passed, 0 failed - `bun run typecheck`: passed - `git diff --check`: passed - coverage includes deployed mixed chain, transient 429/402-in-flight/503 recovery, long Retry-After skip, account-wide quota, 401/402/403, malformed/empty/HTTP-200 provider errors, 404, 5xx, timeouts, one global retry bound, raw-body non-disclosure, and same-chat one-call/one-write/one-completion-reply behavior ## Release requirements - live service is unchanged and remains on `c15eecb08cad2e2a5c6c5e1aa31e3317dfc40bcf` - after merge, remove stale `minimax/minimax-m2.7:free` from the existing `LLM_MODELS` value while preserving other env values and `/app/data` - deploy through Easypanel, confirm the running merge SHA, then perform real-account Telegram Web `/retag` QA - no paid fallback, credential rotation, or other bot changes Tracker: GEN-KANEO-23 — Fix Tag Smart Bot model rate-limit failures
backmeupplz commented 2026-09-22 17:44:12 +00:00 (Migrated from github.com)

Independent review handoff — PASS

Exact reviewed head: e41f318a08c98c17fedd2e01163672948997dd06 (full c15eecb → f5bacac → e41f318 range).

OpenAI GPT-5.6 Sol high re-review confirmed both prior blockers are cleared:

  • ambiguous per-model 429 quota wording now falls through to configured models; only canonical account-wide free-quota markers short-circuit
  • one 30s end-to-end deadline covers retries, Retry-After waits, fallback, fetch, and response-body reads, with 10s per-attempt caps

Validation on the exact exported tree:

  • bun test: 25 passed, 0 failed
  • bun run typecheck: passed
  • Bun production-target bundle: passed (42 modules)
  • git diff --check: passed
  • independent deadline probes: stalled body 43ms/40ms budget; retry+wait 55ms/55ms; fallback+stall 45ms/45ms
  • same-chat concurrency regression confirms one model call, one tag write, and one completion reply

Residual release gates: this PR is not merged or deployed. After merge, remove stale minimax/minimax-m2.7:free from the existing Easypanel LLM_MODELS value while preserving all other values, source/start command, and /app/data; then verify the running merge SHA and perform controlled real-account Telegram Web /retag QA.

## Independent review handoff — PASS Exact reviewed head: `e41f318a08c98c17fedd2e01163672948997dd06` (full `c15eecb` → `f5bacac` → `e41f318` range). OpenAI GPT-5.6 Sol high re-review confirmed both prior blockers are cleared: - ambiguous per-model 429 quota wording now falls through to configured models; only canonical account-wide free-quota markers short-circuit - one 30s end-to-end deadline covers retries, Retry-After waits, fallback, fetch, and response-body reads, with 10s per-attempt caps Validation on the exact exported tree: - `bun test`: 25 passed, 0 failed - `bun run typecheck`: passed - Bun production-target bundle: passed (42 modules) - `git diff --check`: passed - independent deadline probes: stalled body 43ms/40ms budget; retry+wait 55ms/55ms; fallback+stall 45ms/45ms - same-chat concurrency regression confirms one model call, one tag write, and one completion reply Residual release gates: this PR is not merged or deployed. After merge, remove stale `minimax/minimax-m2.7:free` from the existing Easypanel `LLM_MODELS` value while preserving all other values, source/start command, and `/app/data`; then verify the running merge SHA and perform controlled real-account Telegram Web `/retag` QA.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
backmeupplz/telegram-member-tags!1
No description provided.