Skip to content

fix: clamp negative Retry-After delays before sleeping - #855

Merged
dpiet-oai merged 2 commits into
openai:mainfrom
abhinavkr26104:codex/fix-negative-retry-after
Sep 9, 2026
Merged

fix: clamp negative Retry-After delays before sleeping#855
dpiet-oai merged 2 commits into
openai:mainfrom
abhinavkr26104:codex/fix-negative-retry-after

Conversation

@abhinavkr26104

Copy link
Copy Markdown
Contributor

Summary

  • clamp parsed Retry-After and Retry-After-Ms delays to Duration.ZERO when they are negative
  • preserve immediate retries for past HTTP-date values
  • add sync and async regression coverage for negative numeric delays and past dates

Fixes #853

Testing

  • git diff --check passed
  • direct ktfmt 0.61 validation passed for both changed Kotlin files
  • full Gradle test suite was attempted online and offline; the online run timed out during Kotlin/Gradle execution without diagnostics, while the offline run was blocked by uncached junit-jupiter-engine:5.9.3
  • repository lint tasks were attempted; direct ktfmt passed, while Gradle lint was blocked by the same local dependency/compile environment

@abhinavkr26104
abhinavkr26104 requested a review from a team as a code owner August 10, 2026 07:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T20:43:38.233453Z 4d752c1 New commits
🔒 Security Review Completed 2026-09-09T20:45:10.263388Z 4d752c1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dpiet-oai dpiet-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

55 mixed files remain; 0 existing customizations changed.

Compared fe00c016821f4d752c1d7aee. Generated baselines verified.

55 existing customizations unchanged
  • openai-java-core/src/main/kotlin/com/openai/models/audio/AudioResponseFormat.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageFunctionToolCall.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolMessageParam.kt
  • openai-java-core/src/main/kotlin/com/openai/models/embeddings/Embedding.kt
  • openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCall.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextConfig.kt
  • openai-java-core/src/main/kotlin/com/openai/models/videos/Video.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/BetaServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/BetaServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/WebhookServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/WebhookServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranscriptionServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/checkpoints/PermissionServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/BetaService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/BetaServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/WebhookService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/WebhookServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/audio/TranscriptionServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/chat/ChatCompletionService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/finetuning/checkpoints/PermissionServiceImpl.kt
  • openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseFunctionWebSearchTest.kt
  • openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponsesServerEventTest.kt
  • openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionWebSearchTest.kt
  • openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesServerEventTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/CompletionServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/ImageServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/WebhookServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/audio/TranscriptionServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/beta/ResponseServiceAsyncTest.kt

15 more in the full report.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 34402662364 --repo openai/openai-java \
  --name castiron-custom-code-34402662364-1 --dir /tmp/castiron-custom-code-34402662364-1
git apply --stat /tmp/castiron-custom-code-34402662364-1/custom-code.patch
cat /tmp/castiron-custom-code-34402662364-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin fe00c016821fd314d2089f97c5964e4fd0064c42 4d752c1d7aee359631af2260c1ae2a05b046c0ab
python3 scripts/castiron/custom_code_report.py report \
  --base fe00c016821fd314d2089f97c5964e4fd0064c42 \
  --head 4d752c1d7aee359631af2260c1ae2a05b046c0ab --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-4d752c1d7aee
cat /tmp/castiron-custom-code-4d752c1d7aee/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@dpiet-oai
dpiet-oai added this pull request to the merge queue Sep 9, 2026
Merged via the queue into openai:main with commit 0f9fe12 Sep 9, 2026
12 checks passed
@openai-sdks openai-sdks Bot mentioned this pull request Sep 9, 2026
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.

fix: clamp negative Retry-After delays before sleeping

2 participants