Repository navigation
Read Reward Memory eligibility once when building Turn context - #8383
loopx-agent wants to merge 1 commit into
Conversation
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: model_agent, gpt-6.1-sol, OpenAI, runtime_reported, reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
打开已有 Reward Memory 绑定的 Codex App Turn 时,控制面需要判定能否交付召回建议,以及是否要求独立证据支撑的反思。 原路径为召回和反思分别请求完整行动投影,写提示又重读一次。新路径在一次上下文构建中取得两项资格,按原条件生成同样的建议和结果字段。 缩小跨 Python 与 TypeScript 的资格响应并去掉重复读取,同时保留已准入来源、Agent 绑定和原结算门。 交付范围是同一个上下文构建的本地资格读取。生产 provider 效果、模型用量和完整任务成本是其他验收项。 本轮使用受控 provider 夹具及临时 File/SQLite 状态。真实 provider 账单、模型收益和安装版覆盖还没有资格证据。
改动思路 / Approach
同一受校验来源可一次提供两项资格,不需要缓存跨 Turn 的授权,也不必让 Python 另解完整行动签名。紧凑返回只给现有消费者所需的身份和能力事实。 范围限于一次上下文构建和一条内部投影操作,既有完整 Host 来源校验、旧 envelope 与原结算均保留。 每次构建先读两项独立资格,再生成私有建议和反思字段。规范的消费、审批及 PostSettlement 验证仍走原 owner。
具体改动 / Changes
审查提交 89e55cf6dcfbf4ccc0a887a8b0c805c31132e473,对照 3b16b849148817988535ae165d626da82f44356b。四个文件共 +79/−58。Python 合并资格读取和提示生成,内部 TypeScript 操作复用已校验来源并缩小输出。
基线规范固定在 3b16b849148817988535ae165d626da82f44356b。 loopx/capabilities/reward_memory/README.md
- same-source-eligibility(已验证)。保持原绑定、来源完整性及召回与反思的独立门。真实 File/SQLite、错误 Agent 和已重绑定的作用域都保留原判定。
- single-read(已验证)。在一次上下文构建中合并资格读取,并保留同 Turn 幂等。两个原生入口和两种后端每组首读加重放均 8→2,已召回记录不会被重复读取 provider。
- optional-and-settlement(已验证)。缺失或超限建议不阻塞普通工作,独立反思与 PostSettlement 保持其门。关闭、陈旧、provider 不可用和超限均用有界夹具验证;独立验证/结算测试通过。
关键代码讲解
memory_context_result。一次取得两项资格,readback 仍省略私有建议,超限只裁去建议。提示文字和独立验证义务沿用原句。 审查位置enabled_reward_memory_automation。共享已校验能力事实,并单独匹配 Goal、Agent 与两项策略。旧调用仍可通过单项 wrapper 检查。 审查位置capability_automation_source。完整 Host 继续走 completeHostSource,原生 quota 使用同一 action projection。内部输出缩为身份与能力边界,支持分阶段数值令牌。 审查位置quota_capability_automation_source。把原生 quota 输入交给现有 Effect runtime 投影入口,保留协议版本检查和失败通道。 审查位置
对主干的风险 / Risks
PASS。File 和 SQLite 的原生 quota 与薄心跳路径,每对首次准入加同 Turn 重放都是 8→2 次资格投影。各组仅被替换投影的编码参数和返回总量约 632 KB→114 KB。启用的真实 CLI 夹具同 Turn 只召回一次。 两边各 255 项 Python 与 84 项 TypeScript 测试通过。准确 head 的 TypeScript typecheck、Ruff、6 项直接与 3 项所选快速检查通过。
PASS。未配置、关闭和陈旧绑定在原生入口两边均零资格投影。错 Agent、无准入与无效 envelope 拒绝建议和反思。70 KB 建议被裁去后,独立启用的反思字段继续保留。 准确差异的严格质量凭据已回读。
UNVERIFIED。 provider 是隔离夹具。局部投影字节只统计被替换调用的 JSON 参数和返回,完整传输、真实 provider、模型账单和远端 CI 留待各自证据。
语义与 CI 对齐
内部 quota.turn_envelope.evaluate 增加投影选择值,复用已有身份、权威、绑定和结果 vocabulary。 以同一入口的基线对照检查失败回退和既有权限。
我的整体评价 / Verdict
四组对照都降低了原生交接所需的资格调用和编码开销。同 Turn 重放依旧使用原身份和已有召回回执。 关闭或无资格的普通任务照常推进。有资格时,模型仍收到同样的非权威建议和独立验证要求。 本轮审查的是 CLI 与 Host 内部资格投影、提示和结果字段,完整差异没有修改产品渲染或设置。 采用了走通普通任务、拒绝条件与恢复回读的检查方法。历史评审结论与此版本的性能或授权无关。
English verdict: APPROVE. Head 89e55cf. Native File/SQLite quota and thin-heartbeat pairs cut eligibility projections from eight to two. Scoped binding, fail-open guidance, original replay and reflection gating retained parity.
An active Codex App guard could request the entire quota action signature four times to decide whether Reward Memory can supply recall and accept a reflection. Resolve both operations together through the existing typed Turn owner and return the checked capability facts. The scope covers the normal quota entry, the command emitted by the thin heartbeat, and the complete Host reader.
On main
3b16b84914and candidate89e55cf6dc, the four matched File/SQLite App cases each include first admission and same-Turn replay. Eligibility reads fell from 8 to 2 per pair. Total encoded Python↔TypeScript request and response payload fell 36.05%–36.09%. Host cases with both operations enabled fell 5.21%–5.98%. The provider is a fixture. Model usage and complete task cost remain separate acceptance items.This isolates the shared implementation in a four-file PR. Two Reward Memory files already match C1, and a merge preview finds one overlap in the numeric-token operation list. C1 has already retired the controller-input operation on its branch. C1 #8266