Skip to content

fix(mattermost): preserve thread-local delivery hygiene - #46885

Merged
teknium1 merged 1 commit into
mainfrom
salvage/mattermost-thread-routing
Jun 15, 2026
Merged

fix(mattermost): preserve thread-local delivery hygiene#46885
teknium1 merged 1 commit into
mainfrom
salvage/mattermost-thread-routing

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Mattermost progress, tool, media, and final-answer deliveries now preserve thread locality without leaking progress noise into flat channels.

Changes

  • Mattermost text sends honor metadata.thread_id in addition to reply_to.
  • Mattermost media/file sends preserve thread metadata through upload/post helpers.
  • Gateway progress routing treats Mattermost top-level posts as valid thread roots, matching the platform’s thread model.
  • Mattermost inbound top-level channel posts seed source.thread_id in thread mode; DMs do not.
  • Final notify-worthy replies may flat-fallback with a warning only when Mattermost clearly rejects a broken/missing thread root.
  • Tool/progress/status sends remain thread-strict and do not fall back into the channel.

Validation

Check Result
python3 -m py_compile plugins/platforms/mattermost/adapter.py gateway/run.py tests/gateway/test_mattermost.py pass
uv run --with pytest --with pytest-asyncio --with aiohttp python -m pytest tests/gateway/test_mattermost.py -q -o addopts= 52 passed

Contributor credit

Salvages the valid thread-routing and delivery-hygiene pieces from #41640 by @WolframRavenwolf while omitting the unrelated stream-consumer fallback deletion and Mattermost display-policy change.

Infographic

Mattermost Thread Hygiene

Salvage the valid thread-routing pieces from #41640:
- route Mattermost progress/status sends through metadata thread IDs
- treat top-level Mattermost channel posts as thread roots for progress
- preserve thread metadata through media/file sends
- allow flat fallback only for final notify-worthy replies on confirmed broken roots

Co-authored-by: Wolfram Ravenwolf <github.com@wolfram.ravenwolf.de>
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/mattermost-thread-routing vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10959 on HEAD, 10959 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5771 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Jun 15, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related: #41640 (the WolframRavenwolf PR this salvages thread-routing/delivery-hygiene pieces from), #12063 (the underlying issue: Mattermost adapter ignores metadata.thread_id). Competing/adjacent thread-routing work also in flight: #45654, #45861, #33470. As the salvage that omits the unrelated stream-consumer fallback deletion and display-policy change, this is the focused/authoritative version reviewers can land.

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 P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants