fix(streaming): validate SSE retry digits - #3835
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 👍 / 👎.
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.