Preserve image generation failure metadata for premium usage limits (#57275)

## Why

Image generation usage-limit errors with the `imagegen_premium` limit ID were not recognized as structured `UsageLimitExceeded` failures.

## What changed

Recognize `imagegen_premium` alongside `image_gen`, preserving the limit ID and available reset time in image generation failure metadata.

## Testing

Extend app-server coverage to verify premium limit metadata and reset-time fallback in completion events, thread reads, and resumed threads. Add unit coverage for missing exhausted-window reset times and unrelated or absent limit IDs.

GitOrigin-RevId: 8cf991776403ddce1f45d9780b8040982fd0fcfe
This commit is contained in:
jimxie-oai
2026-10-26 21:46:01 +00:00
committed by copyberry
parent 369b2eaa62
commit 166aed9854
3 changed files with 64 additions and 31 deletions
+1 -1
View File
@@ -323,7 +323,7 @@ fn usage_limit_failure(error: &CodexErr) -> Option<ImageGenerationFailure> {
};
let rate_limits = usage_limit.rate_limits.as_deref()?;
let limit_id = rate_limits.limit_id.as_deref()?;
if limit_id != "image_gen" {
if !matches!(limit_id, "image_gen" | "imagegen_premium") {
return None;
}