Skip to content

refactor(runtime): defer process transport at core callers - #8218

Open
cocolord wants to merge 1 commit into
mainfrom
codex/small-kernel-doctor-loading-20261106
Open

cocolord wants to merge 1 commit into
mainfrom
codex/small-kernel-doctor-loading-20261106

Conversation

@cocolord

@cocolord cocolord commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Pure Turn-decision imports selected process transport through four existing callers. This proposal defers those imports while preserving the original exported functions and caller patch points. It restores the existing unselected-module oracle without changing subprocess algorithms, decisions or deadlines.

纯 Turn-decision import 原来会经四个调用方加载进程传输。本提案仅调整加载时机,保留原函数对象和补丁点,使既有隔离 oracle 通过;进程算法、决策和 deadline 保持原 owner。

Author Declaration

  • Written by: model_agent — GPT-6 (OpenAI), via TRAE CLI.
  • Specification and revision: the bilingual small-kernel RFC at the baseline above; V1/V3 and I3 scoped to these existing caller imports.
Criterion Disposition Owning path Evidence
V1: unselected dependencies stay cold implemented for the four callers and pure Turn-decision import Doctor Git, contract, validation command, Host bridge transport Cold-caller tests and unchanged architecture oracle
V3 / I3: existing imports remain compatible implemented within this slice Same four modules Direct/from/star imports, complete public name sets, original identity/signatures, module patch points, preloaded owners and reload
Keep typed decisions and existing transport owners implemented Existing TypeScript callers and extensions/process_runtime.py No changes to either decision or process algorithm
Full preset, install and managed-Turn acceptance out_of_scope Existing RFC owners Remains open; a monolithic wheel is not split installation or adoption
  • Self-check: reviewed all seven changed paths, original callers and negative oracles, compared immutable baseline/head public surfaces and real registered previews, and scanned the public diff. The bounded refactoring pass was applied at the four active import boundaries; a shared loader framework and unrelated Python rewrite were unnecessary.

Scope And Continuation

Complete within this author-proposal scope. Python remains platform transport; no capability, provider, default, authority or persisted state is added. Local export-name sets describe existing compatibility, not a new shared vocabulary.

The full registered preview still selects transport. Its remaining dependency closure and full R0/V10/M1/R1/context/model/install acceptance, D2/D5/D6/I3/D3, and I3's minimum minor-release window remain open. Existing M1 work retains its #8011 dependency. Reverting this proposal restores eager bindings without migration.

该作者切片完整且可独立回滚;完整 preview 仍会加载 transport,完整内核、安装、采用和性能验收保持开放。Canary 的既有失败仍需独立修复,不能据此认定整体验收通过。Runtime 合入留给 maintainer。

Validation

  • Tested revision: e32d4db3ceca9b4a8b7f3ea7a0dc7291e8edde48; immutable baseline 7f521ff4505fa916a98a7401032922189eef414a. Tests used the same final product/test file bytes; final bilingual/diff checks were rerun after the checkpoint's failure disclosure.
  • Run state: finished.
  • Input classes: synthetic, public_fixture. Python 3.13.5 on macOS arm64; disposable Git repositories, SQLite authority and subprocesses; no model or benchmark jobs.
Check kind Result Evidence / limitation
static passed Focused Ruff, diff-scoped semantic advisory, DCO and staged/head bilingual checks. The advisory detected no supported vocabulary carrier; export sets remain local compatibility metadata.
unit / real_entrypoint / real_backend passed Source: 178 passed, 2 platform skips across tests/test_process_runtime_loading.py, tests/architecture/test_control_plane_import_boundaries.py, the existing doctor/contract Git tests, validation cleanup, Host process, stdin-deadline and process-runtime suites.
integration / real_entrypoint passed Newly built monolithic wheel installed outside the checkout: 150 passed, 2 platform skips across the same process/compatibility suites. Wheel Turn-decision cold import and complete public name/signature parity also pass. Existing hosts were not upgraded.
regression_parity passed Original real-path suites on the immutable baseline: 118 passed, 2 skips. Four new cold-import oracles fail there. Complete discovery/star name sets and exported signatures match. Accepted and rejected registered SQLite previews preserve the entire returned envelope and signed action, apart from the fresh source-decision digest. Native sequences match: 2 Node starts, 13 Git probes, 62/61 connection observations respectively.
real_entrypoint passed Source and wheel help/unknown-command output and exit codes agree with baseline. Pure import/help have no process/connection effects; real registered previews retain their required native effects and still select transport.
static / integration failed Standard Canary: six direct checks passed; 17 of 18 selected checks passed. examples/project/first-connect-contract-smoke.py:146 raises KeyError: should_run on both baseline and proposal because its helper assumes an inline field. This remains a validation hold.
integration not_run Full CI, full-tree mypy and browser acceptance are not qualified by these focused runs. Existing #8212 lint/browser failures and skipped aggregate checks retain their separate status.

Coverage includes timeout/Ctrl-C cleanup, exited-leader descendants, Git unknown/error behavior, validation receipts and stdin restoration, bridge framing/backpressure, and refusal to certify unobserved cleanup. The transport implementation is reused. Windows cases were skipped on this host; no Windows qualification, performance uplift, host adoption or merge readiness is claimed.

Frontend / Visual Evidence

UI impact: none. Existing CLI contracts remain compatible; the RFC checkpoint adds evidence only. The unchanged Chat bundle was built solely to produce a complete wheel and is not part of this diff.

