Skip to content

Test C1 first-read recovery after a native journal write failure - #9107

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/c1-first-read-journal-recovery-20261120
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/c1-first-read-journal-recovery-20261120

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Goal and outcome

Keep recovery of a ready C1 Turn executable when the native observation journal becomes unavailable between pages. The integration test now covers a journal write failing with ENOSPC after a warm first page. It checks that the old offset is rejected with a command to reopen the same capture and verifies the complete write scope and original settlement identity.

Validation

  • Exercised File and SQLite through native context hooks, the actual read and writeback CLI, and the original settlement route. Retried settlement returns the same validation, writeback and spend receipts, with one spend.
  • Kept the existing compaction cases and ran 12 focused tests covering the new failure, journal invalidation and duplicate pages. The standard premerge check passed.
  • Removed the recovery command temporarily in an isolated checkout. The new test failed at the refusal check. Restored the production reader before committing.
  • Ran 28 tests in an isolated checkout of the combined tree with Keep ready controls visible for large Todo scopes #9106 at a0133c2da3a2504b668b89896643b94b04e1c3d2. The wider ready opening and original-capture recovery passed together.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@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.2-sol · OpenAI (runtime_reported, max)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

[P2] 恢复命令漏掉写入范围时,新增回归仍会通过

把返回的恢复命令换成同一捕获下仅选择 /schema_version 的有效读取后,原测试仍在 File 和 SQLite 通过。完整范围断言走的是另一次 read_initial(current)。 直接断言 recovered_values[scope_path] 等于完整范围,并在同一故障用例保留原捕获摘要和三个结算回执的断言。 相关代码

动机 / Motivation

维护原生 context-read 和结算的开发者需要验证失效发生在分页中途时的真实行为。 主干的宽范围用例只从 PostCompact 进入失效和恢复。候选增加 PostToolUse 写日志失败后续读的路径。 实际 CLI 在 File 和 SQLite 上都拒绝旧偏移,返回的恢复命令能读回 270 项原写入范围及原 effect ID。组合结算的三张回执重试时逐字一致,计数只增加一槽。 改动限定在既有测试模块和这条恢复路径。 失败通过真实 Host hook 入口注入 ENOSPC。已安装 Codex App 的生命周期事件和模型实际保留仍待验证。

改动思路 / Approach

用原 fixture 先让完整观察生效,再把首个暖读页交给真实 PostToolUse hook,将 ENOSPC 注入保存动作。之后继续调用正常 CLI,核对失效、同一捕获和结算。生产 reader 以及 File 和 SQLite 的写回入口都参与验证。

具体改动 / Changes

精确 head 3a9a519d6f97ab11e03a2f46f207defeb932d327,base 8e9a28a866da06cc6fd63e78709910fe35dad564。一个测试文件 +54/−12。逐项复核 日志失效与原游标拒绝、原捕获恢复和完整范围、原回执与扣额。 验收约定

  • 现有 PostCompact 分支继续验证观察失效后恢复。新分支把日志保存失败放在已生成的继续游标与下一页读取之间。 源码
  • 恢复命令的原真实输出在两种存储均包含完整写入范围及原 effect ID。缩成同捕获单字段的反例区分了完整性断言。 源码
  • 原结算重复请求返回相同的 validation、durable_writeback 和 quota_spend 回执,外层独立计数验证扣额。 源码

对主干的风险 / Risks

12 项聚焦 Python 检查、File/SQLite 各一项完整范围补充对照和本地 5 项直接预合并检查通过。 删除恢复命令后,File 和 SQLite 都在拒绝检查处失败。用有效单字段选择替换后仍通过,定位到现有测试的完整性断言。实际磁盘容量波动导致的运行失败经保留原日志并串行复跑后排除。

我的整体评价 / Verdict

保留现有集成用例。将完整范围的断言放到失败响应实际给出的恢复命令上,再保留原捕获与扣额读回,便可覆盖原操作员必须执行的恢复路径。

English verdict: REQUEST_CHANGES. Real CLI recovery and idempotent settlement work in both stores. The regression still passes when the advertised recovery command omits the write scope, because completeness is checked using a separate read.

restored, restored_facts, restored_bytes = read_initial(current)
assert scope_path not in restored[0].get("previously_delivered_fields", [])
assert restored_facts[scope_path] == scopes and original.read_bytes() == raw
assert all(restored_facts[key] == value for key, value in recovered_values.items())

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.

这里仅核对恢复命令返回的键。把该命令换成原捕获的 /schema_version 选读后,两种存储的用例仍通过。请直接断言 recovered_values[scope_path] 等于 scopes。

This branch has not been deployed

No deployments
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.

1 participant