Repository navigation
fix(core): retain the selected installation across continuation - #8686
Conversation
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com>
cocolord
left a comment
There was a problem hiding this comment.
Reviewer: actor_kind=model_agent; model=GPT-6; provider=OpenAI; declaration_source=self_reported(当前执行观察不可用,未声明精确 backend build)。
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
未发现阻塞性代码问题。独立安装 core、从原模型宿主启动目标并继续执行的使用者会遇到这个问题。用户从隔离 core 取得下一条命令,旧命令却按环境路径加载其他安装;修复后直接执行整条命令仍留在原 core,显式选择其他 executable 的操作保持有效。可观察结果是完整激活命令与后续安装诊断均使用原安装,诊断不会被外部 Python 搜索路径悄悄替换。本轮边界是续接命令的安装来源;不新增模型服务、生命周期或权限 owner。真实模型中断恢复、渐进产品控制、完整最小闭包、跨端采用与完整成本仍待原 R1 验收。 原安装测试只把参数重新交给测试 interpreter,未执行用户实际收到的 executable,因此旧的 23 项通过结果不能证实这个路径可靠。当前相同完整命令反例在不可变基线仍返回 91;这说明问题可复现,而不是从作者描述推断。
改动思路 / Approach
安装来源属于现有命令渲染和安装诊断的不变量;扩展已有 argv owner 比新增 launcher、配置开关或状态同步更直接。当前 PR 完整覆盖 core 返回命令、module 诊断、显式 route 对照、多 Goal renderer 与拒绝路径,保留原 task/state owner。 命令从已有 entrypoint 进入 cli_invocation_route,只对独立 core 派生当前 Python 的完整 argv;所有下游 renderer 复用这份临时 route,离开调用时恢复。显式全局 executable 属于调用者选择,普通发行仍采用原默认。后续 module doctor 先证明当前导入文件归已有 distribution RECORD 所有,再核验记录中的入口;现有 version/catalog/help probe 使用同一隔离 module 调用,避免外部 Python 搜索路径替换被检查的代码。原 Goal、Agent、task lease、journal 和 settlement 均保留各自 owner,diagnosis 不产生工作权限。
我比较了不改、只替换一条启动命令以及另加 launcher/配置三条路线。不改保留确定失败,只替换第一条会留下后续诊断与多 Goal 分支,另加 owner 则制造不必要维护面。当前扩展已有 owner 的边界能直接执行,并且可以整体回滚。-I 排除额外 Python 路径定制,是独立安装明确不允许 overlay 的边界;需要不同 executable 时仍有原显式 route。没有新的 capability 开关、工作策略或自动模型执行。
具体改动 / Changes
评审精确 head 为 1f9371dc3e987614db533ff42f450a7b7b212f8d,对照基线为 7bb1b01687c5ecb36971b19fc432d6019d3e5492。规范引用为 docs/architecture/rfcs/monorepo-distribution-split-v0.md,spec_revision 为 7bb1b01687c5ecb36971b19fc432d6019d3e5492;我按变更前的验收行判断,而不是用新 checkpoint 反向定义成功。
V2:触及的 File/SQLite 合法执行、续接、旧 lease 拒绝、确认结果恢复与一次结算由既有 installed suite 继续验证。V3:普通 source 的 13 类完整 parsing/output/exit/诊断结果逐字一致,core 的完整返回命令与明确拒绝路径获得本轮资格。V1、V4、V5、V10 和 R1 的完整验收均 deferred:安装来源正确不能代替完整闭包、真实模型恢复、实际上下文采用或成本核算。现有 R1 验收继续承担这些缺口;本轮 fixture context 通过只证明相应协议路径。
关键代码讲解
loopx_cli_route从单 executable 改为有类型的完整 argv tuple,继续在 finally 中恢复 context;不会把 parser 的非法空值提前变成 Python traceback。cli_invocation_route复用既有 standalone 判断,core 默认选择当前 Python 的-I -m loopx.entrypoint,显式全局 route 优先,普通发行默认保持。current_script_invocation_path仅在实际 module path 与已核验 core distribution 相符时承认该入口;完整 doctor 的 primary command 也采用该已证明路径。collect_python_distribution_checks通过已有 RECORD summary 要求 module 记录及真实存在的 recorded console,再以同一隔离 argv 执行 read-only probe。普通 console 所有权检查保持。_build_multi_goal_start_selection_packet把两个原始 executable 拼接替换为既有 renderer;选择前禁止 activation/write 的原事务条件没有变化。
另外,tests/test_core_distribution.py 新覆盖完整命令、显式 sentinel 对照、缺失/重定向 module RECORD、缺失 console 记录/文件;core README 和两个 RFC 镜像共同披露行为及未完成验收。九个文件共 219 行增加、15 行删除,其中 107 行是独立安装反例,56 行是文档。没有新模块、共享 protocol/state vocabulary、权限或迁移;语义 diff advisory 与全树检查共同通过,未降低既有预算。
对主干的风险 / Risks
最强风险是测试仍剥掉 executable,或 doctor 的 probe 继承外部 Python 搜索路径,因此“当前 core 被检查”可能是假象。本轮真实 Python 3.11 wheel 完整执行激活与诊断,foreign sentinel 保持不可达;显式 --cli-bin loopx 则仍命中 sentinel 并返回 91。记录/入口被破坏时 doctor 必须失败,复制到 RECORD 之外的 launcher 和缺失 runtime 文件也保留拒绝。多 Goal 原 smoke 夹具通过真实 installed entrypoint 重放,选择 stop 及 module doctor 都通过,没有测试 mock 提供所需 postcondition。
源码 focused 检查 64 项通过,companion 检查 145 项通过,各保留一个 native platform skip;13 类 immutable base/head CLI 完整 stdout/stderr/exit 字节相同,不做归一化。最终 core/恢复/context 回归 29 项在 128.13 秒通过;1,887 个 wheel runtime 文件与精确源码一致。Changed-file Ruff、双语 staged/head gate、完整 semantic 和 public-boundary scan 通过。Premerge 的六项直接检查与十九项选中检查通过;最初缺 TypeScript npm dependency 的失败保留,按原环境要求 npm ci --ignore-scripts 后重跑通过。先前 source route 修改造成两项 parser 诊断失败也保留,修复后完整诊断对照和 focused suite 通过;一个误用测试文件名的无测试执行单独保留。
完整 native Windows 安装路径、当前 Host 的模型采用、完整最小闭包与成本未测,不能从这些结果推断。绝对 interpreter 路径需要环境继续存在,切换环境前仍须核对原 attempt。可通过回滚本 slice 恢复旧命令规则,同时保留 task/journal 权威。CI 在观察时仍 pending,保留为非代码判断的诊断项;merge readiness 和既有 owner authority 必须另行执行。
我的整体评价 / Verdict
本轮是 justified_increment。Long-horizon 维度在所触及的续接路径上 improved:同一个 artifact 可以进入后续诊断并保持原恢复/一次结算机制;这不宣称完整模型长程收益。User experience 在所触及 CLI 路径上 improved:没有额外身份填写、导航或确认轮次,直接使用已知 interpreter。本轮只改变 CLI 命令及安装诊断,已检查 bootstrap、doctor 和 source callers;没有更改渲染页面。 未验证展示范围为 none,因为没有可见页面变更;原产品渐进控制仍属于未完成验收。
安装来源属于现有命令渲染和安装诊断的不变量;扩展已有 argv owner 比新增 launcher、配置开关或状态同步更直接。当前 PR 完整覆盖 core 返回命令、module 诊断、显式 route 对照、多 Goal renderer 与拒绝路径,保留原 task/state owner。 整体范围 proportionate,已有 owner reused,ordinary/default-off 路径 isolated。最有价值的同域简化已落在多 Goal renderer;不需要新 launcher 或广泛安装重构。完整输出对照与真实 installed 反例支持有意的 provenance 改动,剩余 R1/V10/采用证据如实保留。精确 head 的源码和必需本地门通过,无 unresolved blocking finding;结论为 APPROVE。作者账号不能 formal self-approve,因此采用 COMMENTED approval conclusion,GitHub 原生审批状态及 merge readiness 不由此冒充为绿色。
English verdict: APPROVE - 1f9371d; whole returned core commands and module diagnosis retain their installation, explicit/ordinary routes preserve behavior, and exact-head source/installed/premerge qualification passes. Full R1/model adoption and pending CI/readiness remain separate.
Standalone core startup returned ambient
loopxcommands, so continuing from an isolated core could load another installation through PATH/PYTHONPATH. Generated commands now retain the selected core interpreter with-I -m loopx.entrypoint; explicit global--cli-binselection and ordinary distribution defaults retain their behavior. Core module diagnosis verifies the recorded module and a present recorded console, and runs its version/catalog/help probes with the same isolated interpreter. Multi-Goal selection reuses the existing command renderer.This is a bounded prerequisite for RFC R1: execute the complete returned activation and diagnosis commands reliably. The installed tests now execute whole commands, including a foreign-package sentinel, explicit-route control, missing/redirected RECORD rejection and existing SQLite/File recovery and context checks. The bilingual checkpoint keeps full R1, real model adoption/recovery, progressive control, minimal closure and complete costs open. No lifecycle, authority, protocol or default capability is added.
Validation at
1f9371dc3e987614db533ff42f450a7b7b212f8d: focused source checks passed (64 passed, one platform skip); companion startup/host/doctor checks passed (145 passed, one native Windows skip); changed-file Ruff and staged bilingual checks passed. The clean Python 3.11 core wheel contains 1,887 runtime files matching the reviewed source bytes. Final installed regression passes 29 cases in 128.13 seconds, including core/File/SQLite recovery and context checks; multi-Goal installed selection/diagnosis also passes. Premerge passes all six direct and 19 selected checks. Its first run lacked the declared npm TypeScript dependency; npm ci --ignore-scripts restored the environment and the qualified rerun passes. An immutable base/head 13-case ordinary CLI corpus preserves complete output and diagnostics byte for byte. The historical defective artifact failed the implicit whole-command probe with exit 91; explicit override reached the sentinel as intended. Earlier failed attempts remain recorded separately.The bounded refactoring pass replaces the multi-Goal branch's raw executable formatting with the existing renderer; broader install-owner restructuring is unnecessary for this slice. Roll back the routing/diagnosis change while retaining task authority and reconciling original attempts. This PR does not install or release the candidate into an existing host.