You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix a bug in Pregel's retry predicates where retryable error markers are only recognized at the beginning of an error message, causing legitimate transient failures to be treated as non-retryable.
Problem
RetryPredicates.NetworkErrors and RetryPredicates.TemporaryErrors use a custom contains() helper that only performs prefix matching, despite being intended for case-insensitive substring matching.
In practice, network and API errors often contain additional context:
rpc call failed: CONNECTION RESET by peer
request failed with HTTP 503 Service Unavailable
provider replied: TOO MANY REQUESTS
These errors contain recognized retryable markers, but the existing implementation fails to detect them. Consequently, agent nodes may terminate prematurely instead of applying their configured retry policy.
Changes
Replace the custom prefix-matching logic with strings.Contains(strings.ToLower(...)) for case-insensitive substring matching.
Remove redundant string-matching helpers.
Add table-driven regression tests covering network failures, HTTP 503/429, case variations, unrelated errors, and nil errors.
Add an end-to-end RetryExecutor unit test verifying successful recovery after a transient network failure.
The change is limited to retry-error classification and does not modify retry budgets, backoff policies, or execution interfaces.
Verification
Verified on GitHub-hosted Ubuntu with Go 1.27.2.
Focused regression tests:
CGO_ENABLED=0 go test -count=1 -v \
./internal/harness/graph/pregel \
-run '^TestRetry(PredicatesMatchEmbeddedErrorMarkers|ExecutorRetriesEmbeddedNetworkError)$'
Result: PASS — all 8 table-driven cases and the retry recovery test passed.
Complete Pregel package tests:
CGO_ENABLED=0 go test -count=1 ./internal/harness/graph/pregel
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
The retry substring helper now matches markers anywhere in an error message without regard to case. New tests cover embedded error markers, unrelated and nil errors, and executor recovery on a second attempt.
Changes: Retry error marker matching
Layer / File(s)
Summary
Substring matching and retry validation internal/harness/graph/pregel/retry.go, internal/harness/graph/pregel/retry_predicates_test.go
The helper uses strings.Contains on lowercase strings to match markers anywhere in an error message. Tests cover embedded network and temporary-error markers, unrelated and nil errors, and a successful second attempt after a wrapped connection-reset error.
No actionable merge-blocking risk is identified; the change is ready for normal checks.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title clearly and concisely describes the main change: recognizing retryable errors when markers appear beyond string prefixes.
Description check
The description includes the required Summary section and provides clear problem context, implementation details, tests, verification results, scope, and limitations.
Fix all pre-merge checks with AI
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
A rabbit checks the error trail, Finds markers tucked beyond the start. Case may change; the match still holds, One retry brings “recovered” home. Two hops, then carrots for the heart.
Comment @coderabbitai help to get the list of available commands.
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
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.
Summary
Fix a bug in Pregel's retry predicates where retryable error markers are only recognized at the beginning of an error message, causing legitimate transient failures to be treated as non-retryable.
Problem
RetryPredicates.NetworkErrorsandRetryPredicates.TemporaryErrorsuse a customcontains()helper that only performs prefix matching, despite being intended for case-insensitive substring matching.In practice, network and API errors often contain additional context:
rpc call failed: CONNECTION RESET by peerrequest failed with HTTP 503 Service Unavailableprovider replied: TOO MANY REQUESTSThese errors contain recognized retryable markers, but the existing implementation fails to detect them. Consequently, agent nodes may terminate prematurely instead of applying their configured retry policy.
Changes
strings.Contains(strings.ToLower(...))for case-insensitive substring matching.RetryExecutorunit test verifying successful recovery after a transient network failure.The change is limited to retry-error classification and does not modify retry budgets, backoff policies, or execution interfaces.
Verification
Verified on GitHub-hosted Ubuntu with Go 1.27.2.
Focused regression tests:
Result: PASS — all 8 table-driven cases and the retry recovery test passed.
Complete Pregel package tests:
CGO_ENABLED=0 go test -count=1 ./internal/harness/graph/pregelResult: PASS (14.432s).
Go formatting checks also passed.
CI evidence: https://github.com/SiyuanChenToDo/ragflow/actions/runs/39116631581
The full repository test suite and external-service integration tests were not run.
Scope
Only two files are changed:
internal/harness/graph/pregel/retry.gointernal/harness/graph/pregel/retry_predicates_test.goAI assistance was used to identify, implement, and validate this fix.