Repository navigation
fix(lark): give ready private replies an available worker - #8557
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 family, OpenAI, self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewed exact head: 7bfd335
动机 / Motivation
等待原飞书私聊答复的用户,可能在 Core 已经完成时仍然等不到结果。历史扫描占用一个线程,其他后台检查同时到期,已有一条原回复可发送。旧版把尚未启动的后台检查也算入保留位置,可用线程被全部保留,原回复继续等待。候选优先给一条已就绪的原回复分配空闲线程,隔离用例读回原会话答复。四线程上限继续约束所有工作,原请求的校验和回传仍由现有 transport 处理。已安装服务的回传耗时和历史生产延迟的具体成因仍待核验。
改动思路 / Approach
原四线程服务从持久队列读取原回复,使用同一个工作池提交回传和后台检查。本次调整限于已就绪的回复与尚未开始的后台检查之间的调度。 调度先核对实际占用,再看尚未开始的检查需要多少位置。如果这些检查会占满空闲位置,允许一条待发的原回复先用一个。已有工作继续运行,随后由同一扫描器安排其余检查和回传。
具体改动 / Changes
C1 要求在原 Core Turn 产生结果后沿原飞书会话回传。待发正文仍来自持久记录,原 worker 在发送和读回前继续检查来源和授权。新增用例先让原 Core Turn 完成,再让历史扫描与到期检查竞争同一个工作池,最后从原会话读回应答。
C2 要求所有后台工作继续受四线程上限约束。调度计算在运行的任务数,并区分仅到期的检查。已有工作占满时等待下一个空位。一次扫描先保障一条原回复;原有历史恢复排序与到期检查仍由同一服务处理。原会话 RFC
关键代码讲解
- loopx/extensions/lark/goal_topic_runtime_service.py:201 把实际占用与到期检查的预留分开计数,必要时让一条原回复先获得空位。
- loopx/extensions/lark/private_conversations.py:1921 负责以现有原请求与原回执交付,保持来源复核与不确定回执的处理。
- tests/test_lark_private_conversations.py:6490 用真实本地 Core 和工作池、合成飞书输入验证回传。原模型只启动一次,入站检查也能继续。
对主干的风险 / Risks
需要核对满载和后台任务的时机。四个工作实际在运行时,调度保留持久请求并等空位。若仍有空位,本次只给一条原回复额外优先,剩余请求沿原排序。用例覆盖满载无额外内存积压、历史扫描慢、停止、来源拒绝与不确定回执。合入前检查、10 项回传用例及 41 项入站用例通过。飞书 provider 使用合成数据。
我的整体评价 / Verdict
旧版能在存在空位时延后已经可发送的原回复。候选在原服务内修复调度,集成用例验证原答复和后台检查都能继续。已安装服务上的速度需要在保护评审与正常采用后单独核验。
English verdict: APPROVE
Goal And Delivered Outcome
When background checks become due together, their reservations can consume every free slot in the private Lark reply pool. A reply that Core has already produced then waits behind those checks.
Give one ready reply an available worker when those reservations would otherwise block it. The existing pool still caps all work at four active jobs and can run the due checks as workers become available.
Author Declaration
Written by a model agent from OpenAI's GPT-6 family.
Implemented against
App Conversation And Async Inbox describes the existing four-slot pool, the original Core Turn, and the verified original Lark route.
Scope And Continuation
The change adjusts worker selection inside the existing scanner. Provider readback, reply ownership and the Core Turn still use the existing checks. Independent review and installed acceptance are pending.
Validation
UI impact none.
Type Of Change
LoopX Area