-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(ragflow): preserve final retry response body #2631
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
Open
Ycymac
wants to merge
10
commits into
agentscope-ai:main
Choose a base branch
from
Ycymac:codex/fix-ragflow-retry-714
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+123
−8
Open
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ac7c997
fix(ragflow): preserve final retry response
Ycymac da578ec
Merge branch 'main' into codex/fix-ragflow-retry-714
Ycymac fcabde8
fix(ragflow): prefer final response after retries
Ycymac d190aec
Merge branch 'main' into codex/fix-ragflow-retry-714
Ycymac 1133980
Merge branch 'main' into codex/fix-ragflow-retry-714
Ycymac ca17047
Merge branch 'main' into codex/fix-ragflow-retry-714
Ycymac ce08ccb
Merge branch 'main' into codex/fix-ragflow-retry-714
zouyx 498e3c6
Merge branch 'main' into codex/fix-ragflow-retry-714
Ycymac 58bca96
test(ragflow): cover final retry IOException
Ycymac 61a31c7
Merge branch 'main' into codex/fix-ragflow-retry-714
Ycymac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
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.
删除了这个异常会不会有问题?
我理解删除了就改变了这个拦截器的动作。
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.
是的,这里确实改变了一个分支,但改变的是历史异常覆盖最终请求结果的行为(之前bot提出的问题)。
lastException 只可能来自之前的重试;如果最后一次请求仍抛出 IOException,当前代码会在 attempt == maxRetries 的 catch 中直接 抛出异常,因此最终网络异常会正常向上传递。
删除后各终止路径为:
原本的逻辑的问题只发生在“前一次 IOException、最后一次得到 5xx”时:旧的 lastException 会覆盖最后一次 HTTP 响应。新增的 testRetryReturnsFinalErrorResponseAfterEarlierIOException 覆盖了这个场景。
所以这里不会放宽或吞掉最终异常,而是让最后一次尝试的结果决定最终行为。
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.
已补充测试提交
58bca961,生产代码未再修改。新增
testRetryThrowsFinalIOExceptionAfterEarlierIOException,确定性模拟IOException -> IOException,并验证:finalException;chain.proceed(request)恰好执行 2 次。验证结果:聚焦测试 1/1、
RAGFlowClientTest39/39、RAGFlow 模块 99/99,Spotless 均通过。这条测试直接确认删除历史lastException后,最终传输异常仍会正常抛出;改变的仅是“历史 IOException 覆盖最终 HTTP 5xx 响应”的错误分支。