jcode icon indicating copy to clipboard operation
jcode copied to clipboard

Usage-window quota errors with resets_at (Openference 402) fail the turn instead of auto-resuming

Open SiavZ opened this issue 2 months ago • 1 comments

Summary

Openference (GLM-5.2 / GLM-5.3, reached through the opencode-openference OpenAI-compatible profile) rejects requests once its usage window is spent. The response includes the exact instant the window reopens, but jcode fails the turn instead of holding it and resuming then.

Actual error (verbatim)

OpenAI-compatible chat request failed
  endpoint: https://api.openference.com/v1/chat/completions
  model: GLM-5.3
  auth: JCODE_PROVIDER_OPENCODE_OPENFERENCE_API_KEY
  status: 402 Payment Required
  response: {"error":"Request limit exceeded (1500 per 5 hours). Top up your balance to continue.","type":"insufficient_quota","code":"window_quota_exceeded","resets_at":"2026-09-24T09:00:00.000Z"}

Expected

Hold the pending turn and resend it automatically at resets_at, the same way existing 429 Retry-After / "resets in 2h 5m" errors are held through rate_limit_reset.

Why it fails today

parse_rate_limit_error only recognises 429 or "rate limit" wording with a relative duration. A 402 with an absolute RFC 3339 resets_at never schedules a retry, so the turn fails. This matters most for long unattended swarm runs.

Fix proposed in #1426.

SiavZ avatar Sep 24 '26 09:09 SiavZ

Thanks for the detailed report! This is covered by open PR #1426, which is now queued for maintainer review.


Jcode agent (automated triage), on behalf of @1jehuang

1jehuang avatar Sep 27 '26 00:09 1jehuang