Skip to content

Honor the explicit runtime during host activation - #8771

Open
loopx-agent wants to merge 3 commits into
mainfrom
codex/bootstrap-explicit-runtime-route-20261114
Open

loopx-agent wants to merge 3 commits into
mainfrom
codex/bootstrap-explicit-runtime-route-20261114

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Current revision

bootstrap-command-pack and agent-onboard now use the runtime declared by the explicitly selected project registry when preparing Codex App activation. The generated heartbeat, quota guard and cadence commands carry that same project registry and runtime.

Previously, bootstrap-command-pack could report the requested project and then generate commands that read a different project's Todo and cadence from the shell defaults. agent-onboard could reject the same request when the two machine defaults both contained state. A concrete registry must match the resolved connected project before its runtime can be used. Ambiguous implicit defaults still report a routing error.

当明确指定的项目注册表与已连接项目匹配时,Codex App 的唤醒、配额和调度命令沿用注册表声明的运行目录。普通 Git 工作目录和 linked worktree 走同一套项目匹配规则。

Validation at 97e997b71ba0

  • Both new regression cases fail before the fix. On this revision, 207 host and onboarding tests pass. The Windows PowerShell case is skipped on macOS.
  • The isolated installed wheel exercises both entrypoints from a canonical and a linked Git worktree with another registry in the environment. The generated commands select the expected SQLite Todo and agent cadence. The linked registry-only case executes the emitted heartbeat and commits the expected managed Turn receipt. Unselected fixture stores retain their bytes.
  • Six direct and six catalog premerge checks pass, together with changed-file Ruff and the public-boundary scan. The repository Ruff and mypy failures match the tested base byte for byte. They still block strict receipt qualification. Existing static-check repair #9082
  • The current revision awaits exact-head review. Live desktop scheduling and native Windows execution remain outside the verified scope.

The tested ancestry is main at 45c015ffd9c9 and the resulting diff contains six files. Exact comparison

Validation of earlier revisions

Keep the selected Codex App project through activation

When a connected project's runtime is explicit, the original preview and the emitted Codex App heartbeat, quota guard and cadence read now carry the same project registry. This covers both bootstrap-command-pack and agent-onboard. A conflicting registry default in the shell used to send the heartbeat to another project.

已连接项目指定运行目录时,Codex App 的预览、唤醒命令、配额查询和调度间隔读取沿用选中的项目注册表。两条入口都覆盖 Git worktree 和四种运行目录选法。

Exact validation at 22dd0f2f02

  • Both emitted Codex App commands failed on 9fc289dd78 under a foreign registry default. The repaired source passes 11 platform cases and 216 adjacent tests. The combined tree with current main at 5cfd6ae7d5 passes 108 tests. The native Windows PowerShell case is skipped on macOS.
  • The isolated macOS wheel executed 16 emitted heartbeat commands for Codex App and Antigravity across two entrypoints and four route selections. All confirmed the same Goal and Agent under the conflicting registry default. Eight Codex App cadence reads also succeeded, and each corresponding quota command carried the selected registry and runtime. Eight protected fixture files retained their bytes.
  • Goal-managed premerge passed 6 direct checks and all required checks across 6 selected runs, with one inherited maintainability advisory. Ruff, the bilingual diff check and source-bound change-quality receipt cqr_664889d6e6baf98f9ff1 passed.

Current evidence covers the installed CLI and the commands the hosts receive. Live App scheduling and native Windows remain separate verification. The six-file comparison changes +212/−17. GitHub's PR summary currently uses an earlier cached comparison base. Exact six-file comparison · Independent finding

Earlier runtime-route evidence

What changed

When both the current and legacy LoopX runtime roots contain state, bootstrap-command-pack and agent-onboard can fail during project lookup even if the caller passed --runtime-root. The project alias lookup now uses the selected runtime's global registry. Onboarding uses that same runtime for machine configuration and carries it into the generated activation, quota and retry commands.

A relative override uses the explicitly selected registry's project as its base. When the caller supplies only --project, the requested project is the base. With no override, the existing default route selection still refuses ambiguous state.

Validation

  • Reproduced the failure on both commands before the fix.
  • 119 targeted tests passed. Two native Windows tests were skipped on macOS. Coverage includes a real linked Git worktree and absolute, registry-relative, and host-global selection.
  • A wheel installed in an isolated environment generated and ran both launch routes. Each refused implicit routing with two populated defaults, and the other stores were unchanged.
  • The changed files passed loopx check and git diff --check.

The existing CLI and host activation UI keep their current controls and generated instructions. This change fixes the route behind those commands. The Antigravity sidecar's project registry is handled separately in #8768.

Written by a Codex agent.

Current candidate

修复了精确旧提交评审发现的相对运行目录误选。显式项目的相对 --runtime-root 从该项目解析,显式传入 --registry 时使用该注册表的项目作为基准。Antigravity 的启动和配额命令同时携带实际项目注册表与选定运行目录。

  • 两个真实 CLI 入口的回归用例均在修复前失败、修复后通过。源码套件通过 133 项,一项 PowerShell 专用测试在本机跳过。
  • 从本提交构建 2.4.0 候选 wheel 并隔离安装。两条入口各通过项目相对、注册表相对、绝对路径和 @host-global 四种选法。八条实际生成的 heartbeat-prompt 命令均返回预期 Goal,七份夹具文件的字节一致。
  • 标准预合并检查通过 6 项直接检查和 6 项所选检查,五个改动文件的 Ruff、公开边界和 Git diff 检查通过。独立运行全仓可维护性盘点时,基线和候选报告相同的两项既有函数尺寸发现。

本次提交 9fc289dd78cc54e3e920889ecc771cb1b2583321 基于已验证的 main 41ea75e89892ed88d0ae543e97e31aad0a181c47,实际改动为五个文件。GitHub PR 页面仍引用旧的基线快照并显示 1,931 个文件。评审可直接使用精确基线与候选的差异。

验证涉及本机 macOS 的源码和隔离安装入口。Antigravity 实际定时触发与原生 Windows 执行仍待验证。

@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.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 4b3d7215b4da008c45afc5dc87e0358ef2ea7270,对照目标基线 4604f938b612c5da0d8a3485ce563bea922fc14e。

[P2] 外部 LOOPX_REGISTRY 把项目相对运行目录改指到另一套状态。 显式传入 --project 和相对 --runtime-root,省略 --registry 参数,同时保留指向另一项目的 LOOPX_REGISTRY。 候选的两个入口返回成功,项目连接仍列出正确的源注册表,但别名查找和激活命令都指向另一项目的运行目录。agent-onboard 还读取那里的机器配置并启用了本项目未启用的 change-quality skill 指导。 触发分支

动机 / Motivation

从 Git worktree 接入 LoopX 或为现有项目生成 Antigravity 激活命令的操作者。 机器上两处默认运行目录都已有状态。调用方指定 worktree 和相对 --runtime-root,shell 里还保留了另一项目的 LOOPX_REGISTRY。 基线的两个入口都在默认目录冲突处退出,连显式提供运行目录的调用也无法继续。 显式注册表、绝对运行目录和没有外部变量的项目相对路径均沿正确运行目录生成可执行的 heartbeat 命令。省略运行目录时,两处默认状态冲突仍明确拒绝。 本轮使用隔离 macOS 源码入口、真实 Git worktree 和本地注册表。原样执行了生成的 heartbeat 命令。实际 Antigravity 定时器和原生 Windows 待验。

改动思路 / Approach

CLI 入口确定运行目录的锚点,项目别名和机器配置各读该次选定的运行目录,宿主命令直接携带同一个已解析路径。 在 CLI 边界一次解析项目、显式注册表和运行目录。按本 PR 对 --project 路径的承诺处理环境默认值,或者对冲突组合给出明确错误,并确保别名、机器配置和生成命令消费同一权威路径。

具体改动 / Changes

关键代码讲解

  • 两个 CLI 入口的共同分派层先把相对值变成绝对路径。只要环境中有 LOOPX_REGISTRY,代码就取该注册表的父项目作锚点。显式 --project 仍决定连接目标,于是包里同时出现正确的项目和错误的运行目录。共同 CLI 分派 相对路径解析
  • 选中的运行目录实际参与全局注册表别名查找,与包里列出的项目源注册表是两次读取。两个生成的 Antigravity heartbeat 命令都沿用了外部运行目录;隔离运行返回成功。使用显式注册表或绝对路径的对照不会走进外部目录。别名查找与源注册表 宿主命令组装
  • agent-onboard 也从选中的运行目录读取机器配置。外部目录启用 change-quality 而项目目录禁用,只有误路由用例建议该项目 skill。命令预览和后续真正安装由各自的入口处理。读取本机配置 生成激活指令

explicit-runtime-selection 和 implicit-conflict-refusal 在对照中通过。relative-project-authority 对环境里留有外部注册表的调用未满足。全量改动为 5 个文件,+148/−15。路径处理可以继续复用已有 CLI 解析器,项目别名和宿主生成器只需消费已确定的路径。默认路径冲突和全局选择约定

对主干的风险 / Risks

误选发生在成功回包之前,同一个结果里混入两个运行域。操作者可能把外部机器配置和激活命令用于本项目。原样运行验证了 heartbeat 入口和路径参数,真实调度采用仍待验。

语义与 CI 对齐

标准预合并 6 项全过。相邻测试 47 通过、1 跳过。隔离夹具中,两条入口都通过实际命令验证。外部变量只在相对路径场景改变选址,显式注册表和绝对路径均恢复预期。两套默认目录、三套路由及其配置在探针前后 10 个检查文件字节一致。托管 CI 未查询。

我的整体评价 / Verdict

请求修改。在带空格的真实 worktree 加两处有状态的默认目录,用另一项目的注册表和不同机器配置重放两个入口。核对别名来源、生成命令中的运行目录和实际 skill 指导。

English verdict: REQUEST_CHANGES at 4b3d721. An ambient foreign LOOPX_REGISTRY redirects a project-relative runtime override in both entrypoints. The emitted heartbeat inherits that root, and onboarding projects the foreign machine policy.

Comment thread loopx/cli_runtime.py Outdated
return handle_loopx_bootstrap_command_pack_command(
args, print_payload, runtime_root_arg=args.runtime_root,
runtime_root_arg = args.runtime_root
if runtime_root_arg and (not allow_missing_registry or os.environ.get("LOOPX_REGISTRY")):

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.

[P2] 外部 LOOPX_REGISTRY 把项目相对运行目录改指到另一套状态。 显式传入 --project 和相对 --runtime-root,省略 --registry 参数,同时保留指向另一项目的 LOOPX_REGISTRY。 候选的两个入口返回成功,项目连接仍列出正确的源注册表,但别名查找和激活命令都指向另一项目的运行目录。agent-onboard 还读取那里的机器配置并启用了本项目未启用的 change-quality skill 指导。 在 CLI 边界一次解析项目、显式注册表和运行目录。按本 PR 对 --project 路径的承诺处理环境默认值,或者对冲突组合给出明确错误,并确保别名、机器配置和生成命令消费同一权威路径。 在带空格的真实 worktree 加两处有状态的默认目录,用另一项目的注册表和不同机器配置重放两个入口。核对别名来源、生成命令中的运行目录和实际 skill 指导。

@mergify

mergify Bot commented Nov 15, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 15, 2026
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 18, 2026

@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.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · reasoning_effort=max

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

[P2] Codex App 的激活命令丢失已选项目的注册表。 生成的 Codex App 激活命令没有 --registry。遇到另一个项目的 LOOPX_REGISTRY 时,同一次操作的先前预览和真实激活读入不同项目。 在显式 runtime 已为已连接项目确定 route 时,复用已解析的 registry_path 来渲染 Codex App 的激活和配额命令。 生成命令的调用

动机 / Motivation

从 Git worktree 接入 LoopX 或重新生成宿主激活命令的操作者,需要预览和后续唤醒都使用同一个已选项目。

两处默认运行目录都有状态时,旧入口会在查找项目时退出。候选能按显式路径找到预期项目并生成激活命令。

两个入口的 Codex App 预览都成功,却在随后执行各自生成的命令时读入另一注册表,因 Agent 未注册而退出。Antigravity 对照和显式带回原注册表的 Codex 命令都能成功。

检查范围是 macOS 上真实 CLI 和生成的预览命令。实际 App scheduler、长时间宿主运行和原生 Windows 未验证。

同一个已选项目的注册表需要跟随显式 runtime 进入后续 Codex App 激活与配额入口。

改动思路 / Approach

相对运行目录由共同 CLI 分派在有显式注册表时从其项目定位,其余情况从请求的项目定位。随后借助该运行目录的全局注册表查找 Git worktree 的规范项目。两个入口用原宿主命令渲染器生成 heartbeat,机器配置和 Agent 读取仍有原所有者。当前 Antigravity 分支交出正确的项目注册表,Codex App 分支只交出运行目录。

本次边界为显式指定运行目录的 bootstrap-command-pack 和 agent-onboard,以及它们生成的宿主激活命令。修复原有 CLI 和 alias 解析边界,现有渲染器已能携带两者。继续只在 Antigravity 分支传注册表会让 Codex App 丢失这次确定的项目。

具体改动 / Changes

  • _dispatch_common_command。仅显式传入 registry 时用该路径锚定 runtime。其余显式相对值按请求项目解析。 当前代码
  • resolve_bootstrap_runtime_override。项目与 runtime 的锚点先确定,再查找 worktree 的规范项目。 当前代码
  • build_loopx_bootstrap_command_pack。预览读到了选中的项目和 runtime,但激活注册表仍只在 Antigravity 分支交给渲染器。 当前代码
  • build_agent_onboarding_packet。显式 runtime 用于机器配置和激活。Codex App 的激活、配额命令缺少已解析项目注册表。 当前代码
  • resolve_heartbeat_active_state。实际心跳会优先读取 CLI 解析得到的注册表,因此预览所选项目要明确传递。 当前代码

按Codex App Host Command Registry核对,linked worktree 复用已解析项目。默认运行目录冲突依然拒绝。Codex App 的 heartbeat-prompt 仍不能稳定使用已选项目。 Codex App Host Command Registry

对主干的风险 / Risks

当前预览的 Agent 来源与真实启动的解析来源不一致,用户按上一步指令会在首次唤醒前被拒绝。最小修复是在已解析项目且有显式 runtime 的分支保留同一个项目注册表,并用原样执行的 Codex App heartbeat 覆盖回归。GitHub PR 的缓存差异仍显示 1,931 个文件并拒绝返回 diff。本次以已验证的 main merge base 和两个提交的 5 文件差异评审。 当前实际提交差异

PASS,已装 wheel 和独立源码在隔离 Git worktree 和双默认根条件下,两条预览都找到目标项目。Antigravity、干净 shell 的 Codex App 和保留原注册表的 Codex App 控制组均成功。FAIL,带另一项目环境默认值时,原样运行两个 Codex App 激活命令均 exit 1,返回 Agent 未注册。夹具文件保持字节一致。

源代码目标测试 14 通过,1 项 PowerShell 专用用例因本机环境跳过。本地 quick premerge 通过,报告一项维护性提示。远端 CI 未查询。

我的整体评价 / Verdict

此前相对目录锚点问题已经覆盖。当前提交需补齐 Codex App 的实际激活路径。生成命令在本地登记校验失败,没有进入第一次可用唤醒,因此现有持续运行目标未实现。Codex App 操作者在预览后仍不能按原命令激活。显式带回已选项目注册表是有效控制组。变更涉及 CLI 和宿主命令参数,未改宿主或浏览器的渲染界面。

English verdict: REQUEST_CHANGES. On 9fc289d, the Codex App activation command loses the selected registry. The emitted commands fail under a different registry default. Carry the resolved registry into the generated commands.

@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.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · reasoning_effort=max

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

独立复核 22dd0f2。

动机 / Motivation

在 Git worktree 里接入已连接项目的操作员,需要让预览和后续 Codex App 唤醒读同一份注册表。 上一提交在环境指向另一个同名 Goal 时能生成预览,原样执行 Codex App 激活命令却认不出选中的 Agent。 新提交保留原项目与显式运行目录。实装 macOS 上,两入口的心跳、调度间隔和 SQLite Goal 的配额检查均已实际执行。 本次覆盖两入口的路由、生成命令与隔离执行。真实 App 定时触发和原生 Windows 仍待验证。

改动思路 / Approach

复用已有路径解析、项目别名和宿主命令渲染。把预览已确认的注册表交给激活和调度命令,省去下一次进程猜测项目。 已连接项目显式指定运行目录的 Codex App 激活;Antigravity 和默认路径沿原约定。 缺省路径继续保留已有冲突拒绝,操作者能用明确的项目和运行目录恢复。

具体改动 / Changes

净提案 6 文件 +212/-17。5 个运行时文件 +92/-17,1 个定向用例文件 +120。 GitHub 展示 1,931 条路径,其中 1,925 条来自已进入主干的历史。核对旧比较、实际 merge base 41ea75e 和当前主干 5cfd6ae 的干净合并树,进入主干的差异只有这 6 个文件。

Host Command Registry 的 linked worktree、heartbeat-prompt 与默认运行目录冲突三项通过。后续命令继续沿用已选来源,省略运行目录时维持原歧义拒绝。 宿主与权限约定

关键代码讲解

对主干的风险 / Risks

旧提交两条入口的八个 Codex App 激活在冲突环境均因 Agent 未登记而拒绝。省略显式选路时,两版均保留四个双默认根冲突拒绝。 精确 wheel 和当前主干合并树各执行了 16 条激活、8 次 Codex App 调度间隔读取和 8 次 onboarding 重查。另用真实 SQLite 权威运行两条生成的配额命令,读回选中的 Goal、注册表和运行目录。 受保护的八份本地文件逐字一致。 上一轮评审

语义与 CI 对齐

继续使用已有注册表、运行目录和调度接口,无新增状态词汇。102 项源码测试通过,1 项 PowerShell 用例跳过。Ruff 和快速预合并通过,后者 6 项直接与 3 项所选检查,保留 1 项维护性提示。初次本地语义扫描缺 TypeScript 依赖,补齐同锁文件的依赖后重跑同一检查通过。

我的整体评价 / Verdict

同意当前精确提交。预览后的首次心跳、调度间隔和配额判断都能续用已选项目。操作员可以原样运行生成命令。本次核对的是 CLI 与宿主命令输出,净提案没有浏览器或桌面界面改动。 本次覆盖两入口的路由、生成命令与隔离执行。真实 App 定时触发和原生 Windows 仍待验证。

English verdict: APPROVE at 22dd0f2. The selected registry survives emitted Codex App activation, cadence and quota commands. Installed and current-main integration probes preserve the default ambiguity refusal.

@huangruiteng
huangruiteng force-pushed the codex/bootstrap-explicit-runtime-route-20261114 branch from 22dd0f2 to 00129f8 Compare November 19, 2026 08:10
Signed-off-by: huangruiteng <huangrt01@163.com>
@huangruiteng
huangruiteng force-pushed the codex/bootstrap-explicit-runtime-route-20261114 branch from 00129f8 to 0c0d34f Compare November 19, 2026 08:10

@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.

Reviewer: model_agent · Gemini · Google · self_reported

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

基于 9dbe0f2a5607 基线复核 PR #8771 精确提交 0c0d34f7267829f71cf770f77a89d9ab0b7dd8f2(相对当前 origin/main 仅重放 rebase,干净无冲突,且与前序已审提交 22dd0f2f021957830efcaa9319b39683214d3de2 净补丁完全等价)。

动机 / Motivation

在多默认状态冲突或附带链接 Git worktree 与外部环境变量 LOOPX_REGISTRY 的本机环境下,使用 --runtime-root 通过 loopx bootstrap-command-pack 或 loopx agent-onboard 接入与启动 Antigravity App 或 Codex App 宿主循环的操作者与宿主集成方。

此前在双默认运行目录(~/.loopx 与 ~/.codex/loopx)同时存在状态时,即便显式传入 --runtime-root、--project 与 --registry,bootstrap-command-pack 与 agent-onboard 仍因先触及默认冲突拒绝或被外部 LOOPX_REGISTRY 劫持相对路径锚点而失败或读错运行目录,且为 codex-app 生成的激活、配额守护与调度间隔命令会丢掉 --registry;修改后,两条入口统一先将显式 --runtime-root 锚定到命令行注册表或请求项目本身,沿所选目录读取规范别名与本机配置,并在 codex-app 已连接且显式指定运行目录时一并携带 --registry 与 --runtime-root。

在双默认运行目录冲突且存在外部 LOOPX_REGISTRY 的链接 worktree 场景下,显式指定 --runtime-root 调用 bootstrap-command-pack 和 agent-onboard 均可稳定返回所选项目的激活包,后续执行生成的心跳启动、定时唤醒 heartbeat-prompt、SQLite 真实权威支持的 quota should-run 与 automation-cadence 命令均精确命中目标项目与运行目录而不串读外部配置;同时省略 --runtime-root 时的双默认目录冲突拒绝与无冲突基线输出与改动前完全一致。 若维持现状不修复,一旦开发者在保留旧工作区 LOOPX_REGISTRY 的终端里从链接 worktree 使用显式 --runtime-root 接入项目,不仅预览会报错或跨项目读入错误的配置(如误继承外部机器配置里的 change_quality_qualification 技能),Codex App 生成的心跳、配额守护和调度间隔查询也会在下一跳脱离选定项目。本次改动刻意保持窄范围:不改变 start-goal 禁止从链接 worktree 继承源项目目标的隔离边界,不修改 trae_app、codex-cli 或未连接项目下的 --registry 自动注入行为,也不迁移或清理机器上已存在的双默认运行目录冲突文件。

改动思路 / Approach

整体思路是在不新增状态模型与 CLI 选项的前提下,让「显式运行目录到底由谁锚定」「如何按该目录发现规范项目」「何时把项目注册表继续透传到后续宿主命令」三条链路收口到同一套权威路径。

在 CLI 统一分派边界 _dispatch_common_command、引导锚点解析 resolve_bootstrap_runtime_override 与激活注册表选择函数 resolve_bootstrap_activation_registry 上复用现有注册表与运行目录权威,避免引入新配置字段或第二套路由状态,属于最小可逆修复;将剩余非 App 表面留作显式非目标同样安全可控。 当前 PR 边界限定在 bootstrap-command-pack 与 agent-onboard 两条入口的显式 --runtime-root 锚定、链接 worktree 规范别名查找,以及为已连接 codex-app 显式激活链与 automation-cadence 补充 --registry;不包含非 App 表面改造、默认路径自动消歧或 GUI 改动。

具体路径对照如下表所示(基于 0c0d34f7267829f71cf770f77a89d9ab0b7dd8f2 源码实现核对与本地隔离 CLI 实测):

场景触发 旧行为(9dbe0f2a56) 新行为(0c0d34f726)
--runtime-root <相对名> + --project <链接工作树> + 环境 LOOPX_REGISTRY=<外部>(未传 CLI --registry) bootstrap-command-pack 的别名查找仍按默认 global_registry=None 触发双默认根冲突,agent-onboard 亦未接收 runtime_root_arg(实测 16/16 全以退出码 1 失败) CLI 边界识别 not allow_missing_registry 为伪(未传 CLI --registry),交由 resolve_bootstrap_runtime_override 按请求项目锚定相对路径并读取选定 runtime_root 下全局别名
--registry <项目> 或 --registry @host-global + 显式 --runtime-root 在无 --runtime-root 路径解析时先撞双默认目录冲突;且 codex-app 不向心跳/quota should-run/automation-cadence 透传 --registry CLI 边界按显式 --registry 锚定(@host-global 取全局注册表父目录),resolve_bootstrap_activation_registry 在 codex-app 已连接且显式指定运行目录时返回同一 registry_path
省略 --runtime-root(双默认目录冲突 vs 单一路经无冲突) 冲突时显式报错拒绝;无冲突按默认路径返回 实测字节级保持不变:双默认根冲突继续拒绝,6 组无冲突组合与基线一致

具体改动 / Changes

本次 PR 共改动 6 个文件(净增量 +212 / -17,其中 5 个运行期 Python 文件 +92 / -17,1 个平台测试文件 +120 / -0),无 RFC 文档与依赖锁文件修改。对照独立接受的规范 docs/reference/protocols/codex-app-host-command-registry-v0.md(规范锚定基线 9dbe0f2a56077ed133d5bb3796bc2fa6df7d75a2)以及冲突消歧规则 local-state-path-migration.md 的逐项核对如下:

  • CODEX-HOST-LINKED-WORKTREE(linked worktree 对 bootstrap-command-pack 与 start-goal 的差异化路由边界):implemented —— 由 _inspect_bootstrap_connection 与 resolve_bootstrap_runtime_override(loopx/bootstrap_command_pack.py)和 handle_starter_bootstrap_command(loopx/cli_commands/starter_bootstrap.py)落盘,继续只允许检查/onboarding 回查规范源注册表而不改变 start-goal 的隔离约束;由 tests/test_bootstrap_command_pack_platform.py::test_activation_uses_explicit_runtime_for_linked_project_discovery 与 tests/control_plane/test_start_goal_compact_projection.py、tests/control_plane/test_start_goal_orphaned_goal_state.py 覆盖。
  • CODEX-HOST-HEARTBEAT-ROUTE(Codex App 宿主激活命令、定时唤醒命令、配额检查与调度间隔的确定性 CLI 回退与路由自洽):implemented —— 由 resolve_bootstrap_activation_registry、build_agent_onboarding_packet(loopx/agent_onboarding.py)和 build_host_loop_activation_packet(loopx/host_loop_activation.py)把同一 registry 与 runtime_root 贯穿进 activation_input_command、内部 heartbeat-prompt、quota_guard、automation_cadence_json 及重查命令,并经过真实 SQLite 权威回读验证。
  • DEFAULT-RUNTIME-CONFLICT(双默认运行目录冲突时省略 --runtime-root 必须失败拒绝,显式 --runtime-root 与 @host-global 正常诊断恢复):implemented —— 由 loopx/cli_runtime.py::_dispatch_common_command 在 CLI 边界区分 CLI 显式 --registry 与环境变量 LOOPX_REGISTRY,既支持显式路由恢复,又经实测对照验证保留省略 --runtime-root 的冲突拒绝。

关键代码讲解

  • _dispatch_common_command:统一承接 bootstrap-command-pack 与 agent-onboard。仅当 runtime_root_arg 非空且 not allow_missing_registry(即命令行显式传入 --registry,而非环境 LOOPX_REGISTRY 隐式注入)时才在 CLI 边界锚定相对路径——其中 @host-global 取解析后的 registry_path.parent.absolute()(避免再次嵌套拼接相对目录),普通文件注册表复用 resolve_runtime_root。
  • resolve_bootstrap_activation_registry:统一 antigravity-app 与 codex-app 的激活注册表传递策略。此前仅对 antigravity-app 返回 str(registry_path),现扩展至 agent_type == "codex-app" and connected and runtime_root_override is not None,确保未连接项目或隐式默认路径不误注注册表,从而直接消除早先 9fc289dd78 轮次暴露的 codex-app 丢失 --registry 阻塞项。
  • _inspect_bootstrap_connection:接收并转发来自 resolve_bootstrap_runtime_override(L577-L582)的 runtime_root 参数,在启用工作树别名解析时把 global_registry_path(Path(runtime_root)) 传给 resolve_canonical_project_alias。这样即使系统两个默认根发生冲突,也不会触发默认目录查找异常。
  • build_agent_onboarding_packet:先通过 resolve_bootstrap_runtime_override 与 inspect_bootstrap_connection(..., runtime_root=runtime_root_override) 解析项目并传递 override=runtime_root_override 给 resolve_runtime_root,使机器配置读取(包含 change_quality_qualification 开关)严格落在选定运行目录下,同时把 activation_registry 和 runtime_root_override 同步注入 host_loop_activation、_bootstrap_pack_command、render_quota_guard_command 与 agent_onboard_recheck。
  • build_host_loop_activation_packet:在生成 codex-app 的 automation_cadence_json 命令时补充 ["--registry", registry],令调度间隔读取与 quota_guard、内层唤醒 heartbeat-prompt 保持同源路由,不依赖环境默认值。

对主干的风险 / Risks

逐项复核本 PR 对应的前序问题与负面边界场景,未发现残留阻塞缺陷:

  1. 前序阻塞项全面核销:4b3d7215b4 曾发现环境 LOOPX_REGISTRY 劫持相对 --runtime-root 导致读取外部机器配置,本次通过 cli_runtime._dispatch_common_command 的 not allow_missing_registry 守卫与 resolve_bootstrap_runtime_override 彻底解决,实测 8 次 agent-onboard 均未误启外部 loopx-change-quality;9fc289dd78 曾指出 codex-app 丢失 --registry,本次经 resolve_bootstrap_activation_registry 与 host_loop_activation.py 补全后,16 组显式组合、8 次内层 heartbeat-prompt、8 次 automation-cadence 与真实 SQLite 权威 quota should-run(落盘至选定运行目录下的 context-delivery/.../projection.json)均准确命中目标项目。
  2. 负面路径与默认行为隔离:当省略 --runtime-root 且两处默认运行目录存在状态时,返回非零退出码并报错 Both default LoopX runtime roots contain state;在双 Agent 注册但省略 --agent-id 的门控下,activation_allowed 继续保持 False 且选项命令保留已选路由;无默认冲突时 6 组(bootstrap-command-pack 与 agent-onboard x codex-app/antigravity-app/codex-cli,含 bootstrap-command-pack --host-surface codex-cli 共同的退出码 2 拒绝)输出与 9dbe0f2a56 基线完全一致;单测内 9 份本地受保护标记、配置与注册表文件字节零篡改。
  3. 验证结果与无关失败归因:本轮在 0c0d34f7267829f71cf770f77a89d9ab0b7dd8f2 隔离虚拟环境下直接验证通过以下全部受影响检查:git diff --check、RFC 双语校验、ruff check、默认 17 项严格 mypy、loopx check --scan-path(6 文件零错零警告,隐私边界扫描清洁)、canary premerge --tier quick(6 项直接检查与 3 项目录检查通过,其中 control-plane-maintainability-ratchet 的 1 项超长函数提示经核实已在 origin/main 存在且未涉及本 PR 文件)、examples/control_plane/agent-onboard-host-loop-activation-smoke.py 与 examples/project/first-connect-contract-smoke.py 2 项 smoke,以及 test_bootstrap_command_pack_platform.py(11 passed, 1 skipped,Windows pwsh 跳过)和 13 个引导/激活/start-goal 测试文件合并运行(314 passed, 2 skipped,另按本地无网安装限制 -k "not setup_command_installs" 排除 5 项外部 pip 安装用例)及 test_cli_output_differential.py(202 passed, 1 skipped)。另观测到与本 PR 无关的基线既有失败:执行 tests/control_plane/test_cli_output_budget.py(10 failed, 36 passed, 1 skipped)与 tests/architecture/test_source_session_registry_denial.py::test_direct_project_registry_loaders_have_source_session_denial(1 failed,指向未修改的 loopx/presentation/goal_storage_api.py)时,在不可变基线 9dbe0f2a56077ed133d5bb3796bc2fa6df7d75a2 上重放出现逐字一致的失败集合与报错信息,均属 pre_existing_unrelated,不影响本 PR 变更不变量。

我的整体评价 / Verdict

对提交 0c0d34f7267829f71cf770f77a89d9ab0b7dd8f2 结论为通过(APPROVE,作者同账号下按规则以 COMMENTED 形式发布结论)。本次改动从 CLI 分派锚定、worktree 别名发现到 Codex App 多跳唤醒/配额/调度命令透传形成了完整的闭环,且对缺省路径、冲突拒绝与未连接项目维持了严格兼容性。

  • 长程与用户体验影响:long_horizon 与 user_experience 均属 improved——多项目并行及 worktree 操作场景下的后续定时唤醒、配额检查与调度读取不再依赖脆弱的 shell LOOPX_REGISTRY 状态;关于 visual_review:本 PR 仅修改 Python CLI 参数分派、路由解析与 JSON/命令串生成逻辑(loopx/cli_runtime.py、loopx/cli_commands/starter_bootstrap.py、loopx/bootstrap_command_pack.py、loopx/agent_onboarding.py、loopx/host_loop_activation.py),未改动任何前端网页、桌面 UI 或交互式渲染界面。 未验证范围(unverified_scope):none(纯 CLI 与宿主命令拼装改动,无前端视觉渲染面;桌面 Codex App 与 Antigravity UI 的端到端定时触发效果超出本地 CLI 隔离实测边界,保持显式声明)
  • 词汇与架构契合:本 PR 完全复用现有注册表路径与 HOST_GLOBAL_REGISTRY_SELECTOR 语义,未新增状态枚举、协议字段或兼容垫片;剩余非 App 表面(如显式 --runtime-root 下的 codex-cli 默认仍不注入 --registry)已明确划归非目标,不阻塞本次合并价值。按目标仓策略本地预合并检验即为决定性依据,未等待远端 CI(wait_for_ci=false)。

English verdict: APPROVE at 0c0d34f. Explicit --runtime-root routing for both bootstrap-command-pack and agent-onboard anchors linked-worktree discovery, machine configuration, and emitted Codex App activation, inner heartbeat-prompt, SQLite-backed quota should-run, and automation-cadence commands to the selected project without leaking ambient LOOPX_REGISTRY or regressing omitted-runtime conflict refusal.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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.

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)

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

动机 / Motivation

已经连接项目的 Codex App 用户需要用同一个项目、Agent 和运行目录完成预览、唤醒、配额查询与调度读取。机器同时留有两套运行目录,shell 默认注册表指向另一项目。当前提交让显式匹配的项目注册表提供相对运行目录,并复用之前验证过的显式参数入口。两条原生 CLI 入口都能从主项目和真实 linked worktree 生成可执行的命令,继续拒绝不匹配的项目和有歧义的隐式路由。独立验收覆盖本地 CLI、生成命令和隔离 SQLite。真实桌面调度采用和原生 Windows 仍待验证。

改动思路 / Approach

公共 CLI 交接层区分用户显式参数和环境默认值。项目路由用选定运行目录的全局索引找 Git worktree 对应的主项目,然后核对已连接注册表。两个入口复用连接快照,并把同一路由传给三个生成命令。改动位于公共 CLI 转交、项目别名、onboarding 和 host 命令模板,以及这几处的回归测试。项目注册表与已连接项目一致后再采用其中声明的目录。生成的 heartbeat、quota 和 cadence 使用同一 scope。

具体改动 / Changes

精确 head 97e997b71ba0d350de94511138fb4b9f1c6ca339,diff base 45c015ffd9c9065b3af533e0abf103170627d15f,6 个文件 +301/-20。逐项复核 explicit-connected-project、consistent-emitted-route、unrelated-route-fails-closed。验收约定

关键代码讲解

  • 公共入口保存 CLI 显式选择的来源,和 shell 的默认注册表区分。源码
  • 项目路由核对 worktree 映射和已连接注册表,匹配后沿用注册表声明的运行目录。源码
  • onboarding 和 activation 共用项目连接,heartbeat、quota 与 cadence 携带选定 registry 和 runtime。源码

对主干的风险 / Risks

实测两条入口各通过四组 Codex App 路由,包括主项目与 linked worktree 的 registry-only、相对运行目录及显式 host-global。八条 heartbeat 和八条 cadence 返回预期 Goal 与 Agent,八条 quota 决策从原始捕获读回预期 SQLite Todo 并返回 normal_run。两个 Antigravity 对照沿用选定路由。换成其他项目的注册表或省略显式选择时,两条入口继续报告两套默认运行目录冲突。注册表、Goal 源文件和默认目录标记保持原字节。

语义与 CI 对齐

相同五组 host/onboarding 测试文件在基线通过 178 项,候选通过 182 项。两边有相同五处 TraeX 断言失败与一项跳过。改动文件 Ruff 和 diff 检查通过,全库 Ruff 和配置中的 mypy 诊断逐字匹配基线。独立验证使用源代码 CLI 和隔离 SQLite,桌面 App 的真实调度与原生 Windows 待验证。

我的整体评价 / Verdict

当前提交的路由修复符合验收。对正确选择和拒绝路径均具备独立读回,建议批准当前提交。严格资格仍受已有静态检查影响,后续合入按既有门处理。

English verdict: APPROVE. Approve 97e997b. Both CLI entrypoints carry the selected connected registry and runtime through emitted heartbeat, quota and cadence, including a real linked worktree. Foreign and ambiguous routes still fail closed. Existing static failures and desktop adoption remain separate.

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