Skip to content

test(context): follow file references in worker and checkpoint observers - #7668

Merged
huangruiteng merged 3 commits into
mainfrom
codex/worker-file-manifest-observer
Oct 29, 2026
Merged

huangruiteng merged 3 commits into
mainfrom
codex/worker-file-manifest-observer

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Worker and native checkpoint regression observers still treated file-first quota delivery as an inline context page. With context delivery enabled, that rejected the saved-file manifest before worker selection or checkpoint capture could be verified.

Follow the manifest command exposed in model input, then verify the returned bytes against that original delivery. The generic saved-file reader supplies bytes, digests and cursors; the observer keeps delivery identity from the original manifest. The existing digest, contiguous byte coverage, unchanged original capture, replay and single-debit assertions remain. Full traversal is this deterministic fixture’s voluntary compatibility oracle, not a new obligation for agents. Product delivery, scoring and checkpoint semantics are unchanged.

Validation at 22a197a1055d624816867ec5e653ce877deb1a13:

  • The File/SQLite worker matrix changed from 8 failures / 8 passes to 16 passes; the complete transport suite passed all 40 tests.
  • Final selected-context and native observer regressions: 14 passed, including real generic pagination, no delivery credit from a reference, and rejection of a malformed current response. The new pagination regression fails against the prior observer with KeyError(mode).
  • Ruff, committed diff hygiene, bilingual diff validation, and standard premerge passed: 5 direct checks, 3 catalog canaries, no manual holds.
  • Integration candidate 593ffffae70948c67a7bcebcc4e73296f21c03e1 combines this fix with the numeric-fidelity and Host-timed-wait candidates. Its complete Linux/native synthetic checkpoint qualification passed with context delivery both on and off: fresh source capture, ordinary restore, stride continuation, automatic full recapture, next-generation restore with actual work, and the non-benchmark core path. All twelve stage tests passed without reuse or skips; each fresh receiver started with a full baseline and subsequent qualified work used deltas. Earlier failed source attempts remain recorded separately.

This is synthetic local inference through the actual native CLI and Docker/SQLite checkpoint paths. It does not qualify autonomous model behavior, end-to-end cost savings, a research run, or an installed upgrade. Independent exact-head review remains required.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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 loopx-agent changed the title test(heartbeat): restore file-first worker settlement coverage test(context): follow file references in worker and checkpoint observers Oct 29, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

维护 heartbeat 和 Codex 恢复测试的开发者,会在工具先返回保存文件引用时遇到问题。
原先测试把引用当成完整决策,或从通用分页结果读取不存在的交付元数据,导致测试在进入真实恢复与结算断言前失败;现在先沿可见命令读取,再独立验证实际输入字节。
当前 head 恢复了 worker、原生 checkpoint 和两次压缩恢复检查,并保持引用本身不构成已读证明。
本 PR 只修复测试消费者,不改变产品读取义务、权限、存储或调度协议,也不证明真实模型理解、研究收益或完整成本改善。

改动思路 / Approach

这次完整评审覆盖当前三文件 diff,而不只继承早先单文件修复的结论。生产 reader 仍拥有原文件摘要、字节和游标;测试先跟随模型能看到的引用命令,第一页到达后才合并原引用里的交付身份。独立 byte-map oracle 从实际模型输入重建字节,在完整覆盖和摘要成立后才比较源文件、记录 delivery。只改 worker 会留下 native reader 对通用分页的错误假设;复用现有 helper 并保留独立 oracle 的边界合适。

当前路径(22a197a) 引用阶段 页面阶段 完成阶段
worker 执行 manifest 里的 command 跟随真实 next_command 校验原摘要,再继续重入和结算断言
native observer 暂存 reference,page_calls 为0 从原引用保留 mode/target;字节来自真实页 独立输入覆盖通过后才写 retained/delivery

此表是源码路径说明,不代替执行证据。fixture 自愿全读只服务于该完整字节 oracle;产品按当前任务选读的合同没有改变。

具体改动 / Changes

变更为三处测试与 fixture,+66/-5;没有生产代码、协议、权限或持久状态变更。规范依据是变更前的 docs/reference/required-work-context.md,固定 revision fbe25ff4ea0edccc9cf2d89187ee1a6c0f1f247a。原文段落无编号;以下 CTX 标签仅为本评审映射:CTX-1(引用不等于交付)由零 page_calls、无提前 retained 断言覆盖;CTX-2(真实字节、连续覆盖、原摘要)由独立 oracle 和真实分页用例覆盖;CTX-3(原身份恢复,fixture 全读不扩展产品义务)由 worker 重入、重复结算及 native 压缩恢复覆盖,均为 implemented。

关键代码讲解

  1. NativeContextReader.follow(tests/control_plane/codex_checkpoint_fixture.py:101)把引用保存在 pending,执行其可见命令。首次真实页要求 offset=0、摘要一致,并保留引用的 mode、target、path、recovery;generic reader 本身并不供应这些交付元数据。
  2. delivered_context(同文件第13行)保持未改:只从实际模型输入提取页面,逐字节检查重复一致、无缺口及摘要,不能凭 EOF 或文件存在判定已读。
  3. test_native_reference_reader_uses_real_pages_before_recording_delivery(test_context_capture_selection.py:53)直接使用真实 read_context_capture,断言 page 没有 mode/target、多页游标正确且完成前没有 delivery。worker 的本地 complete_page 则跟随其真实 manifest 命令,然后保留原有重入与一次扣款断言。

对主干的风险

最强反例是测试伪造了带 mode/target 的页面,单测绿色但实际 reader 仍失败。我将同一个当前用例与真实分页分别配上上一版 1a56065e66e0c23d5ce78b97a979190bf0b3dfa4 和当前 reader:前者 FAIL:KeyError mode,当前 PASS。最新损坏输出也不能借较早引用冒充成功,独立覆盖 oracle 没有被替换或削弱。

相同三文件命令在不可变 base fbe25ff4ea0edccc9cf2d89187ee1a6c0f1f247a 为 208 PASS / 8 FAIL,八项均在 context_delivery=True 的 worker 入口因 interaction_contract/action_signature 缺失失败;当前完整 head 为 217 PASS。另以真实 codex-cli0.163.0-alpha.11.1 执行 native capture/delta/compact recovery 及两次压缩测试,18 PASS / 28 deselected。其中只用确定性 loopback 替换模型,进程、工具传输、模型输入和 hook 真实;这些结果不能证明真实模型理解或研究收益。

本地 canary premerge --from-git-diff --git-diff-base origin/main 的5项 direct、3项 catalog及 Ruff 均 PASS。未查询、轮询或等待 CI。最近12个同账号 PR 的范围比对没有显示本次需要合并或删除的重复 smoke;7659 的入口识别与本次 generic-page/worker 边界各有独立反例。一次编排错误启动的非目标 base 运行已中止并排除,以上 base 数字来自固定 fbe25 的完整重跑。

我的整体评价

对测试消费者修复这个已命名切片,判断为 goal_achieved;long_horizon 和 user_experience 均 preserved。后续重入、两次压缩和结算检查恢复可执行,普通用户增加的配置与确认轮次为0。复用了现有 helper 和独立 oracle,没有另建协议或测试框架;本 PR 并未关闭上层研究目标,也未采用其他集成 revision 代替当前 head 的验证。

已检查 tests/control_plane/codex_checkpoint_fixture.py、test_context_capture_selection.py 和 test_heartbeat_envelope_transport.py;三者只改变测试读取与断言,没有渲染呈现变化。 未声称页面视觉、已安装行为、真实模型采用或长期效果得到验证。

English verdict: APPROVE — 22a197a: the complete test-only change follows real file references, preserves independent byte-coverage checks, and passes focused and native recovery validation. Real-model benefit and merge authorization remain outside this review.

@huangruiteng
huangruiteng merged commit f2990e3 into main Oct 29, 2026
9 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants