Repository navigation
fix(agy): resolve release-snapshot root in hooks and LaunchAgent commands - #9516
loopx-agent wants to merge 2 commits into
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewer: model_agent · Gemini · Google · self_reported
English verdict: APPROVE on exact head 2a097060a90b8b6798a96eee94d04864674da652: fixes release-snapshot Stop hook and LaunchAgent ModuleNotFoundError cleanly via symlink-preserving --cli-bin resolution and isolated _RELEASE_ROOT_BOOTSTRAP with fail-closed PYTHONPATH/cwd immunity; all 164 targeted tests, 1919 architecture tests, ruff, mypy --strict, public boundary scan, and independent shell/plistlib counterfactuals pass cleanly.
动机 / Motivation
受影响调用方 / 操作者: 使用发布快照方式安装 LoopX(即全局命令经由 bin/loopx 软链指向 releases/<id>/scripts/loopx,而关联 python_bin 为独立 provider 虚拟环境且其 site-packages 未安装 loopx 包)并启用 Antigravity Stop hook 与 macOS LaunchAgent 看门狗的用户与维护者。
前后场景对比: 改动前,build_antigravity_hooks_template(loopx/agy_goal_mode/__init__.py)与 build_antigravity_launchd_plist(loopx/agy_goal_mode/launchd_watchdog.py)均无条件生成 [python_bin, "-E", "-P", "-m", "loopx.agy_goal_mode.host_runtime", ...];在发布快照安装环境下,-E -P 隔离了 PYTHONPATH 与当前工作目录,provider Python 在 site-packages 中找不到 loopx,导致 Stop hook 与 LaunchAgent 立即以 ModuleNotFoundError: No module named 'loopx' 失败。改动后,通过共享的 resolve_antigravity_runtime_bins 与 build_antigravity_host_runtime_args 检测目标 python_bin -E -P 是否可导入 loopx.agy_goal_mode.host_runtime:在 pip/可编辑虚拟环境保持 -m 不变;在发布快照环境则改用 -E -P -c <_RELEASE_ROOT_BOOTSTRAP>,并在生成侧保留未解引用的软链路径(如 bin/loopx),执行期按 --cli-bin 实时解析最新 releases/<id>/ 根目录并失败关闭执行。
可观测结果: 发布快照环境下生成的 hooks.json Stop hook、build_antigravity_launchd_command 与 LaunchAgent ProgramArguments 在 loopx upgrade 将软链由旧版本切换至新版本并移除旧目录后,仍可在 -E -P、受污染 PYTHONPATH/cwd 与冷启动 cwd="/" 下零 ModuleNotFoundError 正常完成(Stop hook 返回 {},LaunchAgent heartbeat-tick 返回 {"ok": true});若软链目标失效,则直接报错 loopx release root not found from --cli-bin 失败关闭,绝不退回加载外部伪造包。
明确非目标: 本 PR 不改动普通 pip/可编辑虚拟环境的 -E -P -m 启动形式,不提前合并平行重构分支的包路径迁移,也不修改用户机器上既有历史静态文件除非用户显式重新同步 hooks 或重装 LaunchAgent。
当前阶段剩余边界: 与平行 PR #9510(agy_goal_mode -> hosts/agy 迁移与薄兼容转发垫片)同批次合入时,需由后合入分支保持 _HOST_RUNTIME_MODULE 或兼容垫片一致性;此外相对最新前移 origin/main(d976868f7a)的 Goal Change Quality 收据需在合并前重新签收。
需求与规格依据: 仓库内 origin/main 针对本次线上 dogfooding 故障尚无独立 RFC(spec_basis: no_spec),设计要求源自发布快照安装结构契约(bin/loopx -> releases/<id>/scripts/loopx)及现有 Antigravity host runtime / LaunchAgent 协议约束。
改动思路 / Approach
- 统一软链保留与探测逻辑(
loopx/agy_goal_mode/__init__.py):_resolved_executable_path(L233)统一使用os.path.abspath(os.path.expanduser(binary)),刻录软链逻辑路径(如bin/loopx)而不realpath解引用,避免把配置钉死在某一次即将过期删除的releases/<id>快照目录上。resolve_antigravity_runtime_bins(L239)在resolve_local_executable=True时解析sys.executable与cli_bin;在resolve_local_executable=False时返回("python3", cli_bin),完全保留现有远程/模板模式语义。_python_supports_isolated_module(L255)用子进程实际探测python_bin -E -P能否找到loopx与loopx.agy_goal_mode.host_runtime:可导入(editable/pip venv)继续使用-m loopx.agy_goal_mode.host_runtime;不可导入(发布快照providerPython)则切换到-c _RELEASE_ROOT_BOOTSTRAP。
- 失败关闭的运行时发布根引导(
_RELEASE_ROOT_BOOTSTRAP, L217):- 在
-E -P已屏蔽外部PYTHONPATH与cwd的前提下,引导代码仅从sys.argv[1:]解析--cli-bin(兼容--cli-bin X与--cli-bin=X),必要时经shutil.which补全裸命令名,再执行Path(c).expanduser().resolve()解引用至releases/<id>/scripts/loopx。 - 验证
p.parents[1] / "loopx"为目录后将其作为唯一高优先级sys.path[0]并写入LOOPX_RELEASE_ROOT,清除空串/.,设置sys.argv[0]后通过runpy.run_module(..., run_name="__main__", alter_sys=True)拉起真实模块;若目标缺失则以"loopx release root not found from --cli-bin"非零退出,绝不降级污染导入。
- 在
- 消除重复拼装(
loopx/agy_goal_mode/launchd_watchdog.py):build_antigravity_launchd_plist(L94)删去重复的_resolved_executable_path与手写ProgramArguments列表,直接复用resolve_antigravity_runtime_bins与build_antigravity_host_runtime_args("heartbeat-tick", ..., extra_args=..., resolved_bins=(python_bin, resolved_cli_bin))。
架构评估与当前 PR 边界: 改动收敛复用 resolve_antigravity_runtime_bins 与 build_antigravity_host_runtime_args 作为唯一命令行与可执行路径解析 owner,清除了 launchd_watchdog.py 中重复的 _resolved_executable_path / ProgramArguments 拼装代码,实现净减重且与原有 pip/venv 及模板模式保持完全兼容。 当前 PR 仅覆盖 loopx/agy_goal_mode/__init__.py、loopx/agy_goal_mode/launchd_watchdog.py 与 tests/test_agy_goal_mode_host_runtime.py 三个文件,不跨越到不相关 host 或核心状态机。
hooks / plist generator (at install time)
└─ resolve_antigravity_runtime_bins(cli_bin) -> preserves symlink path (e.g. bin/loopx)
├─ _python_supports_isolated_module(python_bin) == True (venv/editable)
│ └─ [python_bin, "-E", "-P", "-m", "loopx.agy_goal_mode.host_runtime", ...]
└─ _python_supports_isolated_module(python_bin) == False (release-snapshot provider python)
└─ [python_bin, "-E", "-P", "-c", _RELEASE_ROOT_BOOTSTRAP, op, "--cli-bin", bin/loopx, ...]
├─ symlink target valid -> resolves parents[1]/loopx -> runs upgraded r2
└─ symlink broken / no loopx dir -> exits non-zero (never falls back to cwd/PYTHONPATH)
注:以上控制流示意基于对 2a097060a90b8b6798a96eee94d04864674da652 源码符号的静态阅读与本地反例验证整理,完整实测结果见下文列表。
具体改动 / Changes
精确提交 2a097060a90b8b6798a96eee94d04864674da652 相对分支基线 b9357ae7e3e305f0d2cc284c23360085402dad7e(及当前 origin/main d976868f7a9db73398014ffe4a0d69c3d0383979 merge-base)共修改 3 个文件(+336 / -50,merge-tree 511db528b5 零冲突):
loopx/agy_goal_mode/__init__.py(+89 / -18):- 新增
_HOST_RUNTIME_MODULE(L216)、_RELEASE_ROOT_BOOTSTRAP(L217)、_resolved_executable_path(L233)、resolve_antigravity_runtime_bins(L239)、_python_supports_isolated_module(L255),并将_antigravity_provider_args泛化为公共入口build_antigravity_host_runtime_args(L274,支持extra_args与resolved_bins复用)。 build_antigravity_hooks_template(L331)与build_antigravity_launchd_command(L363)统一委派给build_antigravity_host_runtime_args。
- 新增
loopx/agy_goal_mode/launchd_watchdog.py(+16 / -32):- 删除本文件内重复的
_resolved_executable_path,改为从包根导入resolve_antigravity_runtime_bins与build_antigravity_host_runtime_args构造 LaunchAgentProgramArguments(L115-141),与hooks.json和install-launchd保持单一语义来源。
- 删除本文件内重复的
tests/test_agy_goal_mode_host_runtime.py(+231):- 新增
_make_release_snapshot(L849)与端到端反例测试test_release_snapshot_hooks_and_launchd_survive_upgrades_without_site_packages_loopx(L874),覆盖无loopx的 provider venv、软链r1 -> r2升级并彻底删除r1、向PYTHONPATH与cwd注入恶意loopx/__init__.py、LaunchAgentcwd="/"执行、editable venv 维持-m分支,以及r2删除后失败关闭。
- 新增
| 验证项目 | 范围 / 命令视角 | 实测结果 |
|---|---|---|
| 定向测试集合 | pytest -q 7 份 host/hooks/install/budget/import 边界测试 |
PASS (164 passed in 39.30s) |
| 架构全套回归 | pytest -n 4 -q tests/architecture/ |
PASS (1919 passed in 93.00s) |
| 静态与契约检查 | ruff check, mypy --strict (2 源码文件), check_rfc_bilingual, vocab (34/34), ratchet, loopx check |
PASS (0 errors, public boundary scan clean: 3 files) |
| Canary Premerge | loopx canary premerge --tier standard --from-git-diff --git-diff-base origin/main |
6/6 direct + 2/2 catalog (failures=0, manual_hold_count=0, failed_commands=[]); 仅前移主干 d976868f7a 上本隔离工作树 CQR 呈 quality_receipt_missing |
| 独立反例扩充测试 | 含空格路径 + 真实 sync_antigravity_hooks + 真实 /bin/sh -c + plistlib 往返 + --cli-bin=<path> + 投毒 PYTHONPATH/cwd + 删除目标失败关闭 |
PASS (ADV_9516_OK=True) |
对主干的风险 / Risks
- 无核心控制面与已有 venv 回归风险:
- 可编辑/
pip虚拟环境通过_python_supports_isolated_module探测命中后仍走原有-E -P -m loopx.agy_goal_mode.host_runtime,resolve_local_executable=False模式仍返回python3 -E -P -m ...,保持 100% 向后兼容; - 新增引导逻辑仅当
python_bin -E -P无法导入loopx.agy_goal_mode.host_runtime时启用,且对路径含空格、--cli-bin=<path>及损坏目标均有确切验证。
- 可编辑/
- 需关注的合并与运维边界(非阻断):
- 与平行 PR #9510 的合入协调: 本 PR 对
origin/main@d976868f7a的只读merge-tree完全无冲突(511db528b5);但平行 PR #9510 将loopx/agy_goal_mode/迁入loopx/hosts/agy/(并在loopx/agy_goal_mode/保留薄转发垫片)。若其中之一先合入,另一分支合入前需确认_HOST_RUNTIME_MODULE与转发垫片协同工作正常(经检查 #9510 的host_runtime.py转发垫片支持__main__入口,仍建议先合后按合并顺序复测一次)。 - 既有旧配置迁移边界: 若用户机器在修复前已写入过旧版
-m的hooks.json或 LaunchAgent plist,升级代码后需重新执行一次slash-commands --with-agy-hooks --execute或install-launchd --execute以刷新静态命令文本。 - Merge-readiness 与 CQR 说明: 本隔离审查工作树在
origin/main@d976868f7a下运行canary premerge全数代码命令通过(failures=0),仅报告因主干已前移导致的quality_receipt_missing(合并前由维护者/作者按需要刷新收据)。
- 与平行 PR #9510 的合入协调: 本 PR 对
我的整体评价 / Verdict
对 exact head 2a097060a90b8b6798a96eee94d04864674da652 全量 500 行 diff、所有调用点(slash_command_install.py、launchd_watchdog.py、host_runtime.py、scripts/loopx)审计以及本地实测结果来看:根因定位精准,软链动态解析与 -E -P 引导脚本兼具安全性(防 PYTHONPATH/cwd 投毒、损坏即失败关闭)和跨升级持续性,同时通过提取共享函数实现了 launchd_watchdog.py 去重。
- 影响评估: 对长程自动续跑与 Antigravity hook/LaunchAgent 稳定性具备明确正向改善(
improved,消除发布快照升级后的ModuleNotFoundError中断);对用户体验属于透明加固(preserved,本 PR 仅修复命令行 hook 与 LaunchAgent plist 生成的运行时命令拼装,不改动桌面端界面、前端 HTML 或可视化交互视图。已在隔离容器内通过真实/bin/sh -c执行生成的 Stop hook 命令行、plistlib序列化往返与含空格路径 LaunchAgent tick 反例验证;真实 macOSlaunchctl bootstrap守护进程常驻未在本审查沙箱直接触发加载。)。 - 结论与后续边界: 本 PR 达到 APPROVE 标准(鉴于作者同源账号限制,按策略以
COMMENTED形式发布批准结论并保留OPEN状态由维护者最终合入)。
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
评审 head 2a097060a90b8b6798a96eee94d04864674da652,代码对照为共同祖先 b9357ae7e3e305f0d2cc284c23360085402dad7e。GitHub 当前目标 base 为 d976868f7a9db73398014ffe4a0d69c3d0383979。
动机 / Motivation
从本机发布快照运行 Antigravity Stop hook 或 LaunchAgent 的用户,升级后仍需要原有自动续跑。
常规安装用软链指向发布快照。旧命令在裸 provider Python 中无法导入 LoopX;候选能跟随健康升级,但当仅 CLI 文件缺失、快照包仍在时,配置预览会把坏链接当作可用。
生成的命令应随健康发布快照切换,并在原 CLI 路径失效时给出明确不可用结果,避免确认无效的 LaunchAgent 配置。
本次验证限于生成命令、独立 provider Python 和安装预览。没有加载真实 LaunchAgent,也没有测量已部署 hook 的实际更新。
改动思路 / Approach
共享 hook 和 LaunchAgent 参数构建与已有发布安装 owner 一致。发布根应由实际可用的 launcher 确认,单用上级目录仍存在会把不完整快照当作可用。
保留存在的有效升级路径和 pip/可编辑模式。补齐 CLI 文件单独缺失的负例,再验证真实生成命令拒绝它。
测试通过健康软链升级、pip/可编辑路径和禁用本机解析的模板分支;不完整快照被误判为正常。 回读现有同头 Gemini 评审。它测试了整个发布目录移除,我独立补齐仅 launcher 文件缺失的情况。并行 #9510 迁移入口的组合仍待确切提交验证。
具体改动 / Changes
完整 PR 涉及 3 个文件,增加 336 行、删除 50 行。以 b9357ae7e3e305f0d2cc284c23360085402dad7e 的 docs/product/release-readiness.md 中 Supported Install And Update Paths 为对照。当前安装与升级路径应交付由已有安装 owner 管理并可实际启动的 launcher。 生成的命令应随健康发布快照切换,并在原 CLI 路径失效时给出明确不可用结果,避免确认无效的 LaunchAgent 配置。 这是本地预览和后续配置的可用性边界。测试在临时目录里只移动夹具文件,未写或加载系统 LaunchAgent。 基线规范
关键代码讲解
_RELEASE_ROOT_BOOTSTRAP以软链目标定位当前发布包。确认上级包目录后启动模块。这里缺少对可执行文件存在性的检查。 源码resolve_antigravity_runtime_bins保留 CLI 软链以跟随升级。共享精确解释器与可执行路径,模板仍使用 python3。 源码build_antigravity_host_runtime_args判断 provider Python 是已安装包还是发布快照。生成隔离的 -m 或快照引导命令,继续传原作用域参数。 源码build_antigravity_launchd_plist在 LaunchAgent 中应用相同运行时参数。保留状态目录、时间限制和 registry 路由。 源码
对主干的风险 / Risks
[P2] 仅缺少 CLI 可执行文件时,LaunchAgent 安装预览仍成功。 在隔离快照生成真实 install-launchd 命令,完整安装预览退出 0。只移除目标 scripts/loopx、保留包目录与软链后,预览仍退出 0,JSON 为 ok:true,输出 ProgramArguments 保留悬空软链。 启动模块前确认解析到的 launcher 文件存在且符合发布布局。补充包目录仍在、唯独 CLI 文件缺失的真实命令回归,同时保留健康软链升级与删除整个发布目录的原对照。 判定位置
候选四项 launchd 定向测试通过,包含 provider 环境没有 LoopX、软链切换到健康快照、旧快照移除及整个快照缺失时失败。 正常和缺件路径使用同一生成 argv,同一 provider Python 与同一发布根,仅切换目标 CLI 文件存在性。 本轮确认的是预览错误成功及定向生成路径。系统 launchctl、已安装旧静态配置的迁移和 #9510 合并后的组合未实测。
我的整体评价 / Verdict
健康发布快照的升级连续性已经改善。不完整安装时,用户需要在安装预览获得可处理的失败,否则可能留下下一次启动才发现的无效配置。保留共享生成机制,补齐缺件检查与回归后复核。
English verdict: REQUEST_CHANGES at 2a09706. The generated LaunchAgent preview still reports success when only the CLI executable is missing from a retained release tree, leaving a dangling launcher in ProgramArguments.
2a09706 to
00759d0
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewer: model_agent · Gemini · Google · self_reported
English verdict: APPROVE on exact head 00759d0bdc55f5da94dbb31569230a0e98282c8b: resolves the Round-2 6083682955 [P2] finding cleanly by enforcing executable presence, permissions, and scripts//bin/ release layout at both hook/plist generation time and _RELEASE_ROOT_BOOTSTRAP runtime while preserving healthy release upgrades and -E -P -m venv parity; 164 targeted tests, 1919 architecture tests, ruff, mypy --strict, boundary scan, canary checks, and independent adversarial counterfactuals all pass cleanly.
动机 / Motivation
受影响调用方 / 操作者: 使用发布快照方式安装 LoopX(即全局命令经由 bin/loopx 软链指向 releases/<id>/scripts/loopx,而关联 python_bin 为独立 provider 虚拟环境且其 site-packages 未安装 loopx 包)并启用 Antigravity Stop hook 与 macOS LaunchAgent 看门狗的用户与维护者。
前后场景对比: 改动前不仅初始主干上的 -E -P -m 会在发布快照安装中触发 ModuleNotFoundError,上一版(2a097060a9)虽然引入了 _RELEASE_ROOT_BOOTSTRAP,但在目标 scripts/loopx 文件被删除、仅保留软链与上层 loopx 包目录时,install-launchd 安装预览仍错误返回退出码 0(ok: true)并把悬空软链写入 ProgramArguments,且未校验证书路径是否处于合规 scripts//bin/ 发布目录。本次 exact head(00759d0bdc)在生成侧与执行侧双双补齐失败关闭防线:生成侧通过 _find_dangling_path_symlink、_is_valid_release_launcher 与 _validate_cli_launcher 拒绝缺失、不可执行、PATH 悬空遮蔽或非 scripts//bin/ 布局的目标(直接抛出 FileNotFoundError),运行期 _RELEASE_ROOT_BOOTSTRAP 亦同步校验 p.is_file()、可执行权限(POSIX X_OK)、p.parent.name in ("scripts", "bin") 与 (p.parents[1] / "loopx").is_dir()。
可观测结果: 健康的发布快照升级(软链从 r1 切换至 r2 并移除 r1)下,hooks.json Stop hook、install-launchd 与 LaunchAgent heartbeat-tick 在含空格路径、受污染 PYTHONPATH/cwd 与冷启动 cwd="/" 下零 ModuleNotFoundError 正常执行;当 scripts/loopx 文件被删、权限不可执行(0644)、被 PATH 首项悬空软链遮蔽或处于无效 other/loopx 目录时,install-launchd --dry-run、Stop hook、以及直接调用 builder(provider Python 与可编辑 venv)全部失败关闭(退出非零 / 抛出 FileNotFoundError),绝不写入悬空配置或退回污染导入。
明确非目标: 本 PR 不改动可编辑/pip 虚拟环境默认的 -E -P -m 启动形式及 resolve_local_executable=False 模板模式,不修改系统既已存在的静态文件,也不在此处合并平行主机包迁移 PR。
当前阶段剩余边界: 系统级 launchctl bootstrap 守护进程加载未在隔离审查环境中执行,同时与平行主机目录整理(如 #9510 迁至 hosts/agy 兼留垫片)同批次并入时应由后合入方保持模块入口同步;本隔离工作树下的 Goal change-quality 收据呈现本地 quality_receipt_missing,需保持作者侧收据同步。
需求与规格依据: 仓库内 origin/main 针对本次 dogfooding 修复尚无独立 RFC(spec_basis: no_spec),规范基准依据现有发布快照布局与支持升级路径约束(docs/product/release-readiness.md)及 Round-2 评审意见(6083682955)。
改动思路 / Approach
针对上轮外部评审 6083682955 指出的 [P2] 仅删除 scripts/loopx 文件时 install-launchd 预览仍返回 ok: true 并将悬空软链留在 ProgramArguments,新 head 00759d0bdc55f5da94dbb31569230a0e98282c8b 建立了生成期与执行期双重一致防线:
- 生成/预览侧校验(
_find_dangling_path_symlinkL248 +_is_valid_release_launcherL260 +_validate_cli_launcherL270):resolve_antigravity_runtime_bins(L290)针对裸命令名cli_bin先调用_find_dangling_path_symlink:只要PATH上排在前面的同级项就是悬空软链,立即捕获该悬空路径而不被后续目录中的其他可执行文件悄然兜底遮蔽。build_antigravity_host_runtime_args(L326)在resolve_local_executable=True时调用_validate_cli_launcher:- 验证显式路径解引用后必须
is_file()且 POSIX 具备os.X_OK(否则抛出FileNotFoundError); - 当目标 Python 处于 release-snapshot 模式(
require_release_layout=not uses_isolated_module)时,进一步强制要求不能是未解析出的裸名且必须满足_is_valid_release_launcher(parent.name in ("scripts", "bin")且(parents[1] / "loopx").is_dir())。
- 验证显式路径解引用后必须
- 执行期引导自校验(
_RELEASE_ROOT_BOOTSTRAP, L217):- 从
--cli-bin(兼容--cli-bin X与--cli-bin=X)解析出p = Path(c).expanduser().resolve()后,同步校验p.is_file()、os.access(p, os.X_OK)(POSIX)、len(p.parents) > 1、p.parent.name in ("scripts", "bin")以及(p.parents[1] / "loopx").is_dir();任一项不满足立即以"loopx release root not found from --cli-bin"非零退出,并在PYTHONPATH/cwd投毒环境下严格保持失败关闭。
- 从
- 跨入口统一复用:
build_antigravity_hooks_template、build_antigravity_launchd_command与launchd_watchdog.build_antigravity_launchd_plist(L94)全部经由build_antigravity_host_runtime_args与resolve_antigravity_runtime_bins执行,确保安装预览、Stop hook 与 LaunchAgent 行为一致且不触发多余探测。
架构评估与当前 PR 边界: 所有发射与校验约束均统一收口在 loopx/agy_goal_mode/__init__.py(resolve_antigravity_runtime_bins、_validate_cli_launcher、_is_valid_release_launcher、build_antigravity_host_runtime_args 与 _RELEASE_ROOT_BOOTSTRAP)及唯一调用方 launchd_watchdog.build_antigravity_launchd_plist,生成期与运行期检查规则完全对称且无任何重复代码,可逆性高。 当前 PR 保持在 3 个相关文件范围内(loopx/agy_goal_mode/__init__.py、loopx/agy_goal_mode/launchd_watchdog.py、tests/test_agy_goal_mode_host_runtime.py),共 +512 / -50 行。
resolve_antigravity_runtime_bins(cli_bin)
├─ explicit path -> abspath(expanduser(cli_bin)) (preserves symlink)
└─ bare name -> _find_dangling_path_symlink first, else shutil.which
build_antigravity_host_runtime_args(...)
├─ probe python -E -P importability -> uses_isolated_module
├─ _validate_cli_launcher(require_release_layout=not uses_isolated_module)
│ └─ missing / non-exec / dangling PATH / invalid parent (!scripts|bin) -> FileNotFoundError
└─ emit [-m ...] (venv/non-local) OR [-c _RELEASE_ROOT_BOOTSTRAP] (release snapshot)
└─ at execution: re-checks p.is_file & X_OK & parent in (scripts,bin) & parents[1]/loopx.is_dir()
注:以上流程基于对 00759d0bdc55f5da94dbb31569230a0e98282c8b 源码的静态阅读整理,各分支均有对应自动化实测验证。
具体改动 / Changes
精确提交 00759d0bdc55f5da94dbb31569230a0e98282c8b 已 rebase 至当前 origin/main(cc44cb7c1601af333b5f828e9f9fe4b378a2c66a,merge-tree a175999751 无冲突),相对上一头 2a097060a9 新增增量 238 行(完整 PR 3 文件 +512 / -50):
loopx/agy_goal_mode/__init__.py(+148 / -18):- 加强
_RELEASE_ROOT_BOOTSTRAP(L217-231),补充p.is_file()、os.access(p, os.X_OK)与p.parent.name in ("scripts", "bin")校验; - 新增
_is_explicit_cli_path(L240)、_find_dangling_path_symlink(L248)、_is_valid_release_launcher(L260)与_validate_cli_launcher(L270),并接入resolve_antigravity_runtime_bins(L290)与build_antigravity_host_runtime_args(L326)。
- 加强
loopx/agy_goal_mode/launchd_watchdog.py(+16 / -32):- 保持去重结构,复用了
resolve_antigravity_runtime_bins与build_antigravity_host_runtime_args。
- 保持去重结构,复用了
tests/test_agy_goal_mode_host_runtime.py(+348):- 在
test_release_snapshot_hooks_and_launchd_survive_upgrades_without_site_packages_loopx(L1058 起)补充:仅删除r2/scripts/loopx(保留r2/loopx与软链)后验证install-launchd --dry-run、Stop hook、provider Python 与可编辑 venv builder 均失败关闭;新增r2/other/loopx非标准布局拒收测试,覆盖生成期FileNotFoundError与执行期退出。
- 在
| 验证项目 | 范围 / 命令视角 | 实测结果 |
|---|---|---|
| 定向测试集合 | pytest -q 7 份 host/hooks/install/budget/import 边界测试 |
PASS (164 passed in 41.46s) |
| 架构全套回归 | pytest -n 4 -q tests/architecture/ |
PASS (1919 passed in 75.66s) |
| 静态与契约检查 | ruff check, mypy --strict (2 源码文件), check_rfc_bilingual, vocab (34/34), ratchet, loopx check |
PASS (0 errors, public boundary scan clean: 3 files) |
| Canary Premerge | loopx canary premerge --tier standard --from-git-diff --git-diff-base origin/main |
6/6 direct + 2/2 catalog (failures=0, manual_hold_count=0, failed_commands=[]);工作树无独立 CQR(作者侧已报告有效收据) |
| Round-2 扩展反例脚本 | 仅删 scripts/loopx 后测 install-launchd --dry-run + /bin/sh -c hook + 直接 builder;chmod 0644 不可执行拒收;PATH 首项悬空软链遮蔽拒收;含空格 r1->r2 升级 + plistlib + 可编辑 venv -m 保持 |
PASS (ADV_9516_V2_OK=True) |
对主干的风险 / Risks
- 无控制面及原有模式回归风险:
- 可编辑/
pip虚拟环境保持-E -P -m与原有工作行为,不触发发布目录布局约束;resolve_local_executable=False模板模式不受影响; - 对缺失文件、
0644不可执行文件、悬空PATH软链及错误目录结构(other/loopx)的拒收边界均已在生成期与运行期双层核实,不会漏出悬空配置或加载受污染路径。
- 可编辑/
- 协调与边界提示(非阻断):
- 若系统在旧版本下已写入历史静态
hooks.json/.plist,需重新执行一次安装同步以刷新启动命令; - 平行 PR
#9510(agy_goal_mode -> hosts/agy重命名兼转发垫片)合入前后需注意入口名称一致性; - 隔离工作树内未复制本地 CQR 状态故
canary premerge显示quality_receipt_missing(命令检查全部 0 失败)。
- 若系统在旧版本下已写入历史静态
我的整体评价 / Verdict
Round-2 修复精确闭合了 6083682955 指出的仅缺目标可执行文件时预览漏判问题,并连带覆盖了文件权限(X_OK)、目录结构(scripts/bin)与 PATH 悬空遮蔽边界;全部回归、静态检查与独立反例均在精确提交 00759d0bdc55f5da94dbb31569230a0e98282c8b 上通过。
- 影响评估: 对长程自动续跑与 Antigravity hook/LaunchAgent 配置可靠性具有明确正向收益(
improved,既支持无感跨快照升级,又在快照损坏时即时阻断无效配置);对用户体验保持安全防护提升(preserved,本 PR 仅校验与构造 Antigravity Stop hook 及 LaunchAgent CLI 启动命令,不涉及前端界面、桌面页面或图形视图变更。 已通过本地真实sync_antigravity_hooks、/bin/sh -c、plistlib往返及install-launchd --dry-run子进程反例校验命令行输出与失败诊断;真实 macOSlaunchctl常驻未作实机写盘加载。)。 - 结论与后续边界: 本 PR 达到 APPROVE 标准(鉴于作者同源账号限制,按策略以
COMMENTED形式发布批准结论并保留OPEN状态由维护者最终合入)。
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
使用 release snapshot 和独立 provider Python 的 Antigravity 用户。 已配置的 Antigravity Stop hook 和 LaunchAgent 应从其当前 CLI 安装运行,跨健康快照更新后继续可启动。 当前在生成和运行时校验 launcher,provider 无 LoopX 时按绑定 CLI 软链导入快照,pip/editable 保持原入口。
上一轮只删 launcher 就能使安装预览误报。当前头已拒绝缺件,另一个可导入的旧安装仍可改变启动来源。 正常快照可以启动,只有 launcher 缺失时拒绝,混合旧安装仍会令 watchdog 退出。
已加载 macOS LaunchAgent、已部署静态配置迁移、联合 #9510 的安装行为与 Windows 暂未覆盖。未查询托管 CI。
改动思路 / Approach
_validate_cli_launcher 拒绝悬空或非可执行文件及错误布局。_RELEASE_ROOT_BOOTSTRAP 解析 CLI 软链,健康时把目标快照放入导入路径首位。LaunchAgent 保留既有 state、registry、PATH 与 watchdog 标签,三个调用者共享运行参数构建。 先从已验证的 CLI launcher 判定是否为明确的发布快照。若是,绑定到该快照或校验模块来源与它一致;普通 pip/editable 继续原 -m 路径。把可导入但缺少 heartbeat-tick 的旧模块加入回归。
当前分支依据模块是否可导入选择 -m 或 bootstrap,无法证明 provider venv 的宿主 runtime 属于配置中的 CLI。
具体改动 / Changes
完整核对 cc44cb7c1601af333b5f828e9f9fe4b378a2c66a 到 00759d0bdc55f5da94dbb31569230a0e98282c8b 的 3 个路径(+512/-50)。已配置的 Antigravity Stop hook 和 LaunchAgent 应从其当前 CLI 安装运行,跨健康快照更新后继续可启动。 Supported Install And Update Paths
关键路径
- 校验可执行文件及发布快照布局。_validate_cli_launcher
- 决定子解释器是否已有宿主模块。_python_supports_isolated_module
- 为 hooks/install/tick 决定共同启动 argv。build_antigravity_host_runtime_args
- 保持原 LaunchAgent 定时和状态配置。build_antigravity_launchd_plist
对主干的风险 / Risks
[P2] 旧可导入安装会遮蔽健康发布快照中的 watchdog。同一有效快照和 CLI 软链下,在另一个隔离 provider venv 加入旧版源码的 editable-style .pth。新 builder 选择 -m;-E -P 的 origin 指向旧版,实际生成的 heartbeat-tick 加 --help 退出 2,因为旧 dispatcher 只支持 stop-hook。裸 venv 的同一桥接命令退出 0。 当前分支依据模块是否可导入选择 -m 或 bootstrap,无法证明 provider venv 的宿主 runtime 属于配置中的 CLI。 当前代码
独立 48 项 Antigravity 回归通过。候选在裸 provider Python 下使用快照 bootstrap;上轮仅缺 scripts/loopx、旧快照删除后升级、无适用发布布局的负例均受真实生成路径覆盖。 两套独立 venv,使用真实新旧源码、真实 plist 生成器和真实 Python 入口,执行 help 到 argparse。旧版为 856cd6a,实际 launchctl 未启动。 已加载 macOS LaunchAgent、已部署静态配置迁移、联合 #9510 的安装行为与 Windows 暂未覆盖。未查询托管 CI。
我的整体评价 / Verdict
REQUEST_CHANGES。先从已验证的 CLI launcher 判定是否为明确的发布快照。若是,绑定到该快照或校验模块来源与它一致;普通 pip/editable 继续原 -m 路径。把可导入但缺少 heartbeat-tick 的旧模块加入回归。 本次范围为已核对的宿主运行时与定向验证,界面布局未改。
English verdict: REQUEST_CHANGES — an importable older editable LoopX takes precedence over a healthy release launcher and rejects the generated heartbeat-tick command. The prior dangling-launcher finding is fixed.
00759d0 to
23fe282
Compare
|
Addressed review
|
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
精确 head 23fe282cc15d80de4dd64c69776455901bbf9890,基线及共同祖先 06941016e224ccdc7c0298fd7a28acec65cf8a35。
动机 / Motivation
使用发布快照及独立 provider Python 来配置 Antigravity Stop hook 或 macOS LaunchAgent 的操作者。 旧生成器始终以 Python 模块方式启动,在未安装 LoopX 的 provider Python 中退出。当前候选让直接安装和重新生成的命令从绑定快照启动。通过激活包获取的命令仍遇到原错误,部分缺件的快照也会获报可安装。 原来的导入失败会让挂钩停止恢复或使看门狗无法启动,而且可能在配置写入后才被发现。直接生成的 hook 与 ProgramArguments 应从所绑定的有效快照启动,升级后应跟随软链。常用激活命令需兑现相同启动结果,缺件则应在写入前明确拒绝。 没有加载系统 LaunchAgent、迁移现有机器上的静态配置、联合验证 #9510 或运行 Windows。未查询托管 CI,作者的质量收据和标准预合并结论仅作为作者记录。
改动思路 / Approach
直接生成路径验证 launcher,识别快照或匹配的 pip/editable 环境,保留软链本身。快照子进程解析实时目标并优先载入目标发布根。LaunchAgent 保留原状态目录、标签、间隔和执行授权。 共享参数构建避免 Stop、安装及 tick 各自选择不同的安装根,也让普通 pip 和匹配的 editable 继续使用模块入口。生命周期归原有安装及宿主 owner,路径解析本身不绑定会话、不加载服务,也不准入新轮。进一步收束宜复用同一个已验证入口,避免便携模板被读成可以在当前机器直接执行的命令,以及目录存在与模块可启动使用不同证据。
直接生成与公开激活各有一条启动路径,目录存在也不能证明宿主模块可启动。本轮应补齐本机激活的执行与缺模块的拒绝,复用现有发布 owner 及兼容分支。
具体改动 / Changes
完整范围为 3 个文件,+760 / -50。两个生产文件改写宿主启动参数生成和发布来源验证,测试文件补充快照升级、路径失效和旧 editable 依赖的真实子进程覆盖。对照 Supported Install And Update Paths 的安装 owner 和激活回读要求,直接构建在已核范围内满足健康快照、缺 launcher 和旧 .pth 这三项。激活包命令和缺模块的写入边界仍未满足。跨宿主迁移属于本次未验范围。 基线规范
关键代码讲解
_use_isolated_host_module先按真实 launcher 区分软链、带发布清单的快照、匹配 checkout 和普通 Python 安装。带旧 editable 路径的 provider 不再能替代绑定的健康快照。 选择逻辑build_antigravity_host_runtime_args为 Stop、安装和 tick 共享解释器入口。直接生成保持软链,便携分支跳过解析。 共享入口build_antigravity_launchd_plist复用共享参数,并保留状态和日志路径、定时及标签。预览和临时写入都经过这个构建器。 plistantigravity_app_activation_extras同时生成 hooks 模板和建议执行的 watchdog 命令。当前两个分支都传resolve_local_executable=False。 激活包
对主干的风险 / Risks
- [P2] 激活包里的 Stop 和 watchdog 仍无法在独立 provider 环境启动。 精确头的 bootstrap-command-pack 与 agent-onboard 都成功返回激活包,包中 Stop hook 和 watchdog 命令继续用 python3 -E -P -m。从仅在 PATH 提供干净 provider Python 的目录执行,四次都退出 1 和 ModuleNotFoundError;watchdog 用 dry-run 核对同一启动前缀。 直接生成成功不足以覆盖首用入口。建议让本机可执行的激活路径使用同一个快照绑定入口,并从两条公开 CLI 读取和执行产出的命令作回归。 激活生成
- [P2] 缺实际宿主模块的快照仍可获报安装成功。 只移走目标快照的 host_runtime.py,保留可执行的 scripts/loopx 和包目录。install-launchd 预览返回 ok=true,执行 --no-load 返回 written=true,写出的 ProgramArguments 及 Stop hook 都以 ImportError 退出。 同一对照里只移走 launcher 会被明确拒绝。建议在发布根验证中检查实际宿主入口是否齐全,在临时 plist 写入前失败,并保留 hook 错误的 JSON 契约。 根验证 写入路径
- 验证。 独立临时 provider venv 的 base/head 配对中,基线 argv 退出 1,候选 argv 退出 0,候选取消 Stop 返回 {}。完整路径测试覆盖软链升级、旧 .pth 和缺 launcher。缺 host_runtime.py 时,真实预览与 --execute --no-load 均成功返回,实际 argv 退出 1。 默认 PATH 命中发布快照时,候选 164 通过、1 失败,错误断言固定为 -m。相同 PATH 的基线失败项单跑通过,前置候选自己的 venv 后该项通过。 因此兼容回归应显式设置测试 launcher,避免以开发机 PATH 隐式选择安装类型。前置候选 venv 的受控 PATH 中,完整套件 165 项通过。Ruff、两文件 strict mypy 及精确差异空白检查通过。
语义与 CI 对齐
改动复用已有注册、Stop 和 watchdog 规则,没有新增共享状态词汇或赋予观察者调度权限。可执行路径校验是本地强制条件。激活投影在目标环境仍不可执行和缺模块误报均以本地实跑记录。没有加载系统 LaunchAgent、迁移现有机器上的静态配置、联合验证 #9510 或运行 Windows。未查询托管 CI,作者的质量收据和标准预合并结论仅作为作者记录。
我的整体评价 / Verdict
旧 editable 遮蔽与仅缺 launcher 两条历史问题在当前头已关闭。对长程运行,已生成的直接命令具备本地升级连续性的证据。对实际使用,首用激活和失败反馈仍需要上述两处修订。共享构建方向合适,保留直接路径的正负例并把验收到实际激活入口及不完整快照。真实系统加载和部署迁移的结果仍待验证。
English verdict: REQUEST_CHANGES on exact head 23fe282cc15d80de4dd64c69776455901bbf9890. Direct release routing now works, while activation still emits unusable commands for a clean provider and an incomplete release can be reported as installable.
|
Addressed all findings from review
Verified on exact head: |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
English verdict: APPROVE on exact head 5c33dd823cd3792363938ba686408263a0e4e74f: resolves all [P2] findings and host-$PATH test isolation from review 6085180999 cleanly (antigravity_app_activation_extras with resolve_local_executable=True + LOOPX_RELEASE_ROOT fallback emits runnable provider commands; incomplete release trees lacking host_runtime files fail closed before any write even alongside stale .pth; launchd -m unit tests isolate stub venv CLI); verified via PATH="<global-release-bin>:$PATH" pytest (15 passed in 8.47s), uv run --extra test 10-suite run (274 passed, 2 skipped in 61.85s), tests/architecture/ (1919 passed in 76.59s), ruff (0), mypy --strict (0/2), loopx check, standard canary premerge (2/2), and counterfactual probe adv_9516_r3.py.
动机 / Motivation
受影响调用方 / 操作者: 使用 release snapshot 方式安装 LoopX(全局 bin 目录下 loopx 软链指向版本化 releases/<id>/scripts/loopx、而 provider Python 位于独立虚拟环境)、以及首次通过 bootstrap-command-pack 或 agent-onboard 接入 Antigravity Stop hook 与 macOS LaunchAgent watchdog 的用户与维护者。
前后场景对比: R2 (23fe282cc1) 解决了旧 .pth 遮蔽直接构建器的故障,但评审 6085180999 指出了两个剩余阻塞与一项测试路径依赖:其一,antigravity_app_activation_extras 生成激活包时仍传 resolve_local_executable=False,致使 bootstrap-command-pack 与 agent-onboard 输出的 Stop hook 与 watchdog 命令在干净 provider Python 中直接以退出码 1 (ModuleNotFoundError) 失败;其二,_is_valid_release_launcher 仅校验 loopx/ 目录存在,若目标快照缺少 host_runtime.py,install-launchd 预览与 --execute --no-load 仍误报成功写入,直到后续运行才以 ImportError 退出;此外既有 launchd 单测直接传默认 cli_bin="loopx" 会在全局软链先于 venv 时被宿主 PATH 影响。本次 R3 同步收口这两处生产缺口并补齐测试环境隔离。
可观测结果: 实际执行真实 bootstrap-command-pack(含 PATH 命中与 LOOPX_RELEASE_ROOT 回退)与 agent-onboard 输出的 Stop hook({})及 LaunchAgent dry-run/heartbeat-tick --help,在仅包含干净 provider Python 且工作目录被污染的环境里全部以退出码 0 完成;当 release-tree 快照缺失 loopx/__init__.py、agy_goal_mode/__init__.py 或 host_runtime.py 时,无论 provider venv 是否装有旧 .pth,预览、--execute --no-load 与 hook 构建均在写盘前以 FileNotFoundError / {"ok": false} 失败关闭(0 plist 写入),同时在全局发布软链置于 PATH 首位(PATH="<global-release-bin>:$PATH")运行单测 15 passed 与 uv run --extra test 跨套件 274 passed, 2 skipped 全绿。
明确非目标: 本 PR 不改动宿主侧已落盘历史静态配置自动迁移、不修改 Windows 安装脚本或加载真实常驻 launchctl 服务,也不改动除 Antigravity App 激活之外的其他 CLI host 模板。
本次复审针对确切 head 5c33dd823cd3792363938ba686408263a0e4e74f(相对基线 origin/main@06941016e224ccdc7c0298fd7a28acec65cf8a35 共 4 个 DCO 签名提交,MERGEABLE 无冲突,直接回应 R2 23fe282cc15d80de4dd64c69776455901bbf9890 上的评审 6085180999)。需求依据说明:当前仓库尚无专门规定 Antigravity Stop hook / LaunchAgent release-snapshot -m 与 -c 路由的独立 RFC(docs/product/release-readiness.md 规范通用发布/更新通道,docs/reference/protocols/host-cli-source-activation-v0.md 面向 Docker benchmark CLI 激活);本次以实际宿主运行时契约及 6085180999 所列全部修复要求作为核验准绳。
改动思路 / Approach
R3 增量改动严格收敛在 loopx/agy_goal_mode/__init__.py(+46/-9 相对 R2,总文件 736 行)与配套测试 tests/test_agy_goal_mode_host_runtime.py,将目录壳检查拆分为 _is_release_tree_launcher 与 _has_host_runtime_files,并在 antigravity_app_activation_extras 复用既有 resolve_local_executable=True 路径,零新增配置开关或并行决策者。
全提案相对 06941016e2 共改动 3 个文件(+1212/-54):loopx/agy_goal_mode/__init__.py(736 行)、loopx/agy_goal_mode/launchd_watchdog.py 与 tests/test_agy_goal_mode_host_runtime.py,经 uv run --extra test、PATH 前置全局软链实测、ruff、mypy --strict、tests/architecture/ 与 canary premerge 全量核验(未等待或查询远程 CI)。
相对 23fe282cc15d80de4dd64c69776455901bbf9890,R3 做了三项高内聚收口:第一,将“发布树外壳检查 (_is_release_tree_launcher)”与“可导入宿主模块完整性检查 (_has_host_runtime_files)”解耦,使 _use_isolated_host_module 在识别出损坏/缺件发布树时直接失败关闭、绝不静默滑落至 -m 误选旧 .pth;第二,在 antigravity_app_activation_extras 打开 resolve_local_executable=True 并在 resolve_antigravity_runtime_bins 为无 PATH 但携带 LOOPX_RELEASE_ROOT 的进程提供回退定位,从而在不改变其他宿主入口的前提下让 bootstrap-command-pack 与 agent-onboard 真正可执行;第三,以 _make_venv_cli_stub 隔离旧有 -m 断言测试,彻底消除开发机 PATH 污染。
具体改动 / Changes
完整提案覆盖 3 个文件(+1212 / -54),其中相对 23fe282cc15d80de4dd64c69776455901bbf9890 仅更新 loopx/agy_goal_mode/__init__.py(+46/-9)与 tests/test_agy_goal_mode_host_runtime.py(+420);loopx/agy_goal_mode/launchd_watchdog.py 保持与 R2 一致未再改动。
关键代码讲解
-
_has_host_runtime_files、_is_release_tree_launcher与_use_isolated_host_module(loopx/agy_goal_mode/__init__.py:282-324, 392-411):_is_release_tree_launcher检查scripts/或bin/下可执行文件且上两级目录含loopx/或release.json;_has_host_runtime_files进一步要求loopx/__init__.py、loopx/agy_goal_mode/__init__.py与loopx/agy_goal_mode/host_runtime.py全部存在。_use_isolated_host_module在target命中_is_release_tree_launcher(target)后优先核对_has_host_runtime_files(target.parents[1]),缺失立即抛出FileNotFoundError("LoopX release snapshot host_runtime missing: ..."),从而杜绝任何写盘前的静默-m回退,并同步由_RELEASE_ROOT_BOOTSTRAP在运行期再次强校验这 3 个文件。
-
resolve_antigravity_runtime_bins的LOOPX_RELEASE_ROOT回退(loopx/agy_goal_mode/__init__.py:333-355):- 当
cli_bin == "loopx"在PATH上既非断链也未被shutil.which命中时,读取环境变量LOOPX_RELEASE_ROOT定位<root>/scripts/loopx(在 Windows 上检查.ps1)且校验_is_release_tree_launcher;若目标缺少host_runtime文件,下游_use_isolated_host_module仍会准确拒绝而不会放行坏快照。
- 当
-
antigravity_app_activation_extras实机绑定修复(loopx/agy_goal_mode/__init__.py:592-624):- 对
build_antigravity_hooks_template(Stop hook)与build_antigravity_launchd_command(reboot_watchdog_command)统一传resolve_local_executable=True,由loopx/hosts/skill_facade.py:183与loopx/host_loop_activation.py:1335为bootstrap-command-pack及agent-onboard生成可直接运行的快照绑定命令,同时在普通 pip/editable 环境下保持-m。
- 对
-
激活包、缺件阻断与
$PATH隔离回归测试(tests/test_agy_goal_mode_host_runtime.py:439-858, 1434-1826):- 新增
_make_venv_cli_stub将test_install_launchd_preview_execute_no_load_reload_and_uninstall等既有用例与本机全局软链完全隔离;新增test_activation_pack_and_onboard_commands_execute_under_clean_provider_python与test_incomplete_release_snapshot_missing_host_runtime_fails_closed覆盖bootstrap-command-pack、agent-onboard、install-launchd预览/写盘零污染与运行期失效拒止。
- 新增
对主干的风险 / Risks
- 验证矩阵与真实执行结果(确切 head
5c33dd823cd3792363938ba686408263a0e4e74f,未等待或查询远程 CI):PATH="<global-release-bin>:$PATH" .venv/bin/python -m pytest -q tests/test_agy_goal_mode_host_runtime.py:PASS(15 passed in 8.47s,验证在全局软链先于.venv/bin的宿主真实PATH下-m隔离用例不再误判)。uv run --extra test python -m pytest -q(覆盖test_agy_goal_mode_host_runtime.py、test_antigravity_host_runtime.py、test_agy_host_surface.py、test_host_loop_activation.py、test_bootstrap_command_pack_platform.py、test_onboarding_command_platform.py、test_slash_command_install.py、test_slash_command_install_equivalence.py、tests/architecture/test_top_level_module_budget.py、tests/architecture/test_control_plane_import_boundaries.py):PASS(274 passed, 2 skipped in 61.85s,2项跳过为 macOS 环境下跳过 Windows PowerShell 平台用例)。tests/architecture/(.venv/bin/python -m pytest -n 4):PASS(1919 passed in 76.59s)。ruff check(3文件):PASS(All checks passed!);mypy --follow-imports=silent --strict(__init__.py、launchd_watchdog.py):PASS(Success: no issues found in 2 source files);loopx check --scan-path ...(3文件):PASS(ok: true, errors: 0, warnings: 0, checks: 5);标准预合并门禁loopx canary premerge --from-git-diff --git-diff-base 06941016e224ccdc7c0298fd7a28acec65cf8a35 --tier standard:PASS(gate.status="passed", direct=6/6, catalog=2/2, failures=0)。- 独立反事实实测脚本(
adv_9516_r3.py):PASS(ADV_9516_R3_OK=True,实证即使provider_venv已存在旧.pthEditable 安装,缺失host_runtime.py、agy_goal_mode/__init__.py或loopx/__init__.py的发布快照均第一时间抛出FileNotFoundError而绝不回落到旧-m;同时真实运行bootstrap-command-pack与agent-onboard产出的 Stop hook 与 watchdog 命令在极简隔离环境退出0)。
- 已部署钩子运行期失败行为边界: 生成与安装阶段(
install_launchd预览/--execute --no-load、hooks 同步、bootstrap-command-pack)在host_runtime缺失时已全部于写盘前拒绝并保留host_runtime.main()的 JSON 错误契约({"ok": false, "error": "FileNotFoundError"});若在部署之后人为删坏目标快照文件,_RELEASE_ROOT_BOOTSTRAP在导入host_runtime之前即按“非零退出 +stderr明确诊断、不执行任何外部污染包”策略安全失败。
我的整体评价 / Verdict
对 long_horizon 与 user_experience 均判定为 improved:R3 完整消除了 6085180999 指出的两项 [P2] 隐患与开发者 $PATH 敏感断言——首次接入(bootstrap-command-pack / agent-onboard)现在与直接构建一样能在干净 provider Python 中直接落地可执行命令,残缺快照会在预览和安装阶段被零写盘阻断;全提案未引入新词表或语义漂移(semantic_alignment 保持一致),并在 15、274、1919 测试以及静态检查、canary premerge 与独立反事实实测中全部通过,具备合入主干(author-owned COMMENTED APPROVE)条件。
视觉与未覆盖边界声明: 本 PR 仅修改 Antigravity Stop hook / LaunchAgent argv 生成、激活包解析与宿主回归测试,无任何前端或 App 渲染界面改动(已核对全部 3 个改动文件)。 未检查 UI 渲染(不适用)、真实 macOS launchctl bootstrap 常驻守护进程加载、历史已部署静态文件迁移、Windows PowerShell 实机(274 用例中 2 项 Windows 用例在 macOS 上跳过)及远程 GitHub Actions CI(wait_for_ci: false 未查询)。
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
使用发布快照启动 Antigravity 的操作者,需要把启用时生成的 Stop hook 和 macOS 看门狗命令留给后续会话。此前,激活包会要求干净的 Python 直接导入 LoopX,导致刚生成的命令无法运行。新头修复了首次启用和不完整快照的预览误报。
如果通过绝对路径调用 LoopX,且 PATH 中没有 CLI,激活包会把当前快照的 launcher 路径写进长期配置。普通更新保留同一个 Python 时,只要旧快照被回收,这些已保存的命令仍会失联。PATH 能找到稳定软链时,同一升级和回收场景通过。会话、Goal、registry 和定时参数沿用原有所有者。
改动思路 / Approach
两条激活入口现在使用与直接安装相同的参数构造器。生成端与执行端都会检查宿主模块文件是否齐全,正常快照按 launcher 解析活动源码。pip 和匹配的 editable 安装仍使用模块入口。显式更新或修复现有配置仍走各自原本的执行权限。
共享构造器保留的是启动参数和绑定。快照的活动 Python 已由 CLI 启动器选择,plist 的首参数仍是生成时的解释器。新版 PATH 回退还持久保存具体快照路径,增加了一个独立的更新断点。保留共享构造器和宿主文件检查,闭合持久 CLI 路径与已保存 LaunchAgent 的解释器迁移。
具体改动 / Changes
全量复核 06941016e224ccdc7c0298fd7a28acec65cf8a35 到 5c33dd823cd3792363938ba686408263a0e4e74f 的三个路径,共 +1212/-54。既有评审指出的旧包遮蔽、激活包无法运行和缺宿主模块误报三个问题均有本次头的定向覆盖。更新契约按固定主干说明判断。 Supported Install And Update Paths
- AGY-RUNTIME-SOURCE,首次启用已实现。
antigravity_app_activation_extras让bootstrap-command-pack与agent-onboard的 Stop 和 watchdog 命令共用本地快照绑定。_has_host_runtime_files验证入口模块和包文件,缺件时安装预览和写入都会拒绝。 激活包 · 完整性检查 - AGY-WATCHDOG-CONTINUITY,两个场景未达到。 PATH 回退在生成阶段把
LOOPX_RELEASE_ROOT/scripts/loopx固定为--cli-bin,并由build_antigravity_launchd_plist持久化。即使找到稳定 CLI 软链,argv 的解释器路径仍可能在显式更换 Python 后失效。 回退分支 · 看门狗参数
关键代码讲解
resolve_antigravity_runtime_bins 保留 PATH 中的软链。CLI 不在 PATH 时,它会改用当前快照下的具体文件。随后,_RELEASE_ROOT_BOOTSTRAP 对存下来的路径做存在性和完整性检查。这个检查正确地拒绝了被回收的路径。长期配置缺少稳定的入口,导致运行时根本找不到已经健康切换的新版本。 解析 · 引导
对主干的风险 / Risks
[P2] PATH 回退会把旧快照绑定进已保存的激活命令。 用绝对 CLI 软链分别运行两条真实激活入口,独立验证有 PATH 和无 PATH 两组,再从隔离目录中的真实 plist 读回参数。最初四组的 Stop、预览和保存的 tick 均可启动。保持同一个 Python,把软链切换到第二份快照并回收第一份后,新 CLI 仍退出 0。有 PATH 的两组保持可用,无 PATH 的两组 Stop、预览和已保存的 tick 全部退出 1。请从受管安装取得可验证的稳定 launcher,或者把快照路径明确限制为临时命令,避免持久化会被回收的路径。加入同一 Python、两份快照、回收旧版本的落盘回归。 持久路径来源
[P2] 显式更换 Python 后,旧 LaunchAgent 仍绑定原解释器。 在 PATH 可解析稳定软链的场景,另以两份快照分别记录不同 Python,通过 install-launchd --execute --no-load 保存 plist。切换软链并退役旧解释器后,当前 CLI 运行成功,旧 plist 的 argv 首项报 FileNotFoundError。用新解释器重装原标签后恢复。请让快照型 LaunchAgent 使用活动快照的解释器,或让更新流程同步现有受管 plist,并保留 label、Goal、Agent、对话和 registry。默认更新继续用同一 Python,因此此项与上述快照回收反例独立。 固定的解释器入口
语义与 CI 对齐
本头 167 项定向测试通过,补了真实 CLI 激活和缺模块拒绝测试。 同提交的作者侧复核确认首次启用和缺件拒绝通过。本轮对照延长至旧快照回收和旧解释器退役。 同提交作者侧评审
独立对照复现了长期配置的两个失效分支。测试在隔离目录写入并读取真实 plist,未启动系统服务,未验证 Windows 或与 #9510 联合后的行为。按本次配置未查询托管 CI。运行时回退属于 Antigravity 局部逻辑,沿用现有状态与权限词汇。
我的整体评价 / Verdict
首次启动路径已改善。仍需让已保存的后台入口跨正常快照清理继续工作,并在显式迁移解释器后保留或恢复原有绑定。建议以持久配置和真实子进程的对照作为复审条件,分别验证回收旧快照和退役旧解释器。
English verdict: REQUEST_CHANGES on exact head 5c33dd823cd3792363938ba686408263a0e4e74f. Initial activation and incomplete-release rejection now work, and 167 tests pass. Persisted activation commands still break after fallback snapshot retirement, and a saved LaunchAgent still pins a retired Python after an explicit interpreter migration.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
从发布快照启用 Antigravity 的操作者,需要 Stop hook 和 macOS 看门狗在更新后接续原会话。原来的配置在干净 Python 中不能导入 LoopX,有旧包时也可能选到旧入口。当前提交修复了没有 CLI PATH 时丢失稳定软链,以及退役旧解释器后后台命令无法启动的问题。
还有一个实际的绑定错误。同机有两份安装时,即使从 A 的绝对 launcher 启用,若 PATH 先找到 B,生成的 Stop 和看门狗仍会绑定 B。移走 B 后,A 的 CLI 继续正常运行,刚配置的后台接续却失效。会话、Goal、registry 和安装权限仍沿用原有所有者。
改动思路 / Approach
外层 launcher 记录调用时的未解引用路径。生成器识别快照并选择入口,POSIX 引导在执行时选取活动 Python,后续由原宿主模块处理 Stop 和 tick。普通 pip、匹配源码的 editable 安装以及部署预览保留原入口和权限。
源快照与 CLI 软链的匹配现在只在 PATH 查找无结果时执行。已有规范化入口足以区分显式选择、实际调用路径和 PATH 兜底。保留稳定软链和执行期解释器选择,并让持久化配置遵循调用者实际选中的安装。
具体改动 / Changes
复核主干 06941016e224ccdc7c0298fd7a28acec65cf8a35 到 568e3a6404f08e8a8bb976fd8c86f3ac47246720 的四个路径,+1796/-61。此前发布的两条 P2 已独立复验。测试实际调用两条激活 CLI、写入隔离 plist,切换快照后回收旧快照或退役旧解释器,原有命令仍能启动。更新以固定主干契约为准。 Supported Install And Update Paths · 上一轮求改
- AGY-RUNTIME-SOURCE,双安装场景未达到。
scripts/loopx已导出调用方的稳定路径。resolve_antigravity_runtime_bins先从 PATH 找默认名字,只有找不到时才向_resolve_release_cli_shim查询实际启动入口。两条公开激活 CLI 都会保存这一选择。 调用来源 · 选择顺序 - AGY-WATCHDOG-CONTINUITY,已绑定的目标升级通过。
_POSIX_RELEASE_SHELL_BOOTSTRAP在稳定软链切换后检查当前快照、重选 Python,build_antigravity_launchd_plist保留原 label 和参数绑定。无 CLI PATH 的单安装场景和显式替换 Python 均有落盘对照。 执行期引导 · plist
关键代码讲解
_resolve_release_cli_shim 能拿到实际调用路径和当前发布根,并校验二者匹配。当前调用它的条件是 PATH 无命中。后续的 POSIX 引导会忠实地执行已保存的 launcher,即便它来自同机另一份健康安装。选择顺序应在参数构造阶段消除这一歧义。 匹配
对主干的风险 / Risks
[P2] PATH 中的另一份安装覆盖当前调用的发布快照。 在两个独立快照都健康、共用一个 Python 的隔离环境中,通过 A 的绝对软链调用 bootstrap-command-pack 和 agent-onboard,让 PATH 指向 B。两条命令返回成功,Stop、预览和真实落盘的 plist 都绑定 B。只移走 B,A 的 loopx --version 仍退出 0,之前生成的三条入口全部退出 1。PATH 选择 A 或在各子命令后显式指定 --cli-bin A,同一场景全部通过。
请保持显式 --cli-bin 优先。默认值采用已验证且匹配当前发布根的调用 launcher,再将 PATH 用作可靠的兜底。添加双健康安装对照,验证实际调用的 A 与 PATH 中 B 同时存在时,Stop 与读回的 plist 仍跟随 A。 问题分支
语义与 CI 对齐
本头 169 项定向测试通过,Ruff、两文件严格类型检查和入口 shell 语法检查通过。独立对照在临时目录执行真实 CLI 并读回 plist,未加载系统服务,Windows 和 #9510 的组合未验证。按当前配置未查询托管 CI。launcher 来源是本机运行时内部字段,未新增共享准入状态。
我的整体评价 / Verdict
固定单安装时,两条旧故障均已修复。双安装时,目标会话可能继续被交给无关的安装,移走该安装便中断后台运行。请补齐入口选择顺序与真实落盘的对照,再复审当前完整方案。
English verdict: REQUEST_CHANGES on exact head 568e3a6404f08e8a8bb976fd8c86f3ac47246720. The two prior upgrade cases pass, as do 169 tests. A second installation on PATH still overrides the explicitly invoked release when onboarding persists the default launcher.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
English verdict: APPROVE on exact head 568e3a6404f08e8a8bb976fd8c86f3ac47246720: resolves both [P2] continuity blockers (PRRT_kwDOStEbEs68szN4 / 4717187821 and PRRT_kwDOStEbEs68szN- / 4717187830) from review 6085418512 cleanly via un-dereferenced LOOPX_CLI_SHIM propagation in scripts/loopx + _resolve_release_cli_shim and POSIX dynamic interpreter resolution in _POSIX_RELEASE_SHELL_BOOTSTRAP; all 17 host-$PATH tests (13.24s), 276 multi-suite tests (2 Windows skips, 64.44s), 1919 architecture tests (74.23s), bash -n, /bin/sh -n, ruff, mypy --strict, loopx check, 10/10 install_release, python canary premerge, and counterfactual probe adv_9516_r4.py (ADV_9516_R4_OK=True) pass cleanly (2/2 review threads resolved).
动机 / Motivation
受影响调用方 / 操作者: 使用 release snapshot 方式安装 LoopX(全局 bin 目录下 loopx 软链指向版本化 releases/<id>/scripts/loopx、由 .loopx-python / scripts/loopx-python.sh 管理隔离 provider Python)并通过 bootstrap-command-pack、agent-onboard 或 install-launchd 配置 Antigravity Stop hook 与 macOS LaunchAgent watchdog 的用户与维护者。
前后场景对比: R3 (5c33dd823c) 修复了激活包直启问题与不完整快照拦截,但评审 6085418512 指出已持久化 Stop hook 与 LaunchAgent plist 仍存在两处跨升级断裂:第一,通过绝对 CLI 软链调用且 PATH 不包含软链目录时,回退逻辑将具体版本路径 LOOPX_RELEASE_ROOT/scripts/loopx 写入配置,旧快照回收后立即退出 1;第二,LaunchAgent plist 与 Stop hook 将生成时的 python_bin 固定写入 argv[0],若后续将软链切到采用新解释器的 v2 并退役旧 Python,旧配置即报 FileNotFoundError。本次 R4 让 scripts/loopx 导出未解引用调用路径 LOOPX_CLI_SHIM 优先回退受管软链,同时在 POSIX 上改为通过 /bin/sh -c 动态解析目标快照的当前活动 Python。
可观测结果: 在 v1 + venv1 下调用真实 scripts/loopx(分别测试携带与省略软链目录 PATH)生成 bootstrap-command-pack / agent-onboard Stop hook 并实际安装 LaunchAgent plist,再将软链切换至 v2 + venv2 并彻底删除 v1 与 venv1 后:全部已保存的 Stop hook({})、dry-run 预览与 plist ProgramArguments(cwd="/")均无需人工重装直接命中 v2 与 venv2 并以退出码 0 完成,且 PRRT_kwDOStEbEs68szN4、PRRT_kwDOStEbEs68szN- 两条评审线索均已回复并关闭(unresolved_count=0)。
明确非目标: 本 PR 不改动宿主侧历史上已落盘的旧静态配置文件自动改写、不将 POSIX /bin/sh 跳板逻辑移植到 Windows 安装路径,也不调用真实常驻 launchctl bootstrap 守护进程或查询远程托管 CI。
本次复审针对确切 head 568e3a6404f08e8a8bb976fd8c86f3ac47246720(相对基线 origin/main@06941016e224ccdc7c0298fd7a28acec65cf8a35 共 5 个 DCO 签名提交,MERGEABLE 无冲突,与 R3 5c33dd823cd3792363938ba686408263a0e4e74f 上的评审 6085418512 两条阻塞线索 PRRT_kwDOStEbEs68szN4、PRRT_kwDOStEbEs68szN- 逐一对应且均已关闭)。需求依据说明:当前仓库无单独定义 Antigravity LaunchAgent -c/shell 跳板细节的独立 RFC(docs/product/release-readiness.md 规范发布/更新路径,docs/reference/protocols/host-cli-source-activation-v0.md 面向 Docker benchmark CLI 激活);本次严格对照真实运行时契约与 6085418512 所列连续性反例逐项验证。
改动思路 / Approach
R4 增量变动严格限定在 scripts/loopx(导出 LOOPX_CLI_SHIM)、loopx/agy_goal_mode/__init__.py(_resolve_release_cli_shim 与 _POSIX_RELEASE_SHELL_BOOTSTRAP)及 loopx/agy_goal_mode/launchd_watchdog.py(确保 LaunchAgent PATH 保留 /usr/bin:/bin)三处既有 owner 内,使生成期软链保留与运行期解释器切换在同一契约下协同工作而零新增持久文件或配置开关。
全提案相对 06941016e2 共改动 4 个文件(+1796/-61):scripts/loopx、loopx/agy_goal_mode/__init__.py(896 行)、loopx/agy_goal_mode/launchd_watchdog.py 与 tests/test_agy_goal_mode_host_runtime.py,经由语法检查、ruff、mypy --strict、PATH 隔离与多套件 pytest、tests/architecture/、安装发布 profile canary premerge 与独立反事实探针全量实测通过。
相对 5c33dd823cd3792363938ba686408263a0e4e74f,R4 的核心设计对称且最小:
- 生成阶段保留稳定“逻辑调用地址”而非易逝目录:在
scripts/loopx解引用软链循环之前先将原始调用路径导出为LOOPX_CLI_SHIM,再由_resolve_release_cli_shim按“合法软链LOOPX_CLI_SHIM-> 合法软链全局<home-bin>/loopx-> 合法非软链LOOPX_CLI_SHIM-> 最后回退LOOPX_RELEASE_ROOT/scripts/loopx”顺序筛选,并且通过target.is_relative_to(expected_root)拒绝指向旧版本目录的过时LOOPX_CLI_SHIM。 - 运行阶段取消硬编码解释器路径:在 POSIX 上由
/bin/sh -c _POSIX_RELEASE_SHELL_BOOTSTRAP按--cli-bin实时解引用最新软链到活动发布根r,再依LOOPX_PYTHON->.loopx-python(经scripts/loopx-python.sh或剥离的首行)-> 回退fallback_py->scripts/loopx-python.sh->python3解析活动解释器并以-E -P -c移交执行;同时保持-m与 Windows 分支原样隔离不变。
具体改动 / Changes
完整提案相对 06941016e224ccdc7c0298fd7a28acec65cf8a35 覆盖 4 个文件(+1796 / -61),其中相对 5c33dd823cd3792363938ba686408263a0e4e74f 修改 scripts/loopx、loopx/agy_goal_mode/__init__.py、loopx/agy_goal_mode/launchd_watchdog.py 与 tests/test_agy_goal_mode_host_runtime.py。
关键代码讲解
-
scripts/loopx:4-10与_resolve_release_cli_shim(loopx/agy_goal_mode/__init__.py:424-485):scripts/loopx在while [[ -L "$script_path" ]]展开前先以invoked_cli_path保留原始软链路径并export LOOPX_CLI_SHIM="$invoked_cli_path"。_validated_release_shim_candidate对候选项做词法规范化(不解引用),再用.resolve()校验_is_release_tree_launcher(target)与target.is_relative_to(expected_root),避免外部过时LOOPX_CLI_SHIM劫持当前 release 根;直接执行脚本且全局用户软链有效时,优先持久化全局软链而非即将过期的版本目录脚本。
-
_POSIX_RELEASE_SHELL_BOOTSTRAP与build_antigravity_host_runtime_args(loopx/agy_goal_mode/__init__.py:254-344, 587-624):- 当
not uses_isolated_module and os.name != "nt"时生成["/bin/sh", "-c", _POSIX_RELEASE_SHELL_BOOTSTRAP, "loopx-agy-host-runtime", python_bin, _RELEASE_ROOT_BOOTSTRAP, *operation_tail];shift 2后"$@"精确保持[operation, "--cli-bin", ...],供内嵌 Python_RELEASE_ROOT_BOOTSTRAP解析。 - shell 跳板支持
--cli-bin <path>与--cli-bin=<path>两种写法、while [ -L "$p" ]逐层解引用(带cd -P处理相对软链及空格路径引号保护)、校验scripts/bin目录名与loopx/__init__.py+agy_goal_mode/__init__.py+host_runtime.py三文件完整存在,并在LOOPX_PYTHON显式配置但失效时立即报错退出1(不静默降级)。
- 当
-
LaunchAgent 最小运行路径守护(
loopx/agy_goal_mode/launchd_watchdog.py:62):- 在
_resolved_launchd_path中补充extras.extend(["/usr/bin", "/bin"]),保障自定义瘦身env_path下 LaunchAgent 调用/bin/sh、bash与dirname/readlink时工具链可解析。
- 在
-
跨版本与跨解释器连续性回归(
tests/test_agy_goal_mode_host_runtime.py:1851-2236):test_real_cli_shim_activation_survives_old_snapshot_deletion_with_or_without_path与test_saved_launchd_and_stop_hook_follow_active_interpreter_after_old_python_retired端到端覆盖:真实scripts/loopx(带/不带PATH)、直接调用脚本回退全局软链、写入真实plist、切换v1 -> v2并删除v1及venv1后全部既有 Stop hook / dry-run /ProgramArguments在v2 + venv2上退出0。
对主干的风险 / Risks
- 验证矩阵与真实执行结果(确切 head
568e3a6404f08e8a8bb976fd8c86f3ac47246720,未等待或查询远程 CI):bash -n scripts/loopx与/bin/sh -n校验_POSIX_RELEASE_SHELL_BOOTSTRAP:PASS(零语法错误)。PATH="<global-release-bin>:$PATH" .venv/bin/python -m pytest -q tests/test_agy_goal_mode_host_runtime.py:PASS(17 passed in 13.24s)。uv run --extra test python -m pytest -q(10 套件:test_agy_goal_mode_host_runtime.py等):PASS(276 passed, 2 skipped in 64.44s,2项为 macOS 上跳过 Windows PowerShell 用例)。tests/architecture/(.venv/bin/python -m pytest -n 4):PASS(1919 passed in 74.23s);ruff check(3.py文件):PASS(All checks passed!);mypy --follow-imports=silent --strict(__init__.py、launchd_watchdog.py):PASS(0issues);loopx check --scan-path ...(4 文件):PASS(ok: true, errors: 0, warnings: 0)。loopx canary premerge --from-git-diff --git-diff-base 06941016e224ccdc7c0298fd7a28acec65cf8a35 --tier standard:PASS(覆盖install_release, python双面,direct_check_count=6/0、catalog_run=2/0、risk_profile_run=8/0,合计10/10smoke 全绿、failures=0、manual_hold_count=0)。- 独立反事实实测(
adv_9516_r4.py):PASS(ADV_9516_R4_OK=True,实证含空格路径 + 相对软链../releases/v1/scripts/loopx、无PATH调用真实scripts/loopx生成 Stop hook 与 plist 后删除v1与venv1在v2 + venv2上成功执行;验证--cli-bin=...等号写法、过时LOOPX_CLI_SHIM指向v0时拒绝劫持并改选$HOME全局软链、缺少scripts/loopx-python.sh时从 CRLF.loopx-python剥离正常启动、无效LOOPX_PYTHON失败关闭、删除v2后悬空软链非零退出且不触发 cwd 投毒、resolve_local_executable=False保持-m原样)。
- 边界说明:
scripts/loopx内原有兜底分支(仅当目标发布目录缺失scripts/loopx-python.sh时)对旧版.loopx-python未额外做剥离(该历史分支非本次修改且正式发布均携带scripts/loopx-python.sh),而本次新增的_POSIX_RELEASE_SHELL_BOOTSTRAP已在无scripts/loopx-python.sh分支主动完成剥离。
我的整体评价 / Verdict
对 long_horizon 与 user_experience 均判定为 improved:R4 把首次启用与直接安装两条生成路径的“逻辑软链保留 (LOOPX_CLI_SHIM)”和“运行期活动解释器跟踪 (_POSIX_RELEASE_SHELL_BOOTSTRAP)”完整闭环,从根本上解决升级并回收旧发布目录或退役旧虚拟环境后后台看门狗与 Stop hook 静默失效的问题;全提案无新词表漂移(semantic_alignment 一致),双面 canary premerge(10/10)、17/276/1919 实测、shell/静态检查与独立反事实探针全绿,两条评审线程均已关闭,具备批准(author-owned COMMENTED APPROVE)合入条件。
视觉与未覆盖边界声明: 本 PR 仅涉及 CLI shell 启动脚本、Antigravity Stop hook / LaunchAgent argv 生成及测试套件,未修改任何前端或 App 渲染界面(已核对全部 4 个改动文件)。 未检查 UI 渲染(不适用)、真实 macOS launchctl bootstrap 系统服务调度、Windows 实机路径(276 项多套件测试中 2 项 Windows 用例在 macOS 上跳过,且 test_real_cli_shim_* / test_saved_launchd_* 在非 POSIX 环境跳过)、与平行重构 PR 联合安装以及远程 GitHub Actions CI(wait_for_ci: false 未查询)。
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
English verdict: APPROVE on exact head de242cd62fa2fc6927f8d72c050ef73546fd5420: resolves [P2] review 6085623614 (PRRT_kwDOStEbEs68tLoc / 4717351393) cleanly by keeping explicit --cli-bin highest priority while prioritizing _resolve_release_cli_shim (scoped strictly to release processes via LOOPX_RELEASE_ROOT/LOOPX_CLI_SHIM) ahead of bare PATH fallback; verified on exact head across 18 host-$PATH tests (16.96s), 277 multi-suite tests (2 Windows skips, 70.14s), 1919 architecture tests (75.84s), bash -n//bin/sh -n, ruff, mypy --strict, loopx check, 10/10 install_release, python canary premerge, and independent counterfactual adv_9516_r5.py (ADV_9516_R5_OK=True, 3/3 threads resolved).
动机 / Motivation
受影响调用方 / 操作者: 在同一台主机上共存多份 LoopX 安装(例如独立发布目录 A 与位于 PATH 前方的另一套安装 B)、或运行无环境变量 LOOPX_RELEASE_ROOT / LOOPX_CLI_SHIM 的普通 venv/可编辑测试环境的 Antigravity Goal Mode 用户与维护者。
前后场景对比: R4 (568e3a6404) 引入了 LOOPX_CLI_SHIM 与 POSIX /bin/sh 解释器跳板,但评审 6085623614(线索 PRRT_kwDOStEbEs68tLoc)指出:resolve_antigravity_runtime_bins 在默认 cli_bin="loopx" 分支先执行 shutil.which("loopx"),导致通过绝对路径调用安装 A 生成 bootstrap-command-pack 或 agent-onboard 时,一旦 PATH 前方命中另一套安装 B,Stop hook 与 LaunchAgent plist 仍被错误绑定到 B(移除 B 后 A 的 CLI 正常而保存的后台命令立即退出 1)。本次 R5 调整解析顺序:显式 --cli-bin 优先不变,发布进程中默认命令优先按当前活动发布根 LOOPX_RELEASE_ROOT 解析实际调用的 launcher,再回退 PATH;同时在非发布态 venv 进程中立即返回 None,避免全局软链外泄。
可观测结果: 当安装 B 位于 PATH 最前方且在用户主目录拥有全局软链、而用户直接以绝对软链或 scripts/loopx 调用安装 A 运行 bootstrap-command-pack / agent-onboard 并写盘 LaunchAgent plist 时:显式传 --cli-bin <B> 仍尊重显式选择指向 B;不传 --cli-bin 时全部产物严格绑定到 A(绝不引用 B),随后彻底删除 B 目录及全局软链,A 的 CLI 与全部已保存 Stop hook / 预览 / plist ProgramArguments 仍退出 0;普通 venv/pytest 环境不泄漏全局软链;全部 3/3 评审线索均已关闭(unresolved_count=0)。
明确非目标: 本 PR 不改动宿主侧历史上已落盘的旧静态配置文件自动迁移、不运行真实常驻 launchctl bootstrap 系统服务或 Windows 实机脚本,也不查询或等待远程 GitHub Actions CI。
本次复审针对确切 head de242cd62fa2fc6927f8d72c050ef73546fd5420(相对基线 origin/main@06941016e224ccdc7c0298fd7a28acec65cf8a35 共 6 个 DCO 签名提交,MERGEABLE 无冲突,针对 R4 568e3a6404f08e8a8bb976fd8c86f3ac47246720 上 6085623614 所开线索 PRRT_kwDOStEbEs68tLoc 已补充实现并全部关闭 3/3 线索)。需求依据说明:仓库无专门规范 Antigravity release-shim 与 PATH 优先级矩阵的独立书面 RFC(docs/product/release-readiness.md 规范发布/更新路径,docs/reference/protocols/host-cli-source-activation-v0.md 面向 Docker benchmark CLI 激活);本次严格对照真实多版本安装隔离与 6085623614 / 4717351393 验收场景核验。
改动思路 / Approach
R5 增量改动严格局限在 loopx/agy_goal_mode/__init__.py 的 _resolve_release_cli_shim 与 resolve_antigravity_runtime_bins(相对 R4 +47/-16 行,全文件 911 行)以及配套回归测试 tests/test_agy_goal_mode_host_runtime.py,仅用现有 LOOPX_CLI_SHIM 与 LOOPX_RELEASE_ROOT 完成作用域隔离与优先级反转,零新增环境开关或并行决策者。
全提案相对 06941016e2 共改动 4 个文件(+2036/-61):scripts/loopx、loopx/agy_goal_mode/__init__.py、loopx/agy_goal_mode/launchd_watchdog.py 与 tests/test_agy_goal_mode_host_runtime.py,经 bash -n、/bin/sh -n、ruff、mypy --strict、全局软链前置 PATH 单测、uv run --extra test 10 套件、tests/architecture/、安装发布 profile canary premerge 与独立反事实探针全量验证。
相对 568e3a6404f08e8a8bb976fd8c86f3ac47246720,R5 对 resolve_antigravity_runtime_bins 的解析顺序列出了清晰的四层优先级:
- 显式路径(
_is_explicit_cli_path(cli_bin)):始终最先返回,确保用户或子命令传入--cli-bin <B>时无条件生效。 - 发布进程作用域门禁:
_resolve_release_cli_shim在cli_bin != "loopx"或环境变量LOOPX_RELEASE_ROOT与LOOPX_CLI_SHIM均为空时立刻返回None,完全退让给后续PATH/ 断链检测,绝不污染普通 venv 或测试进程。 - 发布根内匹配选择:当处于受管发布进程时,按“合法软链
LOOPX_CLI_SHIM-> 经is_relative_to(expected_root)验证的shutil.which软链 -> 用户<home-bin>/loopx软链(同样限定归属expected_root)-> 合法非软链候选 ->expected_root/scripts/loopx”选取活动发布版本 A 的启动器,彻底免疫PATH上共存安装 B 的抢占。 - 普通
PATH兜底:仅在非发布进程或无显式发布上下文时回退_find_dangling_path_symlink/shutil.which。
具体改动 / Changes
完整提案相对 06941016e224ccdc7c0298fd7a28acec65cf8a35 覆盖 4 个文件(+2036 / -61),其中相对 568e3a6404f08e8a8bb976fd8c86f3ac47246720 仅更新 loopx/agy_goal_mode/__init__.py(+47 / -16 行)与 tests/test_agy_goal_mode_host_runtime.py(+225 行);scripts/loopx 与 loopx/agy_goal_mode/launchd_watchdog.py 保持与 R4 一致。
关键代码讲解
-
_resolve_release_cli_shim(loopx/agy_goal_mode/__init__.py:448-500):- 开头以
if cli_bin != "loopx" or (not release_root_raw and not shim_raw): return None实现零泄漏隔离;在expected_root非空时先检验软链LOOPX_CLI_SHIM,再检查shutil.which(cli_bin)与用户默认软链且全部用_validated_release_shim_candidate(..., expected_root=expected_root)限制target.is_relative_to(expected_root),拒绝其他安装 B 越权替代 A。
- 开头以
-
resolve_antigravity_runtime_bins(loopx/agy_goal_mode/__init__.py:502-518):resolve_local_executable=False保持直接返回("python3", cli_bin);_is_explicit_cli_path(cli_bin)保留最高优先级;默认命令先走_resolve_release_cli_shim(cli_bin),仅返回None时再走_find_dangling_path_symlink(cli_bin)与shutil.which(cli_bin)。
-
_POSIX_RELEASE_SHELL_BOOTSTRAP与scripts/loopx(延续 R4,loopx/agy_goal_mode/__init__.py:254-344, 587-624):- 继续通过
LOOPX_CLI_SHIM保留软链路径并由 POSIX shell 跳板在运行期动态跟踪活动快照与.loopx-python/scripts/loopx-python.sh解释器,同时在无scripts/loopx-python.sh场景主动剥离 CR (\\r) 与保护空格路径。
- 继续通过
-
双安装竞争回归测试(
tests/test_agy_goal_mode_host_runtime.py:2239-2461):- 新增
test_invoked_release_shim_overrides_different_install_on_path,建立共享同一干净 provider Python 的两套安装 A 与 B、把 B 置于PATH首位,分别证明显式--cli-bin <B_shim>仍指向 B,而以绝对软链及scripts/loopx调用 A 生成bootstrap-command-pack、agent-onboard与实盘 LaunchAgent plist 后删空整个 B,A 的--version与全部已保存 Stop hook / 预览 /ProgramArguments仍全部退出0。
- 新增
对主干的风险 / Risks
- 验证矩阵与真实执行结果(确切 head
de242cd62fa2fc6927f8d72c050ef73546fd5420,未等待或查询远程 CI):bash -n scripts/loopx与/bin/sh -n校验_POSIX_RELEASE_SHELL_BOOTSTRAP:PASS(零语法错误)。PATH="<global-release-bin>:$PATH" .venv/bin/python -m pytest -q tests/test_agy_goal_mode_host_runtime.py:PASS(18 passed in 16.96s)。uv run --extra test python -m pytest -q(10 套件):PASS(277 passed, 2 skipped in 70.14s,2项为 macOS 上跳过 Windows PowerShell 用例)。tests/architecture/(.venv/bin/python -m pytest -n 4):PASS(1919 passed in 75.84s);ruff check(3.py文件):PASS(All checks passed!);mypy --follow-imports=silent --strict(2 文件):PASS(0issues);loopx check --scan-path ...(4 文件):PASS(ok: true, errors: 0, warnings: 0)。loopx canary premerge --from-git-diff --git-diff-base 06941016e224ccdc7c0298fd7a28acec65cf8a35 --tier standard:PASS(覆盖install_release, python双面,direct=6/6、catalog=2/2、risk_profile=8/8,合计10/10smoke 全绿、failures=0、manual_hold_count=0)。- 独立反事实实测(
adv_9516_r5.py):PASS(ADV_9516_R5_OK=True,实证非发布态.pthvenv 即使在全局软链位于PATH时也不发生泄漏而精准选中 venv 自身 CLI;安装 B 同时霸占PATH首位与主目录全局软链时,以A/bin/loopx或A/scripts/loopx调用agent-onboard仅绑定 A(而--cli-bin <B>仍显式优先绑定 B),彻底删除 B 后全部已保存 Stop hook 与 plistProgramArguments在投毒工作目录退出0;且当活动发布快照自身缺失host_runtime.py而PATH存在健康 B 时,依然对残缺快照以host_runtime missing失败关闭,不静默滑向 B;resolve_local_executable=False原样隔离)。
- 边界说明: 如前次已确认,历史上在 PR #9516 合入之前生成并落盘的旧静态配置文件仍需按常规升级或重绑命令生成一次方能享受到动态路径/解释器跳板;未修改旧版无选择器分支
scripts/loopx:111。
我的整体评价 / Verdict
对 long_horizon 与 user_experience 均判定为 improved:R5 以干净精准的四层优先级顺序彻底解决多版本并存时的 PATH 抢占问题,同时严守发布态作用域边界不侵扰普通 venv 与显式 --cli-bin;加之 R1-R4 建立的软链升级追踪、旧 .pth 反遮蔽、缺件阻断与 POSIX 动态解释器解析,全部 3/3 评审线索闭环关闭、18/277/1919 实测、双面 canary premerge、ruff/mypy --strict 与独立反事实探针全线全绿,具备批准(author-owned COMMENTED APPROVE)合入主干条件。
视觉与未覆盖边界声明: 本 PR 仅涉及 CLI launcher 解析、Antigravity Stop hook / LaunchAgent argv 生成与测试,未涉及任何前端或 App 渲染界面改动(已核对全部 4 个改动文件)。 未检查 UI 渲染(不适用)、真实 macOS launchctl bootstrap 常驻服务调度、Windows 实机执行(277 项多套件回归中 2 项 Windows 用例在 macOS 上跳过,且 POSIX trampoline / CLI shim 集成用例在非 POSIX 环境跳过)、与平行重构 PR 联合安装以及远程 GitHub Actions CI(wait_for_ci: false 未查询)。
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
精确 head de242cd62fa2fc6927f8d72c050ef73546fd5420,基线及共同祖先 06941016e224ccdc7c0298fd7a28acec65cf8a35。
动机 / Motivation
使用发布快照配置 Antigravity 的操作者,需要 Stop hook 和 LaunchAgent 在安装切换后继续使用当前发布。旧行为在独立 provider Python 中可能导入失败,上一头会优先选择 PATH 上的另一份安装。当前头修正了启动来源。操作者直接从发布脚本激活时,自定义安装的稳定入口若排在 PATH 中第二份安装之后,生成的命令仍可能绑定到会被回收的快照。激活应使用同源且可延续的入口,显式 CLI 选择继续生效。系统 launchctl、Windows 实机和 #9510 的组合未核。 Supported Install And Update Paths
改动思路 / Approach
外层 launcher 保留调用时的路径,激活和安装复用运行参数选择,POSIX 运行时从指定 launcher 跟随稳定软链并选择当前发布配置的 Python。旧安装排在 PATH 前面时,校验可以排掉第一个不同源的候选。当前只检索 PATH 的第一个结果,后续同源软链不会参与选择。保留显式 CLI 和同源校验,在 PATH 中继续寻找可延续的同源入口,再考虑固定快照脚本。 入口筛选
具体改动 / Changes
完整改动四路径,+2036/-61。本轮增量两路径,+256/-16。隔离 Git checkout 上 277 项 CLI、宿主和架构定向测试通过,2 项 Windows 用例跳过。Ruff、两文件 strict mypy、launcher 和 POSIX 语法以及 Git diff 检查通过。
关键代码讲解
resolve_antigravity_runtime_bins让显式路径优先,再校验当前发布入口,最后落回普通 PATH。独立运行两条公开激活 CLI,分别从当前发布脚本和稳定软链发起,并把旧版本置于 PATH 首位,生成的 watchdog 均成功,上一轮错绑关闭。 来源决策_resolve_release_cli_shim需要可追溯到当前发布的稳定软链。调用本身经稳定软链或 PATH 首个匹配同源时,已生成的命令可在版本更新和旧快照回收后继续运行。 同源筛选_POSIX_RELEASE_SHELL_BOOTSTRAP从已保存的 launcher 定位发布和活动解释器。plist 跟随生成阶段记录的同一个选择,仍由原安装操作授权写入或加载。 启动引导 · plist
对主干的风险 / Risks
[P2] 后置的同源自定义软链被跳过,旧快照回收后已保存的后台命令全部失效。 两份健康的 archive 安装各有自定义 bin 目录。把另一个安装的 bin 放首位,当前安装的同源软链放第二位,再从当前版本的绝对发布脚本分别执行 bootstrap-command-pack 和 agent-onboard。两条入口都把固定快照路径写入 Stop、watchdog 和 plist。三个入口最初均退出 0。将同源软链切换到下一快照并只回收旧快照后,当前 CLI 仍正常,保存的三个入口均退出 1。保持两份安装并存,只改为经当前软链启动,或把该软链排到 PATH 首位,同一退役对照均退出 0。应在确知发布根时识别 PATH 后续同源软链,把这个组合加入不加载系统服务的真实 plist 回归。 只取首个 PATH 命中
我的整体评价 / Verdict
上一轮的跨安装即时错绑已修复,自定义路径上的同源软链发现仍需要补齐。当前只检索 PATH 的第一个结果,后续同源软链不会参与选择。保留显式 CLI 和同源校验,在 PATH 中继续寻找可延续的同源入口,再考虑固定快照脚本。完整测试与当前反例应同时保留。
English verdict: REQUEST_CHANGES on exact head de242cd62fa2fc6927f8d72c050ef73546fd5420. The original mixed-install routing failure is fixed. With a custom same-release shim later on PATH, direct activation still saves the retiring snapshot, and existing hooks and watchdog commands fail after rotation.
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. 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 HEADFor a same-repository clone whose Keep the DCO |
de242cd to
61bdc20
Compare
|
Rebased cleanly onto
|
…ands Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
61bdc20 to
e81458d
Compare
|
Rebased onto
|
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
先前 P2 已修,回退仍需修订。 精确提交 e81458d8ceb77fae151aee0d5028195cf28d62aa 能在正常更新时跟随原来排在 PATH 后方的同源软链。实际 CLI 回退到宿主目录迁移前的发布后,已保存的后台命令失效。上一轮评审
动机 / Motivation
已配置 Antigravity Stop hook 或 LaunchAgent 的 archive 安装用户,在切换发布版本后仍需要这些命令继续运行。
自定义稳定入口排在另一份安装之后时,新头生成的命令已能跟随正常更新。随后用公开 CLI 回退到宿主目录迁移前的发布,CLI 返回成功,但原有命令全部无法启动。
受支持的更新与回退完成后,已经写入的宿主命令应进入所选发布里的有效宿主入口。
使用隔离的发布目录和实际 CLI,LaunchAgent 写入后未加载,只执行保存的参数。未使用系统 launchctl、已登录的 Antigravity、Windows 实机或托管 CI。
改动思路 / Approach
逐个检查 PATH 候选并优先使用同源稳定软链,解决了后置路径被遮蔽的情况。保存的命令把有效发布的判断绑定在新宿主模块目录,旧版可用的宿主模块不参与校验。 让保存的引导程序从所选发布内识别受支持的宿主模块布局,并保留同源校验。 这样保持生成和运行阶段的来源一致,也保留对缺件发布的拒绝。
具体改动 / Changes
关键代码讲解
_find_path_release_shim_candidate继续检查后续 PATH 目录,选择与实际启动的发布根一致的稳定软链。旧头的两条负例在这版均通过。候选查找- 保存的 shell 引导可以跟随同一个 launcher 读取当前快照,但要求存在
loopx/hosts/agy/host_runtime.py。回退目标只提供迁移前的宿主模块。启动布局检查 旧宿主实现 build_antigravity_launchd_plist把同一参数选择保存到 plist,因此 Stop、安装预览和冷启动参数的结果一致。参数生成 LaunchAgent
对照 0bcdffb9926e46a1024bcdacb18e24de37a1b018 的 docs/product/release-readiness.md,Supported Install And Update Paths 在正常升级边界已通过,回退的现存宿主参数仍有缺口。全 PR 四路径 +2275/-61,测试包括两个真实激活入口。更新与回退契约
对主干的风险 / Risks
[P2] 回退命令成功后,已保存的 AGY 后台入口仍失效。 用自定义 archive 安装生成 Stop 和实际 plist,调用原生 loopx update --rollback previous 并确认软链切到 06941016e224ccdc7c0298fd7a28acec65cf8a35。原 Stop、watchdog 预览与实际 plist 参数在回退前均退出 0。原生回退、权威检查及 Doctor 均成功,旧 CLI 和旧 heartbeat-tick 也能运行,但保存的三类入口均退出 1,提示找不到发布根。 修复后请用同一隔离回退、原样重放三种命令,并继续拒绝实际缺件的快照。
298 passed, 2 skipped;Ruff、两生产文件 strict mypy、bash 与 POSIX 语法、Git diff check 均通过。 两条激活 CLI 的六组独立升级对照全部通过。回退期间仅启动合成安装目录中的进程。
我的整体评价 / Verdict
可以保留逐项同源路径选择,原后置软链问题已复验关闭。当前候选还需要保证受支持的 archive 回退之后,已保存的后台命令继续使用所选发布自己的有效宿主入口。
English verdict: REQUEST_CHANGES at e81458d. The later same-install PATH shim now survives rotation, but the native archive rollback succeeds while saved AGY commands reject the previous release's working legacy module layout.
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
|
Addressed the
|
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
本次对精确 head 87dd2464ac6983a218c74ee5c5abbd8a32426de3 的独立复核结论为通过:PR #9516 在已变基对齐 origin/main@0bcdffb9926e46a1024bcdacb18e24de37a1b018(PR #9510 规范包路径 loopx.hosts.agy 及 loopx.agy_goal_mode 兼容转发层)与修复评审 6085889500 [P2] 后置 PATH 软链选择问题的基础上,在精确提交 87dd2464ac6983a218c74ee5c5abbd8a32426de3 中完整解决了上一轮评审 6087613925 指出的 [P2] 跨 PR #9510 回退兼容缺口(使已保存的 Stop hook、LaunchAgent ProgramArguments 与发布布局检查在 loopx update --rollback previous 回退至未迁目录前的快照时自动识别并执行 loopx.agy_goal_mode.host_runtime,而在存在部分残缺 loopx/hosts/agy 目录或缺失 host_runtime.py 时继续严格 fail-closed,同时清理了此前测试文件末尾重复断言);本地全套验证(ruff、mypy --strict、bash -n//bin/sh -n、20 项带全局 bin 前置 PATH 单元测试、299 项 12 套件联合测试、1919 项架构门禁、loopx check、隔离完整 canary premerge 10/10 通过与反事实探测 adv_9516_r7.py)均在当前 head 上一次通过,无阻塞项遗留。
依据基线文档 Supported Install And Update Paths(锚定基准提交 0bcdffb9926e46a1024bcdacb18e24de37a1b018)以及前序评审线索校验以下契约条目:AGY-REL-SHIM(持久化的 Stop hook 与 LaunchAgent 命令必须绑定到可随版本切换而延续的稳定 CLI 入口而非即将回收的快照路径,同时保留显式 --cli-bin 与跨安装隔离)、AGY-REL-PY(即使 provider Python 环境的 site-packages 不含 loopx 或存在旧版可编辑 .pth,已保存的守护命令与 Stop hook 在正常升级、解释器迁移以及 loopx update --rollback previous 回退至迁目录前旧版快照后仍按所选发布与活动解释器执行)、AGY-REL-FAIL(残缺的发布快照在 hosts/agy 缺失 host_runtime.py 时绝不降级偷走 agy_goal_mode 兼容壳,旧布局缺失 host_runtime.py 同样在构造期与运行期严格失败关闭,且非发布环境零行为回归)。
动机 / Motivation
受影响调用方 / 操作者: 采用发布快照方式安装 LoopX(全局 bin 目录下的稳定软链指向带版本号的快照脚本,而受管 Python 来自隔离虚拟环境)、或在多安装并存与跨版本更新/回退场景下通过 bootstrap-command-pack、agent-onboard 与 macOS install-launchd 配置 Antigravity 守护和 Stop 恢复钩子的用户与维护者。
前后场景对比: 改动前在基线与前序提交上存在两类真实中断:首先,旧版直接发射 [python_bin, "-E", "-P", "-m", "loopx.hosts.agy.host_runtime", ...] 在无 loopx 的 provider 环境中直接 ModuleNotFoundError 且固定旧 Python 与即将回收的快照路径,而竞争安装 B 排在 PATH 首位时直接调用 A 的快照会跳过后置同源软链;其次,评审 6087613925 在上一头 e81458d8ce 发现,即使更新路径已修好,只要执行原生 loopx update --rollback previous 回退到 PR #9510 合并之前的合法旧快照(只含 loopx/agy_goal_mode/host_runtime.py、尚无 loopx/hosts/agy/),保存的引导代码因写死检查并执行 loopx/hosts/agy/host_runtime.py 而全部报 loopx release root not found from --cli-bin 退出 1。改动后在精确 head 87dd2464ac6983a218c74ee5c5abbd8a32426de3 上,_find_path_release_shim_candidate 逐段扫描 PATH 选择同源软链;同时 _RELEASE_ROOT_BOOTSTRAP、_POSIX_RELEASE_SHELL_BOOTSTRAP 与 _has_host_runtime_files 以 loopx/hosts/agy 目录是否存在作为结构分界,存在时仅接受 loopx/hosts/agy/{__init__,host_runtime}.py 对应 loopx.hosts.agy.host_runtime,不存在时则验证并拉起旧布局 loopx/agy_goal_mode/{__init__,host_runtime}.py 对应 loopx.agy_goal_mode.host_runtime,两者缺失核心文件均拒绝执行;因此在 v1 -> v2 升级、B 删除以及原生 update --rollback previous 回退至旧布局快照后,已保存的 Stop hook、预览命令和 LaunchAgent ProgramArguments 全部退出 0。
可观测收益与范围边界: 多安装 PATH 仲裁、跨发布与跨解释器连续性、原生 loopx update --rollback previous 回退至迁移前旧布局,以及对半残缺 hosts/agy 目录和残缺旧目录的 fail-closed 拦截均已在真实子进程与 plist 生成读取下通过验证,loopx/agy_goal_mode/ 兼容层保持薄转发。本 PR 不修改与 Antigravity 无关的 Codex 或 Claude 宿主运行时、不更改运行期单次采集入口 current_loopx_cli_argv、不改动 Windows PowerShell 发布路径的 -m 逻辑外生态集成,也不在自动化测试中修改本机真实 launchctl 系统驻留服务状态。
改动思路 / Approach
基于当前精确 head 87dd2464ac6983a218c74ee5c5abbd8a32426de3 源码整理(示意,非执行凭证),所有持久化命令解析与 POSIX 运行时跳板决策统一保留在规范包 loopx/hosts/agy/ 内,其中外部脚本 scripts/loopx 仅在 readlink 解引用前保存 LOOPX_CLI_SHIM,loopx/hosts/agy/__init__.py 统筹同源软链解析、新/旧布局判别与 POSIX 运行时跳板生成,loopx/hosts/agy/launchd_watchdog.py 通过透传 resolved_bins 单点复用同一解析契约并与 command_invocation.py 的单次采集逻辑解耦。本 PR 边界仅覆盖 POSIX/发布快照下 Antigravity Stop hook 与 LaunchAgent 命令构造、跨迁移目录的合法快照回退识别及残缺目录 fail-closed 校验,不新增持久状态字段、CLI 开关或跨宿主路径改写,普通开发虚拟环境与 Windows 路径保持不变。
| 运行/快照布局状态 | 分界与校验规则(精确 head) | 观测结果 |
|---|---|---|
显式指定 --cli-bin /custom/loopx |
resolve_antigravity_runtime_bins 先校验 _is_explicit_cli_path |
始终优先遵循调用方显式路径 |
发布进程(含 LOOPX_RELEASE_ROOT/LOOPX_CLI_SHIM)且 cli_bin=="loopx" |
_resolve_release_cli_shim 先匹配 LOOPX_CLI_SHIM 软链,再经 _find_path_release_shim_candidate 遍历所有非空 PATH 目录取首个同源软链 |
即使存在前置无关安装 B 或缺失默认用户目录软链,仍绑定 A 的稳定软链且升级删除 v1/B 后退出 0 |
回退到迁移前快照(无 loopx/hosts/agy 目录,具完整 agy_goal_mode/host_runtime.py) |
_has_host_runtime_files、_POSIX_RELEASE_SHELL_BOOTSTRAP 与 _RELEASE_ROOT_BOOTSTRAP 进入 agy_goal_mode 分支并运行 loopx.agy_goal_mode.host_runtime |
原生 loopx update --rollback previous 后,已保存的 Stop hook、预览与 plist ProgramArguments 全部正常执行退出 0 |
新版快照残缺(存在 loopx/hosts/agy 目录却缺 host_runtime.py,即使保留 agy_goal_mode 壳)或旧版缺失 agy_goal_mode/host_runtime.py |
[ -d "$r/loopx/hosts/agy" ] / (r/"loopx"/"hosts"/"agy").is_dir() 锁定新布局分支不回退旧分支;_use_isolated_host_module 与引导同时拦截 |
构造期抛出 FileNotFoundError,运行期打印 loopx release root not found from --cli-bin 退出非 0 |
具体改动 / Changes
- 兼容跨 #9510 回退的布局判别与模块加载:
_RELEASE_ROOT_BOOTSTRAP、_POSIX_RELEASE_SHELL_BOOTSTRAP与_has_host_runtime_files引入_LEGACY_HOST_RUNTIME_MODULE = "loopx.agy_goal_mode.host_runtime";仅当$r/loopx/hosts/agy目录不存在时回退检验loopx/agy_goal_mode/{__init__,host_runtime}.py并通过runpy.run_module(m, ...)启动对应目标;当hosts/agy目录存在时则强制要求hosts/agy/{__init__,host_runtime}.py完整,杜绝半残新包借壳降级(同时确保在 pre-#9510 快照即便已有loopx/hosts/下其他适配器目录时也不会误判)。 - 入口软链传播、逐段
PATH选择与动态跳板:scripts/loopx在readlink循环前导出未解引用的LOOPX_CLI_SHIM;_find_path_release_shim_candidate、_resolve_release_cli_shim与resolve_antigravity_runtime_bins在保持显式--cli-bin最高优先级与非发布进程零干预的同时优先解析同源PATH软链;_use_isolated_host_module、build_antigravity_host_runtime_args与antigravity_app_activation_extras对齐resolve_local_executable=True与动态 Python 解析;_resolved_launchd_path及build_antigravity_launchd_plist保留/usr/bin:/bin并单点委托参数构建。 - 增量修复与全量测试覆盖: 相对前一次评审提交
e81458d8ce,精确提交87dd2464ac修改2个文件+346/-12:删除了tests/test_agy_goal_mode_host_runtime.py末尾重复的assert "--cli-bin"行,并新增test_archive_rollback_to_pre_consolidation_release_preserves_saved_commands构造可执行的 pre-#9510 快照实测原生loopx update --rollback previous回退前后 3 类已保存命令及缺失host_runtime.py拒止行为。全分支4个文件净改动+2609/-61(生产代码合计+456/-59:loopx/hosts/agy/__init__.py+424/-18、loopx/hosts/agy/launchd_watchdog.py+26/-41、scripts/loopx+6/-0;tests/test_agy_goal_mode_host_runtime.py+2153/-2共20项单测)。
对主干的风险 / Risks
- 显式声明(No blocking finding): 本次针对精确 head
87dd2464ac6983a218c74ee5c5abbd8a32426de3的独立源码审计、双提交增量检查与反事实验证未发现阻塞合入的问题;评审6085889500的后置PATH同源软链[P2]、评审6087613925的跨 #9510 原生回退[P2]以及测试末尾重复断言全部已解决并关闭。 - 残余风险与未覆盖边界(Residual risk & strongest missing validation): 第一,macOS LaunchAgent 均采用
--no-load写入 plist 并校验EnvironmentVariables["PATH"]与ProgramArguments实际执行,尚未在桌面交互会话下操作真实launchctl bootstrap系统服务驻留加载;第二,当前 macOS 环境无法实机运行 Windows.ps1发布脚本宿主(2项 Windows 用例显式按平台跳过);第三,若构建出一个极端半残目录(例如从 post-#9510 快照中整目录删掉loopx/hosts/agy/却保留原本依赖它的薄转发壳loopx/agy_goal_mode/),因loopx/hosts/agy/不存在而进入旧分支检验后,最终会在导入loopx.agy_goal_mode.host_runtime -> loopx.hosts.agy时因缺少目标模块报ModuleNotFoundError失败关闭,不影响实际发布回退与单文件缺件防护边界。
独立本地验证摘要(wait_for_ci: false,未依赖远端 CI)
ruff check loopx/hosts/agy/__init__.py loopx/hosts/agy/launchd_watchdog.py tests/test_agy_goal_mode_host_runtime.py:PASS(All checks passed!)。.venv/bin/python -m mypy --follow-imports=silent --strict loopx/hosts/agy/__init__.py loopx/hosts/agy/launchd_watchdog.py:PASS(Success: no issues found in 2 source files)。PATH="<home-bin>:$PATH" .venv/bin/python -m pytest -v tests/test_agy_goal_mode_host_runtime.py:PASS(20 passed in 24.34s,含新增原生update --rollback previous回退及缺件拒止测试)。uv run --extra test python -m pytest -q(12个宿主运行时、兼容层、安装包与架构边界套件):PASS(299 passed, 2 skipped in 85.64s,仅2项 Windows 平台用例按预期跳过)。.venv/bin/python -m pytest -n 4 -q tests/architecture/:PASS(1919 passed in 80.65s)。- 独立反事实脚本
adv_9516_r7.py:PASS(ALL_R7_PROBES_PASSED:验证bash -n//bin/sh -n语法、loopx.agy_goal_mode兼容层导出与loopx.hosts.agy同一性、在B排PATH首位无默认用户软链条件下由新版生成命令并模拟回退a_shim至 pre-#9510 快照兼删除B与新 venv 后 Stop hook 与 plist 正常执行loopx.agy_goal_mode.host_runtime退出0、对残缺新版快照(保留hosts/agy目录 +agy_goal_mode壳却删掉hosts/agy/host_runtime.py)在构造期和运行期均拒止、对残缺旧版快照同样拒止,以及非发布环境零干预)。 loopx check(扫描全部4个变更文件):PASS(ok: true, errors: 0, warnings: 0,public_boundary_scan.ok: true)。loopx canary premerge --from-git-diff --git-diff-base 0bcdffb9926e46a1024bcdacb18e24de37a1b018 --tier standard:PASS(隔离完整一次通过:6/6direct checks、2/2catalog canaries、8/8risk-profile smokes 全部通过,failures=0,manual_hold_count=0,gate.status=passed)。
我的整体评价 / Verdict
精确提交 87dd2464ac6983a218c74ee5c5abbd8a32426de3 以最小而严谨的结构边界(以 loopx/hosts/agy 目录存在与否区分新旧布局、保持 hosts/agy 半残目录不可回退偷渡并在两套分支均坚持缺少 host_runtime.py 即失败关闭),完整打通了 Antigravity Stop hook 与 macOS LaunchAgent 在多安装 PATH 共存、发布快照升级、解释器切换以及跨 #9510 目录迁移原生 loopx update --rollback previous 回退下的全生命周期链路;所有定向测试、299 项跨套件测试、1919 项架构门禁、loopx check、标准 canary premerge 与反事实探测在当前精确 head 上全绿,无阻塞缺陷,具备合入条件(visual_review 为 not_applicable:本 PR 仅涉及 CLI、shell 跳板与 LaunchAgent plist 文本配置,无任何前端或渲染界面变更,未验证范围为真实 launchctl 守护进程加载及 Windows 实机 PowerShell 快照场景)。
English verdict: APPROVE on exact head 87dd2464ac6983a218c74ee5c5abbd8a32426de3.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact head: 87dd2464ac6983a218c74ee5c5abbd8a32426de3
动机 / Motivation
使用归档安装的 Antigravity 用户需要在升级或回退后继续使用已配置的 Stop hook 与后台 watchdog。旧评审头在回退到重新组织目录以前的版本后,已保存命令无法找到宿主模块。新头通过同一稳定 launcher 识别两种真实布局。隔离环境实际回退到原历史源码后,原 Stop、watchdog 预览和 LaunchAgent 参数都能执行。缺件的快照仍被拒绝。验证覆盖隔离 POSIX 发布快照、真实启动器和 plist 参数。Windows 原生环境、正常运行中的宿主进程和远端 CI 尚未验证。
改动思路 / Approach
复用安装器的稳定启动路径、provider Python 选择器和现有 Stop/watchdog 参数。真实快照的安装入口和历史布局可以在同一命令构造器内复用,按快照文件验证所用模块。保留原生模块入口,集中构建 hook 与 LaunchAgent 参数,兼容仍可回退的历史快照。
具体改动 / Changes
按 0bcdffb9926e46a1024bcdacb18e24de37a1b018 的规范核对 原生回退后的已保存入口 与 原生 venv 与损坏快照。同一真实回退与缺件用例经过旧评审头和当前头,且普通 venv 策略得到定向覆盖。 规格与回退边界
- 有效快照按实际模块布局验证,部分 canonical 布局拒绝。 _has_host_runtime_files
- 检查 PATH 内属于同安装的稳定 shim。 _find_path_release_shim_candidate
- 构建路径安全的 provider 命令。 build_antigravity_host_runtime_args
- 共用命令构造并保留调度参数。 build_antigravity_launchd_plist
对主干的风险 / Risks
相同真实旧归档下,上一评审头在回退成功后拒绝原 Stop,提示找不到 release root。现头复放两种激活入口生成的三类命令全部通过;删去旧 runtime 后 Stop 与 plist 参数均明确拒绝。45 项本地 Python 用例通过,1 项平台用例跳过。旧版协调路径的基线对照为 6 项通过。Ruff、shell 语法和差异空白检查通过。上次用基线与候选对照时,已有旧 launcher 的源码激活会失败。这次两个独立 editable 环境中的配对路径均通过。最初跨 venv 借用依赖产生的 5 个模块导入失败,由各自安装当前源码后的同路径通过验证排除。此次用未经改写的 0694101 历史源码归档独立复测,区别于候选测试中从新代码重构旧目录的夹具。
语义与验证对齐
旧安装保留的后台命令能跨版本恢复,用户无需在每次回退后重新部署 hook 或 plist。优先沿用稳定 launcher。安装缺件时停止并修复选中的发布快照。分别覆盖稳定 shim 不在 PATH 第一位、provider 变更、回退到真实旧目录、目录缺件和普通 venv。
我的整体评价 / Verdict
隔离环境实际回退到原历史源码后,原 Stop、watchdog 预览和 LaunchAgent 参数都能执行。缺件的快照仍被拒绝。验证覆盖隔离 POSIX 发布快照、真实启动器和 plist 参数。Windows 原生环境、正常运行中的宿主进程和远端 CI 尚未验证。
English verdict: APPROVE at 87dd246. The native rollback to the unmodified pre-consolidation archive preserves saved Stop, watchdog preview, and LaunchAgent arguments while an incomplete archive is rejected. Ordinary editable CLI routes passed.
Delivery Brief
~/.local/bin/loopx -> ~/.local/share/loopx/releases/<id>/scripts/loopx),.loopx-pythonpoints to a provider venv Python whosesite-packagesdoes not includeloopx. Bothbuild_antigravity_hooks_templateandbuild_antigravity_launchd_plistemitted[python_bin, "-E", "-P", "-m", "loopx.hosts.agy.host_runtime", ...], causing Stop-hook and LaunchAgent invocations to fail immediately withModuleNotFoundError: No module named 'loopx'..pthinstall lacking newer commands such asheartbeat-tick,_python_supports_isolated_moduleonly checkedfind_specwithout launcher classification or module provenance, allowing the stale editable package to shadow a valid configured release launcher.bootstrap-command-packandagent-onboard(antigravity_app_activation_extras) still passedresolve_local_executable=False, incomplete release trees missinghost_runtime.pypassed layout checks, bare"loopx"resolution consultedPATHbefore the active release shim (allowing an unrelated competing install earlier onPATHto hijack the active release), invocations withoutPATHfell back to an ephemeralLOOPX_RELEASE_ROOT/scripts/loopx, and saved plists pinned the older Python interpreter even when~/.local/bin/loopxlater switched to a release using another interpreter.scripts/loopx,loopx/hosts/agy/__init__.py,loopx/hosts/agy/launchd_watchdog.py):LOOPX_CLI_SHIMinscripts/loopxbefore symlink resolution. Inresolve_antigravity_runtime_bins(loopx/hosts/agy/__init__.py), preserved explicit--cli-binprecedence first (_is_explicit_cli_path), checked_resolve_release_cli_shim(cli_bin)before falling back to barePATH(_find_dangling_path_symlink/shutil.which) so an active release install is never shadowed by a competing install earlier onPATH(while returningNoneimmediately outsideLOOPX_RELEASE_ROOT/LOOPX_CLI_SHIMprocesses), and scanned every non-emptyPATHentry via_find_path_release_shim_candidateso later custom symlinks resolving insideexpected_rootare found even when an unrelated install precedes them onPATH. Priority order insideexpected_root: (1) symlinkedLOOPX_CLI_SHIM, (2) first valid symlinkedPATHmatch (_find_path_release_shim_candidate), (3) symlinked~/.local/bin/loopx, (4) valid non-symlinkPATHlauncher, and (5) valid non-symlinkLOOPX_CLI_SHIM, before falling back toexpected_root/scripts/loopx. Keptloopx/agy_goal_mode/forwarding shims unchanged so legacy callers delegate transparently toloopx.hosts.agy.argv[0] == python_binfor POSIX release-snapshot invocations inbuild_antigravity_host_runtime_argswith a/bin/sh -ctrampoline (_POSIX_RELEASE_SHELL_BOOTSTRAP) reading--cli-bindirectly fromargv, resolving symlinks + validating release layout (loopx/hosts/agy/{__init__,host_runtime}.py->loopx.hosts.agy.host_runtimewhenloopx/hosts/agyexists, or pre-consolidationloopx/agy_goal_mode/{__init__,host_runtime}.py->loopx.agy_goal_mode.host_runtimeon archive rollbacks whenloopx/hosts/agydoes not exist), selecting the active interpreter in priority order (LOOPX_PYTHON->.loopx-pythonviascripts/loopx-python.shor stripped first line -> fallbackpython_bin->scripts/loopx-python.sh->python3), and preservingEnvironmentVariables["PATH"](/usr/bin:/bin) inloopx/hosts/agy/launchd_watchdog.pywhile keeping ordinary pip/editable-mpaths and Windows unchanged._is_release_tree_launcher) lacksloopx/__init__.pyor its matching layout's__init__.py/host_runtime.py(_has_host_runtime_files+_RELEASE_ROOT_BOOTSTRAP, never falling back toagy_goal_modeshims whenloopx/hosts/agyexists) before plist writes or-mfallback, classified Case A/B/C in_use_isolated_host_module, and passedresolve_local_executable=Trueinantigravity_app_activation_extras.HEAD87dd2464ac6983a218c74ee5c5abbd8a32426de3, rebased onorigin/main@0bcdffb9926e46a1024bcdacb18e24de37a1b018, zero CI waiting):tests/test_agy_goal_mode_host_runtime.py:test_archive_rollback_to_pre_consolidation_release_preserves_saved_commands: installs archive snapshots under~/.local/share/loopx/releasesfor pre-consolidation (20261127T044107Z,loopx/agy_goal_mode/host_runtime.pywithouthosts/agy) and current (20261127T054107Z,loopx/hosts/agy), generates Stop hooks, watchdog commands, and.plistfiles from current, performs nativeloopx update --rollback previous, verifies all 3 saved entrypoints execute with exit0, and confirms removinghost_runtime.pyfrom the pre-consolidation release still fails closed.test_direct_release_invocation_picks_later_matching_shim_on_path: puts competing installB's shim FIRST onPATHand installA's custom symlink (a_shim -> release_a_v1/scripts/loopx) SECOND onPATH, invokesrelease_a_v1/scripts/loopxdirectly viabootstrap-command-pack&agent-onboard, writes LaunchAgent plists (--no-load), upgradesa_shim -> release_a_v2, deletes bothrelease_a_v1andinstall-b, and verifies all saved Stop hooks, dry-run previews, and saved plistProgramArgumentsbind toa_shimand execute with exit0.test_invoked_release_shim_overrides_different_install_on_path: puts competing installBahead ofAonPATH, verifies explicit--cli-bin B_shimselectsB, whereas invokingA_shim(bootstrap-command-pack,agent-onboard) andinstall_a/scripts/loopxbinds Stop hooks, previews, and.plistfiles exclusively toA, surviving deletion ofB(exit 0).test_real_cli_shim_activation_survives_old_snapshot_deletion_with_or_without_path: executes realscripts/loopxvia symlinked shim with and withoutbin/onPATH(plus~/.local/bin/loopxfallback), writes real LaunchAgent plists, switches symlink tov2and deletesv1, and runs all saved Stop hooks, dry-run previews, and saved plistProgramArgumentscleanly (exit 0).test_saved_launchd_and_stop_hook_follow_active_interpreter_after_old_python_retired: installs saved LaunchAgent plist and Stop hook onv1+venv1, upgrades symlink tov2+venv2, deletes bothv1andvenv1, and verifies saved plistProgramArgumentsand Stop hook runv2onvenv2(exit 0).test_activation_pack_and_onboard_commands_execute_under_clean_provider_python,test_incomplete_release_snapshot_missing_host_runtime_fails_closed,$PATH-isolated launchd-mchecks, andtest_release_snapshot_not_shadowed_by_older_editable_pth_install.bash -n scripts/loopx&/bin/sh -non_POSIX_RELEASE_SHELL_BOOTSTRAP:SH_SYNTAX_OK.uv run --extra test ruff check loopx/hosts/agy/__init__.py loopx/hosts/agy/launchd_watchdog.py tests/test_agy_goal_mode_host_runtime.py:All checks passed!.uv run --extra test python -m mypy --follow-imports=silent --strict loopx/hosts/agy/__init__.py loopx/hosts/agy/launchd_watchdog.py:Success: no issues found in 2 source files.PATH="$HOME/.local/bin:$PATH" .venv/bin/python -m pytest -v tests/test_agy_goal_mode_host_runtime.py:20 passed in 23.32s.uv run --extra test python -m pytest -q(10 combined suites:test_agy_goal_mode_host_runtime.py,test_hosts_goal_mode_batch3_consolidation.py,tests/hosts/,test_antigravity_host_runtime.py,test_agy_host_surface.py,test_host_loop_activation.py,test_bootstrap_command_pack_platform.py,test_onboarding_command_platform.py,test_slash_command_install.py,test_slash_command_install_equivalence.py):261 passed, 2 skipped in 88.13s(2Windows-only skips).uv run --extra test python -m pytest -n 4 -q tests/architecture/:1919 passed in 113.48s.loopx check --scan-path ...(4files):ok: true, errors: 0, warnings: 0.change-quality:cqr_5876ba1ba9f1f4698e55(decision: pass,status: valid,receipt_valid: true, scope5876ba1ba9f1f4698e5557d84b9545d21117ef677336fcd6ffd88cab310f3ec7).canary premerge --from-git-diff --git-diff-base origin/main --tier standard:ok: true,gate.status: passed,direct_checks: 6/6 (direct_failure_count: 0),catalog_run: 2/2,risk_profile_run: 8/8,failure_count: 0,manual_hold_count: 0,quality_receipt_failure_count: 0.