Skip to content

test(quota): validate Codex lease takeover through settlement - #9550

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/qualify-codex-lease-takeover
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/qualify-codex-lease-takeover

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

Problem

Same-owner recovery can resume the original Codex App Turn once the current lease has been verified and a takeover receipt has been committed. Two File and SQLite instances of the existing journey still expected rejection after a successful guard. The mismatch surfaced in the matched validation of the shared type-check repair. Takeover contract · Type-check repair

Change

Update the existing real-CLI journey on both providers. It checks that a replacement lease cannot write before requalification, the guard appends one takeover receipt under the original settlement identity, and the former lease remains fenced. Replaying the guard preserves its receipt. The qualified replacement lease can settle and replay the original Turn with one writeback and one quota debit.

Validation

  • 20 targeted tests passed on File and SQLite, including competing-holder recovery and retired-generation writeback.
  • Standard premerge passed all five direct checks and six selected smokes. Ruff and Git whitespace checks passed.
  • The quota, takeover and settlement regression suites completed with 339 passed.
  • The isolated three-commit combination completed with 311 passed. The unchanged strict mypy configuration checked 17 inputs successfully under Python 3.14.8. Native return repair · Type-check repair

Hosted check dependency

The hosted kernel-contracts job on this exact test-only head reported 3,992 strict mypy errors in 402 files. The configured check and product source have identical bytes on the verified base and this head. #9549 restores this same strict check and its hosted job passed. Recheck the combined main-based result after that repair is adopted. Failing #9550 job · Passing #9549 job · Repair #9549

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 · xhigh

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

精确头通过评审,未发现阻塞项。

动机 / Motivation

维护 Codex App 长程轮次与本地额度回归的开发者,以及租约变更后接续同一未结算轮次的 Agent。 精确基线上的两个旧用例要求原准入一概拒绝替代租约。实际 File 和 SQLite 均返回 normal_delivery_allowed=true,与已合入的 #9488 行为一致。 todo claim → quota should-run --codex-app → task-lease release → 同一 Agent 再 claim → 原 guard → refresh-state --settle-turn → 同身份重放。 把收到真实拒绝、一次接管与一次结算变成回归断言,覆盖同一接管边界两侧。 范围是已发布的本地 File/SQLite 契约与原结算路径。

改动思路 / Approach

原 Agent 持有效新租约必须先以同一 Turn 重入 quota should-run --codex-app。只有当前所有权、版本、代次和原准入证据均满足时才追加 lease_takeover。 测试通过接管前后的显式租约、原结算身份和持久回执验证这条已发布的路径。 原始契约 · #9488

具体改动 / Changes

精确提交 35c3691c7f3790a1cd49ce12a64798f5b1ea3215。基线 509360fb0d3e9e6e578ddf5c12db587886016b23。一个测试文件,增加 43 行,删除 19 行。

关键代码讲解

  • takeover-before-writeback:接管前拒绝新租约,接管后拒绝旧租约。 真实 CLI 测试
  • single-takeover-receipt:原事件及两代租约可回读,重复 guard 保持日志字节等同。 接管断言
  • exact-settlement-replay:重放返回原结算结果,写回和扣额各一条。 结算断言
  • peer-lease-fence:已有相邻测试继续验证其他持有人和陈旧证明的拒绝。 恢复指引

对主干的风险 / Risks

候选定向组合 36 项通过。两个后端均保留原结算身份,首次 guard 只追加一条接管回执,重复 guard 保持日志字节等同。原身份结算及重放合计一条写回、一次扣额。 接管前用新证明写回和接管后用旧证明写回都以 refresh_task_lease_unavailable 拒绝,接管前后均核对无错误追加。相邻用例验证他人接手后原 Agent 不获自领指引、旧证明和其他操作者不能越权关闭。 Ruff 和 git diff --check 通过。既有 generic reentry 用例覆盖恢复入口和追加,现有接管校验用例覆盖当前验收证据。这次更新的 Codex App 测试还将两侧显式拒绝与最终扣额放进同一轮。

语义与 CI 对齐

基线的两个旧用例均在要求 normal_delivery_allowed=false 时得到 true。已核对 #9488 是基线祖先。独立验证覆盖隔离的 File 和 SQLite 真实 CLI、固定基线负例、Git diff 检查及 Ruff。未运行完整仓库套件,未咨询远端 CI。作者的标准预合并属于另行提交的证据。

我的整体评价 / Verdict

APPROVE。 候选以现有真实 CLI 和两种本地权威后端覆盖完整的接管至结算路径。评审范围为精确测试补丁。

English verdict: APPROVE at 35c3691. File and SQLite confirm each side of the lease fence, one takeover receipt, and one debit across settlement replay. 36 targeted cases passed.

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