hermes - ✅(Solved) Fix [Bug]: Mattermost gateway threading doesn't work after first reply. [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#25181Fetched 2026-05-14 03:48:13
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×1cross-referenced ×1

Error Message

ERROR gateway.platforms.mattermost: MM API POST posts → 400: {"id":"api.post.create_post.root_id.app_error","message":"Invalid RootId parameter.","detailed_error":"","request_id":"chy3abtqzpykiyu4syxaogdfzc","status_code":400} ERROR gateway.platforms.mattermost: MM API POST posts → 400: {"id":"api.post.create_post.root_id.app_error","message":"Invalid RootId parameter.","detailed_error":"","request_id":"1d1p7r4bt3g5bdm4ztunxacc7e","status_code":400} ERROR gateway.platforms.base: [Mattermost] Fallback send also failed: Failed to create post

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #25187: fix(gateway): Mattermost Thread and Command Handling Fixes

Description (problem / solution / changelog)

What does this PR do?

This PR changes the mattermost thread handling to properly choose the thread's root id. It also changes the mattermost command handling code to accept commands preceded by a single space character.

Related Issue

Fixes https://github.com/NousResearch/hermes-agent/issues/25181 Fixes https://github.com/NousResearch/hermes-agent/issues/25184

Type of Change

<!-- Check the one that applies. -->
  • 🐛 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

<!-- List the specific changes. Include file paths for code changes. -->
  • gateway/platforms/base.py - uses thread_id if available.
  • gateway/platforms/mattermost.py - Allows prefixed ' ' character in commands for mattermost.
  • tests/gateway/test_mattermost.py - Tests for changed behaviour.

How to Test

  1. Run hermes gateway with mattermost configured and threading enabled.
  2. Post /help to a channel
  3. You should see the proper help command output.
  4. Post /help as a reply to the bot reply.
  5. You should get the same output again.

Checklist

<!-- Complete these before requesting review. -->

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: <!-- e.g. Ubuntu 24.04, macOS 15.2, Windows 11 -->

Changed files

  • gateway/platforms/base.py (modified, +7/-0)
  • gateway/platforms/mattermost.py (modified, +10/-1)
  • tests/gateway/test_mattermost.py (modified, +202/-0)

Code Example

ERROR gateway.platforms.mattermost: MM API POST posts → 400: {"id":"api.post.create_post.root_id.app_error","message":"Invalid RootId parameter.","detailed_error":"","request_id":"chy3abtqzpykiyu4syxaogdfzc","status_code":400}
WARNING gateway.platforms.base: [Mattermost] Send failed: Failed to create post — trying plain-text fallback
 ERROR gateway.platforms.mattermost: MM API POST posts → 400: {"id":"api.post.create_post.root_id.app_error","message":"Invalid RootId parameter.","detailed_error":"","request_id":"1d1p7r4bt3g5bdm4ztunxacc7e","status_code":400}
ERROR gateway.platforms.base: [Mattermost] Fallback send also failed: Failed to create post

---

I'm not doing that. I know what the issue is and will make a PR.

---
RAW_BUFFERClick to expand / collapse

Bug Description

The gateway fails to reply to threads after the first message. Relevant logs:

ERROR gateway.platforms.mattermost: MM API POST posts → 400: {"id":"api.post.create_post.root_id.app_error","message":"Invalid RootId parameter.","detailed_error":"","request_id":"chy3abtqzpykiyu4syxaogdfzc","status_code":400}
WARNING gateway.platforms.base: [Mattermost] Send failed: Failed to create post — trying plain-text fallback
 ERROR gateway.platforms.mattermost: MM API POST posts → 400: {"id":"api.post.create_post.root_id.app_error","message":"Invalid RootId parameter.","detailed_error":"","request_id":"1d1p7r4bt3g5bdm4ztunxacc7e","status_code":400}
ERROR gateway.platforms.base: [Mattermost] Fallback send also failed: Failed to create post

Steps to Reproduce

  1. Run hermes gateway with mattermost configured and thread mode on.
  2. Type /help or trigger the agent.
  3. Reply to it's response.

Expected Behavior

It shouldn't fail to post a message and you should see it as a reply in the thread.

Actual Behavior

Nothing happens in mattermost and you get those log messages.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

I'm not doing that. I know what the issue is and will make a PR.

Operating System

Arch

Python Version

3.11.15

Hermes Version

v0.13.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

Mattermost rejects POST /posts with 400 api.post.create_post.root_id.app_error when root_id points at a non-root post. The gateway was computing reply_to as the triggering post's own id, which is correct for the first message in a channel but wrong for any follow-up inside a thread — the child post id is not a valid root_id.

Proposed Fix (optional)

Changing the behaviour to select the root post instead of the most recent reply will fix this problem. I will make a PR.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING