Skip to content

fix(extensions): follow the selected registry runtime - #8888

Merged
loopx-agent merged 1 commit into
mainfrom
codex/extension-registry-routing-20261116
Nov 16, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/extension-registry-routing-20261116

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

当 registry 已经指定 common_runtime_root 时,extension list 和安装后的 extension doctor --all-enabled --execute 仍会重新选择默认目录。新旧默认目录各自有状态时,命令因此报冲突,无法检查调用方已经选定的扩展。

本改动让 extension CLI 沿用全局参数解析得到的 registry,并复用 effective_runtime_root。相对目录按 registry 所属项目解析,不随当前目录漂移。--state-file 和 --runtime-root 的显式优先级保持原行为;没有可用目录选择时继续拒绝猜测。

  • Basis: existing CLI registry routing and Extension Runtime Lifecycle.
  • Intended base: main, implementation base 31944d835466c29f18f843ea92de75b49e7c0c62.
  • Before → after: --registry 与 LOOPX_REGISTRY 两种真实 CLI 路径均从默认目录冲突变为读取、检查所选目录中的同一扩展。

Author Declaration

  • Written by: model_agent, Codex / OpenAI.
  • Implementation: forward the resolved registry at dispatch; resolve the storage route at the existing extension state-file boundary. No new selector, state schema, migration, activation decision or provider permission.
  • Scope-fit / refactoring: reuse the existing shared route resolver; explicit storage overrides bypass unused registry reads. Further abstraction is unnecessary for this three-file change.

Validation

Tested head: 542a365770ff354b2e17b13b98784135e72138aa. Inputs are isolated synthetic registries, real subprocess CLI calls and the existing fixture extension; no external connector writes or model calls.

Check Result / boundary
Real CLI regression and controls Before: 2 failed / 3 passed. After: all five pass. Covers explicit registry, environment registry, relative path from another working directory, explicit root/state-file with an unused malformed registry, and conflicting defaults without a selection.
Extension runtime / independent readiness contexts / relative registry routing 99 passed. Checks actual extension install, list and doctor, with original default roots preserved.
Ruff, changed-Python compilation, diff and RFC parity Passed. No RFC or new semantic vocabulary changes.
Standard native premerge Passed: 6 direct checks, 5 catalog checks and 8 extension-runtime risk checks; zero failures or manual holds. The earlier quick run also passed.
Public boundary All three changed files clean. The isolated check reports only the expected not-yet-created disposable runtime warning. A check using an existing operator registry separately reported two pre-existing unrelated Goal authority requirements; this PR does not migrate those Goals.
Formal Chat bundle Built and source-verified for packaging; no frontend source changes.

Scope And Continuation

This closes the extension CLI route defect. Normal installed revalidation and adoption remain separate evidence, to be verified after review and authorized merge. No live service restart or broader Bot message-acceptance claim is made here. CI status is separate from these local results.

Frontend / Visual Evidence

  • UI impact: none. Existing CLI and installer calls use the same extension lifecycle owner; no new setting, command or frontend capability is introduced.

Boundary Checklist

  • Synthetic tests only; no private state, credentials, local machine paths, raw traces or internal links.
  • Only the existing extension CLI route and its real CLI regression coverage change.
  • English/Chinese RFC parity check passes; no RFC changes.
  • Commit has a DCO sign-off.
  • Exact-head review and merge readiness remain required; local checks do not grant merge authority.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator 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; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort max

这是作者侧自评审,未声称独立同行或人工批准。评审对象为 8888@542a365770ff354b2e17b13b98784135e72138aa,基线为 31944d8。

动机

维护本地扩展的操作者在正常安装后自动复检时会遇到这个问题。同样已指定 registry(记录运行目录的配置文件),旧扩展命令仍在两个默认目录之间报冲突;修复后按该配置找到唯一状态文件。指定 registry 或环境中的 LOOPX_REGISTRY 后,list 能读到原扩展,批量 doctor 能完成检查;未选中的目录不被改写。本次不变更扩展权限、业务执行、消息发送、启用状态或全局目录迁移。生产安装与原服务采用需要在合并后单独验收;源码通过不代表真实 Bot 已采用。

这里的成本并非报错文字本身:正常安装已有自动批量检查,错误的目录选择使它尚未检查任何启用扩展就退出。仅给安装脚本增加一个目录参数会留下普通扩展命令的同一故障,也让操作者重复提供已经明确的配置。本次修复可独立交付这条默认路径,未把父任务的全部验收算成完成。

改动思路

运行目录选择复用已有 paths.effective_runtime_root,CLI 分发把已解析的 registry 交给扩展适配层;不新增路由状态、配置项或另一套解析规则。当前 PR 交付扩展命令按指定 registry 选择已有状态的完整路径;安装器已有批量 doctor 调用,不需要增加另一套安装流程。

路径优先级保持为:已有 --state-file、显式 --runtime-root、registry 的 common_runtime_root、最后是原默认目录检查。相对路径继续由共享函数锚定 registry 所属项目,与当前工作目录无关。显式路径分支在读取 registry 前返回,因此无关配置损坏不会增加新的前置条件。两处内部调用同包升级,没有独立客户端协议需要兼容解码;持久扩展状态格式保留。

依据是 docs/reference/extensions.md,固定版本 31944d8。原文没有条款编号,以下使用段落标签方便核对:extension-state-location(从运行目录读取扩展状态)、extension-installer-revalidation(安装器自动复检)、extension-proof-only(仅更新本地证明、不授予权限或写连接器)。三项均沿原消费者和生命周期实现;实际安装验收仍单列。

具体改动

生产代码新增9行、删除3行;测试新增109行,三文件合计 +118/-3。没有新增模块、配置、状态格式、依赖、安装步骤或用户确认。完整远端 patch 与本地提交一致,head 未变化。

关键代码讲解

  1. _dispatch_common_command 接收原 CLI 已选定的 registry_path。以前扩展分支只传 runtime_root,路径信息在这里丢失;现在把 registry_path 一并交给已有处理器。其他命令分支不变。

  2. _state_file 先处理已有文件覆盖,再检查是否存在显式运行目录。仅在运行目录缺省时调用 effective_runtime_root,随后让原 default_extension_state_file 拼接 extensions/state.json。它不复制 registry JSON 解析或相对路径规则。错误仍由原配置解析和默认目录边界负责,未自动选择、迁移或重放。

  3. handle_extension_command 将新内部参数交给上述路径函数后,继续调用原 list、install 和 doctor 等生命周期入口。批量 doctor 的 --execute 仍只更新已有本地运行身份记录;list 没有写入。原安装器 scripts/install-local.sh:963 调用的就是这条公共命令,无需增加第二套机制。

  4. 真实 CLI 回归 从独立工作目录启动 main 子进程,同时设置两个有数据的默认目录。它检查命令行和环境 registry 两种选择、相对路径、真实成功的测试 provider、列表只读、两个覆盖优先级,以及无选择时的拒绝。测试没有接触真实连接器或消息。

对主干的风险

最强反例是“为了使用 registry 而无条件打开它”,这会让显式 --state-file/--runtime-root 因无关坏配置失败。当前提前返回保留这条兼容边界;配对检查还覆盖文件覆盖运行目录的重叠输入。另一个风险是静默选错默认目录,故无选择和无具体运行目录的 registry 仍保持原冲突拒绝及完整修复提示。

我用同一份固定文件输入和同一脚本运行不可变基线与精确 head,共10场景、20条公共 CLI 执行记录。4条 registry list/doctor 路径由退出1变为退出0;3条显式覆盖和2条未解决冲突的完整规范化观察一致。第10条“坏 registry 加默认冲突”两版都失败,新版首先显示既有 registry codec 错误,这是开始真正消费所选配置后的明确行为变化;显式覆盖仍绕过它。所有未选默认目录都未改写,list 和失败路径的文件字节保持不变。只规范化绝对测试路径、堆栈位置和具名时钟字段,未抹去异常类型、消息、身份、权限或写入差别。

基线新回归先出现2失败/3通过;修复后三组 readiness/runtime/relative-registry 共99项通过。精确 head 的标准 premerge 为6项直接检查、5项目录检查、8项风险检查,全通过;正式 Chat 构建也通过。首个构建命令误从仓库根目录调用而找不到脚本,已在文档规定的 dashboard 目录成功完成,原失败记录保留。公开文件和正文扫描通过。一次全局元数据检查还发现两个其他旧 Goal 的 authority 状态错误,未将其改称本补丁修复或擅自迁移。当前策略 wait_for_ci=false,未查询或等待远端 CI。

我的整体评价

APPROVE 这个有明确边界的增量:long_horizon 改善了正常安装后检查的可持续性,user_experience 减少重复指定目录的人工步骤;没有新的模型指令、工作义务或权限。语义判断为 reuse_existing,机制与代码量和复现故障相称。运行目录选择复用已有 paths.effective_runtime_root,CLI 分发把已解析的 registry 交给扩展适配层;不新增路由状态、配置项或另一套解析规则。当前 PR 交付扩展命令按指定 registry 选择已有状态的完整路径;安装器已有批量 doctor 调用,不需要增加另一套安装流程。

现有证明覆盖真实 CLI、文件状态和本地测试 provider,不覆盖生产安装、原服务采用、原生 WebView 或真实模型效果。这些后续验收必须分别读回,忙服务门禁继续生效。未发现此精确 head 的阻塞性代码问题;此次作者自评审不能替代独立同行评审的来源属性。

English verdict: APPROVE 542a365 as a bounded CLI routing repair. No blocking findings. The existing registry resolver is reused; explicit storage overrides and ambiguous-default refusal retain paired baseline behavior. Local validation: 99 tests, 10 paired cases, standard premerge 6+5+8, and packaged Chat build passed. Production installation and original-service adoption remain separately unverified.

@loopx-agent
loopx-agent merged commit b12608d into main Nov 16, 2026
12 of 15 checks passed
@loopx-agent
loopx-agent deleted the codex/extension-registry-routing-20261116 branch November 16, 2026 20:32
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