Repository navigation
fix(feishu): preserve mentions in single and batched messages - #96311
Conversation
4d85df3 to
e201416
Compare
|
Codex review: blocked before merge. Reviewed September 5, 2026, 4:40 PM ET / 20:40 UTC. ClawSweeper reviewWhat this changesThe Feishu plugin expands mention placeholders in one pass and carries prepared text through batching so names and references remain intact. Merge readiness⛔ Blocked before merge - 1 item remains This PR remains useful: current main and v2026.9.2 retain the faulty replacement loop. The expanded repair addresses both single-message and batching corruption, with no blocking source findings. Priority: P2 Review scores
Verification
How this fits togetherThe Feishu plugin converts incoming chat events into agent messages and routes replies back to the conversation. Mention normalization prepares readable text while event metadata controls addressing, forwarding, and duplicate suppression. flowchart LR
A[Feishu message events] --> B[Parse text and mention metadata]
B --> C[Expand placeholders once]
C --> D[Combine consecutive messages]
D --> E[Select message queue]
E --> F[Agent turn and reply]
A --> G[Original identity and addressing]
G --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests +89, Docs +3. Total +106 across 10 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single-pass normalizer and separate prepared-text handoff; the small production increase preserves raw event identity without introducing another normalization path. Do we have a high-confidence way to reproduce the issue? Yes, from source: processing @_user_1 before @_user_10 corrupts the longer reference, and batching reinterprets already-expanded names. Focused regression cases and recorded before/after proof cover both; this reviewer did not execute them. Is this the best way to solve the issue? Yes. Fixing substitution at its owner and carrying prepared text avoids repeated interpretation; longest-first substitution alone still corrupts literal names, while word boundaries reject valid mentions immediately followed by text. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c068e13bd18. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…aw#96311) * fix(feishu): replace longer mention keys first * fix(feishu): use copying sort for mention keys --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Feishu messages mentioning several people can reach the agent with missing or incorrect names. Short mention keys can consume longer keys, and later replacements can corrupt display names that contain another mention key. Combining consecutive messages can repeat the corruption using the last message's mention metadata.
Why This Change Was Made
Normalize mention keys in one pass, then carry the prepared text separately through message batching, queue selection, and event parsing. This removes the old path that encoded already-normalized text back into a raw event and interpreted it again. Original message identity and mention metadata remain the source for deduplication, addressing, and forwarding.
This supersedes the closed word-boundary alternative #96284 while preserving valid mentions followed directly by text. The original longest-first fix is retained as part of a complete single-pass solution. Its standalone helper tests are consolidated into the existing parser and batching suites. Contributor Sliverp (@sliverp)'s ancestry and credit are preserved.
User Impact
Individual and combined messages preserve readable names and their intended references. Display names containing placeholder-like text remain literal. Existing bot-addressing, mention-forward recipients, and message delivery identity retain their metadata-based behavior.
Evidence
Secretless GitHub-hosted proof exercised SDK HTTP ingress, the production receive handler and core channel turn/session/reply flow, and actual SDK HTTPS delivery to a controlled synthetic API. TLS verification remained enabled. The provider was an existing per-instance mock.
The baseline failed the prefix-sharing case. A longest-first-only variant still failed literal names. The single-pass normalizer alone still failed ordered batching; the full candidate passed default and batched direct/group flows with exact native mention elements, exact model-output bytes, one HTTPS receipt per turn, and preserved message/recipient identities. All 185 tests across six suites passed.
The nine final source/test files matched the hosted candidate before repository-pinned formatting; subsequent changes are layout and the equivalent repository-required copying sort on a freshly created key array. The pinned Lark SDK 1.73.0 event types were inspected directly: placeholder keys, display names, and identifiers are separate fields. Independent Codex review through P2 found no actionable defects.
This is controlled SDK/channel-runtime/transport proof. It does not claim an authenticated upstream Feishu service, native client UI, or Gateway-daemon run.
Production: +35/-21 (net +14). Tests: +103/-14 (net +89). Production growth carries prepared content across the owning boundary and includes formatter line wrapping; the obsolete raw-event rewrite is removed. Rewriting per-message raw keys would add complexity and change transport metadata, while downstream string guards would leave the producer error intact. The Feishu guide also clarifies readable mentions in combined messages. No configuration, database schema, public SDK export, or dependency is added.
Maintainer verification of linked evidence
Maintainer verification for the latest review's retrieval limitation: I downloaded and inspected the hosted artifacts, including the actual default and batched direct/group transport outputs and 185 passing tests. The recorded failures and candidate successes come from those logs, not solely the PR narrative. The candidate files were also compared against the downloaded patch before formatting; the later copying-sort change preserves ordering on the newly created key array, and exact-head CI33990117811 is green.
I also downloaded the exact Lark SDK 1.73.0 package, verified its SHA512 against registry metadata, and directly inspected its receive-event types. They separate message content, mention key, structured identifier, and display name. This closes the reviewer-specific exact-package/artifact retrieval gap. The proof remains a controlled synthetic API/provider flow; authenticated upstream Feishu and native UI coverage are not claimed. No code or gate change is needed for this disposition.