Repository navigation
fix(feishu): honor session activation mode for group admission (#50490) - #87709
sweetcornna wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 28, 2026, 8:29 AM ET / 12:29 UTC. Summary PR surface: Source +92, Tests +455. Total +547 across 4 files. Reproducibility: yes. source-level. Current and PR source show Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the Feishu session-activation precedence, but make the first admission gate command-aware, use the cached/prepared session-store path or justify a freshness contract, align docs, and require real Feishu proof before merge. Do we have a high-confidence way to reproduce the issue? Yes, source-level. Current and PR source show Is this the best way to solve the issue? No. Reading Feishu session activation at group admission is the right boundary, but the current patch should preserve authorized activation-command recovery, avoid the forced uncached hot-path read, and align user-facing docs before it is the best fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 08d15ec32db3. Label changesLabel justifications:
Evidence reviewedPR surface: Source +92, Tests +455. Total +547 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
feea16c to
d739c5d
Compare
|
@sweetcornna thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
@sweetcornna thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(feishu): honor session activation mode for group admission (#50490) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Closing per ClawSweeper review verdict |
Summary
channels.feishu.mentionRequiredconfig when deciding whether to admit non-@-mentioned messages, so/activation mentionreturned its confirmation reply but the runtime kept forwarding every message — exactly the regression [Bug]: Feishu 群聊中 activation 模式切换无效,始终响应所有消息 #50490 describes.extensions/feishu/src/bot.ts:670, read the session entry throughextensions/feishu/src/group-activation.ts, and overriderequireMentionfrom the persisted/activation mention|alwaysvalue before callingresolveFeishuGroupSenderActivationIngressAccess. Session"mention"forces gating on,"always"forces it off, undefined falls back to config — matching the sibling channels.!isGroup./activationcommand handler itself (the shared command path insrc/auto-reply/reply/commands-session.ts:206already writesgroupActivationcorrectly).Linked context
Closes #50490
Related: same gate shape lives in
extensions/telegram/src/bot-core.ts:280(resolveGroupActivationreads the session store and overridesrequireMentionviafirstDefined),extensions/whatsapp/src/auto-reply/monitor/group-activation.ts:30(resolveGroupActivationFor) +extensions/whatsapp/src/auto-reply/monitor/group-gating.ts:208(requireMention = activation !== "always"),extensions/qqbot/src/engine/group/activation.ts:13(resolveGroupActivation) +extensions/qqbot/src/engine/gateway/stages/group-gate-stage.ts:62.Discord/Slack/Mattermost route group admission through
src/channels/message-access/decision.ts:204, which already accepts thepolicy.activation.requireMentionflag the Feishu gate sets; the missing piece was Feishu computing that flag from the session entry, not a deeper refactor. No sibling-channel changes are needed in this PR.Real behavior proof (required for external PRs)
/activation mentionaccepted in a Feishu group withmentionRequired: falsebut bot still answered every message.clawsweeper:source-reprolabel on the issue). No live Feishu app was driven.pnpm exec oxfmt --check extensions/feishu/src/bot.ts extensions/feishu/src/group-activation.ts extensions/feishu/src/group-activation.test.ts extensions/feishu/src/bot.activation-override.test.tspnpm exec oxlint --type-aware extensions/feishu/src/bot.ts extensions/feishu/src/group-activation.ts extensions/feishu/src/group-activation.test.ts extensions/feishu/src/bot.activation-override.test.tspnpm tsgo --noEmit -p tsconfig.extensions.jsonpnpm check:test-typesnode scripts/run-vitest.mjs extensions/feishu/src/group-activation.test.tsnode scripts/run-vitest.mjs extensions/feishu/src/bot.activation-override.test.tsnode scripts/run-vitest.mjs extensions/feishu/src/bot.test.tsnode scripts/run-vitest.mjs extensions/feishu/src/bot.broadcast.test.tsnode scripts/run-vitest.mjs extensions/feishu(full feishu plugin suite)extensions/feishu/src/group-activation.test.ts— 10/10 pass; covers session "mention" →requireMention=trueeven with configfalse, "always" →falseeven with configtrue, undefined → config fallback, store-read errors → undefined +onErrorcallback, whitespace/case normalization.extensions/feishu/src/bot.activation-override.test.ts— 2/2 pass; reproduces [Bug]: Feishu 群聊中 activation 模式切换无效,始终响应所有消息 #50490 end-to-end forgroupActivation: "mention"(configrequireMention: falsenow drops non-@ messages) and covers the inversegroupActivation: "always"case (configrequireMention: truenow admits non-@ messages).bot.test.ts(69/69),bot.broadcast.test.ts(6/6),policy.test.ts(14/14), and the fullextensions/feishusuite (787/787) all still pass — the early-but-cachedresolveAgentRoutecall does not perturb existing assertions because every group-test mock returns the same shape for the same peer args.mentionRequired: falseare dropped at the activation gate once/activation mentionhas been recorded;/activation alwaysflips the gate back to admit-all; unset session entries keep the existing config-only behavior.clawsweeper:source-reproand the regression is at the admission gate, which is exercised inbot.activation-override.test.tsagainst the same sharedresolveFeishuGroupSenderActivationIngressAccesscallable used in production.handleFeishuMessageentry point and the realloadSessionStoreagainst a tmpdir-backed session-store JSON file.main(commit7a36bb37af), the samebot.activation-override.test.tsscenario woulddispatchReplyFromConfigonce even withgroupActivation: "mention"on disk — there is no code path inextensions/feishu/src/bot.ts(before this PR) that readsgroupActivation. The only callers ofgroupActivationin Feishu before this change are zero (grep -rn "groupActivation" extensions/feishu/ src/had no Feishu hits in production code).Tests and validation
Which commands did you run?
pnpm exec oxfmt --check …(changed files)pnpm exec oxlint --type-aware …(changed files)pnpm tsgo --noEmit -p tsconfig.extensions.jsonpnpm check:test-typesnode scripts/run-vitest.mjs extensions/feishu/src/group-activation.test.tsnode scripts/run-vitest.mjs extensions/feishu/src/bot.activation-override.test.tsnode scripts/run-vitest.mjs extensions/feishu/src/bot.test.tsnode scripts/run-vitest.mjs extensions/feishu/src/bot.broadcast.test.tsnode scripts/run-vitest.mjs extensions/feishu(787 tests, all green)What regression coverage was added or updated?
extensions/feishu/src/group-activation.test.ts— pure unit tests forresolveFeishuGroupActivationOverride(six store-shape variants) andapplyFeishuGroupActivationOverride(four precedence variants, including the explicit [Bug]: Feishu 群聊中 activation 模式切换无效,始终响应所有消息 #50490 case "config false + session mention → requireMention true").extensions/feishu/src/bot.activation-override.test.ts—handleFeishuMessage-level regression that writes a realsessions.jsonto a tmpdir and asserts both session directions:/activation mentiondrops non-@ messages over an open config, and/activation alwaysadmits non-@ messages over a mention-required config.What failed before this fix, if known?
bot.activation-override.test.tsregression. Without this patch,handleFeishuMessageadmits the non-@ message (becauseresolveFeishuReplyPolicyreturnsrequireMention: falsefrom config and the session value is never read),mockDispatchReplyFromConfigis called once, andexpect(dispatched).toHaveLength(0)fails.If no test was added, why not? N/A — tests were added.
Risk checklist
Did user-visible behavior change?
Yes— in groups where the operator leftmentionRequired: false, the bot now stops responding to non-@ messages after the user runs/activation mention. This matches the documented contract of/activationand is what #50490 reports as the missing behavior. Users who never run/activationsee no change.Did config, environment, or migration behavior change?
No— no new config keys, defaults, or migrations. The change reads the existinggroupActivationfield that the shared/activationcommand already writes to session entries (src/config/sessions/types.ts:322).Did security, auth, secrets, network, or tool execution behavior change?
No— only the mention-required gate decision. Sender allowlist enforcement, command authorization, and downstream dispatch paths are untouched.What is the highest-risk area? Adding a second
resolveAgentRoutecall per group inbound message. Telegram does this too (bot-message-context.ts:426), the function is cached insrc/routing/resolve-route.ts:633viaresolveRouteCacheForConfig, and the second call later in the samehandleFeishuMessagehits the same cache key.How is that risk mitigated? Existing
bot.test.tsgroup-routing assertions (expectResolvedRouteCall(0, …), index 1 in topic tests) all pass: my early call uses the samepeerandparentPeershape as the existing call, so call-index assertions match regardless of order. The full feishu suite (787 tests) is green.Additional validation after rebasing/updating this PR branch on 2026-06-03:
node scripts/run-vitest.mjs extensions/feishu/src/group-activation.test.ts extensions/feishu/src/bot.activation-override.test.ts --reporter=dot-> 2 files / 12 tests passed.npx oxfmt --check extensions/feishu/src/bot.activation-override.test.ts extensions/feishu/src/group-activation.ts extensions/feishu/src/group-activation.test.ts extensions/feishu/src/bot.ts-> clean.node scripts/run-oxlint.mjs extensions/feishu/src/bot.activation-override.test.ts extensions/feishu/src/group-activation.ts extensions/feishu/src/group-activation.test.ts extensions/feishu/src/bot.ts-> exit 0.node scripts/run-tsgo.mjs -p extensions/feishu/tsconfig.json-> exit 0.git diff --check && git diff --cached --check-> exit 0 before commit.Current review state
What is the next action? Maintainer review.
What is still waiting on author, maintainer, CI, or external proof? CI run on this PR. No live Feishu proof is included; if maintainers want one, please flag and I'll pair with someone who has a Feishu test tenant.
Which bot or reviewer comments were addressed? N/A — initial submission.