Skip to content

Fix Feishu card action mention gating - #85481

Closed
googlerest wants to merge 10 commits into
openclaw:mainfrom
googlerest:codex/fix-85450-feishu-card-mention
Closed

googlerest wants to merge 10 commits into
openclaw:mainfrom
googlerest:codex/fix-85450-feishu-card-mention

Conversation

@googlerest

@googlerest googlerest commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #85450.

Summary

  • Mark Feishu synthetic group card-action callbacks with bot mention metadata when botOpenId is known.
  • Keep p2p card callbacks unchanged so direct-message callbacks do not gain synthetic mentions.
  • Add regression coverage for both the group mention metadata and the p2p no-mention behavior.

Real behavior proof

Behavior or issue addressed: Feishu structured card button callbacks in requireMention: true group chats were synthesized as group text messages without bot mention metadata, so the existing group activation gate could treat the callback as not addressing the bot and drop it. After this patch, synthetic group card callbacks include a bot mention entry when botOpenId is available, while p2p callbacks still omit synthetic mentions.

Real environment tested: Local macOS OpenClaw checkout at /Users/googlerest/.openclaw/workspace/openclaw-src, branch codex/fix-85450-feishu-card-mention, commit 2482f7f442 Fix Feishu card action mention gating.

Exact steps or command run after this patch:

node scripts/run-vitest.mjs extensions/feishu/src/bot.card-action.test.ts extensions/feishu/src/bot.test.ts extensions/feishu/src/policy.test.ts
git diff --check

Evidence after fix: Terminal output copied from the local OpenClaw checkout:

RUN  v4.1.6 /Users/googlerest/.openclaw/workspace/openclaw-src

Test Files  3 passed (3)
     Tests  102 passed (102)
  Start at  02:24:43
  Duration  3.34s (transform 1.01s, setup 33ms, import 2.34s, tests 843ms, environment 0ms)

Observed result after fix: The Feishu card-action regression now asserts that a synthetic group callback has message.chat_type === "group" and includes mentions: [{ key: "mention_bot", id: { open_id: "ou_bot" }, name: "bot" }]. The same suite also asserts that p2p card callbacks keep message.mentions undefined. The broader Feishu bot and policy regression files passed with the same patch. git diff --check completed with no output.

What was not tested: I did not run a live Feishu group chat card click because this local environment does not have live Feishu credentials.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 28, 2026, 12:07 PM ET / 16:07 UTC.

Summary
This PR passes botOpenId into Feishu synthetic card-action messages so group callbacks include bot mention metadata, with regression tests for group callbacks and p2p callbacks.

PR surface: Source +18, Tests +27. Total +45 across 2 files.

Reproducibility: yes. at source level: current main builds synthetic group card-action text messages without mentions, and the existing requireMention gate drops unmentioned group messages. I did not run a live Feishu card click in this read-only review.

Review metrics: 1 noteworthy metric.

  • Message admission path: 1 synthetic callback path changed. The diff changes metadata that decides whether Feishu group card actions pass the requireMention gate before agent delivery.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #85450
Summary: This PR is the active candidate fix for the canonical Feishu structured-card callback requireMention drop; the alternative bypass PR is closed unmerged and not a safe canonical landing path.

Members:

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

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦞 diamond lobster
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live Feishu group card-click proof or callback transport logs on the current head.
  • [P1] If live credentials remain unavailable, get explicit maintainer acceptance of the proof gap before merge.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The supplied proof is copied local Vitest output and git diff checking, not a live Feishu group card click, transport log, recording, or live callback output; redacted live proof is still needed before merge unless a maintainer accepts the gap. 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.

Mantis proof suggestion
A real Feishu card button click is the missing proof for the changed channel delivery path. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify in Feishu that a requireMention group card button click reaches the agent while p2p callbacks remain unchanged.

Risk before merge

  • [P1] Live Feishu callback proof is still missing, so a mismatch between mocked synthetic event metadata and real card-action delivery could still drop group callbacks or admit the wrong callback path in requireMention groups.

Maintainer options:

  1. Capture live Feishu callback proof (recommended)
    Have a maintainer or Mantis run a requireMention Feishu group card button click and verify the command reaches the agent while p2p callbacks remain unchanged.
  2. Accept source-only proof deliberately
    A maintainer can merge without live credentials if they explicitly accept the direct source contract, regression tests, and remaining live-proof uncertainty.
  3. Pause until credentials are available
    If neither live proof nor maintainer acceptance is available, leave the PR open rather than landing an unproven message-delivery change.

Next step before merge

  • [P1] No repair job is needed; the remaining blocker is live Feishu proof or an explicit maintainer decision to accept source and unit evidence.

Security
Cleared: The diff only changes Feishu plugin TypeScript and tests, with no dependency, CI, secret, packaging, or code-execution surface change.

Review details

Best possible solution:

Land the narrow Feishu plugin fix after redacted live card-click proof, transport logs, or explicit maintainer acceptance of the source/unit proof gap, while keeping group mention gating and p2p callbacks unchanged.

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

