#21694: fix(mattermost): stream tool status + preserve channel/thread history
channel: mattermost
size: M
Cluster:
Mattermost Threading Enhancements
## Example: Before vs Now
### Before
- Thread context had no explicit channel-vs-thread label.
- Tool/reasoning progress was not visible in-channel during generation.
- With `historyLimit > 0`, internal context flags in affected Mattermost channel/thread turns still showed `history_count: 0`.
### Now
- Thread runs include a dedicated `ThreadLabel` (`Mattermost thread <room>`) in context.
- Streaming preview/status updates are visible in-channel during generation.
- History is preserved by recording the current inbound entry after dispatch, so subsequent turns can include prior context up to the configured limit.
## Streaming Finalization Rules
| Case | Behavior |
| --- | --- |
| Text-only final reply (<= preview cap) | Edit the preview/status post into final answer |
| Media reply or oversized final text | Keep status update and send final answer as normal post |
| Preview post update failure | Disable preview updates and fall back to normal delivery |
## What Changed
- add Mattermost post patch support (`PUT /posts/{id}/patch`) with unit coverage
- add streamed status preview queue/throttle for partial/reasoning/tool-start events
- preserve history by recording the current inbound entry after dispatch completion
- include `ThreadLabel` in context payload for thread/channel distinction
## Testing
- `pnpm -s vitest extensions/mattermost/src/mattermost/client.test.ts`
- `pnpm check`
Most Similar PRs
#19274: feat(mattermost): enable threaded replies in channels
by rockinyp · 2026-02-17
67.8%
#14995: fix(mattermost): honor chatmode mention fallback in group mention g...
by ninjaa · 2026-02-12
64.6%
#20928: mattermost: add readMessages action for channel history
by hubertusgbecker · 2026-02-19
62.4%
#16622: fix(mattermost): record pending history for messages dropped by gro...
by oskarmodig · 2026-02-14
61.8%
#16570: feat(mattermost): add replyToMode threading support
by FBartos · 2026-02-14
61.4%
#18764: fix(telegram): preserve streamed draft when tool error occurs
by stakeswky · 2026-02-17
60.8%
#15937: fix(slack): let users control threading instead of system prompt fo...
by taw0002 · 2026-02-14
60.3%
#8353: fix(ui): display tool calls during webchat streaming
by MarvinDontPanic · 2026-02-03
60.1%
#19957: feat(mattermost): add interactive buttons support
by tonydehnke · 2026-02-18
60.0%
#18718: matrix: add pending group history context for room messages
by pharasyte · 2026-02-17
59.5%