Skip to content

fix(feishu): preserve self mentions in agent-facing group messages - #117906

Closed
clawsweeper[bot] wants to merge 2 commits into
mainfrom
clawsweeper/issue-openclaw-openclaw-72504
Closed

clawsweeper[bot] wants to merge 2 commits into
mainfrom
clawsweeper/issue-openclaw-openclaw-72504

Conversation

@clawsweeper

@clawsweeper clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #72504.

The Feishu inbound parser previously removed the receiving bot's own mention from the agent-facing body. In multi-bot groups, that could leave each bot without its own addressing context even when event metadata had already activated it.

This preserves all normalized <at> markup for the agent and keeps group command handling separate: CommandBody uses the command-only normalized probe, so @Bot /model continues to dispatch as /model.

Credit: this repair carries forward analysis from @AxelHu in #72532 and @Bojun-Vvibe in #72661. Their closed PRs are not reopened.

Release-note context: fixes Feishu multi-bot group messages where a receiving bot could lose its own mention context and incorrectly return no reply.

@clawsweeper clawsweeper Bot added clawsweeper Tracked by ClawSweeper automation clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge labels Aug 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Aug 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex review: needs changes before merge.

What this changes

Preserves Feishu bot mentions in agent-facing messages and supplies normalized text for command handling.

Example: A user sends @bot A @bot B coordinate in a Feishu group.

  • Before: Bot A receives only Bot B’s mention in its message content.
  • After: Bot A receives both mentions, including its own identity.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful repair direction, but three concrete command regressions block merging.
Proof confidence 🌊 off-meta tidepool Not applicable: This bot-authored repair is outside the ordinary contributor proof gate; inspected parser and mocked-dispatch tests do not establish registered-ingress behavior.
Patch quality 🦪 silver shellfish (2/6) 3 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Explicitly addressed bots can lose their own addressing context in multi-bot Feishu groups and remain silent.
Reason: Preserving addressing context has clear value, and the maintainer discussion already specifies the required direction and command-safety boundary.

Merge readiness

⛔ Needs changes before merge - 4 items remain

Keep open: current main still loses self-mention context, but this PR has three command regressions and remains under an explicit maintainer pause.

Priority: P1
Reviewed head: 722e5b0a5a2c7e74d4c1727f0daa18c75a266341

Before merge

  • Normalize mentioned commands before selecting the queue lane (P1) - After the parser preserves self-mentions, @bot /stop and @bot /btw question reach this classifier beginning with <at> markup. Both detectors require clean command text, so these events use the ordinary same-chat lane: stop waits behind the active run and btw loses its independent lane. Normalize the classification projection while preserving agent content. This previously reported blocker remains unfixed.
  • Normalize control probes before deciding to debounce (P1) - The registered receiver supplies parsed content here, so @bot /stop now retains leading mention markup and isControlCommandMessage returns false. With a nonzero debounce interval and pending text from the same sender, the command can be merged into ordinary text and cease to dispatch separately. Normalize only the classification input and add a registered-receiver regression. This previously reported blocker remains unfixed.
  • Preserve command arguments when removing addressing mentions (P2) - The probe helper globally removes <at> elements and plain @name tokens, but its output now becomes the actual command body. In an authorized Feishu DM, /btw explain @alice becomes /btw explain before the side-question handler extracts its question; a native Alice mention is also deleted. Previously direct-message command arguments retained that text. Remove only the addressing prefix for dispatch and preserve the argument tail. This is a late discovery on code unchanged since the previously reviewed head.
  • Complete next step - Resolve GitHub-reported merge conflicts while retaining main’s single-pass normalization and prepared-content batching flow.

Findings

  • [P1] Normalize mentioned commands before selecting the queue lane — extensions/feishu/src/sequential-key.ts:17-20
  • [P1] Normalize control probes before deciding to debounce — extensions/feishu/src/monitor.message-handler.ts:292-293
  • [P2] Preserve command arguments when removing addressing mentions — extensions/feishu/src/bot.ts:1410

Tests

  • Missing end-to-end proof: Registered-receiver coverage is missing for mentioned stop interruption, control-command debounce bypass, and preservation of direct-message command arguments; no base-fail/head-pass run was established.
Agent review details

How this fits together

The Feishu receiver parses events, classifies debounce and queue behavior, then dispatches separate agent-facing and command-facing text to core.

flowchart TD
  A[Feishu event] --> B[Registered receiver]
  B --> C[Debounce classification]
  C --> D[Queue lane selection]
  D --> E[Message handler]
  E --> F[Agent context]
  E --> G[Command dispatch]
Loading

Technical review

Best possible solution:

Preserve complete mention context while using command projections that classify ingress correctly and retain command arguments.

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

Source establishes self-mention removal on main and all three introduced command regressions; tests were inspected without execution, and the reported model NO_REPLY outcome was not reproduced live.

Is this the best way to solve the issue?

The separation of agent context from command handling is sound, but this patch is too narrow at ingress and too destructive when its broad probe output becomes command arguments.

Full review comments:

  • [P1] Normalize mentioned commands before selecting the queue lane — extensions/feishu/src/sequential-key.ts:17-20
    After the parser preserves self-mentions, @bot /stop and @bot /btw question reach this classifier beginning with <at> markup. Both detectors require clean command text, so these events use the ordinary same-chat lane: stop waits behind the active run and btw loses its independent lane. Normalize the classification projection while preserving agent content. This previously reported blocker remains unfixed.
    Confidence: 0.99
  • [P1] Normalize control probes before deciding to debounce — extensions/feishu/src/monitor.message-handler.ts:292-293
    The registered receiver supplies parsed content here, so @bot /stop now retains leading mention markup and isControlCommandMessage returns false. With a nonzero debounce interval and pending text from the same sender, the command can be merged into ordinary text and cease to dispatch separately. Normalize only the classification input and add a registered-receiver regression. This previously reported blocker remains unfixed.
    Confidence: 0.99
  • [P2] Preserve command arguments when removing addressing mentions — extensions/feishu/src/bot.ts:1410
    The probe helper globally removes <at> elements and plain @name tokens, but its output now becomes the actual command body. In an authorized Feishu DM, /btw explain @alice becomes /btw explain before the side-question handler extracts its question; a native Alice mention is also deleted. Previously direct-message command arguments retained that text. Remove only the addressing prefix for dispatch and preserve the argument tail. This is a late discovery on code unchanged since the previously reviewed head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0ff84839b2f4.

Provenance checked

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

PR surface

Source -12, Tests +59. Total +47 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 7 19 -12
Tests 2 68 9 +59
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 75 28 +47

Review metrics

Metric Value Why it matters
Production versus test LOC Production +7/-19, net -12; tests +68/-9, net +59 Production shrinks, but added tests stop short of the affected ingress decisions and argument-preservation boundary.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #72504
Summary: This PR remains the open repair candidate for self-mention loss; the merged normalization repair fixes replacement and batching defects.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The patch prevents mentioned stop commands from interrupting active work and can absorb control commands into ordinary text.
  • merge-risk: 🚨 compatibility: Existing mention-prefixed commands lose their queue behavior, and direct-message command arguments can be silently changed.
  • merge-risk: 🚨 message-delivery: A mentioned control command can be coalesced with pending ordinary text instead of dispatching separately.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-12T18:23:30.908Z sha 722e5b0 :: found issues before merge. :: [P1] Normalize sequential command probes before lane selection | [P1] Normalize control probes before deciding to debounce
  • reviewed 2026-08-12T19:17:46.619Z sha 722e5b0 :: found issues before merge. :: [P1] Normalize sequential-key command probes | [P1] Normalize debounce control probes
  • reviewed 2026-08-16T21:21:09.423Z sha 722e5b0 :: found issues before merge. :: [P1] Normalize sequential command probes before lane selection | [P1] Normalize control probes before deciding to debounce
  • reviewed 2026-08-19T13:37:03.803Z sha 722e5b0 :: found issues before merge. :: [P1] Normalize sequential command probes before lane selection | [P1] Normalize debounce probes before control detection
  • reviewed 2026-08-24T03:44:59.856Z sha 722e5b0 :: needs real behavior proof before merge. :: [P1] Normalize sequential command probes before lane selection | [P1] Normalize debounce probes before control detection
  • reviewed 2026-08-30T03:50:26.991Z sha 722e5b0 :: blocked before merge. :: [P1] Normalize sequential command probes before lane selection | [P1] Normalize debounce probes before control detection
  • reviewed 2026-09-25T18:40:26.461Z sha 722e5b0 :: blocked before merge. :: [P1] Normalize mention-prefixed commands before selecting the queue lane | [P1] Normalize control probes before deciding to debounce
  • reviewed 2026-10-02T14:35:47.481Z sha 722e5b0 :: blocked before merge. :: [P1] Normalize mention-prefixed commands before selecting the queue lane | [P1] Normalize control probes before deciding to debounce

Reviewed October 17, 2026, 12:14 PM ET / 16:14 UTC (Revision 17).

@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞🔧
ClawSweeper applied a repair to this PR branch.

Repair: kept the fix on this contributor branch instead of opening a replacement PR.
Validation: pnpm check:changed
Updated head: 722e5b0a5a2c
Run: https://github.com/openclaw/clawsweeper/actions/runs/30739808879

Current state: exact-head review queued immediately; GitHub checks and the review verdict gate final merge.

Automerge progress:

  • 2026-08-02 08:26:16 UTC review requested repair 9a5b84c1e24f (structured ClawSweeper marker: fix-required (finding=review-feedback sha=9a5b84...)
  • 2026-08-02 08:47:11 UTC review queued 722e5b0a5a2c (after repair)

@clawsweeper
clawsweeper Bot force-pushed the clawsweeper/issue-openclaw-openclaw-72504 branch from 9a5b84c to 722e5b0 Compare August 2, 2026 08:47
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 2, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper stop

Blocking P1 on reviewed head 722e5b0a5a2c: preserving Feishu self-mention markup changes the text consumed before handleFeishuMessage, but two ingress decision owners still receive raw <at>…</at>/command:

  1. extensions/feishu/src/sequential-key.ts:17-25: mention-prefixed /stop no longer selects the :control interrupt lane and /btw no longer selects its independent lane. Earlier issue-specific commit 813b20055df3 already demonstrates the missing normalization.
  2. extensions/feishu/src/monitor.message-handler.ts:288-294: mention-prefixed control commands are no longer identified and incorrectly enter the debounce/coalescing queue.

The latest repair only normalizes bot.ts; it does not cover either pre-dispatch owner. Normalize command-only projections at both ingress decision points while retaining the complete agent-visible mention context, and add actual registered-receiver regressions for mentioned /stop priority and control-command debounce bypass before automerge.

@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞✅
Got it. ClawSweeper will leave this item for human review.

I added clawsweeper:human-review, removed clawsweeper:autofix, and paused the automation trail until a maintainer asks again.

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:human-review Needs maintainer review before ClawSweeper can continue rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 5, 2026
@clawsweeper clawsweeper Bot added 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. and removed 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. labels Aug 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 24, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 17, 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 Sep 18, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 2, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Oct 3, 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 Oct 3, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks for the PR. We're closing older pull requests that have gone stale against current main.

This automated repair was stopped by a maintainer with blocking command-handling regressions and has had no commits since August 2. A fresh fix for Feishu self-mention context can be opened against current main if still needed.

If this change is still needed, please open a fresh PR against current main and we'll review it there.

@steipete

Copy link
Copy Markdown
Contributor

Continued in #182441 (credited replacement built on this PR's commits) as part of an old-bug repair sweep. Thank you for the original work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:human-review Needs maintainer review before ClawSweeper can continue clawsweeper Tracked by ClawSweeper automation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu: bot strips its own <at> mention causing NO_REPLY in multi-bot groups

2 participants