Repository navigation
fix(codex): recover current activity beyond cached history - #7231
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.1-sol; OpenAI; runtime_reported; max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
用户打开一个能正常阅读的 Goal,却在侧栏看到状态不可读,无法区分内容故障与执行观测缺失。原来最新回合标记已在文件尾,旧缓存仍让侧栏长期未知;现在同一读取预算内先核对最新尾部,仍缺标记时明确显示执行状态未知。七项旧缓存恢复反例在原实现失败,新实现能读取最新开始、完成或中断标记,未完成记录仍按预算恢复;打包侧栏保留混合活动与真实缺口。本 PR 不改变 Goal 内容访问、执行授权、调度、模型调用或原实验资料,也不承诺所有超长记录一次读完。正常 App 安装采用在评审合并后读回;整个研究页面、其余来源语言和长期稳定验收仍在原任务中继续。
改动思路
同一 provider 的读取顺序与缓存完整性在原 RolloutCursor 内修复,复用有界 Reader 和逆向扫描;UI 仅说明执行观测范围,不新增决策 owner。本 PR 完成交付旧缓存积压下的当前回合观测恢复,以及准确状态文案;原始内容访问、执行和调度权限保持既有边界。
旧路径从已缓存的旧事件继续向前读,大量新增历史会延迟当前状态;新路径只在装载缓存或单次大追加时,用同一个有界读取器核对最新尾部。未完成的巨大记录仍继续既有游标,避免反复重新读取。原身份校验、缓存失败和错误类型保持;无新增权限或决策 owner。这里用文字比较两个分支,未加入未经渲染验收的图。
具体改动
规范依据为 docs/reference/protocols/host-integration-surface-v0.md,规范版本 75f3787。completed host records:implemented,状态取自完整原生记录;8 MiB rollout-read budget:implemented,源校验和恢复共用原有预算;Cached facts are checked:implemented,源检查保留且追齐前不替换检查点。设计规则也要求未知不能推为空闲或执行。
关键代码讲解
- RolloutCursor.observe 校验源与旧事件后,用未读距离以及本次装载/新增量决定是否复用 Backward。限定条件既修旧缓存积压,又保留巨大未结束记录的持续前进。
- RolloutCursor.save 在 forward.pos 尚未到达当前大小时不发布新提示。格式和原子写入保持,源读取不写宿主目录。
- 共享 i18n 将不可读限定为执行状态未知。现有 sidebar、卡片与 ContextHelp 沿用同一类型;既有打包场景覆盖混合、未知、恢复和键盘帮助。四张截图来自同组合成数据,像素、来源和 PNG 元数据均已逐张核对。
对主干的风险
最大反例是没有换行的大结尾记录:若每次预算不足都重新倒查,就会永久恢复不完。当前 head 仅在首次装载或本次新增量超过预算时调整方向;原巨大未完成记录测试和所有宿主测试通过。缓存继续是可丢失提示,不增加共享字段、CLI、任务规则或权限;空绑定、源失败、畸形记录、轮转和陈旧事件保留原含义。真实 SQLite/文件 provider 和实际绑定来源已读回;打包页面的状态为合成 API,不能单独证明宿主执行。Windows writer 与长期稳定不在此资格内,相关 #7222 独立处理。
当前 head 的 137 项宿主/游标/peer 路由测试通过;新七项在原实现全部失败。生产 TypeScript/Chat 构建、现有 goal-activity 场景、Ruff 和语义检查通过。标准 premerge 的6项直接与13项选择检查无失败;原始 ok=false 来自4张二进制图片人工保留项,这4项已另行逐张核对,未冒充自动隐私通过。当前 Goal wait_for_ci=false,未查询、轮询或等待 CI。
我的整体评价
APPROVE,是独立有用且可回滚的增量。长程维度改善持续会话观测恢复,不代表研究收益或生产效率实测提升。用户体验改善来自执行未知与内容可读的区分,真实原因仍可就地查看。实看同一组合成多 Goal、运行/未知/已结束与局部缺口的整页:侧栏把未知限定到执行状态,没有新增说明墙;窄屏弹层完整保留各 lane 原因和事件年龄。视觉证据覆盖这次状态文案和既有弹层;不能认证整个工作台、所有原生宿主或持续稳定性。正常 App 安装采用另行回读。
改动复用已有 provider、缓存和类型,净16行产品逻辑与回归规模合理;更大的索引格式或并行状态 owner 没有必要。未发现阻塞问题。正常安装采用、全页研究体验和持续稳定继续原任务,评审不替代最后准确 head 合并就绪及授权。
English verdict: APPROVE — 8d1983d. Existing bounded observation recovers recent native markers beyond stale cached history, preserves partial/unknown/source boundaries and clarifies execution uncertainty. 137 targeted tests, baseline-sensitive negatives, packaged scene, build and local premerge checks pass; four image holds manually inspected. Installed adoption and general host stability remain separate.
Problem and result
A Goal can load normally while its Codex execution badge stays unavailable: a verified but old observation cache makes the reader replay a large intervening transcript before reaching a recent native turn marker. The cache can also record the current file extent while forward catch-up is incomplete.
The existing read-only provider now searches the latest tail when a loaded checkpoint or large append exceeds the remaining read budget. An incomplete tail still stays unknown and continues its bounded scan. Only caught-up observations replace the durable cache checkpoint. The shared presentation says “执行状态未知 / execution state unknown”, so unavailable execution observation does not imply unreadable Goal content.
Contract and scope
Validation
Visual evidence
Revision: 8d1983d. Public-safe synthetic packaged browser, 1512×982 default and 390×844 expanded contextual help. Baseline presentation is the PR base; rebase retained the same screenshot source inputs. Actual installed readback is a separate private boundary.
The default view identifies execution uncertainty beside the affected Goal. Mixed live/unknown lanes remain distinct; the narrow help retains each lane’s state, cause and event age in place. No explanation paragraph or control was added. The surrounding populated page is unchanged; this is a status-recovery/readability correction, not a full-page redesign.
Author: model_agent (OpenAI Codex), under maintainer direction. Signed-off-by trailer is present.