Repository navigation
fix(chat): retain pending work with large original images - #8122
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; OpenAI; GPT-6 family; self_reported
动机 / Motivation
原生私聊用户发送合法大图、随后额度耗尽时,管家需要继续显示尚未办结的原请求。
三张3 MiB图片被正常接收后,旧版欠办查询因超过8 MiB拒绝;新版仍能显示这条欠办并读回连接状态。
已验证单条、批量和真实HTTP读取均保留欠办,原图、持久记录和外部写入不变。
这解决的是原请求已经存在、却因观察请求过大而读不到欠办状态的问题。非目标是代原接收者执行、自动重放效果未知的失败或把投递失败通知当作业务完成。完整服务设置读取长尾、长期稳定性以及原业务的执行和实际最终回传仍须继续验收。
改动思路 / Approach
状态投影不使用图片内容,沿现有共享输入构造器修复即可;不需要第二状态源、分流协议或提高全局上限。
现有单条和批量欠办读取共用 _quota_pending_inputs。本次只在这个既有边界复制 Turn 时排除顶层 attachments,其余身份、状态、响应、配额继续关系和门禁内容保留。是否欠办仍由 TypeScript 的 planBoundConversationRequest 判断;后续原服务若要恢复执行,还要重新验证原来源和授权。
最强反对理由是这不能解释或消除全部设置读取长尾,因此不能靠一个小型提速声称稳定性完成。但基线已通过合法图片接收流程复现出传输拒绝,具有独立的用户影响。提高全局上限或把图片改走另一种大快照传输会承载状态判定根本不用的数据,也增大维护面。本次保留现有投影归属更合适。本PR只解除合法历史图片阻断欠办观察的故障;原接收者的执行、停止和回传继续由原owner决定。
具体改动 / Changes
审查完整 head 8ce6a65bae765db1ee4759deffc57d29754d77ce,base 2c24d5d102dc35c417b3ce49e25096aa37e1642b,两个文件共72行新增、2行删除。没有独立书面新规格;本PR可复现缺陷是依据。核对了既有 loopx/chat_attachments.py 的12 MiB总量和普通Core消息8 MiB约束,以及 loopx/control_plane/collaboration/conversation_binding.ts 的 pending 分支,没有用补丁重新定义验收。
关键代码讲解
_quota_pending_inputs读当前原Turn和Session,以一个临时字典排除图片。不存在的Turn仍传None,没有生成默认成功状态、持久化新字段、复制判定规则或扩大可处理受众。quota_backlog_pending和quota_backlog_observer因而得到同一修复,原停止事件读取仍在原路径。test_large_original_images_do_not_block_pending_work_or_connection_health使用真实接收、图片下载适配、Core和HTTP,模型额度耗尽是唯一被模拟的执行边界。三张各3 MiB的公共PNG字节输入符合原额度,基线在欠办观察出现 oversized 拒绝;head上单条、批量及HTTP均通过。测试逐字比较全部持久JSON/JSONL,核对外部写入没有增加,未启动原生模型Turn,最后关闭Session再次读取立即得到不欠办。它检验的是用户可观察结果,未用新的输入构造器自证自身。
对主干的风险 / Risks
没有发现阻塞性问题。主要风险是误删判定输入而丢失欠办;逐项检查TS分支后确认它使用原请求关联、Session关闭状态、Turn状态、完整response及继续关系,不读取图片字节。所有这些字段都保留,原图仍在规范Turn中。新的完整接收反例、关闭负例,以及原有source-stop/new、撤销和图片恢复拒绝路径共同约束误放行与误遗漏两种方向。
PASS:两个解释器分别13项针对性检查;最终提交在服务实际Python3.12上重新执行新反例1项通过。PASS:最终提交标准premerge六项直接检查、两项catalog,无阻塞失败或人工hold;Ruff、编译和公开边界扫描通过。保留一项未改动控制面的maintainability advisory,不称全部检查全绿。CQR当前策略disabled,没有伪造质量回执。按当前Goal的wait_for_ci=false未查询或等待远端CI。
语义与 CI 对齐
本次复用既有typed pending词汇和单一判定owner,不新增状态、默认开关或义务。semantic vocabulary检查通过。原关闭、停止、源变更和恢复前置检查未被观察读取绕过;图片只是退出这份不消费图片的临时消息,不是从用户输入或历史中删除。
我的整体评价 / Verdict
这是有实际接收链路反例支撑的完整小修复,比例和归属合理。long_horizon改善在于合法积累输入不再遮蔽未办工作,user_experience改善在于连接状态能返回而无需用户删图或重发;完整服务长尾、安装后采用及长期运行仍未验证,不能从局部健康读取推出。没有修改渲染组件、布局、控件或可见文案,因此 visual_review 不适用;仍保留完整原生App长尾和长期运行的未验范围。
保留原数据和权限语义比提高传输预算更稳妥,未引入兼容分支、手工同步状态或新抽象。冻结的授权只读历史结果也保持一致,但候选计时与测试重叠,只作正确性证据,不发布整体提速或p95结论。本人完成的是自审,未冒称独立接收者已办完业务。可按现有明确合并授权及当前readiness继续;合并与实际升级、补答交付仍分别核验。
English verdict: APPROVE 8ce6a65bae765db1ee4759deffc57d29754d77ce. The legal-image counterexample fails on base and passes through the real pending/HTTP boundary; original media and execution fences remain intact. Full-service latency and soak remain unqualified.
Goal And Delivered Outcome
A legal image request can break the read used to keep unfinished work visible. Chat accepts up to 12 MiB of images, but pending-work observations copied the retained Turn's base64 images into the ordinary Core transport, whose message limit is 8 MiB. A delivered quota-failure notice therefore left an original request that the pending-work reader could not observe.
Exclude image attachments from that read-only Turn projection, as the request projection already does. Canonical images, original input, status, response, source controls and recovery admission stay with their existing owners. No transport limit is raised.
Author Declaration
loopx/chat_attachments.pyand pending-work semantics inloopx/control_plane/collaboration/conversation_binding.ts, base2c24d5d102dc35c417b3ce49e25096aa37e1642b; intended basemain._quota_pending_inputs; original three-image provider admission followed by quota exhaustionturn/startScope And Continuation
Complete within this read-transport defect. The typed pending-work rule is reused unchanged; all non-image Turn fields remain available to it. This does not retry a failed Turn, clear quota gates, change a binding or send a business answer.
General connection-read tail latency, long-running service stability and the actual completion/return of unfinished business remain separate acceptance work. A frozen authorized read-only history retained identical health results after the change; it is not full foreground/background or installed-App latency qualification. No p95 or overall root-cause claim is made.
Validation
8ce6a65bae765db1ee4759deffc57d29754d77ce(the last test-only simplification removes a redundant comprehension loop).TypeScript Effect runtime request is oversized; the fix reaches successful HTTP readbackNo schema, configuration, dependency, permission, storage-authority or model-routing change.