feat(slack): add read-only Slack channel history tool - #54535
Conversation
|
@alt-glitch Is this a P3 though? it's part of core workflows because I will ask the agent to see my last few messages and then process them one by one. I have a few queues with different things so this becomes a core part of my workflows and could benefit others who may use it this way |
a6d2ce8 to
a80c40b
Compare
a80c40b to
14202a6
Compare
|
Hi @sk-holmes — I reviewed and hardened this branch with the original commit/authorship preserved. GitHub would not allow me to open a PR directly against your fork without collaborator access, so I created a ready-for-review diff here: NaMinhyeok#1 It is based on the exact current head of this PR ( The hardening covers trusted direct-Slack turn provenance, current-channel/workspace enforcement before SDK calls, relay/restored/synthetic/background/goal/queued-turn fail-closed boundaries, static prompt-cache safety, bounded untrusted output, MCP alias compatibility, and lifecycle/multiplex cases. It adds no write action. Thread lookup is not permalink-only: the tool supports the active thread, an explicit Validation: 837 focused/integration tests pass, plus 45/45 Slack tool tests after the locator-description refinement; the full suite reports 39,283 passed and the same 45 local-environment failures in 15 unchanged files; Ruff, byte-compilation, Windows-footgun, diff checks, and both docs builds pass. Security, architecture, product, test, maintainability, and plan-compliance review rounds are all LGTM. If this direction looks good, the single commit can be cherry-picked onto your branch. |
14202a6 to
f704aa7
Compare
Thanks 👍 |
f704aa7 to
7f1bec2
Compare
7f1bec2 to
75ef8a1
Compare
…istory-tool # Conflicts: # scripts/release.py
…istory-tool # Conflicts: # gateway/session.py # gateway/session_context.py # hermes_cli/config.py # plugins/platforms/slack/adapter.py # scripts/release.py # tests/gateway/test_multiplex_profile_authz.py # tests/gateway/test_run_progress_topics.py # tests/gateway/test_session.py # tests/gateway/test_slack.py # tests/gateway/test_slack_mention.py # website/docs/user-guide/messaging/slack.md
|
resimplified this branch to stay on original target |
# Conflicts: # gateway/run.py # gateway/session.py # gateway/session_context.py
Adds an opt-in, service-gated, read-only
slacktool for bounded Slack history using the selected profile’s existing live Slack adapter and SDK client.Actions:
list_channels— list bounded public/private channels that the bot belongs to;fetch_history— read a bounded channel or DM timeline;fetch_thread— read a thread parent and replies, including from a validated Slack permalink;find_messages— scan bounded pages using text and URL-domain filters.The tool provides explicit continuation metadata when Slack pagination, match limits, or local serialization limits leave more data.
Authorization model
By default, the tool can read only the active Slack conversation.
An optional cross-channel exception is available only when all of these conditions hold:
D…DM;history_cross_channel_user_idsfor the selected profile;auth.testto be a bot token;allowed_channelspolicy, when configured;Shared channels and threads cannot use the owner exception, preventing private cross-channel results from being disclosed to other participants.
Security and privacy boundaries
allowed_channelsremains profile-local rather than flowing through a process-global environment bridge.find_messagesfails safely if no match can fit.Tool and service gating
slack_historyis an explicit Slack platform toolset. The model schema is exposed only when the selected profile's running adapter has exactly one authenticated bot workspace and both history entry points are available. Profile identity and live eligibility are part of the availability-cache key, so one eligible sibling profile or stale connect/disconnect state cannot advertise a dead capability.Example toolset opt-in:
Optional owner-only cross-channel configuration:
The owner list is profile-local and has no environment fallback. No new credential is introduced.
Related Issue
Fixes #6345
Partially addresses #35291 by adding a read-only Slack history tool and documentation. It does not implement that issue's broader setup wizard, OAuth scope manifest, or event-subscription work.
CI and compatibility repairs included
nmh9097@gmail.comattribution mapping.MagicMockdoes not accidentally become an internal message._primary_profile_namein the bare multiplex runner fixture.Related and overlapping work
Duplicate/overlap search was performed before finalization:
Type of Change
Changes Made
Slack history tool and toolset
tools/slack_tool.pyslacktool withlist_channels,fetch_history,fetch_thread, andfind_messagesactions.toolsets.pyandhermes_cli/tools_config.pyslack_historyplatform toolset and keep it opt-in alongsidehermes-slack.Authorization, identity, and adapter boundaries
plugins/platforms/slack/adapter.pyauth.test, binds reads to a single authenticated workspace, and denies user-token or multi-workspace history access.gateway/authz_mixin.py,gateway/session_context.py, andgateway/run.pygateway/session.pyConfiguration and service availability
gateway/config.py,hermes_cli/config.py, andcli-config.yaml.examplehistory_cross_channel_user_idsconfiguration and preserve profile-localallowed_channelsvalues without a process-global environment fallback.model_tools.pyandtools/registry.pyOutput and persistence safety
tools/tool_result_storage.pyandagent/tool_dispatch_helpers.pyTests, documentation, and attribution
tests/tools/test_slack_tool.pyand the changed gateway, session, multiplex, registry, cache, configuration, CLI, and persistence testswebsite/docs/reference/tools-reference.md,website/docs/reference/toolsets-reference.md, andwebsite/docs/user-guide/messaging/slack.mdscripts/release.pyHow to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs