Skip to content

feat(slack): add ignored channel gate - #46925

Closed
bhanusharma wants to merge 1 commit into
NousResearch:mainfrom
bhanusharma:feat/slack-ignored-channels
Closed

feat(slack): add ignored channel gate#46925
bhanusharma wants to merge 1 commit into
NousResearch:mainfrom
bhanusharma:feat/slack-ignored-channels

Conversation

@bhanusharma

Copy link
Copy Markdown

Summary

  • Add Slack ignored_channels support via slack.ignored_channels and SLACK_IGNORED_CHANNELS.
  • Check ignored channels before allowlist, free-response, mention, and active-thread gates so passive/archive channels stay silent.
  • Avoid logging inbound message previews in gateway logs; log message length instead.
  • Document Slack channel allow/free/ignore env vars and the new Slack ignore-list behavior.

Test plan

  • venv/bin/python -m pytest tests/gateway/test_slack_mention.py -q -o 'addopts='
  • venv/bin/python -m pytest tests/gateway/test_slack.py tests/gateway/test_slack_mention.py tests/hermes_cli/test_slack_cli.py -q -o 'addopts='

Notes

  • DMs are not filtered by ignored_channels.
  • ignored_channels intentionally has higher precedence than allowed_channels and free_response_channels for channel messages.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery platform/slack Slack app adapter labels Jun 16, 2026

@teknium1 teknium1 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.

Thanks for the focused Slack control and documentation work. The requested gate is still absent on current main, but this branch predates Slack's plugin migration and needs a targeted port.

Problems

  • gateway/platforms/slack.py and its legacy gateway/config.py bridge were moved by 1a38066054752d601b71fc655a3ed6bf4228e2da. Current routing is plugins/platforms/slack/adapter.py:2835; its config bridge is _apply_yaml_config() at :4485.
  • The logging change leaves reply_to_text content in the same inbound INFO record (gateway/run.py:10777-10783).
  • Current Slack treats MPIMs as shared surfaces (plugins/platforms/slack/adapter.py:2835), so the salvaged ignored-channel tests need MPIM coverage as well as 1:1 DMs.

Suggested changes

  • Port the gate and YAML-to-env bridge into plugins/platforms/slack/adapter.py, then add current-path tests for config/env precedence, channels, MPIMs, and 1:1 DMs.
  • If retaining the privacy change, remove or length-only log both message and reply-to bodies.

Automated hermes-sweeper review.

# Check ignored channels first — these are passive/archive-only
# channels where the live bot must never respond, even to allowed
# users or explicit mentions.
ignored_channels = self._slack_ignored_channels()

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.

Current main moved Slack to plugins/platforms/slack/adapter.py in 1a38066054752d601b71fc655a3ed6bf4228e2da; port this gate there. Preserve the current not is_one_to_one_dm scope so MPIMs remain subject to the control, and add an MPIM regression case.

Comment thread gateway/run.py
logger.info(
"inbound message: platform=%s user=%s chat=%s msg=%r",
"inbound message: platform=%s user=%s chat=%s msg_len=%s",
_platform_name, source.user_name or source.user_id or "unknown",

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.

This replaces the main message preview, but the same log record still emits _reply_txt as reply_to_text=%r. If this change is intended to avoid inbound content in gateway logs, convert that field to a length or remove it too.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 14, 2026
teknium1 added a commit that referenced this pull request Jul 23, 2026
…g path

Follow-up to the #51899 pick, folding in the config-bridge half of the
competing PR #46925 (@bhanusharma, earliest submitter for the
ignored-channel gate):

- _apply_yaml_config: translate config.yaml slack.ignored_channels into
  SLACK_IGNORED_CHANNELS (list or CSV), env-var-wins like every other
  bridged Slack key.
- SlackAdapter._slack_ignored_channels / gateway.run's
  _slack_ignored_channels_from_gateway_config: fall back to the
  SLACK_IGNORED_CHANNELS env var when PlatformConfig.extra carries no
  value, so top-level slack: blocks (which flow through the env bridge,
  not extra) are honored at both the adapter and runner gates.
- conftest: force-clear SLACK_ALLOWED_CHANNELS / SLACK_IGNORED_CHANNELS /
  SLACK_DISABLE_DMS between tests (config-loader side-effect leak class).
- Tests: env-bridge translation + precedence in test_config.py, env
  fallback + extra-wins in test_slack_runner_ignored_channels.py.

