Repository navigation
Avoid decoding idle App feedback history in the Lark worker - #8241
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | GPT-6 | OpenAI | self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
把 LoopX App 消息同步到飞书后,即使两端都没有新消息,后台也会检查是否要更新已收到或处理中表情。 长会话里所有表情都已处理,旧版本仍每轮解码完整聊天记录;新版在日志没变时先用消息编号和当前处理状态判断是否有待更新的表情。 同一份约 39 MB 的隔离样本上,空闲检查的中位耗时从约 61 毫秒降到约 5 毫秒。 这次改动不改变飞书正文投递,也不宣称补齐历史业务或降低整台服务的 CPU。
改动思路 / Approach
旧 worker 仍是唯一执行者;新观察只决定是否进入既有核验,不能授权投递。 本 PR 只减少空闲表情检查读取历史的开销,保留正文、排队、权限与故障续办规则。 延长轮询间隔会拖慢正在处理状态的收尾;只记历史已完成也会漏掉状态单独变化。这里复用现有 FileChatDiscovery,仅在完整日志未变化时复用消息与 Turn 编号。每次仍读取当前 Turn;发现待更新或观察不完整时,由原 worker 读取完整输入并判断是否可以操作。
具体改动 / Changes
关键代码讲解
- web_input_turn_refs:从完整本地日志选取 App 用户输入及 Turn 编号,复用已有文件变更标记。追加或替换文件后会重读,正文、授权与发送状态不保存在这份观察里。
- _has_app_feedback_work:只检查已核验的原镜像和最新 Turn,发现要处理的阶段才进入原路径。没有反馈记录的历史已结束镜像不会补加表情;日志没有追加也不影响观察 Turn。
- _web_projection_feedback:共享原条件判断,真正写入前仍核对完整输入、当前授权、原 provider 消息和 Turn。反馈与正文投递分开,最终回写只合并原反馈字段。
按基线 App conversation RFC 核对:
| 约束 | 结论 | 验证 |
|---|---|---|
| Turn-only status changes | implemented | 双会话的排队、运行、完成、失败和停止 |
| Exact source and provider proof | implemented | 撤权、替换身份、来源、会话、Turn 和正文变化 |
| No historical backfill | implemented | 同一新增断言基线因重复读日志而失败,本提交通过 |
| Separate body and feedback | implemented | 关闭或故障不影响原正文,长输入沿原分段和回执 |
对主干的风险 / Risks
最需要防的是日志没追加但 Turn 已结束,或缓存命中后权限已变。测试用同一份正文把两个会话推进到不同状态,确认能撤下处理中表情;来源变化用例确认不会往旧镜像写入。观察读失败时回到原有核验,回滚也只恢复原来的全量读取,不需要迁移回执。33 项相关用例、四项基线对照及标准合并前检查通过。较广的项目恢复矩阵有 12 项失败,基线和本提交的失败项及细节相同;本次不据此判定项目恢复合格。按当前规则未查询远端 CI。
我的整体评价 / Verdict
批准这次后台修复。它把可避免的重复读取从持续运行路径移走,也保留了原消息的正文和可见表情行为。检查的是后台表情扫描,未改消息版式或界面组件,无需视觉对比。 安装后的整服务 CPU 和真实飞书呈现还需要各自验收;这次未用隔离测量替代它们。原服务、权限和待办归属均由既有路径负责。
English verdict: APPROVE 54d835b. The existing Lark worker avoids redundant idle transcript decoding while preserving Turn-only reactions and effect-time source verification. Exact-head focused tests and standard premerge pass; unrelated baseline recovery failures are retained.
Goal And Delivered Outcome
The optional Lark feedback worker decoded the full Chat transcript on every idle tick, even when every App mirror was already settled. It now checks App input references and current Turn state first. In a synthetic two-Session fixture with about 39 MB of history, the warm median dropped from 61 ms to 5.3 ms across 23 observations per revision. The new regression fails on
mainbecause the old worker rereads the transcript.Author Declaration
LarkPrivateConversations.reconcile_app_feedbackLarkPrivateConversations._web_projection_feedbackPrivateDeliveryDiscovery.web_input_turn_refsScope And Continuation
The existing feedback worker retains the same schedule and provider effects. A missing or invalid observation falls back to its original reader. The change needs no migration, does not alter recovery or body routing, and can be reverted with the previous build. Installed service CPU and real provider presentation are separate acceptance.
Validation
54d835b4da3a57059b774f6a04c39a39963434a7.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Operator surface and IM integration: reuse the existing file observation and preserve the RFC's source and delivery ownership.
Shared-authority RFC fixture impact
N/A. No provider or authority state changes.
Boundary Checklist