Skip to content

fix(slack): stop injecting thread roots as reply context - #21

Merged
nikitaBarkov merged 1 commit into
mainfrom
nikita.barkov/remove_slack_reply
Aug 5, 2026
Merged

fix(slack): stop injecting thread roots as reply context#21
nikitaBarkov merged 1 commit into
mainfrom
nikita.barkov/remove_slack_reply

Conversation

@nikitaBarkov

Copy link
Copy Markdown
Collaborator

What does this PR do?

Stops Slack thread replies from repeatedly injecting the thread root as [Replying to: ...] on every turn.

Slack's thread_ts identifies the thread root, not an explicit reply target. The adapter already hydrates the root through channel_context when a thread session starts, and subsequent turns retain it in session history. Populating reply_to_text from thread_ts therefore duplicated up to 500 characters of the root in every user message and caused needless context growth.

The fix keeps Slack thread routing unchanged while leaving reply_to_text intact for platforms with true explicit replies.

Related Issue

No exact issue found. The behavior originated from the Slack thread-parent context work in NousResearch#16200 combined with unconditional reply-pointer injection from NousResearch#13676.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • plugins/platforms/slack/adapter.py: stop resolving the thread root into reply_to_text; continue hydrating it through channel_context and retaining cached root text for mention wake checks.
  • tests/gateway/test_slack.py: verify cold-start root hydration and ensure active thread turns neither refetch nor inject the root as reply context.

How to Test

  1. Start a Slack thread by mentioning the bot in a root message.
  2. Send follow-up messages in the thread without repeating the mention.
  3. Confirm the root appears in initial thread context but no follow-up reaches the model with [Replying to: ...].
  4. Run scripts/run_tests.sh tests/gateway/test_slack.py tests/gateway/test_reply_to_injection.py -q175 passed.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run all affected tests and they pass
  • I've added tests for the bug fix
  • I've tested on macOS and verified the behavior in a live Slack thread

Documentation & Housekeeping

  • Relevant inline documentation was updated
  • cli-config.yaml.example — N/A, no config changes
  • CONTRIBUTING.md / AGENTS.md — N/A, no workflow changes
  • Cross-platform impact considered — pure Python platform-adapter behavior
  • Tool descriptions/schemas — N/A, no tool changes

…on hydration

- Simplify `reply_to_text` injections by relying on session history and context hydration instead of explicit parent text refetching.
- Refactor `_fetch_thread_parent_text` to focus on availability checks, removing redundant uses.
- Update tests to ensure thread contexts are reused without repeated root-injection logic.
@nikitaBarkov

Copy link
Copy Markdown
Collaborator Author

Hermes PR: NousResearch#79462

@nikitaBarkov
nikitaBarkov merged commit 1417ea1 into main Aug 5, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant