Skip to content

fix(feishu): set CommandSource and GroupId for group messages#79556

Open
wangdingxin wants to merge 3 commits into
openclaw:mainfrom
wangdingxin:fix/feishu-slash-commands
Open

fix(feishu): set CommandSource and GroupId for group messages#79556
wangdingxin wants to merge 3 commits into
openclaw:mainfrom
wangdingxin:fix/feishu-slash-commands

Conversation

@wangdingxin

Copy link
Copy Markdown

Summary

修复飞书群组消息的两个问题:

  1. bug Bug: Feishu channel does not handle text slash commands (/compact, /new, /stop) #79409: 飞书群组消息缺少 CommandSource 字段,导致 slash 命令无法被正确识别
  2. bug Feishu: groupId incorrectly set to sender open_id instead of group chat ID #78826: 飞书群组消息的 groupId 被错误设置为发送者的 open_id,导致工具策略校验失败

Changes

bug #79409 修复

  • buildCtxPayloadForAgent 中,当消息是文本命令(以 / 开头)时,设置 CommandSource: "text"
  • 这使得 isExplicitSourceReplyCommand() 能正确识别飞书的文本命令

bug #78826 修复

  • finalizeInboundContext 调用中添加 GroupId: ctx.chatId(仅对群组消息)
  • 这确保工具策略解析时使用正确的群组 ID,而不是从格式不正确的 From 字段解析

Testing

本地测试验证:

  • 群组消息的 From 格式:feishu:${senderOpenId}(不包含群组信息)
  • 添加 GroupId 字段后,resolveGroupSessionKey() 能正确获取群组 ID

Files Changed

File Change
extensions/feishu/src/bot.ts 添加 CommandSource: "text"GroupId 字段

Fixes #79409
Fixes #78826

Fixes openclaw#79409 - Feishu channel does not handle text slash commands

The Feishu channel was not setting CommandSource when dispatching
messages, causing slash commands like /compact, /new, /stop to be
treated as regular messages instead of being intercepted by the
command handler.

This change follows the pattern used by other channels (Discord,
Matrix, Tlon) which all set CommandSource: "text" for messages
that start with "/".
@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 8, 2026
@clawsweeper

clawsweeper Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 2, 2026, 1:08 AM ET / 05:08 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +5, Tests +2. Total +7 across 2 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Overall: 🌊 off-meta tidepool
Proof: 🌊 off-meta tidepool
Patch quality: 🌊 off-meta tidepool
Result: rating does not apply to this item.

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

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

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

Codex review notes: model gpt-5.5, reasoning high; reviewed against ebf20241bd17.

Label changes

Label justifications:

  • rating: 🌊 off-meta tidepool: Overall readiness is 🌊 off-meta tidepool; proof is 🌊 off-meta tidepool and patch quality is 🌊 off-meta tidepool.
Evidence reviewed

PR surface:

Source +5, Tests +2. Total +7 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 0 +5
Tests 1 2 0 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 7 0 +7

What I checked:

  • failure reason: codex execution failed.
  • codex failure detail: Codex review failed for this PR with exit 1.
  • codex stdout: Per-item Codex failure; continuing with the rest of the shard.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
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.

When processing group messages, the From field only contains the sender's
open_id (e.g. feishu:ou_sender_1), not the group chat ID. This caused
resolveGroupSessionKey() to incorrectly extract the sender's open_id as
the groupId, which then got dropped by resolveTrustedGroupId() since it
doesn't match the actual group session context.

Adding GroupId: ctx.chatId for group messages ensures the correct group
chat ID is available to tool policy resolution, bypassing the malformed
From field parsing.

Fixes openclaw#78826
…essage tests

Add explicit assertions for:
- CommandSource: text in group slash command messages
- GroupId in group message context

These assertions verify the fixes for openclaw#79409 and openclaw#78826.
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 1, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label Jun 1, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

1 participant