Skip to content

fix(proxy): preserve image rate-limit lifecycle - #3363

Merged
lbjlaq merged 2 commits into
lbjlaq:mainfrom
buluw:codex/image-rate-limit-lifecycle
Aug 30, 2026
Merged

fix(proxy): preserve image rate-limit lifecycle#3363
lbjlaq merged 2 commits into
lbjlaq:mainfrom
buluw:codex/image-rate-limit-lifecycle

Conversation

@buluw

@buluw buluw commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Parse short 429 delays without inflating the grace-retry decision, retry the same account at most once, and preserve only explicit long-lived image quota deadlines.

Closes #3351.
Closes #3353.

Depends on #3362. This is a stacked PR; the new behavior is contained in commit 38a276bf and the diff will narrow after #3362 merges.

Changes

  • Parse structured Google retry delays and Retry-After separately from source-specific wait buffers.
  • Track one same-account grace retry per account without consuming account-rotation budget.
  • Pass retry state through OpenAI Chat, Responses, Gemini, and Images handlers.
  • Preserve long deadlines only for explicit structured QUOTA_EXHAUSTED responses on recognized image models.
  • Persist and restore qualified image lockouts across quota refresh, account reload, and restart.
  • Retain qualified locks through optimistic reset and clear only the matching normalized model bucket.
  • Serialize account-file updates so concurrent limit and account-state writes do not discard one another.
  • Avoid blocking the async runtime while reselecting after a short lock expires.

Validation

  • cargo test --manifest-path src-tauri/Cargo.toml --offline --lib task_
  • Result: 11 passed, 0 failed.
  • Coverage includes structured 1s/3s parsing, same-account rotation state, explicit 58-hour/72-hour image locks, refresh/reload/restart retention, exact-bucket clearing, and nonblocking short-lock reselection.

Compatibility

  • Generic prose, inferred reset times, and text-model limits remain capped at 300 seconds.
  • Existing account JSON remains compatible.
  • OpenAI Chat, Responses, Gemini, and Images use the new request retry state.
  • Claude retains its baseline retry wrapper and parser behavior; same-account grace-retry parity is not claimed.
  • No image scheduler or per-account concurrency behavior is included in this PR.

@lbjlaq
lbjlaq merged commit 38a276b into lbjlaq:main Aug 30, 2026
4 of 7 checks passed
@buluw
buluw deleted the codex/image-rate-limit-lifecycle branch August 31, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Preserve explicit long-lived image quota lockouts across refresh and reload [Bug] Honor short 429 delays and retry each account only once

2 participants