Credit: #46925 by @bhanusharma proposed the same gate with the YAML→env
bridge; #51899 (picked as the base) carries the wider outbound/runner
coverage. Closes #46925 as consolidated here with first-submitter credit.
teknium1 added a commit that referenced this pull request Jul 23, 2026
…g path

Follow-up to the #51899 pick, folding in the config-bridge half of the
competing PR #46925 (@bhanusharma, earliest submitter for the
ignored-channel gate):

- _apply_yaml_config: translate config.yaml slack.ignored_channels into
  SLACK_IGNORED_CHANNELS (list or CSV), env-var-wins like every other
  bridged Slack key.
- SlackAdapter._slack_ignored_channels / gateway.run's
  _slack_ignored_channels_from_gateway_config: fall back to the
  SLACK_IGNORED_CHANNELS env var when PlatformConfig.extra carries no
  value, so top-level slack: blocks (which flow through the env bridge,
  not extra) are honored at both the adapter and runner gates.
- conftest: force-clear SLACK_ALLOWED_CHANNELS / SLACK_IGNORED_CHANNELS /
  SLACK_DISABLE_DMS between tests (config-loader side-effect leak class).
- Tests: env-bridge translation + precedence in test_config.py, env
  fallback + extra-wins in test_slack_runner_ignored_channels.py.

Credit: #46925 by @bhanusharma proposed the same gate with the YAML→env
bridge; #51899 (picked as the base) carries the wider outbound/runner
coverage. Closes #46925 as consolidated here with first-submitter credit.
teknium1 added a commit that referenced this pull request Jul 23, 2026
…g path

Follow-up to the #51899 pick, folding in the config-bridge half of the
competing PR #46925 (@bhanusharma, earliest submitter for the
ignored-channel gate):

- _apply_yaml_config: translate config.yaml slack.ignored_channels into
  SLACK_IGNORED_CHANNELS (list or CSV), env-var-wins like every other
  bridged Slack key.
- SlackAdapter._slack_ignored_channels / gateway.run's
  _slack_ignored_channels_from_gateway_config: fall back to the
  SLACK_IGNORED_CHANNELS env var when PlatformConfig.extra carries no
  value, so top-level slack: blocks (which flow through the env bridge,
  not extra) are honored at both the adapter and runner gates.
- conftest: force-clear SLACK_ALLOWED_CHANNELS / SLACK_IGNORED_CHANNELS /
  SLACK_DISABLE_DMS between tests (config-loader side-effect leak class).
- Tests: env-bridge translation + precedence in test_config.py, env
  fallback + extra-wins in test_slack_runner_ignored_channels.py.

Credit: #46925 by @bhanusharma proposed the same gate with the YAML→env
bridge; #51899 (picked as the base) carries the wider outbound/runner
coverage. Closes #46925 as consolidated here with first-submitter credit.
@teknium1 teknium1 closed this in da131ae Jul 23, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #70196 (merged): earlier submitter for the ignored-channel idea — your env-bridge half was reimplemented with explicit first-submitter credit in the commit.

Thanks for the work — it's credited in #70196's summary.

randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…g path

Follow-up to the NousResearch#51899 pick, folding in the config-bridge half of the
competing PR NousResearch#46925 (@bhanusharma, earliest submitter for the
ignored-channel gate):

- _apply_yaml_config: translate config.yaml slack.ignored_channels into
  SLACK_IGNORED_CHANNELS (list or CSV), env-var-wins like every other
  bridged Slack key.
- SlackAdapter._slack_ignored_channels / gateway.run's
  _slack_ignored_channels_from_gateway_config: fall back to the
  SLACK_IGNORED_CHANNELS env var when PlatformConfig.extra carries no
  value, so top-level slack: blocks (which flow through the env bridge,
  not extra) are honored at both the adapter and runner gates.
- conftest: force-clear SLACK_ALLOWED_CHANNELS / SLACK_IGNORED_CHANNELS /
  SLACK_DISABLE_DMS between tests (config-loader side-effect leak class).
- Tests: env-bridge translation + precedence in test_config.py, env
  fallback + extra-wins in test_slack_runner_ignored_channels.py.

Credit: NousResearch#46925 by @bhanusharma proposed the same gate with the YAML→env
bridge; NousResearch#51899 (picked as the base) carries the wider outbound/runner
coverage. Closes NousResearch#46925 as consolidated here with first-submitter credit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/slack Slack app adapter sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants