Repository navigation
fix(feishu): preserve bot mentions across command admission - #182441
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20d87f4b32
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| inboundHistory, | ||
| rawBody: commandFacingContent, | ||
| commandBody: commandFacingContent, | ||
| commandBody: effectiveCommandProbeBody, |
There was a problem hiding this comment.
Preserve command arguments when removing bot addressing
For Feishu commands containing multiline or whitespace-sensitive arguments, passing effectiveCommandProbeBody as the actual command body corrupts the payload: normalizeFeishuCommandProbeBody() collapses all whitespace and removes mentions throughout the text. For example, /btw explain this Python:\ndef f():\n return 1 reaches the side-question handler as /btw explain this Python: def f(): return 1. The inbound context builder assigns this value to both CommandBody and BodyForCommands, so retaining the original RawBody does not recover the arguments. This also defeats the explicit argument-preservation behavior for skills and free-text commands in src/auto-reply/commands-registry-normalize.ts. Keep the lossy projection for admission checks, but remove addressing from the dispatched command body without rewriting its arguments.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesPreserve receiving-bot mentions in agent context while deriving separate command input for Feishu admission and routing. Example: A group message mentions Bot A (ou_a) and Bot B (ou_b), followed by hello, and Bot A receives it.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this maintainer-authored PR open: it addresses a current Feishu defect, but introduces command-argument corruption and leaves a related CI assertion outdated. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherFeishu events pass through debounce and sequential routing into message parsing, authorization, and inbound context construction, which supplies separate agent and command bodies. flowchart TD
A[Feishu event] --> B[Debounce admission]
B --> C[Sequential routing]
C --> D[Parse and authorize]
D --> E[Agent mention context]
D --> F[Command body]
E --> G[Agent dispatch]
F --> H[Command execution]
Technical reviewBest possible solution: Keep full agent mention context, remove only command addressing without altering arguments, and update the affected batching assertion. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically removes the receiver's mention; the reported model NO_REPLY outcome was not reproduced, and no target code was executed during this read-only review. Is this the best way to solve the issue? Separating agent context from command detection respects the historical command contract, but a lossy detection probe cannot serve as the executable command payload. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against abda524dfc56. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource -5, Tests +103, Docs +2. Total +100 across 9 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 24, 2026, 4:55 AM ET / 08:55 UTC. |
Keep receiving-bot mentions in agent-facing message content, and derive command probes at each decision owner. Preserve abort and btw admission through receive debouncing and sequential routing. Render only locally verified receiving-bot identity for app-scoped bot events, keeping additional recipient restrictions unchanged.
20d87f4 to
2bd7aa2
Compare
|
Merged via squash.
|
…#182441) Keep receiving-bot mentions in agent-facing message content, and derive command probes at each decision owner. Preserve abort and btw admission through receive debouncing and sequential routing. Render only locally verified receiving-bot identity for app-scoped bot events, keeping additional recipient restrictions unchanged.
What Problem This Solves
Fixes: the agent loses track of which bot was addressed when Feishu strips the receiving bot's own mention from the message in multi-bot conversations.
User Impact
The agent now receives the full mention context in groups and DMs, while command matching, authorization, debounce admission, sequential routing, and mention-prefixed
/stopand/btwbehave as before.Why This Change Was Made
The shared mention renderer mixed the agent-facing message with command parsing, so stripping the bot mention for commands also hid it from the agent. The renderer now keeps all mentions, and only the separate command projection is normalized at the parser consumers and command-decision owners, including transcribed-audio probes. For cross-app bot events, the existing local API verification still decides whether the receiving bot was addressed, and only that verified identity is rendered; the restriction on other recipients and admission policy are unchanged, and the duplicated event clone/reparse path is removed. No config, SDK, protocol, schema, dependency, or authorization-policy change.
This continues closed PR #117906, rebuilt on current main with the missing command, debounce, and verified-identity coverage. Production LOC +28/-33; tests +148/-45; docs +2/-0.
Evidence
/stopand/btwimmediately, and then checks ordinary-message FIFO order.git diff --checkpassed; oxlint reports no new diagnostics (one existingno-redundant-type-constituentsfinding on the broadcastagentClaimunion reproduces unchanged on main).pnpm prompt:snapshots:genleft all six generated files byte-identical (snapshot token delta 0); per-message content now includes the receiving-bot mention, sized by the incoming event.NO_REPLY, so PR CI remains the broad proof.Fixes #72504