Yes, at source level: current main builds synthetic group card-action text messages without mentions, and the existing requireMention gate drops unmentioned group messages. I did not run a live Feishu card click in this read-only review.

Is this the best way to solve the issue?

Yes for the code shape: adding a group-only synthetic bot mention reuses the existing Feishu mention gate instead of bypassing policy. The remaining question is proof, not a better code location.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 27c1685f106d.

Label changes

Label justifications:

  • P1: The PR targets a user-triggered Feishu group card-button workflow that can silently fail before agent dispatch.
  • merge-risk: 🚨 message-delivery: The changed synthetic mention metadata controls whether Feishu group card-action callbacks are delivered or dropped by the mention gate.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The supplied proof is copied local Vitest output and git diff checking, not a live Feishu group card click, transport log, recording, or live callback output; redacted live proof is still needed before merge unless a maintainer accepts the gap. 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

PR surface:

Source +18, Tests +27. Total +45 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 19 1 +18
Tests 1 27 0 +27
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 46 1 +45

What I checked:

  • Repository policy read: Root AGENTS.md and extensions/AGENTS.md were read fully; the extension boundary and ClawSweeper proof rules apply because this is a bundled Feishu channel plugin PR. (AGENTS.md:1, 27c1685f106d)
  • Current main lacks synthetic mentions: On current main, buildSyntheticMessageEvent builds the card-action synthetic text message without message.mentions and dispatches it to handleFeishuMessage with botOpenId separately. (extensions/feishu/src/card-action.ts:133, 27c1685f106d)
  • Existing mention gate depends on message.mentions: checkBotMentioned returns true only for a non-broadcast mention whose open_id matches botOpenId, and the group sender activation gate drops unmentioned requireMention group messages. (extensions/feishu/src/bot-content.ts:252, 27c1685f106d)
  • PR source fix: At the PR head, buildSyntheticMessageEvent accepts botOpenId, adds a group-only mention entry with that open_id, and passes botOpenId from dispatchSyntheticCommand. (extensions/feishu/src/card-action.ts:137, ace1626c67d5)
  • PR regression coverage: The PR adds tests asserting synthetic group card callbacks carry the bot mention and p2p callbacks leave mentions undefined. (extensions/feishu/src/bot.card-action.test.ts:336, ace1626c67d5)
  • Linked issue and proof gap: The linked issue remains open with reporter logs from Feishu group card clicks, while the PR proof supplied is local Vitest output and git diff checking, not live Feishu transport proof.