Change Type And Area

  • Refactoring (no functional changes)
  • Documentation update
  • Test update
  • Primary area: control plane and host/runtime integration.
  • Technical direction: small-kernel RFC V1/V3 loading and compatibility.
  • Shared-authority RFC fixture impact: N/A; authority-store semantics, routing and promotion are unchanged. Real SQLite is used for preview readback only.

Boundary Checklist

  • Public-safe diff and body; no private state, raw traces, credentials, internal links or local paths.
  • Scoped to the accepted caller loading proposal; no duplicate benchmark work.
  • Bilingual RFC staged/head checks pass.
  • UI impact is none.
  • All commits include DCO sign-off.

Normal review proposal with the Canary hold disclosed. Maintainer review, required validation and explicit runtime merge authorization remain separate gates.

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.

结论:APPROVE,这批加载边界没有发现阻塞缺陷;仓库仍有独立验证 hold,不能据此合并。

动机 / Motivation

运行 Turn 预览或只导入控制平面的调用者,需要在未使用进程能力时保持该依赖未加载。 此前仅导入 Turn 决策入口,就会经 Doctor、contract、validation 或 Host bridge 加载进程传输;本提案把这四个入口的绑定推迟到实际取用,保留真实进程调用的原实现。 当前源码的既有冷加载 oracle 已通过,四个模块的公开名称、star import、函数对象和签名与基线相同。 本次不交付拆包安装、完整 minimal preset、Host 升级、模型采用或性能净收益。 完整 V1/V3、R0/V10、M1、安装与长程收益资格仍由既有 RFC 路径继续;本次只交付四个在用调用方的加载边界。

改动思路 / Approach

四处局部 lazy reexport 复用既有 Python 模式,进程算法留在 extensions/process_runtime,决策和 deadline 留在原 owner;没有理由为四个绑定新增全局 loader 框架。 保留四个公开调用方、原函数对象和补丁点,仅推迟未选择依赖的加载;完整 preview 依赖闭包与安装采用另行资格化。 未改动进程执行算法,也未新增 capability、provider、持久状态或权限。真实调用从原函数对象进入原 OS transport,取消、deadline 和“未确认清理”的失败仍由既有调用者处理。这里的收益是修复可重现的依赖边界,不能用减少一个 import 推导性能或长程收益。

具体改动 / Changes

精确审阅 e32d4db3ceca9b4a8b7f3ea7a0dc7291e8edde48,比较基线 7f521ff4505fa916a98a7401032922189eef414a:7 个路径,生产代码四个 +150/−10,测试一个 +186,双语文档两个 +72。

关键代码讲解

  • doctor_git.getattr / _export:未知属性仍抛 AttributeError;有效名字按首次实际访问绑定原函数。内部 probe 通过模块绑定查找,因此原调用方补丁点仍有效;预加载 owner 和 reload 也有对应检查。
  • run_caller_validation:只改函数解析位置。timeout/KeyboardInterrupt 仍对整个 owned process tree 立即清理,原 argv、cwd、stdin、退出码与 receipt 保持;已退出 leader 的存活后代也经过真实进程测试。
  • GuardedHostBridge.send / cancel:ready framing 后才写入,复用原 stdin deadline。发送前终止 bridge 不冒充 Host 清理,发送后缺少完成观测仍报 cleanup unconfirmed。

规格是 docs/architecture/rfcs/monorepo-distribution-split-v0.md,按提交 7f521ff4505fa916a98a7401032922189eef414a 的原要求判断:I3 在这四个已有公开入口 implemented;V1 的四个冷调用方增量已验证,完整 preset 范围 deferred;V3 的本次命令/进程路径已验证,完整 supported-command corpus deferred。新 checkpoint 不能自行关闭这些后续资格。

对主干的风险 / Risks

最重要的反例是“冷加载测试绿,但内部调用绕过 monkeypatch 或取消只杀 leader”。我运行的源码进程/兼容性集合为 178 PASS、2 平台 SKIP;基线原集合 145 PASS、1 FAIL、2 SKIP,失败正是既有 Turn import oracle 提前选择 process_runtime。另有原 CLI capture/source-change/retry 的 File/SQLite 8 对 8 PASS,Host 为确定性替身,Core、CLI、存储与原始 capture 是真实路径。完整公开名称、star import 和 callable signature JSON 相同;顶层、quota、turn help 与 unknown-command 的文本/退出码在仅归一化 checkout 前缀后相同。

语义与 CI 对齐

configured Mypy 的 17 个入口、TypeScript typecheck、改动 Ruff、双语/diff/compile 检查通过。standard premerge 六个 direct 检查通过,18 个 selected 中 17 个通过。first-connect-contract-smoke.py:146 的 KeyError: should_run 在基线和 head 的完整 traceback 相同;仓库必需 Ruff 仍有 test_goal_create_completion.py:184 的同一 F841,完整诊断及其文件/配置未变。它们均保留 FAIL 和 strict CQR hold;当前变更的独立通过证据支持 review approval,不把这些失败改记为 PASS。本轮遵守原生策略,未查询或等待远端 CI。

我的整体评价 / Verdict

这是可独立回滚的 justified_increment;long_horizon 和 user_experience 在已检验的源码路径上 preserved,无新增操作轮次。未修改渲染页面;检查了四个内部调用方与 CLI help/错误入口,未触及页面布局。 未验证范围:本次未独立重建 wheel,Windows、完整 preset、安装采用、真实模型及全成本收益均不作通过声明。四个局部绑定仍比新增 loader 框架更合适,export tuple 是 local compatibility metadata;required lint、Canary、CQR 和 maintainer merge authorization 继续各自约束合并。

English verdict: APPROVE the bounded source loading refactor; preserve the independent validation and merge holds.

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