fix(streaming): validate SSE retry digits - #3835
sylvesterkaczmarek wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a211616bff
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elif fieldname == "retry": | ||
| try: | ||
| if value.isascii() and value.isdigit(): | ||
| self._retry = int(value) |
There was a problem hiding this comment.
Keep oversized retry fields from aborting streams
When an SSE endpoint emits a digit-only retry field longer than CPython's configured integer-conversion limit (4,300 digits by default on supported versions), this condition passes but int(value) raises ValueError, aborting both synchronous and asynchronous stream iteration. The prior try/except safely ignored such a field, so retain conversion error handling after the ASCII-digit validation.
AGENTS.md reference: AGENTS.md:L112-L121
Useful? React with 👍 / 👎.
|
Thanks for putting this together! We’re closing this alongside #3834: the validation mismatch is real, but the SDK doesn’t use this field to control retries, and we don’t currently have an example of it causing an application failure. If we’ve missed an affected use case, please share a minimal repro on the issue—we’re happy to revisit both the issue and this change. |
|
Thanks for reviewing this and for the clear explanation. Understood on keeping this aligned with #3834; if I find a concrete application failure from the retry field, I’ll bring back a minimal reproduction. |
Summary
retryvalues only when every character is an ASCII digitFixes #3834
Tests
Regression coverage added in
tests/test_sse_retry_validation.py. The connected development host was unavailable for a local suite run.