Repository navigation
test: reject overlapping native context page reads - #7720
Conversation
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; declaration_source=runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact head: 66b17f9fc621226c1ed9c3e4f2c10af80c244039;不可变 base:d3d9ad209d0a8f57a7582e0165f2fad19df26dcf。
动机 / Motivation
维护原生上下文恢复验证的贡献者,需要知道成功路径是否真的按游标逐页读取。
旧 byte-map 允许相同字节重叠,重复读第一页仍会通过;新夹具会在成功路径的游标不连续时准确失败。
实际原生 reader 的重复第一页反例由旧夹具接受、新夹具拒绝,正常完整模块和原有断言保留。
不改变生产 reader、读取预算、合法重放、权限、模型或已安装 App 的行为,也不完成 C1/C2 整体验收。
这补的是现有验证的敏感性:完整内容的摘要一致,并不能证明成功路径没有反复读同一页。判断不是来自作者的通过数量,而是让真实 reader 重复一页后,对照两版夹具的实际行为。
改动思路 / Approach
复用既有 last_context_page,将连续游标断言留在当前成功路径夹具;通用 byte-map 继续允许合法恢复中的幂等重复。
当前切片只强化现有 source/native 测试的证据敏感性;没有生产改动、新夹具框架或新的产品义务。
同一 production reader 的重试或并发交付仍可合法重复;本 PR 没有把成功路径的局部游标要求提升为全局产品规则。也没有新建第二个 fixture 或完整 reader:每次新 capture 初始化一个本地期望 offset,读取后按实际 UTF-8 字节长度推进,再核对下一游标或 EOF 总长度。
具体改动 / Changes
完整 diff 只有 tests/control_plane/test_saved_context_project.py,+8/-9。普通和 progressive 分支复用既有 last_context_page,删除手工 JSON 提取和重复 import。AST 对照确认主干原有 145 条断言全部保留,当前共 148 条;这项机械检查仅证明断言保留,语义敏感性由下述真实反例证明。
关键代码讲解
- 原生测试 callback 先要求当前工具结果是成功 page。普通完整读取随后核对
offset == read_offsets[name],用len(content.encode())累积字节,检查next_offset或末页total_bytes。它仍跟随实际生成的descriptor.command和next_command。 last_context_page读取最新工具结果,支持现有普通及 code-mode 包装;最新结果不合法时不会用一个更早的成功 page 掩盖。generic byte-map、完整原始内容和生命周期断言保持不变。
spec_ref:docs/reference/required-work-context.md;spec_revision:d3d9ad209d0a8f57a7582e0165f2fad19df26dcf。
Saved context cache / 已保存上下文缓存:implemented,选定完整读取时遵循真实游标、完整 UTF-8 内容和原摘要,恢复不重新准入或扣额。Selected capture details / 按需读取捕获详情:implemented,progressive profile 继续只读所需索引/字段;局部 EOF 不成为全量 retention 证明。
对主干的风险 / Risks
未发现当前阻塞性问题。 我在隔离复制的两版测试里注入相同的一次冗余第一页命令,生产代码保持完全相同:旧夹具接受了重复的实际 reader 输出,当前夹具在 offset 0 与已经累积的期望游标处拒绝。两个实验的注入标记均独立读回,避免把没有真正执行反例的设置失败当成证据。
正常当前模块 43 passed、0 skipped,覆盖六个实际 native profile,包括普通 App、machine、code mode、progressive 与两种 worker 路径;使用实际 Codex 0.163.0-alpha.11.1 和确定性的本地 loopback inference,没有真实模型调用。App 30s、worker 60s 限制未变。原内容、digest、Stop、生命周期、原 Turn 与一次结算/无重放断言仍执行。
最初两份树外 native 反例漏载了仓库的隔离 fixtures,在读页前因隐式默认路由冲突而失败;它们不是 mutation 证据。加载原有 fixtures 后,在同一生产代码上取得上述旧通过、新拒绝结果,实际模型输入中也分别读回两次 offset0。原准备失败、正常通过和预期断言失败均分别保存。
标准 premerge 5 direct + 0 selected 全部通过,零 failed/skip/manual hold,Ruff 通过;测试-only 风险选择没有额外 catalog/risk 项。已对照现有 checkpoint helper、同文件相关历史与完整当前 PR 队列:这里没有复制现有 smoke,而是强化已采用 caller 的不同 oracle。共享账号本身不证明同一 Agent,也没有据此作贡献限制判断。未查询或等待 CI。
我的整体评价 / Verdict
APPROVE 当前有界测试修复,delivery 判断为 goal_achieved,只指这一项 oracle 缺口。long_horizon 与 user_experience 为 preserved:生产行为没有改变,验证更能识别冗余工具工作;不能由此宣称模型更理解上下文或实际任务成本已经下降。
相邻简化已采用既有 parser,并将 clean-success cursor 留在本夹具;通用幂等恢复 oracle 和既有原生 profile 都有独立语义,应继续保留。仅改测试夹具,生产 CLI、网页、App 和视口均未改变。 已安装宿主、真实模型采用和长期完整成本收益未验证;没有需要补图的渲染表面。
English verdict: APPROVE — 66b17f9fc621226c1ed9c3e4f2c10af80c244039. The real repeated-page counterexample passes the old fixture and fails the strengthened cursor oracle; all 43 current native tests pass and all 145 prior assertions remain. Production behavior and broader C1/C2 qualification are unchanged.
Goal And Delivered Outcome
#7687 已合入实际
descriptor.command/next_command分页。本 PR 保留其后的一个独立缺口:完整内容的 byte-map oracle 允许相同字节重叠,因此成功路径中重复读取一页仍能通过。在既有原生 saved-context 夹具中记录每次捕获的预期 UTF-8 byte offset,要求下一页接续上一页,并核对实际内容长度与返回游标。普通与 progressive 分支统一复用现有
last_context_page,删除重复 JSON 提取和导入。通用 byte-map oracle 保留,其他恢复测试仍可验证合法的重复交付。offset 0与预期59760的冲突。正常完整模块全部通过。Author Declaration
model_agent— OpenAI Codex (GPT-6 family).tests/control_plane/test_saved_context_project.pyBounded refactor: use the existing parser in both branches; keep only local per-capture cursor state with an independent failure oracle. No new framework or parallel decision owner.
Validation
Tested revision:
66b17f9fc621226c1ed9c3e4f2c10af80c244039, integratingmaind3d9ad209d0a8f57a7582e0165f2fad19df26dcf. Run state:finished. Inputs:synthetic,public_fixture.real_entrypointpassedregression_paritypassedregression_paritypassedstaticpassedThe first disposable counterexample copies failed before execution because the existing fixture module was absent from their import path. Those preparation failures remain recorded; correcting only that experiment's import path produced the behavioral results above. They are not runtime failures or sensitivity evidence.
Exact-scope author quality receipt:
cqr_a802a4a631eece2b4a5f, valid/pass for fingerprinta802a4a631eece2b4a5f0c458dfa37ed2848092bbf234615910344dad0c33c2b; safe-fix allowed=true/applied=false, blocker/warning/advisory=0. Author qualification is separate from independent review and merge readiness.Standard source-checkout premerge: 5 direct checks passed, zero selected catalog/risk checks for this test-only diff, zero failures, skips, quality failures or manual holds. The exact current quality receipt is valid. Remote CI, independent review and merge readiness remain separate; no self-merge authority is granted.
Coverage boundary: this is source/native fixture validation. No new wheel qualification, installed App adoption, model understanding, sustained latency, complete outcome cost, remote CI or independent approval is claimed. #7687's final wheel evidence remains tied to its own revision. No live installation, model call or benchmark campaign was performed. C1/#7430 and C2's actual consumer adoption/full-cost acceptance continue under their existing owners; this test slice does not close them.
Frontend / Visual Evidence
UI impact:
none; first viewport, before/after and preview: N/A (test-only diff). No frontend, Lark or CLI product operation is extended.Type Of Change