-
Notifications
You must be signed in to change notification settings - Fork 1
Fix stale JSON repair stream state leak #704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
Warning Rate limit exceeded@matdev83 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 26 minutes and 13 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
| async def process(self, content: StreamingContent) -> StreamingContent: | ||
| if not self._enabled: | ||
| return content | ||
|
|
||
| self._cleanup_stale_states() | ||
|
|
||
| if content.is_empty and not content.is_done: | ||
| return content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update stream access time before early-returning on empty chunks
The TTL cleanup runs before checking content.is_empty and the method returns immediately when the chunk is empty without ever touching the per-stream state. As a result last_accessed is not refreshed for streams that send periodic keep-alive/heartbeat chunks with is_empty=True while a JSON fragment is still buffered. After state_ttl_seconds elapses the next call will purge the stream from _states as “stale”, discarding the buffered partial JSON and corrupting the eventual output even though the stream was still active. Consider updating last_accessed (or bypassing cleanup) for empty chunks so active streams are not evicted simply because they temporarily contain no payload.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task