Repository navigation
fix: Mattermost and Feishu render agent callback buttons, Mattermost taps arrive once - #201973
Conversation
…taps arrive once
Mattermost and Feishu dropped typed callback buttons, so a `message` action's
`action: { type: "callback" }` button never appeared. Both now render the ones a
message action marked for the agent (unmarked typed callbacks still stay
label-only). Mattermost also delivered every click twice, once as a system event
and once as the inbound message; the system-event path is removed.
Co-authored-by: obviyus <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR renders agent-owned callback buttons on Mattermost and Feishu and removes Mattermost’s duplicate system-event delivery. Example: An agent sends an Alpha button with callback value pick:a.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs callback rendering and duplicate Mattermost delivery still present on main; no blocking code defect was found. Priority: P2 Before mergeNone. Findings
Tests
Agent review detailsHow this fits togetherCore marks agent-authored callback values; channel renderers encode them into native buttons, and existing interaction handlers authorize taps and route their decoded values into the conversation. flowchart LR
A[Agent message action] --> B[Core callback marker]
B --> C[Channel presentation renderer]
C --> D[Native button]
D --> E[Authorized tap handler]
E --> F[Conversation inbound dispatch]
F --> G[Agent reply]
Technical reviewBest possible solution: Keep the shared callback marker, encode supported buttons through the existing channel envelopes, and retain only Mattermost’s inbound click dispatch. Do we have a high-confidence way to reproduce the issue? Current-main source directly establishes both rendering rejections and Mattermost’s two delivery calls; the PR reports red-on-base regressions, but this review executed no target code. Is this the best way to solve the issue? The runtime change is the smallest complete repair using existing owners: two renderer conditions admit supported marked callbacks, and deleting the second delivery path removes duplication without adding state or APIs. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b8cd64b14968. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -37, Tests +38. Total +1 across 7 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 19, 2026, 1:19 PM ET / 18:19 UTC. |
|
Landed as 66fc4d8. Mattermost and Feishu now show the callback buttons the agent sends, and a tap reaches the agent as |
…taps arrive once (openclaw#201973) ## Problem Follow-up to openclaw#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 (openclaw#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 openclaw#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 <[email protected]>
…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 <[email protected]> (cherry picked from commit 66fc4d8) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 580696656a79f3b8ec9e7831e6e50726f0ca29cf) (cherry picked from commit 2478713e7e82e228f4ea292448fd17799faa0654)
Adapt only the duplicate-delivery repair from 66fc4d8 (openclaw#201973). Remove the parallel system-event path and its unused session resolver; preserve normal authenticated inbound dispatch and question/model-picker controls. Exclude typed callback rendering and its missing prerequisite. Proof: original production 1 failed/20 passed; repaired owner, question and model-picker suites 36/36 passed. Format, staged diff, test-line and mock-export ratchets pass. Scoped typed lint remains blocked by physically external declaration inputs; no dependency reconciliation or guard bypass. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e962cfdd8e3bac91c5237bbcac41f56164590761) (cherry picked from commit 00cf098df2a917fa5187acb5bb6ded75476d04d6)
Problem
Follow-up to #201764 (core marks agent-authored controls) for two channels:
messageaction button withaction: { 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 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 anactionthat is not anask_userquestion returns[].extensions/feishu/src/presentation-card.ts(resolveFeishuCommandButtonValue): anyactionother thancommandreturnsundefined, so the button degrades to a markdown label.extensions/mattermost/src/mattermost/interactions.ts: after the post update, the handler both callscore.system.enqueueSystemEvent(…)(resolving the session through a separateresolveSessionKeycallback) anddispatchButtonClick(…), which runs the normal inbound path.Solution
agentControlText(value)is defined). The existing tap paths already decode the mark (fix: agent-authored message buttons reach the agent on every channel #201764): Mattermost through the signedcallback_datacontext, Feishu through the quick envelope. Unmarked typed callbacks (plugin-owned, no handler on these channels) stay label-only, as before.dispatchButtonClick(the inbound path with the sender's identity and session plan). The system-event block and theresolveSessionKeycallback that only served it are deleted.What was deleted
resolveSessionKeyoption (−44 lines).Accepted edges
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).Tests (red on base, green on head)
mattermost/normalize.question.test.ts: marked typed callback renders withcallback_data: ::pick:a; unmarked typed callback does notmattermost/interactions.test.ts: a click callsdispatchButtonClickexactly once and enqueues no system eventfeishu/presentation-card.test.ts: marked typed callback renders a callback button withq: ::pick:a; unmarked stays- PluginThe 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.tsexcluded: 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