Skip to content

fix(channels): word group-chat intro by authoritative ChatType (#95645) - #95668

Closed
hansraj316 wants to merge 1 commit into
openclaw:mainfrom
hansraj316:fix/mattermost-channel-intro-prose-95645
Closed

hansraj316 wants to merge 1 commit into
openclaw:mainfrom
hansraj316:fix/mattermost-channel-intro-prose-95645

Conversation

@hansraj316

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #95645. For any non-DM Mattermost conversation — including a public channel — the system-prompt intro declared "You are in a <provider> group chat.", while the trusted inbound-meta block reported chat_type: "channel". The two contradicted each other, and the salient "group chat" prose nudged agents to emit chat_type: group (or --chat-type group) for channels. Because session keys are namespaced by chat type, a wrong group addresses a non-existent session and breaks downstream routing.

Why This Change Was Made

"group" is overloaded: it is both a specific chat_type enum value and a loose adjective in the prose. The declarative intro line is the one place that should match the authoritative ChatType, so it now words the venue by ChatType (channel → "channel"; group stays "group chat"). The remaining colloquial "group" delivery mentions are left as-is — they describe role/delivery, not the chat type.

User Impact

Agents in Mattermost public/private channels no longer receive a system-prompt line that contradicts the trusted chat_type, so they stop mislabeling channels as group and mis-addressing sessions. No config or API change.

Evidence

  • src/auto-reply/reply/groups.ts: intro line now derived from ChatType.
  • New test in src/auto-reply/reply/groups.test.ts asserts a channel ChatType yields "You are in a Mattermost channel." and a group ChatType still yields "group chat".
  • pnpm test src/auto-reply/reply/groups.test.ts ✅ (7 passed); src/agents/prompt-composition.test.ts ✅ (Slack group wording unchanged).

…law#95645)

A 'channel' ChatType was declared a 'group chat' in the system-prompt
intro, contradicting the trusted chat_type:channel meta and nudging
agents to emit 'group' for public/private channels. Declare the venue
by the actual ChatType instead.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c50f02467c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +248 to +249
const venueNoun = chatType === "channel" ? "channel" : "group chat";
lines.push(`You are in a ${providerLabel} ${venueNoun}.`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply channel wording to the full prompt

When ChatType is channel, get-reply-run.ts routes the turn through buildGroupChatContext, so this hunk only changes the first sentence while the same generated prompt still immediately says replies are sent to “this group chat” and “this same group” on lines 257/261. For Mattermost public/private channels, that leaves model-facing guidance that still conflicts with the authoritative chat_type: channel metadata and can continue nudging agents to address the non-existent group session this fix is meant to prevent.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Close: current main already implements this PR's central Mattermost channel prompt fix through the merged canonical PR, with source and tests showing ChatType: "channel" now renders channel-specific opener and delivery wording. The fix is current-main-only; the latest v2026.6.10 release still has the old wording.

Root-cause cluster
Relationship: superseded
Canonical: #96244
Summary: This PR is superseded by the merged current-main implementation in #96244; broader residual wording work remains separate from this branch.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the merged current-main implementation from #96244 as the canonical fix; handle broader residual channel-wording choices in the separate open follow-up PRs if maintainers want them.

Do we have a high-confidence way to reproduce the issue?

No, current main no longer reproduces the central issue: source inspection shows ChatType: "channel" now renders channel opener and delivery wording. The latest release tag still reproduces the old hard-coded group-chat wording, so this is current-main-only.

Is this the best way to solve the issue?

Yes, closing this PR is the best cleanup path because the merged current-main implementation is same-or-better and this branch is now conflicting and obsolete. Broader full-prompt wording choices are separate maintainer decisions in other open PRs.

Security review:

Security review cleared: The reviewed branch only changes prompt text and tests, and the cleanup decision does not add any dependency, workflow, secret, package, or code-execution surface.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • arkyu2077: Authored the merged PR and squash commit that put the ChatType-aware channel wording on current main. (role: canonical merged fix author; confidence: high; commits: 9e3a917d9ee0; files: src/auto-reply/reply/groups.ts, src/auto-reply/reply/groups.test.ts, src/auto-reply/reply.triggers.group-intro-prompts.cases.ts)
  • vincentkoc: Co-authored commits in the merged fix branch and posted the squash-merge provenance comment for the canonical implementation. (role: recent area contributor; confidence: high; commits: 89187a57872d, 9eb1073364b8, 44c003f73ffb; files: src/auto-reply/reply/groups.ts, src/auto-reply/reply.triggers.group-intro-prompts.cases.ts, test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/discord-group-codex-message-tool.md)
  • tyler6204: History for the shared group prompt context traces the persistent group-chat prompt wiring to the nested-subagent work that added this prompt path. (role: introduced prompt behavior; confidence: medium; commits: b8f66c260db8; files: src/auto-reply/reply/groups.ts, src/auto-reply/reply/get-reply-run.ts)

Codex review notes: model internal, reasoning high; reviewed against 68ddb9744f78; fix evidence: commit 9e3a917d9ee0, main fix timestamp 2026-06-24T12:27:04+08:00.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 22, 2026
@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant