Skip to content

fix(reward-memory): use effective Agent automation in prompts and settings - #5846

Merged
huangruiteng merged 2 commits into
loopx-project:mainfrom
hhyykk:codex/reward-memory-admission-20261007
Oct 7, 2026
Merged

huangruiteng merged 2 commits into
loopx-project:mainfrom
hhyykk:codex/reward-memory-admission-20261007

Conversation

@hhyykk

@hhyykk hhyykk commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Heartbeat prompts use Goal-wide desired Reward Memory flags, so an Agent without a verified effective binding can receive automatic-ingest instructions. The settings summary also presents desired automation as effective when the bound live config disables it.

Reuse the existing read-only per-Agent configuration/receipt resolver in CLI and scheduled prompts, and separate desired flags from effective settings. Disabled prompt content and identity errors retain their behavior. No provider is contacted or provider-write permission added.

The Python configuration owner remains a projection adapter; the TypeScript recall/application owner is unchanged. This bounded repair does not close the wider memory integration roadmap. The related settings correction removes duplicate admission knowledge at the same owner; no new capability, switch or UI layout is introduced.

Validation

At 7354b4c2f34daff2f3a8bb49b4772d5b5533fc38, based on 31510ea75c2d95956c624a6828cd06384b4186d5:

  • 104 source tests passed, with baseline false-admission and desired/live mismatch regressions reproduced before repair. Ruff, semantic advisory, registry-I/O census and full semantic smoke passed.
  • Built wheel, sdist and wheel from sdist; changed product files and all 20 Chat files match source/build bytes. Both installed paths passed 102 tests and real API/CLI/scheduled/catalog checks. Two TS-source-dependent parameters remain covered by source tests and are deselected in installed tests.
  • Packaged settings journey through Goal settings → Reward Memory → existing advanced values verified desired-on/live-off, digest drift denial, and restored verified positive state. Uses disposable synthetic receipts; no live provider qualification, real Goal mutation or installed-user-app upgrade is claimed. Existing navigation/layout is unchanged; Lark has no new entrypoint.
  • Risk-based premerge: five direct checks (diff, compile and maintainability) and nine selected canaries passed. The heartbeat-prompt output-budget canary failed (12107 characters versus 10500). Same absolute-path fixture produced byte-identical base/head brief JSON and Markdown; a continued differential also found an unchanged thin-Markdown overage. Later differential rows were not reached. Heartbeat diagnostics are already owned by #5827; no ceiling was raised. The premerge gate remains failed, not merge-ready.

No PostgreSQL authority-store change. Provider integration, Windows and remote CI remain separate evidence boundaries. Runtime changes are left for maintainer review and merge.

hhyykk added 2 commits October 7, 2026 12:49
Signed-off-by: hyk <4408344+hhyykk@users.noreply.github.com>
Signed-off-by: hyk <4408344+hhyykk@users.noreply.github.com>
@hhyykk
hhyykk marked this pull request as ready for review October 7, 2026 05:00

@hhyykk hhyykk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Reviewer: model_agent; model gpt-6.1-sol; provider OpenAI; runtime_reported, effort ultra.

动机

使用现有 heartbeat-prompt 的 Agent 会按提示整理一次工作后的 Reward Memory 候选。此前,只要 Goal 表示“想自动摄取”,CLI 和定时提示就可能给尚未通过当前配置、回执验证的 Agent 发出摄取指令;同一 Goal 的设置页还可能把“想开启”显示成“已经生效”。例如配置文件明确关闭摄取和回忆、但 Goal 的期望开关仍为真时,操作者看见的有效状态会误导下一次使用。此 PR 让提示按当前这个 Agent的实际准入决定,让设置中的有效开关反映实时配置。它修复现有入口的错误指导与读回,不执行 provider 写入,也不宣称完成更广的记忆质量闭环。

真实 provider 写入、目的地回忆与更广的记忆质量闭环仍由原 owner 完成;#5827 的输出预算修复、远端 CI 和维护者合并就绪检查仍待完成。

改动思路

接受准入事实的现有 owner 是 resolve_goal_reward_memory_experiment:它核对 Goal 内的 Agent 白名单、配置摘要及该 Agent 的验证回执,并读取当前配置。两个提示入口共用一个只读判定,再把布尔结果交给原有提示构造器;未获准的 Agent 不收到自动摄取指导,也不会为它留提示预算。Goal 设置摘要则保留“期望”和“有效”两个概念:有效摄取、回忆分别要求期望为真,且至少一个已验证、可用的 Agent 的实时配置开启对应功能。摘要是 Goal 级聚合,提示仍按单个 Agent 判断,因此一个 Agent 的回执不能授权另一个 Agent。最小修复必须落在现有配置 owner,同时修正两个提示调用者;只改期望开关或前端文字仍会留下错误判定。这个边界没有新增状态、provider I/O、前端操作或平行的 TypeScript 决策源;现有 TypeScript 回忆/应用 owner 未改。

具体改动

验收依据是变更前的 Reward Memory 契约文档(revision 31510ea75c2d95956c624a6828cd06384b4186d5),不是 PR 自述或新测试。Experimental activation 要求按命名 Agent 启用,缺失回执或配置摘要漂移时自动使用不可用:两个提示入口的负例、安装包 CLI/API 读回已覆盖。Recovering a changed binding 所述的 provider 重新验证属于现有流程,本 PR 没有改变或执行它;安装包只用预先构造的匹配合成回执验证漂移拒绝和恢复后的设置投影。文档的 configuration catalog 段要求区分期望和有效自动化:真实配置关闭而期望开启时,已安装包及现有 Goal 设置页都读到有效摄取、回忆为假。文档提到的 qualified experience write、真实 provider 写入及目的地回忆属于更广的质量闭环,本 PR 不宣称完成。

关键代码讲解

  • reward_memory_goal_configuration_summary 保留每个实际可用 Agent 的 resolver 结果,再与各自的 Goal 期望开关相交;期望、历史回执和有效名单仍分别呈现。
  • reward_memory_automatic_ingest_for_agent 先用期望值快速关闭,再复用同一只读准入;未知、别名注册或未验证的 Agent 不会被 Goal 级聚合误放行。
  • handle_support_control_command 在已有身份校验之后将单 Agent 判定送入公开 CLI 提示,保留原身份错误。
  • goal_heartbeat_prompt 为定时生成路径调用同一判定;默认关闭时提示正文与预算保持一致。
  • test_effective_automation_requires_live_config_flags_in_catalog 用真实临时配置、当前摘要及验证回执覆盖“期望开启、实时配置关闭”的错误读回,并核对 catalog。测试文件还覆盖两条提示入口的非白名单、待验证、错误 provider、摘要漂移、缺失回执、身份错误和关闭态一致性。已有 I/O census 仅随 upgrade.py 移动两处 load_registry 行号,I/O 分类不变。

对主干的风险

最重要的反例是同一 Goal 有已验证的 pilot,却让未验证的 meta 继承其提示资格;独立真实配置检查确认 Goal 聚合可为真,但 meta 提示仍为假。配置两项自动化关闭、回执待验证、provider 不匹配及摘要漂移时也不发自动摄取指导;实际漂移修复仍须走原配置预览和 provider 验证流程。关闭功能时,两个入口的正文和预算与无 Reward Memory 的基线相同,且不读配置绑定;判定没有 provider 预检或写权限。现有高级 JSON 设置入口可读回“期望开启/有效关闭”和漂移拒绝;恢复正例使用预先构造的匹配合成回执,只证明投影读回,导航及布局未改。

验证不能写成全绿:当前精确头的 5 个直接检查通过,10 个已选 canary 中 9 个通过、1 个失败;失败的是 heartbeat-prompt --brief 长路径 JSON 输出 12,107 字符超过 10,500 上限。相同 128 字符路径、同一数据在基线 31510ea75c2d95956c624a6828cd06384b4186d5 和本头的 JSON、Markdown 字节及摘要相同,所以该失败不是本 PR 引入;继续比较的 thin Markdown 5,438/5,100 也两边相同。后续差分行未运行,不能称全部预算通过。现有 #5827 拥有 heartbeat 输出预算修复;本 PR 不应调高上限或重复实现。整个 premerge gate 仍是 FAILED,远端 CI 在审阅时仍排队,维护者合并就绪检查必须继续等待。

源码 104 项测试、Ruff、语义检查通过;最终头的 wheel 与 sdist 重建 wheel 各有 102 项安装态测试通过,另有 2 项依赖未分发 TypeScript 源码、只在源码态覆盖。四个产品/清单文件及 20 个 Chat 文件与最终构建字节一致;打包设置读回使用一次性合成回执,没有接触真实 provider、生产 Goal 或已安装用户应用,Windows 与远端 CI 仍是独立证据边界。安装态及页面证据固定于上述 base/head;之后主干又有提交,不能把它们当成新主干上的集成重验。

我的整体评价

APPROVE 对 7354b4c2f34daff2f3a8bb49b4772d5b5533fc38 的代码审阅;不代表可合并。 长期使用上,重复唤醒不再把 Goal 期望误当成某个 Agent 的有效准入;用户体验上,既有提示和设置读回更一致,恢复仍走原有授权流程,没有新增必经步骤。约 371 行新增、21 行删除主要是回归测试,生产改动复用已有 Python 配置投影 owner,大小与两个同源误导问题相称;相关的有效设置修正已在此 PR 完成,没有必要再拆一个平行决策层。它复用既有状态词汇和回执语义,没有新增协议枚举。更广的真实 provider/记忆质量链路仍待其原 owner;当前失败的输出预算由 #5827 处理并在新基线上复核。premerge gate 失败、远端 CI 未完成且这是 runtime 变更,维护者必须在相同精确头完成后续检查与合并决策。

English verdict: APPROVE the code review of 5846@7354b4c2f34daff2f3a8bb49b4772d5b5533fc38: per-Agent prompt admission and effective settings match live configuration. Source 104 and installed 102 tests per artifact passed; the premerge gate remains FAILED on a byte-identical baseline heartbeat budget defect owned by #5827. Remote CI and maintainer merge readiness remain pending.

@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; model gpt-6.1-sol; provider OpenAI; runtime_reported, effort xhigh.

动机

使用 Heartbeat 的 Agent,以及在既有 Goal 能力设置中检查 Reward Memory 的操作者。 同一 Goal 的 pilot 已验证而 meta 未启用时,旧提示仍向 meta 发自动摄取指令;配置关闭但期望开启时,旧设置还把自动化显示为有效。 本头两种提示都只指导当前已验证且实时摄取开启的 Agent,既有设置读回实时有效开关。 此修复不执行 provider 写入,不新增操作或权限,也不验收更广的记忆质量闭环。 这类误导会在后续唤醒中重复出现;修正资格和读回有可验证的局部价值,但不能凭提示正确就推断记忆质量提高。

改动思路

复用现有只读配置准入 owner;提示按命名 Agent 消费它,设置只聚合实际可用 Agent 的实时标志。 本 PR 完成两个既有提示入口和既有设置投影的资格修复;实际 provider 重新验证、经验写回与回忆效果仍由原记忆 owner 验收。 我比较了不修、把 Goal 期望一律关闭、只修 CLI 与新增准入 owner:前两种仍误导或压掉合法 Agent,CLI 单点会遗漏定时入口,另建 owner 会再次复制回执规则。当前设计复用现有 resolve_goal_reward_memory_experiment 的注册、白名单、真实配置、摘要和回执判定,Python 只适配提示与设置投影;既有 TypeScript 回忆/应用 owner 不变。设置仍是 Goal 级聚合,提示是单 Agent 判定,一个 Agent 的有效回执不会授权同 Goal 的其他 Agent。

具体改动

完整核验 5846@7354b4c2f34daff2f3a8bb49b4772d5b5533fc38 的五个文件,比较基线 31510ea75c2d95956c624a6828cd06384b4186d5。独立验收依据为 loopx/capabilities/reward_memory/README.md,revision 31510ea75c2d95956c624a6828cd06384b4186d5,并未按 PR 自述改写验收标准。

  • Experimental activation:按命名 Agent 启用,缺回执、未验证或配置漂移时自动使用不可用。真实 CLI 和定时构造器的八组同输入 base/head 对比覆盖这些状态。旧基线给未启用的 meta 发指令,本头不发;pilot 合法正例仍成立。
  • configuration catalog:期望、历史回执与实时有效状态分开。真实配置两项关闭、Goal 期望开启时,旧有效摄取为 true,本头摄取和回忆均 false;实际 wheel HTTP 与既有设置页读回一致。
  • Recovering a changed binding:原有摘要/回执拒绝及恢复 owner 保留。实际安装包与浏览器看到配置漂移变为 unavailable,恢复原配置字节后读回 verified;这仅验证旧有效绑定的回退恢复,不冒充对新配置的 provider 重新验证。
  • Lifecycle completion boundary:真实经验写入、精确 provider 回读、目的地回忆及记忆质量属于该契约区分的后续边界,本次只读修复未执行,也不宣称完成。

关键代码讲解

  1. reward_memory_automatic_ingest_for_agent:期望关闭先返回 false;其他情况复用现有命名 Agent resolver,只有当前 available 且实时 ingest 为 true 才投影指导。未知/旧别名身份失败关闭,不调用 provider。
  2. reward_memory_goal_configuration_summary:只收集实际可用 Agent 的实时自动化,再与期望相交;原来只凭“至少一个可用”就把两项期望当有效的误判消失。字段、回执与真实配置仍由原 owner 管理。
  3. handle_support_control_command:原身份校验之后把实际调用 registry 的 Agent 交给共享 helper,去掉重复的 Goal 期望判定;原身份错误保留。
  4. goal_heartbeat_prompt:定时提示采用同一 helper,避免第二入口继续错误指导。测试补了真实文件、回执、身份、默认关闭路径;I/O 清单只更新两处既有调用行号。

对主干的风险

未发现阻塞性问题。最强反例是“同 Goal 已验证 pilot → 未启用 meta”,以及把 pilot 回执复制给 meta 但保留错误内嵌身份:实际公开入口均拒绝错误指导。激活后新注册 Agent 也不自动获准。改变注册顺序、增加一百项无关展示数据不改变合法 Agent 的资格。八组实际 base/head 对比中,缺回执、pending、错误 provider、漂移、实时关闭均修复为 false;期望关闭的提示正文和预算逐字节相同,配置/registry 字节未被这些只读入口改写。

独立本头 230 项 Python 测试通过、零跳过;Ruff、diff、语义 advisory 后完整 semantic/census smoke 通过。已重建本头前端、构建 wheel、隔离安装,四个产品/清单文件及二十个 Chat 文件与源码字节相同;五组安装态公开入口与源码一致。Ego 实际操作“设置 → 能力中心 → 单个 Goal → Reward Memory → 既有高级 JSON”,读到期望 true/有效 false,随后实际文件漂移、页面重新读取与恢复原字节均读回正确。既有导航、展示布局、Lark 入口未改;合成回执不能证明真实 provider 验证,未升级用户安装。

语义与 CI 对齐

复用既有 config v1、回执、availability 和自动化词汇,没有新协议、第二决策源、权限或通用领域义务。原五个直接检查与九个 canary 通过,但 premerge 仍 FAILED:heartbeat_prompt_brief/json 的 128 字符绝对根路径输出 12107 > 10500。我独立用同一命令重现基线与本头失败,另用同一绝对路径、同一 fixture 捕获,两边 brief JSON 和 Markdown 的完整字节及摘要相同;默认关闭路径也未变化,故该预算失败归因于未改基线,不能算本 PR 回归,也不能写成全部检查通过。原 #5827 拥有预算修复;没有放宽阈值,后续预算差分不称已全通过。按当前审查配置未读取、轮询或等待远端 CI。

我的整体评价

APPROVE 本头代码评审,合并就绪仍须单独判断。 长程效果 improved:后续唤醒不再把 Goal 期望当作当前 Agent 准入,配置漂移也不会继续伪装有效;体验 improved:同一条既有路径的读回更可信,无新增必经确认。主要新增为 307 行回归覆盖,生产改动沿现有配置 owner 收束两处重复判定,相关设置修正同批完成,规模与问题相称,未来维护减少重复规则。明确启用时多一次本地配置读取是成本,默认关闭不读绑定;这轮没有测到净 token、compute 或耗时改善,不能把避免错误指导直接当成量化效率提升。真实 provider、模型和长期记忆效果保留其原验收边界;既有预算失败及维护者合并 gate 保持可见,不据此自合并或宣称本机采用。

English verdict: APPROVE — 5846@7354b4c2f34daff2f3a8bb49b4772d5b5533fc38. Independent whole-PR review verifies exact per-Agent prompt admission and truthful live automation settings: 230 source tests, eight base/head public-path cases, three scope counterfactuals, five installed cases and the packaged settings drift/recovery journey passed. Premerge remains FAILED on the independently byte-identical baseline brief-output budget; no remote CI, provider qualification, model-efficiency or merge claim.

@huangruiteng
huangruiteng merged commit 1eed1c4 into loopx-project:main Oct 7, 2026
20 of 46 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.

3 participants