Skip to content

fix(filter): improve force mute keyword triggers#119

Open
lumia1998 wants to merge 1 commit into
ChatLunaLab:mainfrom
lumia1998:fix/force-mute-keyword-triggers-v2
Open

fix(filter): improve force mute keyword triggers#119
lumia1998 wants to merge 1 commit into
ChatLunaLab:mainfrom
lumia1998:fix/force-mute-keyword-triggers-v2

Conversation

@lumia1998

@lumia1998 lumia1998 commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • 私聊消息包含预设 mute_keyword 时触发闭嘴
  • 群聊消息需同时包含 mute_keyword,并且 @/引用角色或包含角色昵称
  • 监听 preset_updated 刷新 filter 预设缓存
  • mute 期间阻止 triggerMessage / triggerCollect 等旁路唤醒
  • 在历史拉取和响应锁等待后重新检查 mute;已取得锁时会先释放再返回
  • 优化 isForceMute 配置说明

Review follow-up

This supersedes #118 and addresses its review comments:

  • clarify the force-mute configuration description
  • close the mute race window around pullHistory() and acquireResponseLock()

Validation

  • tsc --noEmit
  • ESLint for src/plugins/filter.ts and src/service/message.ts
  • git diff --check

Manual test plan

  • 群聊仅发送关键词:不闭嘴
  • 群聊 @机器人 + 关键词:进入闭嘴状态
  • 群聊 角色昵称 + 关键词:进入闭嘴状态
  • 私聊发送关键词:进入闭嘴状态
  • 修改预设 mute_keyword 后无需重启即可生效
  • mute 期间 agent task 完成不会唤醒角色

Summary by CodeRabbit

  • Bug Fixes

    • Improved forced-mute keyword handling for private messages, group messages, direct mentions, and configured nicknames.
    • Updated mute behavior so messages are not collected or processed while a session is muted.
    • Prevented message collection when a session becomes muted during processing.
    • Preset updates now take effect more reliably without requiring a restart.
  • Documentation

    • Clarified the requirements for using the mute_keyword preset keyword in private and group messages.

Support private mute by keyword, group mute by @/quote or nick_name with keyword, refresh filter preset cache on update, and block all collect paths while muted.
@gemini-code-assist

Copy link
Copy Markdown

Caution

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

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 53c1b591-5311-463b-abc1-78dfedb363ec

📥 Commits

Reviewing files that changed from the base of the PR and between e43b6ce and 4706795.

📒 Files selected for processing (3)
  • src/config.ts
  • src/plugins/filter.ts
  • src/service/message.ts

📝 Walkthrough

Walkthrough

Force-mute documentation and preset caching were updated, keyword-based mute activation was expanded, and message triggering and collection now stop early when sessions are muted.

Changes

Force-mute and message collection

Layer / File(s) Summary
Force-mute configuration and preset refresh
src/config.ts, src/plugins/filter.ts
The isForceMute description documents mute_keyword behavior, and global presets plus the preset pool refresh when presets are updated.
Force-mute keyword decision
src/plugins/filter.ts
Plain-text extraction and mute activation now use force-mute configuration, keyword matches, direct or appel sessions, and preset nickname matches.
Mute-aware message collection
src/service/message.ts
Message triggering and collection return early for muted sessions, including a post-lock check that releases the response lock.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: cooksleep, dingyi222666

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately highlights the main force-mute keyword trigger changes in the filter logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant