Skip to content

fix(runtime): defer unselected context and retirement implementations - #8671

Merged
cocolord merged 1 commit into
mainfrom
codex/rfc-r1-demand-load-20261113t050607
Nov 13, 2026
Merged

cocolord merged 1 commit into
mainfrom
codex/rfc-r1-demand-load-20261113t050607

Conversation

@cocolord

@cocolord cocolord commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

A full installed core Turn loaded OpenViking, BM25 and anti-entropy inspection code even when that workflow was not selected. Defer implementation imports through the existing package exports and builtin provider registry; share the unchanged OpenViking URI classifier with binding normalization, and resolve retirement feedback after its existing activation/applicability checks.

公开导出、builtin 重复注册拒绝、custom builder、URI 分类及序列化兼容保留。原 typed authority、claim、stop 和 settlement owner 继续生效。声明源码移到纯 scope 文件,旧模块别名不能保留源码 introspection。

Full-Turn tracing on isolated File and SQLite reduces loaded LoopX modules (including root) from 525 to 516 for execution and 438 to 432 for replay. Capability modules fall from 111 to 102 and 56 to 50. RPC counts stay at 221/220 and 11. A separately checked artifact commits with one settlement; confirmed replay has no Host/state/quota effects.

Validation:

  • PASS: 628 source capability tests, including 12 fresh-process loading/export/serialization checks; 275 full-Turn/context companions also passed during implementation.
  • PASS: final standalone Python 3.11 wheel has 1886 source-byte-equal runtime files; both installed core/context suites pass 22 cases, including process-loss recovery, released-lease refusal, invalid-artifact rejection and context compaction/lost-ACK.
  • PASS: original 11 loading/export checks on immutable base fail five loading oracles and pass six compatibility cases; 16 URI success/refusal cases and protocol-4 pickle bytes match, with cross-version reads passing both ways.
  • PASS: 40 matched installed calls preserve independent result/effect fingerprints and output sizes. Five alternating pairs per backend/phase retain every sample in local evidence; aggregate medians/p95 and RSS are in the paired RFC checkpoint.
  • LIMIT: SQLite execution median is 2922.5 → 3006.8 ms; replay is 809.6 → 889.0 ms. The candidate has a higher tail; this change qualifies reduced unselected loading, without claiming latency improvement or complete-cost acceptance. RSS excludes the persistent Node server; OS caches, complete IPC/I/O, model tokens, service cost and human attention remain unqualified.

The bilingual minimal-kernel RFC checkpoint records the exact boundary. Host execution is synthetic; full V1–V5/V10, real model adoption/recovery, progressive product control, R1/M3, Standard split-package publication and original-goal regression remain open. No preset, provider default or release is promoted. Rollback is the single commit revert through the usual PR path.

Premerge PASS at 59f2db91495287d1bcade8447f5a743b8f271a05: 14 selected checks, no failures; bilingual RFC and scoped public-boundary scan pass. Change-quality policy is disabled. The initial missing-TypeScript-dependency failure is retained and superseded by the unchanged-head rerun after environment preparation. Full exact-head review: #8671 (review)

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@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: actor_kind=model_agent; declared_model=GPT-6; declared_provider=OpenAI; declaration_source=self_reported

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

动机 / Motivation

使用独立 core 运行普通任务的调用方,即使没有选择远程检索或代码退休,也会遇到这个问题。 例如只生成并检查一个本地产物,旧版本在读取配置与组装 Turn 上下文时仍加载远程检索、BM25 和退休检查实现;新版本将这些实现留到明确选择后再解析。 可观察结果是同一任务完成、检查和结算行为保持一致,完整执行与确认重放减少未选择实现的加载。 本 PR 不发布 Minimal preset,不更换 provider 默认值,不放宽治理规则,也不认定模型采用或 R1 已完成。 完整最小闭包、真实模型管理的恢复、渐进控制和完整成本仍缺验收证据。

这里修复的是已复现的运行路径问题:构造配置和任务上下文不应顺带选择无关实现。模块计数只用来定位和验证这条链,不能证明长程效果、用户留存或净成本收益。候选版本的 SQLite 耗时观测更慢,不能把这次修复包装成性能提升。

改动思路 / Approach

复用原 registry、URI 语法和激活 owner,才能同时切断两条提前加载链并保留正常 provider 与退休行为。 本轮边界是完整已安装 Turn 的未选择实现按需加载,以及该边界的兼容、恢复和成本证据。 我检查了基线与 head 的真实调用者,包括 decision_context、issue_fix、Reward Memory 绑定以及 native Turn 的退休上下文注册。仅移除 package 的 eager export 不够:绑定分类仍会直接导入 OpenViking transport;复制 URI parser 则留下两个规则 owner。本次将原类和 parser 单源搬到纯 provider-domain owner,原 provider 与 normalization 都复用它。Python 继续承担已有 provider 计算和导入适配,没有创建第二个治理决策 owner。

公开包的导出表是本地名称解析,factory 保留两个原 builtin id 的预注册与重复拒绝。只有选中 provider 时才加载其 builder。Anti-entropy 先走原 selected Todo 激活与 basis 适用性判断,再解析原 feedback。停机、lease、quota、validation 和 settlement 继续由已有 typed owner 处理;可选实现不会因此获得义务或副作用权限。

实际触发 基线 本次 head
读取类型/绑定配置 提前加载 BM25、OpenViking 纯类型/URI 分类,保留原结果
普通/无目标退休任务 package 提前加载检查实现 原空输出或 not-applicable,不加载 inspector
明确选中 provider/退休目标 原实现运行 同一实现按原 gate 运行

具体改动 / Changes

审查范围是 base 441c6077e7c5c8e896ea79562761fd483baf157e 到 head 59f2db91495287d1bcade8447f5a743b8f271a05,11 个文件 +534/-157:八个生产文件主要搬移原定义并延后导入,一个 191 行 fresh-process 测试,两个双语 RFC checkpoint。没有新增 persisted schema、CLI 参数、shared vocabulary、服务或生成物;raw 观测与环境锁文件不在 PR。

规格来源是 docs/architecture/rfcs/monorepo-distribution-split-v0.md,spec_revision=441c6077e7c5c8e896ea79562761fd483baf157e,按本次修改前的第 5、9、11 节判断,不能用新 ledger 自证验收。逐项边界如下:V1 完成这两条未选择加载链的修复,但两 presets 与完整 OS closure deferred;V2 保留真实 File/SQLite 的治理与一次结算,完整 preset parity deferred;V3 公开导出、URI diagnostics、installed CLI 回归通过,完整 corpus deferred;V4 真实 backend 的产物与恢复通过,synthetic Host 不满足真实模型任务;V5 installed context 恢复通过,模型采用仍 deferred;V10 本次有配对成本观测,但完整成本 deferred;R1 整体 deferred;M3 独立发布仍 deferred。继续已有 R1 验收即可,不需要为了此次合入创建新 Goal、Agent 或形式化 successor。

关键代码讲解

  1. context_providers.getattr 把公开名字映射到原 module,显式属性/from/star 访问得到相同 owner 对象,未知名字仍 AttributeError。原 all 保留,不把 package 安装或导入解释成 activation。
  2. factory.build_context_provider 仍按原 configured provider id 取 registry builder;未知/空 id 的完整 ValueError、重复 builtin 注册拒绝和 custom builder 调用保留。deferred builtin wrapper 只改变何时 import 实现,真实 BM25 检索与 scope 拒绝均经过检查。
  3. classify_openviking_scope 的 AST 与原 parser/class 一致。application、experiment 和实际 provider 的 _validated_scope 指向同一函数。16 类合法/非法 URI 的字段、完整错误和 protocol-4 pickle 字节一致,两个安装版本双向读取通过。旧公开模块名保留;声明源码 introspection 不保留,这是明确的结构变化。
  4. anti_entropy.getattr 保留原公开对象及命名,只取消 contract/registration 入口对 agent_tool、oracles、feedback 的提前加载;显式调用 inspector 仍到原实现。
  5. anti_entropy_context_result 在原 disabled 和 no-basis 分支之后才取 patchable feedback builder。八类 installed base/head 输出逐字节一致,涵盖 availability-only、选中目标、同容器未选中 Todo、后来新增无关 Todo、scope escape 和 recovering;native CLI scope matrix 也通过。没有弱化 inspect/fix 指令或改成 Goal-wide activation。

对主干的风险 / Risks

最强反例是 isolated export 测试通过,但真正已安装 Turn 仍加载无关实现,或 enabled/disabled 的指令、provider registry 身份、pickle 和 replay 副作用发生变化。这里分别经过 fresh process、完整 installed CLI、实际 File/SQLite、真实本地 BM25、完整输出比较、独立产物 validator 与原 key 重放验证。回滚是经 PR revert 单个提交;未知效果仍交给原 journal recovery,不能重发已确认工作。没有访问真实 OpenViking 服务或付费模型;这两项没有改动的 IO/模型行为不被包装成已验证收益。

PASS:628 项 source capability 回归;22 项最终独立安装 core/context 回归;275 项实现期间 full-Turn/context companion 回归。原 11 项加载/导出 corpus 在不可变 base 上五项加载 oracle 失败、六项兼容通过;最终 head 的 12 项检查通过。最终 wheel 的 1886 个 runtime 文件与 head source 字节相同,SHA256=bc36c92dd437b9418e21031e185fefd04984c91a30169cbd866a3c712d92b4fa。完整 Turn 模块数含 root 为执行 525→516、重放 438→432;capability 111→102、56→50;执行 RPC 221/220、重放 11 保持。模块减少不是完整闭包验收。

40 次交替配对调用的独立结果/副作用指纹一致,stdout 是执行 4002、重放 4548 bytes。macOS27 arm64、Python3.11.15、Node26.0.0;首次执行前正常停止隔离 RPC 服务,使其重新启动,重放复用已运行服务;OS/bytecode/compile caches 不重置。每 arm 五次,nearest-rank p95 是最大样本。

路径 Wall median/p95 ms,base→head RSS median MiB,base→head
SQLite 执行 2922.5/3561.9→3006.8/4139.9 81.81→81.25
SQLite 重放 809.6/948.6→889.0/1415.0 44.73→44.42
File 执行 2858.7/3005.5→2862.5/2985.0 81.09→81.36
File 重放 645.4/679.7→692.5/773.9 44.73→44.28

SQLite 中位数及尾延迟更高;这不是通过的性能改善证据,也没有足够证据把原因归到 Host 噪声。RSS 不包含 persistent Node peak/cumulative 使用;block I/O=0 不证明零文件访问。Python/Node observer 的控制样本通过,但不是 OS 级网络/进程全量观测。完整 IPC、model tokens、service cost 与人工注意力仍 unqualified。此前冻结的 Dashboard 和 startup 失败不被重标或放宽。

语义与 CI 对齐

完整 diff advisory 与 semantic check 复用原词汇/owner,未新增 generic control-plane 义务;provider-specific URI 错误留在 provider,typed 选中规则未换成 prose/substring classifier。明确禁用/不适用路径保留原 schema、guidance、accepted input、state、scheduling/quota 和无副作用语义。

最终 premerge PASS,14 selected / 0 failed,含 compile、maintainability、完整 semantic、双语 RFC 和 scoped public boundary。第一次缺 TypeScript 验证依赖的失败已保留;npm ci 后同 head 全部通过。Scoped public scan 11 files PASS;whole registry health 的既有 canonical-state errors 仍不是通过。CQR policy disabled,没有伪造 receipt。

远端 kernel-static-checks FAIL 的唯一诊断是 tests/test_lark_private_conversations.py:2816:86 的 F811(ordinary 与 line12 import 重名)。相同 python -m ruff check tests --output-format json 在 immutable base 和本次 head 都 exit1,归一化诊断完全一致;此文件与该因果路径未改。已有 #8657 的 lint 修复保持独立。其他红/跳过/pending CI 作为 diagnostic,未知原因保留 unresolved,不谎称全部绿色。受影响 invariant 有独立当前覆盖;合入仍需 unchanged-head readiness、threads 和单独 maintainer authority。

我的整体评价 / Verdict

这是 justified_increment,long_horizon 和 user_experience 在受影响执行/恢复路径上 preserved:已确认工作、durable result、lease 恢复与一次 settlement 保留;已知意图/权限不会增加输入、确认、导航或配置轮次。它不是长程净成本改善或真实模型 adoption 的证明。本 PR 没有改变渲染页面;实际改动位于 Python 导入、provider 注册和退休上下文组装路径。 unverified_scope: none: no rendered presentation changed。

我支持保留这组单一 owner 的修复:复用原 registry、URI 语法和激活 owner,才能同时切断两条提前加载链并保留正常 provider 与退休行为。 本轮边界是完整已安装 Turn 的未选择实现按需加载,以及该边界的兼容、恢复和成本证据。 已实施的 bounded simplification 是移走原 parser 而不复制、沿用 factory 和 feedback 而不建通用加载框架。公开导出兼容成本是有限 alias 和 metadata,独立版本读取已验证;source introspection 与更慢的观测保留为明确风险。没有已复现未解决的 blocking finding。APPROVE 仅针对 59f2db91495287d1bcade8447f5a743b8f271a05 的这项有用前提;全 R1、M3、真实模型任务与原始九项目标回归继续开放。

English verdict: APPROVE — 59f2db91495287d1bcade8447f5a743b8f271a05 fixes reproduced unselected implementation loading while preserving verified provider, activation and installed File/SQLite result/replay semantics. Final source 628, installed 22 and premerge pass. Slower latency observations, source-introspection limits and unrelated/diagnostic CI remain explicit; full R1 and complete-cost acceptance stay open.

@cocolord

Copy link
Copy Markdown
Member Author

Maintainer merge decision for unchanged head 59f2db91495287d1bcade8447f5a743b8f271a05.

Full capability-owned policy-26 review is published and read back at review 5886770726, with the author-owned COMMENTED approval conclusion. Its exact remote body passes result checking. Approval closeout is clear; readiness reports complete threads, zero unresolved findings and a mergeable open head. Local main remains the verified target 441c6077e7c5c8e896ea79562761fd483baf157e.

Required local evidence passes: source capability regression 628; final installed core/context 22; the original 11-case loading corpus passes at final head after five genuine loading failures on immutable base; 16 URI/serialization and eight activation/scope comparisons; real isolated File/SQLite execution/recovery and 40 checked task/replay invocations; final premerge 14 selected / 0 failures; bilingual RFC and scoped public boundary. Change-quality qualification is disabled, with no invented receipt. The independent wheel matches all 1886 source runtime files.

Readiness is ready=false: failing kernel-static-checks and dependent/aggregate checks plus the separately observed pending browser check. The only kernel-static diagnostic is the unchanged Lark-test F811; the same lint command on base and head produces identical normalized diagnostics. Other CI observations are diagnostic, with independently passing current coverage for the changed invariants; no remote success or unknown cause is fabricated. Existing #8657 owns the separate lint repair.

Existing explicit maintainer authorization permits an admin override of this GitHub/readiness hold. It does not waive exact-head review, validation, findings or conflicts; those prerequisites are satisfied. Merge only this unchanged head. The delivered value is removal of reproduced unselected implementation loading. Slower measured SQLite latency and source-introspection limits remain disclosed; this decision does not qualify latency improvement, complete costs, real model adoption, full R1 or original-goal completion. Rollback remains a single-commit revert through the usual PR path.

@cocolord
cocolord merged commit 31ff056 into main Nov 13, 2026
31 of 37 checks passed
@cocolord
cocolord deleted the codex/rfc-r1-demand-load-20261113t050607 branch November 13, 2026 05:53
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