Skip to content

fix(feishu): preserve card actions through mention gating - #116105

Merged
Patrick-Erichsen merged 2 commits into
openclaw:mainfrom
metaforismo:codex/fix-feishu-card-action-mention
Jul 30, 2026
Merged

Patrick-Erichsen merged 2 commits into
openclaw:mainfrom
metaforismo:codex/fix-feishu-card-action-mention

Conversation

@metaforismo

@metaforismo metaforismo commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Feishu and Lark group users can click an authenticated structured-card button and have the callback silently dropped when the group uses requireMention: true. The callback enters the normal group admission path without bot-mention metadata, so the agent never receives the action. Fixes #85450.

Why This Change Was Made

The card-action handler now adds the already-resolved bot open_id as Feishu mention metadata only when it builds a synthetic group callback. This makes the callback satisfy the existing mention contract instead of adding a broad bypass based on a synthetic message-ID prefix. Direct-message callbacks remain unchanged, and a missing bot identity does not fabricate a mention.

Thanks to @googlerest in #85481 and @zhouhe-xydt in #85609 for the earlier investigations. Both proposals were closed unmerged; this replacement validates the current monitor lifecycle and preserves the current admission policy.

User Impact

Card buttons such as approval confirmations and quick actions work in groups that require bot mentions. Ordinary unmentioned group messages are still rejected, and direct-message card callbacks do not gain synthetic mention metadata.

Evidence

Base cff7cbfdcb8089e5005e3549153e131347aeb198; head 403df4cd76f82a6b5f4f636b47e6e19ead8c380f.

Before the production change, the new current-main lifecycle regression failed with zero agent dispatches for an authenticated group callback under requireMention: true.

After the change, 152 focused Feishu tests passed across the card-action handler, real monitor lifecycle, bot admission, and policy suites. The lifecycle regression proves the callback reaches the agent; the adjacent policy tests prove ordinary mention gating remains intact.

The first hosted precise OpenGrep run found two legacy raw-command fixtures in the now-touched lifecycle test. Head 403df4cd76f82a6b5f4f636b47e6e19ead8c380f converts them to the structured interaction envelope while preserving their no-outer-context and no-reply-target cases. The same 152 focused tests pass after that repair, and both the fresh precise OpenGrep scan and Opengrep OSS check pass.

The Feishu extension TypeScript check passed after refreshing the repository's generated Plugin SDK declarations.

Oxfmt, type-aware oxlint, max-lines ratchet, conflict-marker scan, and diff checks passed for the three-file change.

A live Feishu tenant was not available locally, so maintainer provider validation remains authoritative.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Jul 29, 2026
@metaforismo
metaforismo marked this pull request as ready for review July 29, 2026 22:25
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jul 29, 2026
@clawsweeper

clawsweeper Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 29, 2026, 6:43 PM ET / 22:43 UTC.

ClawSweeper review

What this changes

This PR adds synthetic bot-mention metadata to authenticated Feishu group card-action callbacks so they pass existing requireMention admission while direct-message callbacks remain unchanged.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 3 items remain

Keep this PR open. The narrow approach—representing an authenticated synthetic group callback as mentioning the resolved Feishu bot—preserves the established admission contract better than bypassing requireMention, and the supplied lifecycle coverage targets the reported silent drop. However, the PR still has only test/CI claims rather than inspectable after-fix provider-runtime proof, so it is not ready to merge under the real-behavior-proof gate.

Priority: P1
Reviewed head: 403df4cd76f82a6b5f4f636b47e6e19ead8c380f

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and covered by targeted regressions, but real behavior proof remains a merge gate for this user-visible channel delivery change.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR reports focused lifecycle and policy tests, but no inspectable after-fix live Feishu, provider-runtime, terminal, or redacted log artifact demonstrates a real callback dispatch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR reports focused lifecycle and policy tests, but no inspectable after-fix live Feishu, provider-runtime, terminal, or redacted log artifact demonstrates a real callback dispatch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Narrow admission-preserving change: The reviewed PR diff adds a mention only for synthetic group callbacks when a resolved bot open ID is available; p2p callbacks and missing identities remain unchanged. That directly targets the normal mention gate rather than introducing a message-ID-based bypass.
Regression coverage: The branch adds a lifecycle case for an authenticated group callback in a group configured with requireMention: true, asserting that it reaches the configured reply dispatcher, plus unit assertions for group mention metadata and p2p omission.
Prior alternatives: The supplied context identifies two closed, unmerged prior proposals: #85481 used the same mention-metadata direction, while #85609 proposed a broader admission bypass. This PR follows the narrower contract-preserving direction.
Findings None None.
Security None None.

How this fits together

Feishu structured-card actions arrive as authenticated callbacks and are converted into synthetic inbound messages before entering the normal Feishu message-admission flow. The group mention policy then determines whether the callback reaches the agent and reply dispatcher.

flowchart LR
  A[Feishu card button] --> B[Authenticated card callback]
  B --> C[Synthetic inbound message]
  C --> D[Group mention admission]
  D --> E[Agent dispatch]
  E --> F[Reply dispatcher]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR reports focused lifecycle and policy tests, but no inspectable after-fix live Feishu, provider-runtime, terminal, or redacted log artifact demonstrates a real callback dispatch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Merging without real Feishu/provider-runtime evidence leaves the changed callback-to-dispatch path unproven outside mocks; an integration mismatch could still keep user actions silent or alter mention-gated delivery.
  • Complete next step (P2) - The remaining blocker is contributor-supplied real behavior proof from a Feishu/provider runtime, which an automated repair worker cannot credibly generate from this checkout.
Agent review details

Security

None.

PR surface

Source +55, Tests +29. Total +84 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 62 7 +55
Tests 1 31 2 +29
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 93 9 +84

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #85450
Summary: This PR is a candidate fix for the open Feishu structured-card callback admission failure tracked by the canonical issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Add provider-runtime proof before merge (recommended)
    Provide a redacted live Feishu or provider-runtime transcript/log showing an authenticated group card callback reaches dispatch with requireMention enabled and ordinary unmentioned group messages still do not dispatch.
  2. Accept an explicitly documented test-only exception
    A maintainer may accept the remaining integration risk if live Feishu validation cannot be obtained, but should record why the lifecycle regression is sufficient for this channel path.

Technical review

Best possible solution:

Obtain redacted after-fix evidence from a real Feishu/provider-runtime callback showing that a button click in a requireMention group reaches the agent, alongside evidence that an ordinary unmentioned group message remains rejected.

Do we have a high-confidence way to reproduce the issue?

Yes, from source-level evidence: an authenticated group card callback is synthesized and then subjected to the normal mention gate, while the added lifecycle scenario demonstrates the intended failing boundary. This review does not have independent live Feishu reproduction evidence.

Is this the best way to solve the issue?

Yes, conditionally: adding valid mention metadata to the synthetic group message is narrower and more maintainable than bypassing requireMention based on an internal callback identifier. It still needs real provider-runtime proof that the metadata matches Feishu delivery behavior.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 5141a3593c4c.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P1: The PR addresses a silent loss of authenticated Feishu group card actions on an established channel workflow.
  • merge-risk: 🚨 message-delivery: The patch changes synthetic group message metadata consumed by the admission path that decides whether callbacks reach the agent.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports focused lifecycle and policy tests, but no inspectable after-fix live Feishu, provider-runtime, terminal, or redacted log artifact demonstrates a real callback dispatch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • googlerest: Authored the earlier closed proposal using the same synthetic group mention-metadata direction for this callback path. (role: adjacent implementation contributor; confidence: medium; commits: ace1626c67d5; files: extensions/feishu/src/card-action.ts, extensions/feishu/src/bot.card-action.test.ts)
  • zhouhe-xydt: Authored the alternative earlier proposal for the same requireMention callback-loss report, providing relevant history on the rejected broad-bypass approach. (role: adjacent implementation contributor; confidence: medium; commits: abe717cf1e88; files: extensions/feishu/src/bot.ts, extensions/feishu/src/bot.broadcast.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted after-fix provider-runtime or live Feishu evidence that shows the group callback reaches dispatch under requireMention: true.
  • Show in the same evidence that ordinary unmentioned group messages remain blocked, with identifiers and credentials redacted.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-07-29T22:30:33.962Z sha c2213b1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-29T22:40:02.359Z sha 403df4c :: needs real behavior proof before merge. :: none

metaforismo commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the hosted precise OpenGrep finding in 403df4cd7. The two legacy lifecycle fixtures now use createFeishuCardInteractionEnvelope without adding outer conversation context, preserving the SDK-style and no-reply-target cases while satisfying the structured-card security rule.

Validation after the repair: 152 focused Feishu tests passed, along with the Feishu extension typecheck, formatting, type-aware lint, max-lines, conflict-marker, and diff checks. The fresh precise OpenGrep scan and Opengrep OSS check both pass.

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 29, 2026

@MixxyAI MixxyAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused fix. I like that it keeps the normal mention gate instead of adding a broad bypass. I found one scope edge case in the shared dispatcher that may be worth making explicit before merge; details inline.

params.event,
params.command,
resolvedChatType,
params.botOpenId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may also change legacy behavior unintentionally. dispatchSyntheticCommand() is used by the decoded.kind === "legacy" fallback at the end of handleFeishuCardAction, so passing botOpenId here causes any non-ocf1 group card payload to receive synthetic mentions and pass requireMention. Those legacy payloads do not go through the structured envelope's expiry, expected-user, or expected-conversation checks.

The PR description scopes the fix to structured-card callbacks. Would it be safer to make this opt-in from the structured branch (for example, with an explicit satisfyMentionGate flag), or is widening legacy group-card behavior intentional? A regression test using a raw { command: "/help" } payload in a requireMention: true group would make the contract clear.

@Patrick-Erichsen Patrick-Erichsen self-assigned this Jul 29, 2026

@Patrick-Erichsen Patrick-Erichsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking code findings. The mention synthesis is the best fix: it represents a card click as addressing the bot while preserving the normal group/sender admission path, instead of bypassing requireMention by synthetic message ID.

I also traced the legacy-path concern. Both WebSocket and webhook card callbacks cross a provider-authenticated transport boundary before handleFeishuCardAction; the legacy branch still represents a user clicking a bot card. Its lack of structured expiry/user/chat bindings is separate from mention semantics, and group plus sender policy remains enforced. I therefore consider the legacy widening intentional/acceptable. A raw legacy regression case would document that contract, but I do not consider it a merge blocker.

The remaining blocker is live Feishu proof: in a real group with requireMention: true, click a current structured card and show that it reaches dispatch, then show that an ordinary unmentioned group message is still dropped. This machine's live OpenClaw config has no Feishu tenant, so I could not produce that provider proof here.

@Patrick-Erichsen
Patrick-Erichsen merged commit c868c81 into openclaw:main Jul 30, 2026
109 of 114 checks passed
vincentkoc added a commit to licheer-zte/openclaw that referenced this pull request Jul 30, 2026
…id-retention

* origin/main: (83 commits)
  refactor(channels): own account config mutations (openclaw#115970)
  fix(discord): keep activity receipts in adopted threads (openclaw#116119)
  fix(feishu): preserve card actions through mention gating (openclaw#116105)
  perf(gateway): cache lazy server methods import (openclaw#116060)
  refactor: keep update timing constants private
  fix: reject stale update reconciliation
  refactor: keep update status response private
  fix: bound update status reconciliation
  fix: preserve uncertain update outcomes
  refactor: keep update reconciliation within size budgets
  fix: release update reconciliation on access loss
  docs: note control ui update reconciliation
  test: cover both managed update response orders
  fix: reconcile ambiguous gateway updates
  fix(codex): prevent approval promotion from blocking unattended runs (openclaw#116117)
  fix(daemon): require system-scope ownership before removing the user unit
  fix(daemon): only treat same-canonical-name user+system units as dueling
  fix(daemon): detect and resolve dueling user+system systemd gateway units
  fix(macos): back off approval socket retries (openclaw#116125)
  test: add stalled provider response body timeout coverage
  ...
vincentkoc added a commit to yetval/openclaw that referenced this pull request Jul 30, 2026
* origin/main: (23 commits)
  refactor(channels): own account config mutations (openclaw#115970)
  fix(discord): keep activity receipts in adopted threads (openclaw#116119)
  fix(feishu): preserve card actions through mention gating (openclaw#116105)
  perf(gateway): cache lazy server methods import (openclaw#116060)
  refactor: keep update timing constants private
  fix: reject stale update reconciliation
  refactor: keep update status response private
  fix: bound update status reconciliation
  fix: preserve uncertain update outcomes
  refactor: keep update reconciliation within size budgets
  fix: release update reconciliation on access loss
  docs: note control ui update reconciliation
  test: cover both managed update response orders
  fix: reconcile ambiguous gateway updates
  fix(codex): prevent approval promotion from blocking unattended runs (openclaw#116117)
  fix(daemon): require system-scope ownership before removing the user unit
  fix(daemon): only treat same-canonical-name user+system units as dueling
  fix(daemon): detect and resolve dueling user+system systemd gateway units
  fix(macos): back off approval socket retries (openclaw#116125)
  test: add stalled provider response body timeout coverage
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
…16105)

* fix(feishu): preserve card actions through mention gating

* test(feishu): use structured card action fixtures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Structured card action callback filtered by requireMention in group chats

3 participants