feat(mattermost): auto-title conversation threads from the /new banner - #79276
Open
chesterXalan wants to merge 1 commit into
Open
feat(mattermost): auto-title conversation threads from the /new banner#79276chesterXalan wants to merge 1 commit into
chesterXalan wants to merge 1 commit into
Conversation
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)
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.
What does this PR do?
Mattermost threads have no title field — the Threads list previews the root post's text. Every
/newbanner 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:/newin a DM (outside a thread) posts the reset banner as a flat bot-owned post via the new adapter methodsend_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/newmessage, whose root post the bot can never rewrite.rename_thread()rewrites the banner text to💬 {generated title}after the first exchange, so the Threads list shows real conversation titles. Abase_messageprop keeps rewrites idempotent.hermes_session_bannerprop are ever rewritten — user thread roots and ordinary bot replies no-op./new <title>pins the manual title (auto_title=falsein the banner props), which generated titles never overwrite.MATTERMOST_AUTO_TITLE=falsedisables the whole flow.i18n: adds two hint keys to
locales/en.yamlonly; 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
Changes Made
plugins/platforms/mattermost/adapter.py:send_session_banner(),rename_thread(),hermes_session_bannerpost props,MATTERMOST_AUTO_TITLEgate.gateway/run.py: route the auto-title callback to Mattermost banner-thread sessions.gateway/slash_commands.py:/newin a Mattermost DM emits the banner via the adapter path;/new <title>pins a manual title.plugins/platforms/mattermost/plugin.yaml: documentMATTERMOST_AUTO_TITLEinoptional_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 passedpython -m pytest tests/gateway -k "slash_command or thread_title" -q— 61 passed, 2 skippedpython -m py_compileon all touched Python files