fix(gateway): derive the Slack capability note from the live tool surface - #70194
Merged
Conversation
…ols present Ports #63234 forward onto current main per teknium1's review. gateway/session.py hard-coded the stale-API disclaimer for every Slack session regardless of whether Slack tools were actually loaded. This contradicted the system prompt when MCP or native slack tools were present, causing the agent to refuse Slack API actions it could actually perform (issue #6536). Per review, the original predicate only checked the native 'slack' toolset, missing Slack MCP servers (registered under mcp-<server> in tools/mcp_tool.py) entirely. _slack_tools_loaded() now checks two independent paths: 1. Native 'slack' toolset + SLACK_BOT_TOKEN (as before, but now calls _get_platform_tools() with include_default_mcp_servers=True instead of False, so a default-enabled MCP server also counts). 2. A connected MCP server that has ACTUALLY registered tools into the live registry (new tools.mcp_tool.get_registered_mcp_server_names()), whose name suggests Slack. This is session-scoped in the sense that matters here: MCP servers connect once per gateway process (not per-session), so checking the live per-server tool-registration map is the correct availability-filtered signal -- unlike the earlier get_all_tool_names() approach this replaces, which conflated ALL built-in tool names process-wide, this only inspects the small, purpose-built MCP server-name map. Added a real regression test that registers a tool via the actual tools.mcp_tool._track_mcp_tool_server() tracking function (not a mock of the capability check) to verify a genuine Slack MCP server is detected, plus a negative case for an unrelated MCP server. 5/5 Slack-specific tests pass; 126/126 in the full tests/gateway/test_session.py file.
…sitive note to tool schemas Follow-up to the #68627 cherry-pick (cluster C15 — Slack platform capability-note accuracy; earliest report/fix: #6545 by @daikeren): 1. Session/prompt stability: the pinned session-context render (_pinned_session_context_prompt) is keyed by _ephemeral_change_key, whose contract requires every rendered input to appear in the key. The new _slack_tools_loaded() gate reads config + the live MCP registration map, so its state is now hashed into the key exactly like the existing Discord gate — a gate flip re-renders ONCE (a legitimate bust); within a session the note stays byte-stable for the life of the conversation (A/B: the new parity test fails with this key change reverted, passes with it). 2. Derived, non-overpromising positive note: rather than hardcoding a capability list that can drift stale again (the original bug class), the tools-present note tells the agent to consult the actual loaded Slack tool schemas for supported operations — the schemas ARE the source of truth, so the note cannot overclaim ops a given Slack toolset/MCP server doesn't expose (e.g. a read-only history server). 3. Tests: parity test proving a gate flip changes both render and key; byte-stability test proving three consecutive turns in one Slack session return the identical pinned object (sha256-equal); autouse fixture pins the new gate so key<->render parity is env-independent.
Contributor
૮ >ﻌ< ა ci reviewran on 55d31c9 ℹ️ InfoDesktop E2E visual evidence · View test artifacts · View job1 visual diff. inline evidence upload failed. Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso) |
This was referenced Jul 23, 2026
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Slack platform note no longer lies to the agent: instead of unconditionally claiming "you do NOT have access to Slack-specific APIs", the note is derived from the live tool surface (MCP servers + native toolsets), mirroring the merged Discord pattern — so the agent stops refusing valid requests when Slack tools are present.
Fixes #6536.
Changes
tools/mcp_tool.get_registered_mcp_server_names()— post-connection, availability-filtered MCP registration map; capability gate inbuild_session_context_promptderives from it + native slack toolset/config.Credits
Base: #68627 (@ygd58) — the only one of five overlapping PRs deriving the gate from the live tool surface, cherry-picked with authorship.
Supersedes #6545 (@mecampbellsoup — EARLIEST diagnosis, credited as originator), #62135, #36676, #69094.
Validation
tests/gateway/ -q -k slackInfographic