Skip to content

feat: add scoped Slack history tool - #29489

Open
wamelinkwebdesign wants to merge 1 commit into
NousResearch:mainfrom
wamelinkwebdesign:feat/slack-history-tool
Open

feat: add scoped Slack history tool#29489
wamelinkwebdesign wants to merge 1 commit into
NousResearch:mainfrom
wamelinkwebdesign:feat/slack-history-tool

Conversation

@wamelinkwebdesign

Copy link
Copy Markdown

Summary

  • Adds a scoped slack_history tool for recent messages, thread replies, and bounded channel search.
  • Gates Slack recall behind SLACK_BOT_TOKEN, adds Slack/messaging toolset integration, and exposes current Slack IDs in Slack session context only when the tool is available.
  • Updates Slack manifest scopes, docs, and tests for history recall behavior and safety boundaries.

Safety

  • Requires explicit channel outside Slack sessions.
  • Hard-caps returned messages at 100.
  • Labels Slack history as untrusted data/evidence, not instructions.
  • Handles missing scopes and inaccessible channels with actionable errors.

Test Plan

  • TZ=UTC LANG=C.UTF-8 PYTHONHASHSEED=0 /Users/dennis/.hermes/hermes-agent/venv/bin/python -m pytest -o addopts= -n 4 --ignore=tests/integration --ignore=tests/e2e -m 'not integration' tests/tools/test_slack_history_tool.py tests/tools/test_slack_history_toolset.py tests/hermes_cli/test_slack_cli.py tests/gateway/test_slack_history_context_prompt.py -q
  • Result: 16 passed in 2.08s

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have platform/slack Slack app adapter comp/gateway Gateway runner, session dispatch, delivery comp/tools Tool registry, model_tools, toolsets labels May 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Clean resubmission of closed #29473 (which was closed for bundling a Supabase memory provider plugin). This version correctly scopes to the Slack history tool only. Related to long-standing feature request #6345.

@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 resubmission. The feature addresses a current gap: gateway/session.py:496-504 still tells Slack sessions that Slack APIs cannot be called, and current main has no tracked slack_history tool.

Problems

  • tools/slack_history_tool.py:111-125 passes the entire SLACK_BOT_TOKEN value as one bearer token. Hermes supports comma-separated multi-workspace tokens in website/docs/user-guide/messaging/slack.md:524-561, and the active adapter splits them in plugins/platforms/slack/adapter.py:979-992; this path would fail for those configured workspaces and cannot select the inbound workspace's credential.
  • toolsets.py:62 puts the tool in _HERMES_CORE_TOOLS. All platform bundles inherit that list (toolsets.py:430-485), so any configured Slack token exposes Slack retrieval to non-Slack sessions as well. That defeats the claimed scoped boundary.

Suggested changes

  • Route history calls through the active workspace-aware Slack client/token mapping and add multi-workspace coverage.
  • Keep the tool Slack-scoped rather than core, and fail closed unless invocation provenance is an authorized Slack session.

Automated hermes-sweeper review.



def _token() -> str:
token = (os.environ.get("SLACK_BOT_TOKEN") or "").strip()

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.

SLACK_BOT_TOKEN may be a comma-separated multi-workspace value. The active adapter splits it and maps credentials per workspace (plugins/platforms/slack/adapter.py:979-992); passing the whole value as one Bearer token fails and cannot select the workspace for this session. Please use the same workspace-aware credential path and add a multi-workspace regression test.

Comment thread toolsets.py
# Cross-platform messaging (gated on gateway running via check_fn)
"send_message",
# Scoped Slack history/search (gated on SLACK_BOT_TOKEN via check_fn)
"slack_history",

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 makes Slack history part of every hermes-* bundle because they inherit _HERMES_CORE_TOOLS. With any Slack token configured, a non-Slack session can invoke it with an explicit channel ID. Keep this in the Slack-specific bundle/toolset and enforce trusted Slack-session provenance before retrieving workspace data.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
@andrexibiza

Copy link
Copy Markdown
Contributor

Campaign interlock

Related: #6345. Related: #79772. Collision candidate; retain contributor credit while adjudicating #6345.

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 comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have platform/slack Slack app adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants