Skip to content

feat(mattermost): auto-title conversation threads from the /new banner - #79276

Open
chesterXalan wants to merge 1 commit into
NousResearch:mainfrom
chesterXalan:mattermost-thread-auto-title
Open

feat(mattermost): auto-title conversation threads from the /new banner#79276
chesterXalan wants to merge 1 commit into
NousResearch:mainfrom
chesterXalan:mattermost-thread-auto-title

Conversation

@chesterXalan

Copy link
Copy Markdown
Contributor

What does this PR do?

Mattermost threads have no title field — the Threads list previews the root post's text. Every /new banner reads the same, so once a user has a few conversations going they are indistinguishable. This ports the Discord auto-thread / Telegram topic auto-title flow to Mattermost:

  • /new in a DM (outside a thread) posts the reset banner as a flat bot-owned post via the new adapter method send_session_banner(), making it the root of the next conversation thread. This deliberately bypasses the shared reply chain: the normal reply path would anchor the banner under the user's own /new message, whose root post the bot can never rewrite.
  • The existing auto-title callback now covers Mattermost thread sessions: rename_thread() rewrites the banner text to 💬 {generated title} after the first exchange, so the Threads list shows real conversation titles. A base_message prop keeps rewrites idempotent.
  • Safety rails: only bot-owned posts stamped with the hermes_session_banner prop are ever rewritten — user thread roots and ordinary bot replies no-op. /new <title> pins the manual title (auto_title=false in the banner props), which generated titles never overwrite.
  • MATTERMOST_AUTO_TITLE=false disables the whole flow.

i18n: adds two hint keys to locales/en.yaml only; other locales fall back to English. Happy to add translations if you'd like them bundled.

Related Issue

No existing Mattermost issue found (searched open and closed issues/PRs). Same feature family as the Discord/Telegram/Slack thread-title work (#33862, #64021, #74385). Related: #36498 (Mattermost adapter test coverage).

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

  • plugins/platforms/mattermost/adapter.py: send_session_banner(), rename_thread(), hermes_session_banner post props, MATTERMOST_AUTO_TITLE gate.
  • gateway/run.py: route the auto-title callback to Mattermost banner-thread sessions.
  • gateway/slash_commands.py: /new in a Mattermost DM emits the banner via the adapter path; /new <title> pins a manual title.
  • plugins/platforms/mattermost/plugin.yaml: document MATTERMOST_AUTO_TITLE in optional_env.
  • locales/en.yaml: two hint keys.
  • tests/gateway/test_mattermost_thread_title.py (new, 29 tests): banner send path, rename gating (props/ownership/manual-pin), idempotent rewrites, disable flag, callback routing.

Test plan

  • python -m pytest tests/gateway/test_mattermost*.py -q — 53 passed
  • python -m pytest tests/gateway -k "slash_command or thread_title" -q — 61 passed, 2 skipped
  • python -m py_compile on all touched Python files
  • Running in production on our self-hosted Mattermost workspace since 2026-07-17 (v0.18.2 through v0.20.0).

Mattermost threads have no title field — the Threads list shows the root
post's text.  /new banners all read "Session reset!", so multiple
conversations are indistinguishable.  Port the Discord auto-thread /
Telegram topic auto-title flow:

- /new in a DM (outside a thread) posts the reset banner as a flat
  bot-owned post via the new adapter send_session_banner(), making it the
  root of the next conversation thread.  The normal reply path would
  anchor the banner under the user's own /new message, whose root the
  bot can never rewrite.
- The auto-title callback now covers Mattermost thread sessions:
  rename_thread() rewrites the banner text with the generated title,
  keeping the original banner below it (base_message prop keeps rewrites
  idempotent).
- Only bot-owned posts stamped with the hermes_session_banner prop are
  ever rewritten; user thread roots and ordinary bot replies no-op.
  /new <title> pins the manual title (auto_title=false).
- MATTERMOST_AUTO_TITLE=false disables the whole flow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit b42e254)
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants