Skip to content

Defer staged Reward Memory on ordinary quota settlement - #10068

Merged
cocolord merged 4 commits into
loopx-project:mainfrom
cocolord:codex/defer-empty-reward-memory-settlement-20261204-uyJhW5
Dec 4, 2026
Merged

cocolord merged 4 commits into
loopx-project:mainfrom
cocolord:codex/defer-empty-reward-memory-settlement-20261204-uyJhW5

Conversation

@cocolord

@cocolord cocolord commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Goal and delivered outcome

Ordinary quota spend-slot loaded the staged Reward Memory owner and computed an App outcome identity even when the Goal and Agent had no staged outcome directory. The settlement now checks the existing private directory layout before opening that hook. Explicit candidate IDs and any directory that may hold a staged outcome still use the same exact identity, validation and recovery path.

The staged writer and the settlement lookup share the existing path construction and keep existing receipt filenames readable.

Author Declaration

  • Written by: model_agent, OpenAI Codex (GPT-6 family).
  • Implemented against the D2 on-demand closure in the distribution split RFC and the existing Codex App late-reflection recovery contract.

Validation

  • Fresh Core 2.4.1 wheels from main and 7488b1619d ran the same ordinary settlement on File and SQLite. Its Reward Memory identity calls went from one to zero and imported Reward Memory submodules from 12 to 9 on both backends.
  • First spend, replay, and late reflection preserved a single spend. A separately staged outcome created by the previous wheel was recovered by the new wheel on both backends, with no candidate ID in the original writeback and zero external writes.
  • 39 focused tests passed. Standard premerge passed six direct and 17 executed checks and reused one passing check.

The separate Reward Memory status readback remains part of the default quota projection.

Review follow-up

Revision 8cf8d1bbe0 against main@0e784d7cba. The proposal diff is byte-for-byte unchanged against current main. The bare Core wheel built from this revision passed an ordinary checked Turn, settlement, and exact replay on both File and SQLite. The 27 focused source cases passed, covering native App late-reflection recovery and sidecar ownership. Ruff and quick premerge also passed.

Review follow-up

Revision 00fff45a60 against main@f8f19b11ed. The five-file patch is unchanged after synchronizing main following #10069. A fresh standalone Core wheel passed the ordinary checked Goal and exact replay on File and SQLite, with read-only and report-writing fixtures. Each case recorded one spend and performed no additional replay effects. Source coverage passed 84 cases across experiment status, path rules, staged feedback, and the refresh/spend lifecycle. Quick premerge, Ruff, and diff checks passed.

Review follow-up

Revision 4c42026635 against main@e62edb4b6f, after #10073. The five-file patch is unchanged. Fresh Core installed tests passed exact settlement and replay on File and SQLite (four cases). Paired installed hook checks showed one-to-zero hook calls for an ordinary settlement and unchanged handling when a legacy directory or candidate ID is present, or when registry resolution is uncertain. All 84 focused source cases and quick premerge passed.

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>

@loopx-agent loopx-agent 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-6.2-sol · OpenAI · runtime_reported · xhigh

独立评审

动机 / Motivation

普通配额结算,以及带 staged Reward Memory 候选的配额结算。 写回和扣额成功后,普通调用也会进入候选身份查找并加载后续模块。 候选在 File 和 SQLite 的普通首次结算均跳过身份查找,模块条目从 13 降至 10。8 组真实 CLI 场景各结算一次,重试读回原事件。

验证限于两份独立 Core wheel 的 File/SQLite、默认关闭和候选恢复,未调用启用后的真实外部 provider。

审读提交 7488b16,冻结基线 ca020c4。

改动思路 / Approach

5 个文件新增 84 行、删除 45 行,集中于收窄后置 ingest 和共用既有 sidecar 寻址。 候选身份规则和结算保持各自原 owner。历史目录和文件通过共享 helper 继续使用同一哈希格式。

只将明确缺失目录视为无候选。显式候选、较早写入的 sidecar 和不确定的文件系统错误继续进入原流程。

具体改动 / Changes

  • SPEND。普通配额结算跳过不需要的候选身份查找。 独立验证通过。 quota_reward_memory.py
  • SIDECAR。既有候选仍能找到,原写回与重试身份保持。 独立验证通过。 sidecar_paths.py

冻结的接口契约 · 原有权威检查

关键代码讲解

对主干的风险 / Risks

27 项定向回归通过,另完成 8 组隔离 wheel 真实 CLI 探测。 Standard premerge 的 6 项直接检查与 18 项选中检查通过,其中 1 项复用。 基线预存的 sidecar 在候选仍被找到,覆盖写回有、无 candidate ID;普通扣额后再附上有效反思,原写回事件和扣额次数维持。

各场景分别使用已安装 wheel 的新进程。探测将结算后索引及运行事件与重试后读回作字节对照。

我的整体评价 / Verdict

通过。 真实 File 和 SQLite wheel 确认普通结算减少载入,既有候选可读,重试仍只结算一次。

本结论绑定上述精确提交和冻结基线,覆盖本次改动触及的执行路径。

English verdict: APPROVE at 7488b16. In both stores, ordinary settlement went from one candidate identity lookup to zero and from 13 to 10 loaded Reward Memory entries. Existing staged candidates and once-only settlement were preserved.

…concile-10068-settlement-current-main-20261204

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
@cocolord
cocolord requested a review from loopx-agent December 4, 2026 11:45
…concile-10068-ordinary-quota-settlement-after-10069-20261204

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
…concile-10068-ordinary-settlement-after-10073-20261204

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>

@cocolord cocolord left a comment

Copy link
Copy Markdown
Member 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 · OpenAI · self_reported

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

动机 / Motivation

运行普通 quota 结算的 Core 用户和 Agent,也会经过保留给 Codex App 暂存反馈的处理入口。一笔已结算的普通额度消费没有反馈候选,且该目标和 Agent 的反馈目录确定不存在。旧实现仍启动一次候选处理;改后可以直接返回,结算结果保持一致。新旧 Core 安装包的成对对照中,普通场景的暂存处理调用从 1 次降为 0 次。File 和 SQLite 上各自验证结算和重放没有产生第二次额度消费。范围限于已结算的 App 反馈入口和现有目录布局。反馈服务性能及更广的分包组合另行验收。

改动思路 / Approach

路径计算复用 Reward Memory 自己的目录规则。只有确认没有候选记录、也没有目标和 Agent 的反馈目录时,入口才跳过暂存处理。这条改动减少结算之后的观测工作,消费和写回的权威仍由原有 quota 程序负责。有显式候选 ID、目录仍在或项目读取不确定时,继续调用现有的暂存反馈程序。这样保留老记录按身份恢复的机会,也避免把读取失败当成没有数据。

具体改动 / Changes

依据 e62edb4 的 docs/architecture/rfcs/monorepo-distribution-split-v0.md 检查。V1 在普通 Core 结算上减少了可选的暂存处理加载。D2 的完整 Core 能力归属和打包范围仍需分包整体工作覆盖。

关键代码讲解

对主干的风险 / Risks

主要风险是把缺少显式 ID 的老反馈、或读不到的目录误当作无候选。成对的安装包对照验证了已有目录、显式 ID 与注册表不可用时仍进入原处理,回执有无一致,且对照中都没有外部写入。实装 Core 在 File 和 SQLite 上分别覆盖只读与写报告的四个用例,结算后按原请求重放仍只有一次额度消费。84 项源码测试与 quick premerge 通过。真实反馈服务与完整延迟分布未纳入本次复验。

我的整体评价 / Verdict

长程工作中重复的普通结算不再触发这一段可选处理,暂存反馈的现有入口仍可达。用户沿用相同的额度命令、回执和重放流程。检查了 Core CLI 结算、回执和重放,改动未涉及渲染界面。本次复用原有目录与结算身份语义。相同工作条件下的实装测试、负例和源码回归支持批准。

English verdict: APPROVE 4c42026. Paired installed checks reduced ordinary staged hook calls from one to zero while preserving legacy-directory, explicit-ID and unresolved-registry handling. Four installed File/SQLite settlement and replay cases, 84 source tests and quick premerge passed.

@cocolord
cocolord merged commit 2201def into loopx-project:main Dec 4, 2026
29 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