Skip to content

feat(feishu): add per-group require_mention flag - #11193

Closed
JerryRobocat wants to merge 1 commit into
NousResearch:mainfrom
JerryRobocat:feat-feishu-require-mention-flag
Closed

feat(feishu): add per-group require_mention flag#11193
JerryRobocat wants to merge 1 commit into
NousResearch:mainfrom
JerryRobocat:feat-feishu-require-mention-flag

Conversation

@JerryRobocat

Copy link
Copy Markdown

Summary

Adds an opt-in require_mention: false per-group setting for Feishu group rules. When set, the bot processes every message in that group without requiring an @mention — useful for solo bot-user groups or dedicated topic channels where you want DM-like behaviour without the ceremony of @-mentioning the bot every message.

Default remains True, so existing team/multi-person groups keep the safe mention-gated behaviour unchanged.

Motivation

In Feishu, group chats require an explicit @mention of the bot for messages to reach the agent — this is the correct default for shared/team groups. But users often want dedicated topic channels (just themselves + the bot) to organise parallel conversations on different projects. In those solo-with-bot groups, having to @-mention the bot for every single message is friction-heavy.

This change lets users opt specific groups out of the mention gate via a single config flag, while keeping the default safe for all existing groups.

Changes

  • FeishuGroupRule dataclass gains a require_mention: bool = True field
  • FeishuAdapter._load_settings() parses the new field from group_rules config
  • _should_accept_group_message() checks the flag after the policy gate and bypasses mention checking when opted out
  • The policy/allowlist/blacklist gate still applies — a blacklisted sender is still rejected even when mention gating is off
  • New test covers the opt-in bypass, default-gated groups, and blacklist-still-applies cases

Example config

feishu:
  group_rules:
    oc_solo_topic:
      policy: open
      require_mention: false  # bot reads every message
    oc_team_chat:
      policy: open            # require_mention defaults to true

Tests

  • tests/gateway/test_feishu.py::FeishuAdapterTests::test_per_group_require_mention_false_bypasses_mention_gate (new)
  • Full tests/gateway/test_feishu.py suite: 107 passed
  • Targeted group-gate tests: 13 passed

Adds an opt-in `require_mention: false` per-group setting for Feishu
group rules. When set, the bot processes every message in that group
without requiring an @mention — useful for solo bot-user groups or
dedicated topic channels where you want DM-like behaviour.

Default remains True, so existing team/multi-person groups keep the
safe mention-gated behaviour unchanged. The policy/allowlist/blacklist
gate still applies, so a blacklisted sender is still rejected even
with mention gate bypassed.

Example config:

  feishu:
    group_rules:
      oc_solo_topic:
        policy: open
        require_mention: false
      oc_team_chat:
        policy: open  # require_mention defaults to true

Tests:
- New test covers mention-gate bypass for opt-in group
- Verifies default (require_mention: true) groups still gate
- Verifies policy gate still applies when bypass is on
@JerryRobocat

Copy link
Copy Markdown
Author

Closing for now — going to soak this locally for a few days before re-opening once the behaviour is polished. Local patch is staying applied on my machine to exercise it in real use.

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