Likely related people:

  • Takhoffman: Authored and merged the structured Feishu card actions and interactive approval flow that introduced this synthetic callback path. (role: feature introducer; confidence: high; commits: fa62231afca3; files: extensions/feishu/src/card-action.ts, extensions/feishu/src/bot.card-action.test.ts)
  • drobison00: Authored and merged the Feishu repair that resolves card-action chat type before dispatch in the same helper area. (role: adjacent repair author; confidence: medium; commits: 90979d7c3ef7; files: extensions/feishu/src/card-action.ts, extensions/feishu/src/bot.card-action.test.ts)
  • liuhao1024: Authored a recent merged Feishu card-action reply-target filter touching the same synthetic message helper. (role: recent adjacent contributor; confidence: medium; commits: a4d013a9f3b9; files: extensions/feishu/src/card-action.ts)
  • vincentkoc: Merged recent adjacent Feishu card-action work and appears repeatedly in Feishu refactor/history around this channel. (role: recent area merger; confidence: medium; commits: a4d013a9f3b9, 9b6859e5db77; files: extensions/feishu/src/card-action.ts, extensions/feishu/src/bot.ts)
  • m1heng: The Feishu plugin package and public plugin reference identify the plugin as community maintained by this handle. (role: declared plugin contact; confidence: medium; files: extensions/feishu/package.json, docs/plugins/reference/feishu.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 22, 2026
@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. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@giodl73-repo giodl73-repo 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.

This is the right fix shape for #85450. The PR keeps the Feishu group admission and sender gates intact, and only makes synthetic group card-action callbacks carry the same bot mention metadata that the existing requireMention path already understands.

No blocking findings.

Reviewed code path: extensions/feishu/src/card-action.ts, extensions/feishu/src/bot-content.ts, extensions/feishu/src/bot.ts, extensions/feishu/src/policy.ts, and extensions/feishu/src/bot.card-action.test.ts.

Verification:

  • node scripts/run-vitest.mjs extensions/feishu/src/bot.card-action.test.ts extensions/feishu/src/bot.test.ts extensions/feishu/src/policy.test.ts passed: 3 files, 102 tests.
  • git diff --check origin/main...HEAD passed.
  • Live checks on a7247eb34fcb16dd02f3e6a23a012369aa142942: Real behavior proof, preflight, security-fast, dependency-change-awareness, check-lint, check-prod-types, check-additional-extension-channels, and checks-fast-contracts-channels-b are green.

I did not run a live Feishu group button click, but the source contract is direct: checkBotMentioned reads event.message.mentions, and this patch supplies a non-broadcast bot open_id mention only for group synthetic callbacks. p2p callbacks remain unchanged.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label May 23, 2026
@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@googlerest

Copy link
Copy Markdown
Contributor Author

Updated real behavior proof — current head 7416145b67

Environment: macOS arm64 (M4), Node v25.9.0, branch codex/fix-85450-feishu-card-mention, commit 7416145b67

Key passing tests (card-action specific):

✓ Feishu Card Action Handler > marks synthetic group card callbacks as mentioning the bot
✓ Feishu Card Action Handler > preserves p2p callbacks for DM quick actions

Full results:

node scripts/run-vitest.mjs extensions/feishu/src/bot.card-action.test.ts extensions/feishu/src/bot.test.ts extensions/feishu/src/policy.test.ts --reporter=verbose

 RUN  v4.1.7 /Users/googlerest/openclaw-dev

 Test Files  3 passed (3)
       Tests  118 passed (118)
    Start at  21:32:19
    Duration  17.73s

[test] passed 1 Vitest shard in 27.70s

git diff --check: no output.

118 tests pass on macOS arm64 at commit 7416145b67 (up from 102 at prior head). The test "marks synthetic group card callbacks as mentioning the bot" directly asserts the fix.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 18, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

@googlerest

Copy link
Copy Markdown
Contributor Author

@steipete — updated proof is in the comment above (118 tests on macOS arm64, commit 7416145b67, including the specific "marks synthetic group card callbacks as mentioning the bot" assertion). The PR is already approved by giodl73-repo. Live Feishu credentials are not available in this environment. Per ClawSweeper's maintainer options, you can accept source and unit evidence and merge if the direct mention-gate contract, regression tests, approval, and green checks are sufficient.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 19, 2026
Adds botOpenId param to buildSyntheticMessageEvent so group card actions
include a bot mention in the synthetic message event, enabling the existing
mention-gating logic to correctly scope responses in group chats.

Also preserves upstream/main fix: card-action-c-* temporary IDs are filtered
via validReplyTargetId to avoid 'Invalid ids' errors from the streaming reply API.
@googlerest
googlerest force-pushed the codex/fix-85450-feishu-card-mention branch from 7416145 to 9f7328e Compare June 20, 2026 11:29
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 20, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 20, 2026
@googlerest

Copy link
Copy Markdown
Contributor Author

@steipete — following up on the proof update from 5 days ago (commit 7416145, 118 tests on macOS arm64, commit 9f7328e now at HEAD after merging main).

ClawSweeper's June 21 re-review still blocks on live Feishu group card-click evidence. Since a live Feishu environment is not available here, requesting you consider Maintainer option 2 from the ClawSweeper review:

"A maintainer can merge without live credentials if they accept the direct source contract, regression coverage, and the Approved review."

Current merge readiness:

  • ✅ 1× Approved (giodl73-repo, May 23)
  • ✅ 118 tests pass at 9f7328e (card-action group + p2p assertions both covered)
  • ✅ main merged in 3 days ago (1dc8a98)
  • ✅ git diff --check: no output
  • ⚠️ stale label added by bot (4 days ago) — this comment resets it

Can you confirm whether to merge on current evidence, or specify what live proof format would unblock this?

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 23, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 24, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 25, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 25, 2026
@googlerest

Copy link
Copy Markdown
Contributor Author

@openclaw-mantis visual task: verify in Feishu that a requireMention group card button click reaches the agent and p2p card callbacks stay unchanged.

@googlerest

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

@googlerest

Copy link
Copy Markdown
Contributor Author

@openclaw-mantis visual task: verify in Feishu that a requireMention group card button click reaches the agent

@googlerest

Copy link
Copy Markdown
Contributor Author

@openclaw-mantis visual task: verify in Feishu that a requireMention group card button click reaches the agent while p2p callbacks remain unchanged.

@googlerest

Copy link
Copy Markdown
Contributor Author

@steipete Hi! Could you please trigger the Mantis visual task by commenting the following command? Since I am a contributor, the bot did not respond to my trigger. Thank you!

@openclaw-mantis visual task: verify in Feishu that a requireMention group card button click reaches the agent while p2p callbacks remain unchanged.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 27, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 27, 2026
@googlerest

Copy link
Copy Markdown
Contributor Author

CI failed on runtime-inventory-drift-check with a gateway timeout (timed out after 60000ms waiting for telegram ready; gateway timeout after 5000ms), unrelated to this PR's feishu changes. Could a maintainer please re-run the failed job?

@googlerest

Copy link
Copy Markdown
Contributor Author

CI is green. Could a maintainer please merge?

@googlerest

Copy link
Copy Markdown
Contributor Author

CI is green and patch quality is 🐚 platinum hermit per ClawSweeper. The only remaining blocker is live Feishu proof. Could a maintainer trigger Mantis to capture it?

@openclaw-mantis visual task: verify in Feishu that a requireMention group card button click reaches the agent while p2p callbacks remain unchanged.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS stale Marked as stale due to inactivity 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

4 participants