Skip to content

fix(harness): recognize retryable errors beyond string prefixes - #21114

Merged
yingfeng merged 6 commits into
infiniflow:mainfrom
SiyuanChenToDo:fix/pregel-retry-predicates-substring
Oct 19, 2026
Merged

yingfeng merged 6 commits into
infiniflow:mainfrom
SiyuanChenToDo:fix/pregel-retry-predicates-substring

Conversation

@SiyuanChenToDo

@SiyuanChenToDo SiyuanChenToDo commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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.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

Result: 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.go
  • internal/harness/graph/pregel/retry_predicates_test.go

AI assistance was used to identify, implement, and validate this fix.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3684d536-1636-414c-bb82-a44d6978a10b
📥 Commits

Reviewing files that changed from the base of the PR and between 543e167 and 25f858a.

📒 Files selected for processing: 2
  • internal/harness/graph/pregel/retry.go
  • internal/harness/graph/pregel/retry_predicates_test.go

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.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: yingfeng

Merge Risk: ⚪ Minimal · up to 25f85

No actionable merge-blocking risk is identified; the change is ready for normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: recognizing retryable errors when markers appear beyond string prefixes.
Description check Passed 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.

❤️ Share

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.

@yingfeng yingfeng added the ci Continue Integration label Oct 19, 2026
@yingfeng
yingfeng merged commit b811e5b into infiniflow:main Oct 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants