# Discourse AI does not respect the "everyone" group

**URL:** https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048
**Category:** Bug
**Tags:** ai, ai-bot
**Created:** [January 18, 2024, 7:34am UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048 "2024-01-18T07:34:41Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Rusty\_M](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rusty_m/32/347643_2.png) [@Rusty\_M](https://meta.discourse.org/u/Rusty_M)
#### Post date: [January 18, 2024, 7:34am UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/1 "2024-01-18T07:34:41Z")

</div>

It looks like this is the same known issue that causes problems with templates.  
[everyone-group-unable-to-see-private-templates](https://meta.discourse.org/t/everyone-group-unable-to-see-private-templates/277514)

In this case, the ai-bot options appear, but the bot simply never responds.

---

<div class="post-metadata">

### Author: ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)
#### Post date: [January 18, 2024, 9:16pm UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/2 "2024-01-18T21:16:00Z")

</div>

Thanks for searching for prior issues! 🕶 👍

I think the same applies here:

> [@"everyone" group unable to see private templates](https://meta.discourse.org/t/everyone-group-unable-to-see-private-templates/277514/5):
>
> ‘Everyone’ is more a pseudo group that includes anon, and probably shouldn’t be included as an available group to set here. 🤔
> 
> I think setting TL0 would be the thing to do. 👍

You can not give anonymous users access to the chat bot, so using `trust_level_0` is an effective solution for your use case. 🙂

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 24, 2025, 6:44am UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/3 "2025-07-24T06:44:12Z")

</div>

@Roman reading through the code in Discourse I think this works now.

> <https://github.com/discourse/discourse/blob/ebc5703b42bd64c0e5a182969b9d11df983a5992/plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-editor.gjs#L97-L108>

Is it time to close this off and remove the backwards compat code?

---

<div class="post-metadata">

### Author: ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)
#### Post date: [July 29, 2025, 7:06pm UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/4 "2025-07-29T19:06:25Z")

</div>

It’s a bit tricky. I originally added the `everyone` option because we wanted to let anonymous users see gists. Every feature has its own rules so I don’t think setting a Persona’s allowed groups to that will make the feature available to everyone.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [December 8, 2025, 7:13pm UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/5 "2025-12-08T19:13:39Z")

</div>

This is still an issue. If “AI bot allowed groups” is set to `everyone`, the bot does not respond.

I think the bug is [here](https://github.com/discourse/discourse/blob/455b9dae1f468dd282570cd12bde47fe52360c2c/plugins/discourse-ai/lib/ai_bot/playground.rb#L730C9-L730C93)

`return false if (SiteSetting.ai_bot_allowed_groups_map & post.user.group_ids).blank?`

If the setting is `everyone` then this returns false, since 0 is not in `post.user.group_ids`

The correct pattern is `!user.in_any_groups?(SiteSetting.ai_bot_allowed_groups_map)`

which has a special case for `everyone`:

```plaintext
  def in_any_groups?(group_ids)
    group_ids.include?(Group::AUTO_GROUPS[:everyone]) ||
      (is_system_user? && (Group.auto_groups_between(:admins, :trust_level_4) & group_ids).any?) ||
      (group_ids & belonging_to_group_ids).any?
  end

```

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [March 5, 2026, 2:28pm UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/6 "2026-03-05T14:28:35Z")

</div>

> [@RGJ](#):
>
> ai\_bot\_allowed\_groups

Does it make sense to disallow “everyone” to be selected for that setting? Similar to how it was done in [DEV: restrict everyone on whisper groups via a new disallowed\_groups attr by renato · Pull Request #37515 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/37515)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2026, 5:00am UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/7 "2026-03-06T05:00:41Z")

</div>

Yeah we got to remove it… @martin has on his list to clean a lot of this up, but it may take a bit.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 24, 2026, 7:04am UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/8 "2026-08-24T07:04:04Z")

</div>

@martin should we close this one? just patch current?

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [August 26, 2026, 11:37pm UTC](https://meta.discourse.org/t/discourse-ai-does-not-respect-the-everyone-group/292048/9 "2026-08-26T23:37:11Z")

</div>

Small PR here to do it, along with fixing this bug:

> [@RGJ](#):
>
> `return false if (SiteSetting.ai_bot_allowed_groups_map & post.user.group_ids).blank?`

> <https://github.com/discourse/discourse/pull/42944>
>
> Also fix one call site where user.in\_any\_groups? was not used
