Skip to content

fix: keep system reminders out of conversation history - #9844

Open
kidding-404 wants to merge 1 commit into
AstrBotDevs:masterfrom
kidding-404:fix/9779-temporary-system-reminder
Open

fix: keep system reminders out of conversation history#9844
kidding-404 wants to merge 1 commit into
AstrBotDevs:masterfrom
kidding-404:fix/9779-temporary-system-reminder

Conversation

@kidding-404

@kidding-404 kidding-404 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Mark injected system reminders as temporary content. The reminders remain available to the model for the current request but are excluded from persisted conversation history, preventing them from polluting later context and repeatedly consuming tokens.

The existing main-agent test is extended to cover both the current-request and persistence behavior.

Testing

  • uv run ruff format .
  • uv run ruff check .
  • uv run pytest tests/unit/test_astr_main_agent.py

Fixes #9779

Summary by Sourcery

Prevent system reminders from polluting future conversation context and consuming tokens repeatedly.

Bug Fixes:

  • Exclude injected system reminders from persisted conversation history while keeping them available during the current model request.

Tests:

  • Extend main-agent coverage to verify system reminders are included in the current request but omitted from saved messages.

@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 Aug 27, 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 assessment

Needs a human reviewer. If the temporary marker is wrong, system reminders will be omitted from saved conversation history, so reconstructed conversations could lack that context. Reverting restores persistence for future messages but cannot recover reminders that were already skipped, although the reminders are derived and the impact is bounded.


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.

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 size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] system_reminder 注入块请使用已有的 mark_as_temp() 机制,避免固化进持久化历史

1 participant