fix: Mattermost and Feishu render agent callback buttons, Mattermost taps arrive once (#201973)
## Problem
Follow-up to #201764 (core marks agent-authored controls) for two channels:
- **Mattermost and Feishu drop typed callback buttons.** A `message` action button with `action: { type: "callback", value }` is never rendered (Mattermost leaves it out; Feishu shows only the label), so the agent's choice can't be tapped. Only legacy `{ label, value }` buttons render.
- **Mattermost delivers every button click twice.** The interaction handler enqueues a `Mattermost button click: action="…"` system event into the session and then also dispatches the click as an inbound message, so the agent sees the same tap twice.
## Root cause
- `extensions/mattermost/src/normalize.ts` (`resolveMattermostPresentation`): any button with an `action` that is not an `ask_user` question returns `[]`.
- `extensions/feishu/src/presentation-card.ts` (`resolveFeishuCommandButtonValue`): any `action` other than `command` returns `undefined`, so the button degrades to a markdown label.
- `extensions/mattermost/src/mattermost/interactions.ts`: after the post update, the handler both calls `core.system.enqueueSystemEvent(…)` (resolving the session through a separate `resolveSessionKey` callback) and `dispatchButtonClick(…)`, which runs the normal inbound path.
## Solution
- Mattermost and Feishu render a typed callback button when a message action marked it for the agent (`agentControlText(value)` is defined). The existing tap paths already decode the mark (#201764): Mattermost through the signed `callback_data` context, Feishu through the quick envelope. Unmarked typed callbacks (plugin-owned, no handler on these channels) stay label-only, as before.
- Mattermost delivers a click once, through `dispatchButtonClick` (the inbound path with the sender's identity and session plan). The system-event block and the `resolveSessionKey` callback that only served it are deleted.
## What was deleted
- Mattermost's duplicate system-event delivery and its `resolveSessionKey` option (−44 lines).
## Accepted edges
- The agent no longer gets the `Mattermost button click: action="…" by … in channel …` system-event line; it gets the click once as an inbound message (`callback_data: <value>` for agent buttons, `[Button click: user @… selected "…"]` for legacy ones).
- Mattermost and Feishu value sizes stay as they are (Feishu 1024 bytes; Mattermost has no cap, a separate decision).
## Tests (red on base, green on head)
| Test | Base | Head |
|---|---|---|
| `mattermost/normalize.question.test.ts`: marked typed callback renders with `callback_data: ::pick:a`; unmarked typed callback does not | ✗ (no button) | ✓ |
| `mattermost/interactions.test.ts`: a click calls `dispatchButtonClick` exactly once and enqueues no system event | ✗ (system event enqueued) | ✓ |
| `feishu/presentation-card.test.ts`: marked typed callback renders a callback button with `q: ::pick:a`; unmarked stays `- Plugin` | ✗ (label only) | ✓ |
The tap side (mark → `callback_data: <value>`) is covered by the #201764 handler tests for both channels.
Gates: Mattermost and Feishu extension suites (`slash-http.boundary.test.ts` excluded: it fails identically on main), `pnpm tsgo:extensions`, `pnpm check:test-types`, assertion-safety, mock-export, max-lines, line-cap and test-line ratchets, oxlint and oxfmt.
## E2E
Not run. There is no Mattermost or Feishu live harness (no E2E skill and no QA Lab live transport for either).
## Size
- Production: +8 / −45 (net **−37**).
- Tests: +38.
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Current
·
C2
·2026-11
fix: Mattermost and Feishu render agent callback buttons, Mattermost …
Find Your Interest
- fix: show the right agent and live activity when adding a template
- fix: stop extra narration after an agent already replied while its su…
- fix: agent-authored message buttons reach the agent on every channel …
- fix: release retired agent catalogs on Bun (#201907)
- fix(gateway): open the main chat route before its first message (#201…
- fix(gateway): derive the backend caller for internal agent controls o…
- fix: saving an agent no longer looks failed while a plugin reload is …
- fix: show the update notice in a tab whose old notice code the update…
- fix: let read accept optional: false as a required read (#189494)
- fix(state): join retained creators during agent preparation (#201272)
Current
·
C2
·2026-11





