Repository navigation
fix(chat): read complete history through stable original-session pages - #7388
Conversation
…ages Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval): APPROVE — exact head ea34ecc841c7d18a7466dac23e74876db6c500cb.
动机
用户打开积累了大量消息的原管家或 Goal 对话时,需要看到完整原记录。 以前一次读取整段历史,客户端不识别分页;451 条记录被分成三页后会只显示前 200 条。现在同一会话按原游标读完固定前缀,中途失败显示不完整并可重试,正文、附件和草稿保留。 真实 Chat HTTP/store 的打包旅程读回全部 451 条原记录,第二页失败后恢复,读取过程存储不变且零 Turn。 本 PR 不新增消息消费者、复制历史、执行业务或授予权限,也不宣布完整双端同步完成。 完整同步仍有原生 App 输入、回复线程、真实 Lark 媒体及离开对话后的后台回传验收缺口。
改动思路
沿原会话 GET、原 journal 和既有历史 hook 完成同一次读取,不新建消息服务。先冻结原前缀,再依次读取原游标,全部页面验证后才发布完整历史;失败沿既有重试恢复,用户无须填写标识或追加确认。冻结前缀和完整性校验放在原读取链路;IO仍属原store,协作投影复用原载体规则。纯游标helper不保存状态,既满足模块上限,也避免另建会话服务。当前PR边界是同一原会话的分页完整读回、失败恢复和正文/原卡片保留,完整同步和原生provider验收继续由原任务接续。
| 情况 | 本次原路径行为 |
|---|---|
| 451条原记录、每页200条 | 读完0、200、400偏移后才发布完整快照 |
| 中途追加新消息 | 固定前缀不移动,下次原revision刷新再读后缀 |
| 第二页失败或来源改变 | 明确不完整、保留草稿,原路重试;不创建Turn |
具体改动
依据已接受的原连续性与失败矩阵:history-readable、history-scope、history-no-replay在本有界读取路径实现并独立验收;background-return继续deferred,不能用分页通过替代离页回传结论。未分页v1接口和实际后台调用者保留,数据格式不迁移;新增字段只由原记录计算,不需要用户或Agent另外维护。
关键代码讲解
- page_chat_messages把Session、冻结记录数、偏移和原前缀摘要绑定起来;允许追加,拒绝改写、截短和跨会话游标。它是纯读取helper,没有store、worker或grant。
- project_chat_session_snapshot保留严格原journal读取,并把冻结上下文与选定页面交给原投影;project_collaboration仍只选择一个原卡片载体,跨页回传标签可读原载体但不会再渲染一份。
- fetchChatSessionHistory检查连续偏移、稳定total/digest、唯一消息身份及游标前进;第一页之后丢失协议不能静默当作完整。长文、附件、重复正文和原追加序保留。
- fetchChatHistory仍是原共享owner;完成后复核bound/managed确切来源,撤权或连接改变拒绝发布,没有fallback或重放。
对主干的风险
136项相关Python回归、默认路由smoke与typecheck、源码及完整打包恢复场景通过;真实Chat HTTP/store打包旅程在第二页503后读回451条、保留长文与草稿,并独立检查存储不变及零Turn。最终standard premerge为6项直接检查、19项执行检查,零执行失败;3个PNG人工hold已逐张查看像素及PNG chunks。第一次store超过继承上限的失败保留,已抽出纯codec,store为1997行,没有提高2000行阈值。CI按当前策略不查询、不等待。
默认完整回传脚本的后段仍有红项:相同原基线driver、相同小样本工作量分别运行在不可变基线2de490ed6c632e0d641453fd2f10ed3dde69fc48和本head,都在离开对话后的old-session503等待处超时。该观察/导航路径未修改,不能声称修复,也没有删除旧断言或放宽超时;新--pagination-only只验收独立分页旅程。完整历史每页仍读取并摘要整个固定前缀,记录数有界不等于总字节或IO有界;因此不声称延迟或长期成本改善。既有原生输入、实际媒体及provider链路继续保留未验状态。
语义与 CI 对齐
新增的是局部派生读取元数据,复用原Session/快照与源权限,不产生新的Actor生命周期、调度义务或第二套真相源。未分页API保留真实独立调用者;自动UI分页默认值已写入双语RFC和测试。继承模块上限按原规则通过,未放宽预算;人工图片审查与本地执行结果分开记录。
我的整体评价
这是原完整同步任务中的有依据的有界增量。长程执行保持原owner、原结果和无重放边界;用户体验改善在完整历史、可见失败及原路恢复,普通路径零新增确认。已检查完整桌面和390px页面:失败提示与可用当前消息、草稿和重试位于同一视口;恢复后能看到历史尾部和保留草稿。正文全文由DOM和HTTP另验,截图不替代完整性证据。 未验证范围明确保留:完整同步仍有原生 App 输入、回复线程、真实 Lark 媒体及离开对话后的后台回传验收缺口。 新增机制与该独立完整读取旅程相称,纯helper抽取已经完成,不需要并行服务或新的配置表。以上结论只对本exact head成立,既有后台红项和后续原生/provider资格继续由原任务接续。
English verdict: APPROVE this exact head as a bounded original-history read/recovery improvement. Stable pages preserve complete original records and metadata without execution; matched baseline/head background-return failure and native/provider/media gaps remain explicitly open. No CI waiting or general latency benefit is claimed.
Long conversations now hydrate through the original Session in stable pages, retaining complete text, attachments and append order. A read freezes its prefix, rejects rewrites/truncation and inconsistent cursors, and rechecks an exact source before publication. A failed page remains incomplete and retries through the existing history owner. Cross-page commitments and return metadata retain their original carrier, without reloading every off-page Turn.
Validation: 136 focused Python regressions; default Chat route smoke and typecheck; source and packaged recovery scenarios; packaged UI against real Chat HTTP/store with 451 rows, a failed second page, complete retry, long body, retained draft, unchanged store and zero Turns. Exact-commit standard premerge completed: six direct checks and nineteen executed checks have zero execution failures. Three PNG manual holds were independently inspected. The initial module-ceiling failure was fixed by extracting the pure codec; the store is 1997 lines, without raising its inherited 2000-line ceiling. CI waiting is disabled by managed policy.
The existing default return scenario's later background-read wait times out with both unchanged baseline production code (2de490e) and this branch. The explicit --pagination-only journey qualifies the new boundary and leaves that failure open. Native App input, reply threading, live Lark media and full synchronization remain unqualified. Response row count is bounded; journal reads/prefix hashing still scale with full history, with no latency claim. No new consumer, store, execution or grant is added.
Visual evidence below is the packaged synthetic runtime at this PR head (1512×982 and 390×844). The first capture is an injected second-page fault, followed by recovery, not a baseline-version comparison. Unrelated delegation readback is unavailable in this fixture. Pixels and PNG metadata were inspected; no private operating context is included.