Repository navigation
feat:飞书回复预表情自动删除 - #10223
feat:飞书回复预表情自动删除#10223Edge-HH wants to merge 16 commits into
Conversation
- Match reaction operator by app_id or open_id: reactions created with a
tenant_access_token are reported with operator_type=app, so the previous
open_id-only comparison never matched and the reaction was left behind.
- Request ListMessageReaction with user_id_type=open_id and page through
results instead of only reading the first page.
- Track the pre-ack reaction under a single PRE_ACK_REACTION extras key as
a (reaction_id, emoji) tuple.
- Drop the auto_remove option: pre-ack reactions are always removed after
processing, per the issue request. Sync config metadata in 4 locales and
docs/zh|en.
- Restore cfg.get("enable", False) semantics for pre-ack enable checks.
- Cover scheduler happy path, delete-failure fallback and pagination in
tests; share test scaffolding helpers.
feat:飞书回复预表情自动删除
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/core/platform/sources/lark/lark_event.py" line_range="1072" />
<code_context>
+ )
+ if page_token:
+ builder = builder.page_token(page_token)
+ response = await self.bot.im.v1.message_reaction.alist(builder.build())
+ if not response.success() or not response.data:
+ logger.error(
</code_context>
<issue_to_address>
**issue (bug_risk):** The fallback `alist()` request and the final `adelete()` request are not wrapped inside `remove_reaction()`. A network or SDK exception escapes to `PipelineScheduler`, where it is swallowed after logging, leaving the successfully created pre-ack reaction on the Lark message.
**Triggers:** When the initial deletion by reaction ID fails and the subsequent list or retry-delete request raises an exception.
**Suggested fix:** Catch and log exceptions around the fallback list/delete calls, and apply an explicit retry strategy or return a failure status so cleanup failures are observable.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and when enabled, this change automatically deletes the Lark reaction through the external API, and the fallback lookup could select an existing reaction with the same emoji and operator if creation did not return an ID. Reverting stops future deletions but cannot restore reactions already removed; the default auto-remove policy also provides no failure signal if that decision is wrong.
Blocking findings: astrbot/core/platform/sources/lark/lark_event.py:1072
fix(lark): 捕获消息表情回应列表与删除接口的异常并补充测试
feat:飞书回复预表情自动删除
修复了飞书在启用“[飞书] 启用预回应表情”时,回复完成后不会自动清除预表情的问题
Fixes #8003
Modifications / 改动点
astrbot/core/config/default.py:新增 platform_specific.lark.pre_ack_emoji.auto_remove 配置(默认 true)及 WebUI 元数据
astrbot/core/platform/astr_message_event.py:react() 返回 reaction id,新增 remove_reaction()
astrbot/core/platform/sources/lark/lark_event.py:创建表情回应时返回 reaction_id;无法取得 id 时按表情与机器人操作者解析并删除
astrbot/core/pipeline/preprocess_stage/stage.py:开启自动删除时记录 _pre_ack_reaction_id
astrbot/core/pipeline/scheduler.py:事件处理结束时删除预回应表情
dashboard/src/i18n/locales/{zh-CN,en-US,ja-JP,ru-RU}/features/config-metadata.json:四语言文案
docs/zh|en/dev/astrbot-config.md:补充配置说明
tests/test_lark_pre_ack_auto_remove.py:单元测试
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
📚 I checked the affected WebUI instructions and screenshots in
docs/zhanddocs/enagainst the changed navigation, page structure, and labels, and updated them in this PR (or explained why no documentation update is needed). For renamed, moved, or merged entry points, I included an old entry → new entry mapping in the documentation and changelog./ 我已对照变化后的 WebUI 入口、页面结构和术语,核对并在本 PR 中更新
docs/zh和docs/en的相关操作说明与截图(或说明无需更新文档的原因)。入口改名、移动或合并时,已在文档和 changelog 中补充 旧入口 → 新入口 对照。🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Automatically remove Feishu pre-response reactions after processing while allowing the behavior to be configured.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: