Skip to content

fix: respect zero values for forward parser depth/fetch limits - #9394

Merged
Soulter merged 1 commit into
AstrBotDevs:masterfrom
Foolllll-J:fix/forward-parser-zero-respect
Jul 26, 2026
Merged

fix: respect zero values for forward parser depth/fetch limits#9394
Soulter merged 1 commit into
AstrBotDevs:masterfrom
Foolllll-J:fix/forward-parser-zero-respect

Conversation

@Foolllll-J

@Foolllll-J Foolllll-J commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

_read_int_mapping in quoted_message/settings.py treated 0 as invalid and fell back to the default value (4/6/32), making it impossible for users to disable forward message parsing by setting all limits to 0 in WebUI.

Modifications / 改动点

  • astrbot/core/utils/quoted_message/settings.py:24 — value <= 0 → value < 0, allowing 0 to pass through as a valid value.
  • astrbot/core/utils/quoted_message/extractor.py:56 — skip WARN log when max_fetch=0 (user intentionally disabled fetching).
  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果


Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Respect zero values in quoted message forward parsing limits and avoid warning logs when users intentionally disable fetching.

Bug Fixes:

  • Treat 0 as a valid configuration value for forward parser depth/fetch limits instead of falling back to defaults.
  • Skip nested forward fetching warnings when max_fetch is explicitly set to 0 to disable fetching.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. area:core The bug / feature is about astrbot's core, backend labels Jul 26, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 26, 2026
@Soulter
Soulter merged commit 7c2a2e9 into AstrBotDevs:master Jul 26, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants