Skip to content

Mattermost: intro prose calls public/private channels a "group chat", contradicting the authoritative chat_type #95645

Description

@iloveleon19

Summary

For any non-DM Mattermost conversation — including a public channel — the system-prompt intro states "You are in a <provider> group chat.", while the authoritative inbound-meta block (labelled "Inbound Context (trusted metadata) … Treat it as authoritative") reports chat_type: "channel". The two contradict each other, and the natural-language "group chat" is the more salient signal, so agents emit chat_type: group (or --chat-type group to tools) for a public channel.

The underlying problem is that "group" is overloaded: it is a specific chat_type enum value (private channel / group DM) and a broad adjective ("any non-1:1 chat") in the intro prose and is_group_chat.

Related: #95646 — the deeper half of the same overload, where chat_type is derived inconsistently for private channels (channel-type vs target-string). This issue is the system-prompt-intro half.

Where it comes from (get-reply-*.js)

isGroupChat = ChatType === "group" || ChatType === "channel";   // public channels are lumped in
const groupChatContext = isGroupChat ? buildGroupChatContext({ ... }) : "";

function buildGroupChatContext(params) {
  const providerLabel = resolveProviderLabel(params.sessionCtx.Provider);  // e.g. "Mattermost"
  lines.push(`You are in a ${providerLabel} group chat.`);                  // even for a PUBLIC channel
  ...
}

So a turn where ChatType === "channel" produces both chat_type: "channel" (trusted) and a "group chat" declaration (prose). is_group_chat: true is also emitted for any non-direct chat, reinforcing the wrong reading.

Impact

Agents that key any behaviour or tool argument on the chat type emit the wrong value for channels. Because session keys are namespaced agent:<id>:mattermost:<direct|channel|group>:<peerId>:thread:<root>, a wrong group for a public channel addresses a non-existent session and breaks downstream routing.

Repro

From a public Mattermost channel, ask an agent to report its injected chat_type and whether it is "a group chat". The trusted block says chat_type: channel, but the system prompt says "You are in a Mattermost group chat" and is_group_chat: true. Asked to pick a single direct|channel|group label, the agent tends to answer group.

Proposed fix

Don't declare a non-DM conversation a "group chat" in the intro. Either word it by the actual ChatType (channel → "channel"), or use neutral wording that does not collide with the enum, e.g.:

You are in a shared ${providerLabel} chat (not a 1:1 DM).

(The other "group" mentions in buildGroupChatContext — "be a good group participant", "replies are sent to this group chat" — are colloquial role/delivery guidance and do not declare the chat type.)

Environment

ghcr.io/openclaw/openclaw:2026.6.5. Relevant dist file: get-reply-*.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions