feat: Mattermost channel handler (DM mode)#1242
Open
msaidf wants to merge 2 commits into
Open
Conversation
release: promote dev to stable
Add native Mattermost channel support to GoClaw gateway. The handler polls for direct messages every 3 seconds and posts agent responses back to the DM channel via Mattermost REST API. - internal/channels/mattermost/channel.go: DM polling, inbound dispatch - internal/channels/mattermost/send.go: outbound message posting + file uploads - internal/channels/mattermost/factory.go: Factory + DB config loading - Register TypeMattermost in channel type constants - Add MattermostConfig struct to ChannelsConfig - Wire factory in gateway.go and config fallback in gateway_channels_setup.go
34aff22 to
7d5e484
Compare
mrgoonie
requested changes
Jun 20, 2026
mrgoonie
left a comment
Contributor
There was a problem hiding this comment.
Summary: This is a useful direction, but this PR should not merge as-is. It adds a second, partial Mattermost implementation while an older Mattermost PR already covers the same channel surface more broadly.
Risk level: Medium
Mandatory gates:
- Duplicate/prior implementation: overlap found with open PR #430 (
feat: add Mattermost channel support in web dashboard), which already addsinternal/channels/mattermost/*, config wiring, tests, and UI integration. - Project standards: issue found — this PR adds ~814 lines with no Mattermost tests and no UI/schema/i18n integration for DB-created channel instances.
- Strategic necessity: clear value, but the implementation should be consolidated with #430 or explicitly supersede it instead of creating competing Mattermost channel code.
- CI/checks: missing/no checks reported for this branch.
Findings:
- Important: Duplicate/overlap risk. #430 is still open and implements the same Mattermost channel type plus broader files (
internal/channels/mattermost/*, config, gateway registration, UI channel schema/i18n). Please either coordinate with #430 and make one successor PR, or explain why this narrower DM-only implementation supersedes #430 and close/retarget the duplicate path. - Important: No regression tests for the new channel. The PR introduces polling, API request helpers, chunking, upload, and DB credential parsing, but there are no tests for config normalization,
chunkText, send/create-post behavior, first-poll watermark behavior, or error handling. At minimum, add unit tests around the pure helpers and HTTP-client behavior using a test server. - Important: SSRF/internal egress policy needs an explicit decision.
server_urlis used directly for authenticated outbound HTTP calls. That may be acceptable for operator-configured channel instances, but recent provider/web-fetch work is tightening internal URL boundaries; this PR should document the trust boundary and add validation or an explicit “operator configured Mattermost base URL” policy so this does not become an unreviewed internal-network dialer.
Next step: consolidate with #430 or clearly mark this PR as the chosen successor, add the missing tests, and document/validate the Mattermost server_url trust boundary before re-review.
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.
Changes
Adds native Mattermost support to GoClaw, enabling DM-based agent interactions through Mattermost servers.
Files:
internal/channels/mattermost/channel.go— channel implementation with WebSocket connectioninternal/channels/mattermost/factory.go— channel factory and configinternal/channels/mattermost/send.go— message sending logicinternal/config/config_channels.go— Mattermost config schemaTesting
Verified on a live deployment with 9 Mattermost bot accounts — all agents respond correctly in DM mode.