Skip to content

refactor(feedback): defer retained-state mutation adapters - #8339

Open
cocolord wants to merge 3 commits into
mainfrom
codex/small-kernel-feedback-successor-20261108T0516
Open

cocolord wants to merge 3 commits into
mainfrom
codex/small-kernel-feedback-successor-20261108T0516

Conversation

@cocolord

@cocolord cocolord commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Importing the shared feedback validators previously required the retained-state writer and legacy writer-fence adapters, so pure validation failed when either mutation dependency was unavailable. Load those two existing adapters on first use. Reward mutation resolves both before registry reads or writes, then retains the original guard and writer call sites, including module-level patches made during a call.

This continues the accepted monorepo distribution RFC after #8302 landed. The proposal changes four files over target main 0ed909880326a05a35c4ae7ca1708eca3abf31d3; it uses the existing feedback adapter and TypeScript rule owners. It adds no capability, product configuration, persisted protocol or authority cache. The local compatibility map and module export hooks preserve all 50 original star-export names and the original adapter objects, index/state lock order, credential refusals and partial-write behavior.

Validation on proposal head 6d1b38822f2870e36853c828b9fda25d56d1a08b:

  • 48 adapter/write/recovery cases and 265 shared feedback-policy cases pass, as do focused mypy and Ruff. Independent unavailable-adapter cases fail on the original parent; candidate validation works and a missing writer fails before reward mutation. The earlier integration's 291 policy and 48 boundary cases remain historical evidence.
  • A newly built, isolated wheel matches 1,841 packaged tracked source files after installed-module ownership is asserted outside the checkout with PYTHONPATH cleared. Five existing source-only omissions remain. The wheel was built at 8f3cc15414baa4a5a782211637adac6f4f30bdd1; the final commit changes only the paired RFC and preserves those production bytes.
  • Four fresh source/wheel × File/SQLite 101-Todo CLI lifecycles on the changed main baseline pass the original artifact, completion-time, scope, four-receipt, one-debit, restart, refusal and replay oracles. Both managed native daemons exit per case. They use default bytecode and qualify correctness; no prior lifecycle or frozen cost sample is counted as a new performance result.
  • The existing dashboard Chat bundle builds for wheel preparation. There is no UI source or caller-facing operation change. All four proposed files pass the public-boundary scan; the separate full registry check retains unrelated canonical-authority errors.

Exact-head standard premerge passes all six direct checks and all 14 selected checks (five catalog, eight risk-profile and one public-boundary check). The existing peer hard-cut failure from the preceding transaction proposal remains historical evidence; this feedback diff does not select or change that boundary. Independent review, CI and merge readiness remain separate gates; no merge authorization is claimed.

Whole-path and full marginal-cost benefit remain unqualified. No new PostgreSQL host/wheel, model/attention or installed adoption qualification is claimed. Preserve the frozen failures and remaining I3/minor-release, M1/#8011, full R0/V10/R1, D2/D5/D6/D3 and context/model/split-install/full-cost/adoption acceptance in the English and Chinese checkpoints. The original task stays open for the actual quota/context/refresh callers' remaining qualification.

cocolord and others added 3 commits November 8, 2026 13:13
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@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.1-sol | OpenAI | runtime_reported | reasoning_effort=max

动机 / Motivation

维护 CLI、状态刷新及共享校验入口的人,需要在只读校验时避免加载与该任务无关的写入依赖。以前只导入反馈校验函数也会强制加载两个状态写入适配器,缺少其中任意一个就无法校验;改动后纯校验可继续,真正的 reward 写入仍先确认两个依赖可用,再读取或修改状态。独立缺依赖对照从旧版三种导入失败变为此 head 三种校验成功,同时凭证拒绝保持。这次只交付现有 feedback 模块的加载边界,不新增 provider、配置、数据格式或用户操作,不宣称完整小内核、性能收益或安装采用已经验收。完整 R0/V10/R1、I3 至少一个 minor release、M1/#8011、D2/D5/D6/D3、context/model、split-install、完整成本和采用资格仍保留。

改动思路 / Approach

两个按需导入入口只缓存原函数对象,既有 TypeScript 写入判定与 Python 持久化边界保持;兼容入口服务已发布的导出和 patch 点,不建立第二个规则 owner。当前边界是纯校验与既有 reward 写入的依赖隔离,以及完整导出兼容;后续加载决策仍由现有 quota/context/refresh callers 沿 RFC 继续。直接把两个 import 移入写入函数更短,却会丢失原模块级导出或改变调用中途 patch 的生效位置。这里保留现有符号并在原调用位置重新取 binding;没有改权威判定、锁或写入算法。

具体改动 / Changes

关键代码讲解

准确 head 6d1b38822f2870e36853c828b9fda25d56d1a08b,相对真实 merge base 0ed909880326a05a35c4ae7ca1708eca3abf31d3 为四个文件 +233/-4:feedback.py +35/-4、聚焦测试 +90,以及双语 RFC 检查点 +59/+49。队列的目标分支观察值是 94366314f0ba281b97b6ff2fc90b929320b163af;没有把主干后续提交算成作者改动。

  • loopx/feedback.py:32 的 __getattr__ 仅为两个已发布名称导入原 owner,并缓存原函数对象;未知名称仍抛 AttributeError。
  • 第 45 行 _mutation_adapter 优先读当前模块 binding;第 516、525 行仍在原 guard/writer 位置取值,因此 guard 调用中替换 writer 的行为不变。
  • 第 427 行 append_human_reward 在 441–442 行先解析两个依赖,再走原 actor、Goal、registry、index/state lock 和写入顺序。writer 的 OSError 仍表示 index 已提交、摘要未完成,不能冒充整个写入回滚。
  • 第 655 行 __all__ 和第 41 行 __dir__ 保留原模块可发现性。独立完整 star-import 名称对照为 50/50 相同,两个函数仍是原 owner 对象。

规范依据:docs/architecture/rfcs/monorepo-distribution-split-v0.md,固定修订 0ed909880326a05a35c4ae7ca1708eca3abf31d3。I2、I3、I7、I8 在本切片 implemented:唯一规则 owner、历史导出、未使用写入依赖不加载及既有拒绝/恢复保持。I9 implemented 指正确披露资格范围:未把测试数或导入边界当成 whole-path 性能收益,未关闭父级资格。

独立验证:普通写入、摘要写入、dry-run、缺 actor、注入 Todo、调用中途 writer 故障、并发 Todo 变更及真实 loopx reward 共八组完整返回值、异常、registry/state/index 观察,在 parent/head 逐项相同;只归一 fixture 和 checkout 路径前缀。最新主干 a02be126957953b7a61796e3b99fcfe578eb5174 的独立合并树也通过八组完整结果对照。

既有 47 项相关测试在 parent/head 均 PASS;新增适配器测试 3 项、mypy、Ruff PASS。最初各有 8 项冷接收端 setup ERROR,原因均是未构建 loopx/web/chat/bundle-manifest.json;完整错误行一致。构建各自现有 Chat 资源后,同样 8 项真实 File/SQLite、物理/别名 registry、源码模块存在/缺失组合,在 parent/head 和最新主干合并树均 PASS,没有删改断言。精确 head 标准 premerge 的 6 direct/14 selected PASS。

另从此 head 构建并隔离安装 wheel,清空 PYTHONPATH、在 checkout 外核对实际模块来源、feedback.py 字节、50 个导出、原 owner identity 和缺写入依赖的纯校验,均 PASS;未把它冒充全 wheel 生命周期或已安装 Host 采用。没有查询或等待远端 CI。

对主干的风险 / Risks

未发现阻断问题。 最强风险是缺 writer 时先提交 index、稍后才发现不可写,以及延迟加载意外绕过 guard 或破坏 patch 点。入口预解析、原调用位置取 binding、真实拒绝/并发/部分写入对照和 File/SQLite 冷路径覆盖了这几个边界。纯校验的缺依赖成功是有意变化;可用依赖下没有改变业务默认、调用参数、提示、持久格式或已验证状态输出。

语义与 CI 对齐

复用原导出及规则,未增加共享词汇或语义分类。两个字符串键只是原函数名称到原模块的本地映射。未引入 opt-in 开关,也没有把安装或模块可发现性当成执行授权。首次缺资源错误保留为准备失败,其修复是构建相应源码的既有资产,不是修改产品或放宽测试。完整性能、PostgreSQL Host/wheel、跨平台和真实模型/采用证据没有在本审新增资格。

我的整体评价 / Verdict

APPROVE,属于有边界的有效增量。 两个按需导入入口只缓存原函数对象,既有 TypeScript 写入判定与 Python 持久化边界保持;兼容入口服务已发布的导出和 patch 点,不建立第二个规则 owner。当前边界是纯校验与既有 reward 写入的依赖隔离,以及完整导出兼容;后续加载决策仍由现有 quota/context/refresh callers 沿 RFC 继续。long_horizon 与 user_experience 均为 preserved:可用依赖下的写入、权限拒绝和结果读回保持,没有增加用户配置或确认轮次。视觉检查为 not_applicable:检查的 loopx/feedback.py 不改任何渲染源码;未验证范围是视觉布局、全套 wheel 生命周期、Windows/PostgreSQL Host 及真实安装采用。保留当前兼容入口,后续按原 I3 窗口退休;没有合并授权。

English verdict: APPROVE — 6d1b388; lazy mutation adapters preserve the validated write boundary and all 50 exports. Native checks and real File/SQLite paths pass; broader performance and adoption remain unqualified.

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.

2 participants