Skip to content

Keep failed C1 composition captures diagnostic - #9052

Merged
huangruiteng merged 1 commit into
mainfrom
codex/c1-composition-failure-receipt-20261119
Nov 19, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/c1-composition-failure-receipt-20261119

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

Change

When complete C1 composition fails after admission, quota now saves the existing transport diagnostic and original receipts. The capture remains readable with quota context-read. The service refuses it as work input at quota context-project.

On main, a rejected composition could write the uncomposed success packet. The historical reader accepted that capture even though the original guard had reported a failure. The native path could register its pending claim as live. The failure path now reuses one diagnostic builder, preserving successful current C1 capture and historical replay through their existing readers.

The existing post-capture failure coverage now checks the actual v1 input outside the injected fault.

Verification

  • Four File and SQLite combinations on main 41ea75e89892 reproduce successful projection after deliberately interrupted composition. Head 52220d89024b refuses all four. Original receipts are readable by digest. The native claim source stays intact, and the fixtures record zero new debits.
  • Four non-editable Core wheel cases exercise File startup loss and SQLite typed refusal, with Off and native delivery. The four packaged runtime files match the tested source. Native diagnostics fit the 4,096-byte tool budget.
  • The installed Codex App Server with isolated loopback inference verified the original receipt in the actual final input for File and SQLite. It observed typed refusal before reading the receipt, with one original guard record and zero debits in each fixture.
  • The exact head passed 391 regressions with 14 opt-in cases skipped. Changed Python Ruff, configured mypy, the bilingual diff and standard premerge passed. Premerge ran six direct and 19 selected checks with one inherited maintainability advisory.
  • Trial Git merges with fix: pin deferred native context reads to the original capture #9048 4cc3775934a6 and Recover interrupted Codex readiness from the original Turn #9050 3461f733bbe2 apply cleanly at these heads.

Production adoption and matched single-session outcomes and complete costs remain part of C1 acceptance.

Author declaration

Implemented by model_agent using OpenAI Codex. The CLI reuses its transport failure diagnostic, immutable capture writer and existing context reader.

@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)

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

动机 / Motivation

额度 guard 已留下回执时,组合完整 Turn 的运行时请求仍可能失败。操作者需要用保存的捕获核对原轮事实。主干会把失败之前的未组合成功对象写入 capture,历史 reader 能重放为工作输入,原生会话的认领来源也可能被它替换。候选写入明确的诊断,允许按摘要读回原收据,工作投递拒绝这个诊断,之前已验证的捕获仍可恢复。本次核对新写入的失败类型、已验证捕获回读和旧格式的兼容边界。

改动思路 / Approach

现有 transport failure owner 生成诊断。完整组合失败时,capture writer 保存这个诊断和原收据,不走活跃 claim source 发布。工作投递沿原摘要读入,再拒绝已标为失败的对象。当前修复覆盖新写入的组合失败。历史未签名格式仍走既有兼容路径,原有已验证 v1 捕获继续使用原 reader。在 File 和 SQLite 的正常及原生入口先生成可验证的捕获,再注入 startup 失败或 typed refusal。验证同轮收据、前后文件、实际 reader 与复用投递,无新扣额。

具体改动 / Changes

精确 head 52220d89024b956ae27a07f5f2f98d3533d78ef2,diff base 41ea75e89892ed88d0ae543e97e31aad0a181c47,6 个文件 +122/-24。逐项复核 diagnostic-only、no-native-claim-source、historical-read-isolation、verified-source-recovery。验收约定

关键代码讲解

  • 组合失败调用现有 transport failure 形状。File 走 startup 失败,SQLite 走 typed refusal,候选均写出诊断。源码
  • 诊断保留 heartbeat_receipt 等原收据,工作合同和认领动作不进入该对象。源码
  • 标准 context-read 读出原收据,context-project 拒绝新诊断。此前已经验证的 v1 捕获仍可按相同摘要恢复。源码
  • 原 cold 测试与独立 warm 对照保留原源字节。原生两例各 1,943 字节,比配置的 4,096 字节上限小。源码

对主干的风险 / Risks

四组同条件对照中,主干失败文件仍能被投影,原生两例还替换了前次已验证的活跃认领摘要。候选四组均拒绝新诊断投影,并保留前次捕获与原收据,一次原准入、零新增扣额。另把主干生成的四份旧未签名失败文件交给候选,仍可经既有 legacy 路径恢复成功形状,该历史兼容边界保留。

语义与 CI 对齐

新的失败写入使用已有 error_code 和原始收据字段。完整工作决策和失败诊断现在经不同外层形状判定,正常核验和原生激活规则保留。166 项相关用例通过,14 项跳过。独立覆盖源码 CLI 与隔离 provider,作者另有 Core 和 App Server 证据。

我的整体评价 / Verdict

批准当前精确提交的新写入修复。源读回验证覆盖 File、SQLite、普通和原生入口,也覆盖已有已验证捕获。旧未签名失败文件继续命中 legacy 兼容,正式采用时仍需区分这些历史载荷。

English verdict: APPROVE. The exact head keeps newly failed compositions diagnostic across both providers and delivery modes, preserves the original receipts and verified capture, and keeps inherited legacy replay behavior visible.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@huangruiteng
huangruiteng force-pushed the codex/c1-composition-failure-receipt-20261119 branch from 52220d8 to 4e4ef3f Compare November 19, 2026 06:59

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · GPT-5 · OpenAI · self_reported

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

动机 / Motivation

当 quota guard 已经完成准入、随后完整 C1 Turn 组合失败时,Agent 最需要的是原回执,而不是一次盲目重跑。旧路径可能丢失这份证据,或者留下一个看似可执行的半成品上下文,使后续 reader 把诊断数据当成当前工作。候选把失败保存成只供 context-read 使用的 diagnostic,并让 context-project 明确拒绝它;原 Turn 的 Goal、Agent、Todo、settlement identity 和回执仍然可读。

affected_caller_or_operator 是 recovering an admitted quota Turn 的 Agent/operator;before_after_scenario 是失败时只保存原 receipt 与 failure metadata,context-project 则拒绝该 diagnostic。observable_outcome 是 context-read 恢复原 receipt、context-project 与 native claim source 不改变且没有 extra spend;non_goals 是不引入 new admission、provider call、retry、schema、claim 或 work projection。

改动思路 / Approach

失败事实继续由现有 quota failure/report owner 构造,capture writer 继续负责不可变文件与 digest。只有成功组合的 ok=true payload 才能进入当前 context projection 或 native claim source。这个切片没有新增失败数据库,也没有把“可读取”误写成“可执行”;恢复仍沿原回执与正常 quota recovery,避免第二次准入和第二次 spend。Existing capture and context readers own recovery, while the failure reporter provides a non-executable diagnostic payload. 本次 current_pr_boundary 是 Preserve the original receipt after complete C1 composition failure and refuse the diagnostic capture as current work.

具体改动 / Changes

精确 head 4e4ef3f701eb06436aa7cc37c347ae94e8c402c9,diff base 036a95fb1a,6 个文件 +122/-24。规范引用 docs/reference/required-work-context.md @ 036a95fb1aac866526dc2409e0468c25bc656a3d。preserve-original-receipt 与 diagnostic-not-executable 均已实现。

关键代码讲解

  • compose_quota_work_contract 在 composition error 时调用 diagnostic projection,并保留原始 heartbeat receipt。
  • quota_decision_transport_diagnostic 只生成失败和回执证据,不复制 interaction_contract 或可执行 claim source。
  • project_saved_context_capture 在读取 capture 后先检查 ok is False,明确要求用 context-read,避免把 diagnostic 注册为当前 native context。

对主干的风险 / Risks

最强风险是 diagnostic 文件可读却被后续路径当成 fresh ready。当前测试同时观察保存 JSON、claim-source 字节、heartbeat receipt 数量、spend run 和 Todo state;失败后这些都不发生额外变化。PASS:81 项 quota capture 测试通过;quick premerge 通过,包含 compile、diff hygiene、scheduler ACK、quota routing 和 public boundary。继承的 maintainability advisory 不在本 diff 内。

语义与 CI 对齐

capture digest 只证明读取字节一致,不授予 freshness 或执行权;ok=false 明确把失败归类为 diagnostic。成功路径、历史 capture 和 normal context projection 保留原语义。

我的整体评价 / Verdict

批准当前精确提交。Existing capture and context readers own recovery, while the failure reporter provides a non-executable diagnostic payload; 本次边界是 Preserve the original receipt after complete C1 composition failure and refuse the diagnostic capture as current work. Admission 已发生后不会因为组合失败而失去可恢复证据;用户体验上,操作者得到一条明确的 receipt 恢复路径,而不是重新准入。实现复用现有 failure/capture owner,范围和风险都集中在一个边界上。

English verdict: APPROVE at 4e4ef3f. Failed complete composition preserves the original receipt as diagnostic evidence, context-project refuses executable projection, and 81 focused tests plus quick premerge pass.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · GPT-5 · OpenAI · self_reported

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

动机 / Motivation

当 quota guard 已经完成准入、随后完整 C1 Turn 组合失败时,Agent 最需要的是原回执,而不是一次盲目重跑。旧路径可能丢失这份证据,或者留下一个看似可执行的半成品上下文,使后续 reader 把诊断数据当成当前工作。候选把失败保存成只供 context-read 使用的 diagnostic,并让 context-project 明确拒绝它;原 Turn 的 Goal、Agent、Todo、settlement identity 和回执仍然可读。

affected_caller_or_operator 是 recovering an admitted quota Turn 的 Agent/operator;before_after_scenario 是失败时只保存原 receipt 与 failure metadata,context-project 则拒绝该 diagnostic。observable_outcome 是 context-read 恢复原 receipt、context-project 与 native claim source 不改变且没有 extra spend;non_goals 是不引入 new admission、provider call、retry、schema、claim 或 work projection。

改动思路 / Approach

失败事实继续由现有 quota failure/report owner 构造,capture writer 继续负责不可变文件与 digest。只有成功组合的 ok=true payload 才能进入当前 context projection 或 native claim source。这个切片没有新增失败数据库,也没有把“可读取”误写成“可执行”;恢复仍沿原回执与正常 quota recovery,避免第二次准入和第二次 spend。Existing capture and context readers own recovery, while the failure reporter provides a non-executable diagnostic payload. 本次 current_pr_boundary 是 Preserve the original receipt after complete C1 composition failure and refuse the diagnostic capture as current work.

具体改动 / Changes

精确 head 4e4ef3f701eb06436aa7cc37c347ae94e8c402c9,diff base 036a95fb1a,6 个文件 +122/-24。规范引用 docs/reference/required-work-context.md @ 036a95fb1aac866526dc2409e0468c25bc656a3d。preserve-original-receipt 与 diagnostic-not-executable 均已实现。

关键代码讲解

  • compose_quota_work_contract 在 composition error 时调用 diagnostic projection,并保留原始 heartbeat receipt。
  • quota_decision_transport_diagnostic 只生成失败和回执证据,不复制 interaction_contract 或可执行 claim source。
  • project_saved_context_capture 在读取 capture 后先检查 ok is False,明确要求用 context-read,避免把 diagnostic 注册为当前 native context。

对主干的风险 / Risks

最强风险是 diagnostic 文件可读却被后续路径当成 fresh ready。当前测试同时观察保存 JSON、claim-source 字节、heartbeat receipt 数量、spend run 和 Todo state;失败后这些都不发生额外变化。PASS:81 项 quota capture 测试通过;quick premerge 通过,包含 compile、diff hygiene、scheduler ACK、quota routing 和 public boundary。继承的 maintainability advisory 不在本 diff 内。

语义与 CI 对齐

capture digest 只证明读取字节一致,不授予 freshness 或执行权;ok=false 明确把失败归类为 diagnostic。成功路径、历史 capture 和 normal context projection 保留原语义。

我的整体评价 / Verdict

批准当前精确提交。Existing capture and context readers own recovery, while the failure reporter provides a non-executable diagnostic payload; 本次边界是 Preserve the original receipt after complete C1 composition failure and refuse the diagnostic capture as current work. Admission 已发生后不会因为组合失败而失去可恢复证据;用户体验上,操作者得到一条明确的 receipt 恢复路径,而不是重新准入。实现复用现有 failure/capture owner,范围和风险都集中在一个边界上。

English verdict: APPROVE at 4e4ef3f. Failed complete composition preserves the original receipt as diagnostic evidence, context-project refuses executable projection, and 81 focused tests plus quick premerge pass.

@huangruiteng
huangruiteng merged commit 04bee59 into main Nov 19, 2026
21 of 43 checks passed
@huangruiteng
huangruiteng deleted the codex/c1-composition-failure-receipt-20261119 branch November 19, 2026 07:32
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