Skip to content

fix(#2995): ignore leading vis-thinking block in react parser#2996

Merged
Aries-ckt merged 1 commit into
eosphoros-ai:mainfrom
LXW2019124:fix-2995
Mar 23, 2026
Merged

fix(#2995): ignore leading vis-thinking block in react parser#2996
Aries-ckt merged 1 commit into
eosphoros-ai:mainfrom
LXW2019124:fix-2995

Conversation

@LXW2019124

Copy link
Copy Markdown
Contributor

Description

更新了react_parser.py,让 ReAct 解析在提取 Thought / Phase / Action / Action Input 之前,先忽略前置的 vis-thinking 包装内容。

这次改动只发生在 parser 层,范围很小:
当模型输出以前置 VisThinking 块开头时,parser 会先剥离这段 thinking 包装,再继续解析正文。
如果剥离之后没有正文内容,parser 会返回空步骤列表,而不是把 thinking 内容误当成可执行的 ReAct step。
thinking 结束位置的判断也做了收敛,避免两类边界问题:
不会因为 thinking 内部出现 fence 而过早截断
不会把后续真实正文错误吞进 thinking 区域
这个修改修复了 deepseek-reasoner 在 ReAct 场景下,因 reasoning 内容被误解析成多个 step,从而触发 Only one action is allowed each time. 的问题。

How Has This Been Tested?

测试覆盖的场景包括:
标准 ReAct 文本解析行为保持不变
前置 vis-thinking 块会被正确忽略
只有 vis-thinking、没有正文时,返回空步骤
thinking 内容内部包含 standalone fence 时,仍能正确跳过 thinking
正文本身包含 standalone fence 时,不会被错误吞掉,仍能正常解析

Snapshots:

Include snapshots for easier review.

Checklist:

  • My code follows the style guidelines of this project
  • I have already rebased the commits and make the commit message conform to the project standard.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions Bot added the fix Bug fixes label Mar 19, 2026
@Aries-ckt

Copy link
Copy Markdown
Collaborator

I am very appreciate your contribution. we will test and merge it soon.

@chenliang15405 chenliang15405 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. LGTM

@Aries-ckt Aries-ckt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

@Aries-ckt Aries-ckt merged commit 1695ae6 into eosphoros-ai:main Mar 23, 2026
2 checks passed
@LXW2019124 LXW2019124 deleted the fix-2995 branch March 24, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] deepseek-reasoner 在 /api/v1/chat/react-agent 中会触发 ReAct 重试死循环(Only one action is allowed each time)

3 participants