Repository navigation
Retry transient GitHub REST read failures - #82
Merged
Merged
Conversation
Summary: - retry GitHub REST GET reads when request send or JSON body decode fails with transient transport errors - keep non-GET requests single-shot and preserve existing rate-limit handling - add a regression test that simulates a truncated JSON response and verifies the second GET succeeds Rationale: - transient connection resets and truncated bodies can fail otherwise healthy GitHub reads - limiting retries to idempotent GET requests reduces recovery noise without risking duplicate writes Tests: - cargo test rest_json_retries_truncated_get_responses
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 Walkthrough🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@rust/src/github.rs`:
- Around line 1967-2016: The server thread currently blocks forever on
listener.accept() calls; add a deadline inside the spawned closure so the second
accept (and thus server.join()) will time out instead of hanging. Inside the
thread closure that currently calls listener.accept().unwrap(), create an
Instant deadline (e.g. now + Duration::from_secs(N)) and replace each direct
accept() with a non-blocking loop (listener.set_nonblocking(true) or try_accept
loop) that repeatedly attempts accept(), sleeps briefly, and returns/errs when
Instant::now() > deadline; ensure the closure returns cleanly on timeout so
server.join() won't block. Update the closure around the two accept points (the
thread spawned into server) so it uses this deadline behavior.
- Around line 1495-1530: should_retry_github_read_error currently only treats
reqwest transport failures and a set of string needles as retryable; extend it
to also treat truncated-JSON decode errors as retryable by inspecting the error
chain for serde_json::Error (or a reqwest::Error that wraps a serde_json::Error)
and checking its classification/message for EOF/truncated JSON (e.g.,
serde_json::error::Category::Eof or messages like "EOF while parsing" /
"unexpected end of file"); update should_retry_github_read_error to return true
when such a serde_json EOF decode is found (in addition to the existing reqwest
checks) and add this check alongside retryable_github_read_error_text so JSON
decode EOFs are retried.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Summary: - retry GitHub REST GET reads when truncated JSON decode errors surface as serde_json EOF failures - harden the raw-socket retry regression test with a bounded accept deadline so CI fails cleanly instead of hanging - add coverage for both transport truncation and JSON EOF decode retry paths Rationale: - review feedback identified a decode path that could still fail before retrying a read - deadline-bounded test sockets keep retry regressions observable without risking stuck test jobs Tests: - cargo test rest_json_retries_truncated_get_responses - cargo test rest_json_retries_truncated_json_decode_errors - cargo fmt --check - cargo clippy --all-targets --all-features -- -D warnings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
GitHub REST GET calls can fail on transient transport truncation and currently abort otherwise healthy reads instead of retrying the idempotent request.
TL;DR
Retry transient GitHub REST GET failures so truncated responses do not break issue reads.
Summary
Alternatives
Test Plan
cargo fmt --checkcargo testcargo clippy --all-targets --all-features -- -D warningscargo test rest_json_retries_truncated_get_responsesSummary by CodeRabbit