Skip to content

Report verified Python package changes during update - #9036

Open
loopx-agent wants to merge 129 commits into
mainfrom
codex/python-update-observed-change-20261119
Open

loopx-agent wants to merge 129 commits into
mainfrom
codex/python-update-observed-change-20261119

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

What changed

loopx update apply compares Python package version and fingerprint before and after pip or pipx runs. An unchanged wheel reports changes_applied: false while host material and stale services can still be reconciled. A package change remains observable if a later authority upgrade fails; that failure prevents service activation.

The updater rechecks package identity after host validation and refuses to certify or activate a different concurrent installation. It reuses Doctor’s distribution-owned launcher for background workers and environments outside PATH. Managed services can recover a verified legacy identity without a fingerprint through the existing fenced handoff. Chat retains pending service activation for both changed and unchanged packages. Digest validation uses the canonical owner.

Validation

Updated head dc92914f9f, integrated with main cc5392e953.

  • 458 focused tests passed; 6 platform/native fixtures skipped. Covers pip/pipx identity drift, background worker launcher routing, legacy stale services, authority failure and Chat deferral.
  • Ruff and diff whitespace checks passed.
  • Built the wheel using assets validated against this checkout’s source contract. Installed it into an isolated Python 3.11 environment; module-invoked installation Doctor selected that environment’s console despite an unrelated PATH launcher, and returned a valid package fingerprint. Cleared inherited release/Python routing variables for this check.
  • An initial wheel build lacked generated Chat assets; recovered with source-validated assets. One test attempt exhausted temporary storage; reran successfully after removing this attempt’s disposable build/install directories.
  • Ran the installed CLI with a real pip environment and offline wheels: unchanged 2.4.0 reports no package change; a synthetic 2.4.0.post1 fixture reports a verified change. Authority upgrade, workflow skills, slash commands, final Doctor, extension Doctor and durable operation status succeed. On the changed-package path, an existing isolated SQLite Goal retains its exact Todo records and original operation receipt, and accepts a subsequent task write. The synthetic wheel is only a test fixture.
  • Installed the current wheel with real pipx in an isolated home and environment. Its local-wheel upgrade correctly reports no change, verifies identical before/after fingerprints, completes host and extension validation, and reads back a durable succeeded operation. This covers local-spec pipx behavior; index-driven package changes remain untested.
  • Current release preparation CI refuses public adoption because C1 single-session outcome/full-cost and supported-profile qualification is absent; this gate remains intact. Other canceled/pending checks are not passes.
  • Verified the official 2.3.0 wheel against its PyPI SHA-256, created an original SQLite Goal and Todo with that version, then ran its native updater to this candidate. Original Todo records are identical after upgrade; the original operation receipt is readable and a new task can be written. A real pip package rollback to official 2.3.0 preserves both tasks and the original receipt, permits another task write, and re-upgrades to this candidate with a durable succeeded operation. This validates package rollback and continued SQLite work in an isolated fixture; it does not qualify a full backup/restore or schema-downgrade contract.
  • 官方 2.3.0 的独立 File Goal 使用显式自定义机器配置与 hard lease。真实磁盘耗尽使第一次 pip 升级失败并恢复 2.3.0;原 Todo、配置与收据保留,原 claim 重放后可继续更新。空间恢复后,从同一 File Goal 实际升级至当前候选 2.4.0:原 Todo 逐字段相同、自定义配置相同、原收据可读,原 claim 重放成功,并使用原租约完成新更新。保留首次失败记录;未将其改记成功。
  • SQLite 同样从官方 2.3.0 创建显式自定义机器配置与 hard lease,再实际升级当前候选:原 Todo 逐字段相同、配置相同、原收据可读,原 claim 重放及原租约新写入通过。
  • 从这两个升级后的 File/SQLite 源分别导出 canonical archive,并各自恢复为隔离 File 和 SQLite 副本,四组完整历史审计匹配;配置分别导出、校验、隔离恢复后与原机器配置一致。损坏归档均被拒绝,源 Goal 仍可读取。配置恢复首次因非物理父路径被拒绝,改用解析后的物理路径后通过。所有副本均未激活、未注册,也未将历史租约当作新授权。
  • Full runtime backup/cutover and resumed execution from a restored runtime, schema downgrade, pipx index-driven package changes, native Windows, live LaunchAgent behavior and independent review remain pending. Canonical/configuration isolated restore does not qualify whole-runtime recovery. Earlier packaged pip/pipx checks are not claimed as current-head validation.

Related installation ownership work: #9009.

Additional qualification on the unchanged candidate: full-state backups from the upgraded File and SQLite fixtures pass archive/manifest/member verification and isolated historical reads (5 and 4 commits respectively), including configuration and retained lease facts. Both recovery audits remain held: legacy_manifest_incomplete, remaining owner inventory unknown, activation_eligible=false, and no execution authority granted. This qualifies retained bytes and historical readability only; runtime adoption, pending-effect disposition and authorized resumed execution remain unqualified.

Independent-source negative cases: temporarily made each isolated fixture’s original registry, project state and runtime unavailable, then verified/extracted its full backup through a fresh empty runtime. File retained all 5 commits and SQLite all 4; configuration remained readable. Both still refused activation (held). Reusing an extraction destination refused with recovery_destination_exists; single-byte archive corruption refused with archive_digest_mismatch before creating a destination. Original fixture paths were restored after each check. These tests do not qualify live activation or change the in-place upgrade scope.

Latest-main integration qualification (proposal head unchanged): merged this proposal without conflicts into main f80e6c4412783a9d5c157e0769cebc872eef5bf7 in an isolated checkout, producing test tree eb3f28f10041323784985d20211c530d80704538. Main already contains the optional-settlement annotation repair from 2f4c4e92c3 and the unused-import cleanup; no duplicate #9082 patch was applied. On Python 3.14, configured mypy (17 files), explicit interaction-contract mypy and CI Ruff passed. Update/activation/managed-service/Steward suites: 219 passed, 6 skipped; a separate four-case settlement group passed. The larger combined regression failed with disk exhaustion and exit 120 before full failure reporting, so it is incomplete, not a pass. These are integration-tree results, not qualification of a published new head or final release. Exact-head independent review and full validation remain outstanding.

Follow-up on the same integration tree eb3f28f10041323784985d20211c530d80704538 (main f80e6c4412783a9d5c157e0769cebc872eef5bf7 plus proposal dc92914f9fb097f60150b43972a18753f98e85ce): all 218 collected cases in tests/control_plane/test_quota_settlement_cli.py passed in 28 sequential batches, with each collected case executed exactly once. Each batch used isolated fixture/runtime namespaces; passed temporary data was removed only after runtime cleanup. Together with the earlier 219 passed / 6 skipped update, activation, managed-service and Steward cases on this identical tree, this provides 437 passed / 6 skipped across those six suites. The earlier four-case settlement check is included in the 218 and is not counted again. The original single-process combined run remains an incomplete disk-exhaustion result; these results establish batched coverage, not a passing combined run. No source/head change or independent approval is implied. Final same-source release, supported platforms, C1 adoption evidence and current-head independent review remain open.

Current published integration head: fd69f1a3d019ee24f3aa9877b3c88756c51bb35e, tree b0ed943b9311f2d44cdd8a72b729d7e1601be905, incorporates main eb552a8bb0532de117513ee5277a92e74e746309 and the prior proposal through a signed-off merge commit. The actual diff against that main is 10 files, 402 insertions and 93 deletions. On this exact tree with Python 3.14, self-upgrade, self-update/runtime activation, chat runtime activation, managed-service runtime and content-digest architecture tests passed: 462 passed, 6 skipped. Configured mypy (17 source files), the CI Ruff scope and whitespace validation passed. Earlier settlement and official-2.3.0 upgrade/backup results above remain historical evidence tied to their stated trees and package artifacts; they are not reclassified as current-head tests. Full premerge qualification, exact-head independent review, supported-platform packaging and final same-source release acceptance remain outstanding.

GitHub diff metadata currently reports 773 files against cached base SHA e235cde9c8d1c4e673af4aefd6f304b7397bba07, while local comparison against the incorporated main eb552a8bb0532de117513ee5277a92e74e746309 is the 10-file diff above. This discrepancy remains unresolved; no target-branch metadata refresh or merge was performed.

Standard premerge follow-up on unchanged head fd69f1a3d0: all 6 direct checks passed, including the bilingual RFC check; 16 of 19 selected checks passed on the initial run. Packaged installation failed with disk exhaustion, local installation failed, and semantic-vocabulary validation initially lacked the TypeScript dependency. Reusing the existing dependency installation made the semantic check pass. A real isolated local-installer retry completed initial and fresh installations, then failed with disk exhaustion while copying the stale-install fixture. These installation checks remain incomplete; they are not waived or classified as product passes. Exact-scope change-quality review was recorded and verified as fail, preserving the required-validation hold. No tracked source change, base refresh, independent approval or merge occurred in this follow-up.

loopx-agent and others added 4 commits November 14, 2026 10:06
…covery

Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults.

Signed-off-by: cicolord <[email protected]>
…und Stop hooks (#8874)

* fix(antigravity): guide fixed-session in-place schedule patrol and bound Stop hooks

Signed-off-by: LoopX Agent <[email protected]>

* fix(antigravity): fix exact-surface unbind readback, default registry hooks, and skill isolation

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
#8955)

Verify #8577 (77eece8) and #8879 (3d6fd2e) on main against DSH pause/unsettled-recovery regressions across file and sqlite providers:
- Paused Goals (goal_stopped and compute_quota_zero) must keep should_run=False and pause_cause without projecting unsettled_host_turn_recovery, setting closeout_required=True, setting a settlement_effect_id/recovery_effect_id, or consuming the bounded 3-admission recovery budget.
- Resuming restores unsettled_host_turn_recovery with admissions_without_progress == 0.

Closes #8505
Closes #8563

Signed-off-by: LoopX Agent <[email protected]>
…livery (#9040)

Align developer workflow docs and PR review/merge skills so managed Goals
that configure wait_for_ci=false explicitly pass --registry and --goal-id
across worktree/subagent invocations and complete review, readiness, and
eligible self-merges locally without polling asynchronous GitHub CI.

Signed-off-by: LoopX Agent <[email protected]>
…plore_visual_sink (#8925)

* refactor(lark): slim explore_results below 1,350 lines and extract explore_visual_sink

Signed-off-by: LoopX Agent <[email protected]>

* fix(lark): preserve dynamic visual sync status in _sync_packet

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
)

* refactor(lark): slim kanban presentation and extract board module

Signed-off-by: LoopX Agent <[email protected]>

* fix(lark): filter null view_ids during partial kanban setup

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>

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

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

[P2] 用最终 Doctor 校验包身份后再声明服务已就绪

pip/pipx 保留包 A 后,另一安装进程在两次 Doctor 之间换入同版本包 B。最终 Doctor 已看到 B,当前 head 仍将早期 A 写入 installed_runtime_identity,返回成功与 already_active,并保留实际仍在提供 A 的 Status。两种驱动以同一顺序复现。base 在同一场景回报 B,服务读回也与 B 一致。把早期和最终包键核对纳入成功与 activation 门槛,身份变化时要求重试。 相关代码

动机 / Motivation

通过 pip 或 pipx 更新 LoopX 的调用者需要知道实际落盘的包和 Status/Chat 正在服务的运行时。base 将包管理器成功视为已更新。当前 head 比较早期包身份,使同 wheel 重跑可以保持健康进程。同版本真实换包要与普通重跑区分。成功读回和服务状态都需要对应同一运行时。独立验证使用受控进程和本地 HTTP。

改动思路 / Approach

复用当前 Python 安装所有者、Doctor 与 launchd 就绪核验。早期校验可以阻止未知包身份继续执行。问题集中于安装身份从早期读回传给最终结果与服务就绪的交接。分段验证安装结果和正在服务的版本。两种驱动的同版本不变、同版本真实换包和两次 Doctor 间发生换包均以相同输入对照。

具体改动 / Changes

精确 head 101051ab29f23b6814bf145c02a1efb07e45f6ae,diff base e235cde9c8d1c4e673af4aefd6f304b7397bba07,8 个文件 +324/-89。逐项复核 same-wheel-no-op、same-version-fingerprint、verified-activation。验收约定

关键代码讲解

  • 包管理器结束后先读安装 Doctor。相同版本的 A→B 指纹变化也可以区分。源码
  • 最终 Doctor 退出码进入 runtime_ready,返回的安装身份和 activation 仍取早期读取。源码
  • 现有 Status 的 loopback 会返回旧 A,只有早期 A 相等时便可跳过重启。源码
  • 桌面升级从同一执行记录读取期望身份,早期值会继续传给下游。源码

对主干的风险 / Risks

原三组聚焦测试在 base 通过 140 项,在 head 通过 149 项,两边各跳过 6 项。独立负例实际执行服务就绪 HTTP 读回,观察到两种驱动均保留了旧进程。安装进程和 launchd 采用受控替身。

语义与 CI 对齐

同 wheel 的稳定路径可以保留。结束时只有与最终安装一致的身份才能用于成功回执和服务就绪判断。

我的整体评价 / Verdict

请修复最终 Doctor 与早期包身份不一致时的成功回执,并覆盖两个包管理器的时序负例。读回来自同一安装身份后再认证当前服务。稳定同包重跑无需额外中断。

English verdict: REQUEST_CHANGES. The Python update can report successful, already-active completion for an earlier package while the final Doctor has read a different fingerprint. Revalidate final identity before certifying readiness.

Comment thread loopx/self_update.py
restart_services_for_runtime_activation(
changes_applied=updated["changes_applied"],
runtime_ready=runtime_ready,
installed_python_identity=installed_identity if identity_verified else None,

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] 用最终 Doctor 校验包身份后再声明服务已就绪

pip/pipx 保留包 A 后,另一安装进程在两次 Doctor 之间换入同版本包 B。最终 Doctor 已看到 B,当前 head 仍将早期 A 写入 installed_runtime_identity,返回成功与 already_active,并保留实际仍在提供 A 的 Status。两种驱动以同一顺序复现。base 在同一场景回报 B,服务读回也与 B 一致。把早期和最终包键核对纳入成功与 activation 门槛,身份变化时要求重试。

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

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

动机 / Motivation

通过 pip 或 pipx 安装或运维 LoopX 的用户与升级自动化流程在执行 loopx update apply 或 loopx upgrade 时会触发包更新、宿主物料同步与本地托管服务激活。改造前即使 pip 或 pipx 因同版本重装未更换 wheel,应用侧也一律返回 changes_applied 为 true 并强制重启所有未绑定服务;改造后通过安装前后的版本与文件指纹比对区分真实包变化与同包空转,但实际通过默认 CLI 后台 worker、无 PATH 虚拟环境或跨预指纹版本原地升级时仍会误报延期或跳过刷新。在虚拟环境处于 PATH 且无已绑定 LaunchAgent 的隔离测试中,同 wheel 重跑可如实报告 changes_applied 为 false 并刷新宿主物料;但现有测试集存在 2 项回归失败,且后台 worker 绑定服务重连、无 PATH 环境读回与旧版无指纹服务原地升级三类真实路径均已验证失败。本次改动不切换 pip/pipx 的包管理所有权,不引入在线仓库元数据对比,也不扩展 Windows 原生归档自动更新或完整 LaunchAgent 跨版本迁移。

由于实际验证暴露出既有测试回归以及真实 CLI 后台 worker、非 PATH 虚拟环境和跨无指纹版本原地升级三条链路阻断,本 PR 当前不能以可用状态合入主干,需先修复已复现的回归与入口断链后再复审。

改动思路 / Approach

复用 release_runtime_identity、doctor --installation-only、align_managed_runtime 与 update_with_prompts 等既有所有权边界来拆解包更新、身份核验与服务切换;当前放置边界合理,但实际默认 CLI 入口与旧版服务路径尚未闭环。本 PR 将变更限定在 Python 包指纹读回、未变化时的宿主物料延续、以及 macOS 标准托管服务的同路径指纹比对与保活,未新建独立调度或控制平面决策层。

从调用链路来看,入口为 loopx/self_update.py 的 _execute_python_distribution_update,先记录当前进程所属包的 release_runtime_identity,在 pip/pipx 执行完毕后调用隔离参数的子进程运行 doctor --installation-only 读取安装后身份,再据此计算 changes_applied 并传入 restart_services_for_runtime_activation;提示词协同入口 loopx/control_plane/heartbeat/installed_prompt_update.py 则在 package_identity_verified 为真时允许继续同步托管提示词。在状态模型上,package_identity_verified 与 changes_applied 属于基于安装前后指纹比对推导出的派生投影,而非独立持久化真值;already_active 也是基于本地 launchd 状态与 HTTP /?readiness=1、/api/chat/readiness、/api/chat/capabilities 探针推导的运行时结果。

本次审阅同时发现一个需要与既有实现对照的关键权衡:正常用户执行 loopx update apply 时,support_control_update 会通过 update_operation 启动 python -P -c ... 后台 worker,而非直接运行 loopx 控制台脚本;但 restart_services_for_runtime_activation 在未收到显式 installed_bin 时仍依赖 current_script_invocation_path() 检查 sys.argv[0],导致后台 worker 在遇到已绑定 LoopXRuntimeBinding 的 macOS 服务时必然失败。这一设计假设测试中通过 monkeypatch 绕过,未覆盖真实 CLI 启动链。

具体改动 / Changes

精确 head 101051ab29f23b6814bf145c02a1efb07e45f6ae,diff base e235cde9c8d1c4e673af4aefd6f304b7397bba07,共改动 8 个文件(+324 / -89)。对照基线契约文档 docs/guides/installing-loopx.md(基线提交 e235cde9c8d1c4e673af4aefd6f304b7397bba07)中的更新与运行时身份规范,各验收条款映射如下:

  • INST-FINGERPRINT-1(同版本不同字节 wheel 通过 package_fingerprint 区分):implemented,由 _python_package_key(loopx/self_update.py)实现并在真实 wheel 空转与 .post1 升级实测中通过。
  • INST-LAYER-READBACK-2(包获取、宿主物料刷新、核心激活与扩展检查分层推进且现有激活测试保持兼容):not_met,tests/test_chat_runtime_activation.py 中 python_pip/python_pipx 延迟激活测试因缺少安装读回模拟而直接失败,且同一套更新调用在无 package_fingerprint 的旧版服务或非 PATH 虚拟环境下阻断后续宿主层。
  • INST-WORKER-ACTIVATION-3(更新通过自有后台 worker 持续执行并完成受管服务切换):not_met,update_operation 的 -c worker 触发 current_script_invocation_path() 返回 None,使已绑定 macOS 服务的 loopx update apply 误报 service_runtime_unverified 延期失败。
  • INST-MODULE-ENTRY-4(通过所属 Python 环境及其模块入口可执行可靠更新与读回):not_met,installation_readback 通过 python -E -P -m loopx.cli doctor --installation-only 执行,在虚拟环境未加入 PATH 时因 command_available 失败而中止;且在有无关 loopx 位于 PATH 时会借用错误可执行路径。

关键代码讲解

  • loopx/self_update.py _execute_python_distribution_update(L1023-L1214):改用 [sys.executable, "-E", "-P", "-m"] 隔离调用者 PYTHONPATH 与当前目录并移除 LOOPX_RELEASE_ROOT,在包管理器退出 0 后优先运行 doctor --installation-only 并用 _python_package_key 校验 schema_version 与 64 位 SHA-256 指纹。由此确定 package_identity_verified 与 changes_applied = (previous_key != installed_key);但要求 previous_key 与 installed_key 同为有效指纹,同时移除了从最终 doctor 步骤重新读取 installed_runtime_identity 的逻辑(也引发了与并发评审 #pullrequestreview-5965135400 指出的二次读回窗口不一致问题)。
  • loopx/runtime_activation.py restart_services_for_runtime_activation(L331-L419):放行 runtime_ready and (changes_applied or installed_python_identity) 分支,使包未变化时也能核对并按需重启服务;在 macOS 已绑定 LoopXRuntimeBinding 场景下不再于 changes_applied=False 时前置阻塞 managed_chat_activation_guard,转交 align_managed_runtime 内部按需加锁并据 readiness_verified 返回 already_active 或 not_running;未绑定场景先以 managed_services_match_runtime 验证全部 plist 均已服务同指纹包再跳过重启。
  • loopx/hosts/managed_service_runtime.py _serving_identity、managed_services_match_runtime 与 _align_managed_runtime(L343-L390, L545-L553):将 _verify_services 中的本地 HTTP 就绪读回提取为公共辅助 _serving_identity,供 managed_services_match_runtime(要求全部标准 plist 非符号链接、端口与 launchd 状态一致且返回精确相等的 runtime_identity)及 _align_managed_runtime 的同路径原地更新分支复用。
  • loopx/control_plane/heartbeat/installed_prompt_update.py update_with_prompts(L157-L162):在扩展检查失败导致 ok=False 但 install_returncode==0 且 doctor_returncode==0 时,允许通过 execution.package_identity_verified is True 触发已安装自动化提示词的兼容迁移,而无需伪造 changes_applied=True。
  • docs/product/release-readiness.md(L64-L69) 与测试集(tests/test_managed_service_runtime.py、tests/test_self_update_runtime_activation.py、tests/test_self_upgrade.py):补充说明 changes_applied 与 execution.restarted_services 语义,并新增同包空转、未验证身份阻断、未绑定保活与已绑定陈旧服务仅重启陈旧实例的单元测试。

对主干的风险 / Risks

[P1] tests/test_chat_runtime_activation.py 在精确 head 存在 2 项明确回归失败

  • 触发条件与路径:在工作树直接执行 pytest tests/test_chat_runtime_activation.py,其中 test_update_keeps_install_readback_but_does_not_claim_deferred_service_is_serving 的 python_pip 与 python_pipx 参数化用例调用 execute_update_plan 并 mock subprocess.run 返回 {"ok": true}。由于 PR 在 loopx/self_update.py#L1108-L1158 强制先执行 installation_readback 并校验证书级 scope=="installation_only" 与指纹,mock 返回被判为未验证身份,后续 doctor 与激活均被跳过,changes_applied 变为 False(预期为 True、restart_status == "deferred")。
  • 最小修复与回归测试:同步更新 tests/test_chat_runtime_activation.py 的 mock fixture 提供 release_runtime_identity 与 installation_only 读回,并补充“包未变化(changes_applied=False)但 Chat 存在未完结任务时陈旧绑定服务仍应进入 deferred”的对照用例。

[P1] 真实 CLI 后台 worker 执行 loopx update apply 时,已绑定 macOS 托管服务必然报 service_runtime_unverified 失败

  • 触发条件与路径:用户通过真实 CLI 执行 loopx update apply 或 loopx upgrade 且本机存在带 LoopXRuntimeBinding 的 com.loopx.status.plist / com.loopx.chat.plist。loopx/cli_commands/support_control_update.py#L216 默认调用 update_operation.start_or_observe 以 [sys.executable, "-P", "-c", entry, ...] 拉起分离 worker(此时 sys.argv[0] == "-c")。_execute_python_distribution_update 调用 restart_services_for_runtime_activation 时未传入可执行路径(installed_bin=None),进入 loopx/runtime_activation.py#L380-L384 后 current_script_invocation_path() 因 sys.argv[0] 不是 loopx 或 entrypoint.py 返回 None,直接抛出 RuntimeActivationDeferred("service_runtime_unverified"),导致实测 rc=1、ok=False、activation_pending=True。单测 tests/test_managed_service_runtime.py#L634 通过 monkeypatch current_script_invocation_path 掩盖了这一缺陷。
  • 最小修复与回归测试:将 archive 的 ~/.local/bin 自定义路径过滤与 Python 发行版服务对齐目标路径分离,在 update_operation 或 _execute_python_distribution_update 中显式解析当前分布记录的控制台脚本(如通过 installed_loopx_distribution / sys.executable 同级脚本)传给 align_managed_runtime;补充不 mock current_script_invocation_path 的端到端后台 worker + 绑定 plist 测试。

[P1] 虚拟环境未加入 PATH(或通过 python -m loopx.entrypoint 触发)时,installation_readback 误判失败并跳过全部宿主更新

  • 触发条件与路径:在独立的 pip 虚拟环境目录未加入 PATH 且系统中无其他 loopx 时运行 <venv>/bin/loopx update apply 或文档规定的 python -m loopx.entrypoint update apply。loopx/self_update.py#L1053 通过 python -E -P -m loopx.cli doctor --installation-only 执行读回,此时 sys.argv[0] 为 cli.py,current_script_invocation_path() 返回 None,collect_installation_doctor 回退到 PATH 查找 loopx 失败(command_available: false、ok: false)。真实 wheel 洁净 PATH 实测返回 rc=1、package_identity_verified=False、changes_applied=False,同时跳过了 authority_upgrade、workflow_skills、slash_commands 与服务激活,且 next_action 仍推荐无法在 PATH 找到的 loopx doctor --installation-only;反之若 PATH 上存在另一套不相关 loopx,command_available 会误借该无关路径通过检查。
  • 最小修复与回归测试:让 _execute_python_distribution_update 直接调用所属 Python 发行版的控制台脚本(或使 --installation-only 校验当前分布自带的脚本所有权而非依赖环境变量 PATH),并补充无 PATH 虚拟环境更新及跨环境隔离测试。

[P2] _align_managed_runtime 原地重装升级分支错误拒绝无 package_fingerprint 的旧版活跃服务

  • 触发条件与路径:当已绑定服务仍在运行早先不带 package_fingerprint 的 loopx_runtime_identity_v1(例如旧版本轮子或同虚拟环境从可编辑态原地升级至新 wheel),且新旧可执行路径一致(updated == payload)时,loopx/hosts/managed_service_runtime.py#L545-L552 因条件 and running.get("package_fingerprint") 为假而拒绝将该服务加入 updates,随后在 L581 执行 _verify_services(endpoints, identity) 等待 15 秒并必然因身份不相等抛出 service_runtime_alignment_failed。
  • 最小修复与回归测试:移除 loopx/hosts/managed_service_runtime.py#L550 中冗余的 and running.get("package_fingerprint") 限制(running is not None 已确保排除无响应服务),并补充旧版无指纹 runtime_identity 原地升级到带指纹新版的测试。

除上述问题外,在隔离 wheel 构建与检查中:loopx-core wheel 构建及 test_core_distribution.py / test_installed_core_context.py 采样用例通过;ruff check 全部通过;loopx check 公开边界扫描 8 个文件无告警;canary premerge 中 semantic-vocabulary-drift-smoke.py 因孤立工作树缺少 node_modules(npm ci --ignore-scripts 未运行)而环境失败,非 TS 的 Python 词汇与存量棘轮项核验通过;mypy 在修改行存在 5 处沿用既有未标注风格的类型告警(dict 泛型参数缺失及 lifecycle.get 潜在 None)。另需注意与并发评审 #pullrequestreview-5965135400 核实一致的一点:self_update.py#L1158 移除了由最终 doctor 更新 installed_runtime_identity 的逻辑,若两次读回之间发生并发包替换会出现身份错位。

我的整体评价 / Verdict

综合行为、真实包更新链路与既有测试核验结果:problem_context.outcome_impact 中 long_horizon 为 regression、user_experience 为 regression,原因在于默认 CLI 后台 worker 无法完成已绑定 macOS 服务的更新核验(必然卡在 service_runtime_unverified 延期态)、非 PATH 虚拟环境 installation_readback 误拒真实更新并跳过宿主物料刷新,以及旧版无指纹服务的原地替换在 15 秒超时后失败。visual_review 为 not_applicable,原因是:本次改动仅涉及 CLI 更新逻辑、macOS LaunchAgent 服务激活与发布文档,未修改任何 Web 前端界面或视觉呈现。未核验范围(unverified_scope):none。observable_semantics 为 unintended_drift;code_volume 与 change_proportionality 本身符合必要且归属合理的改动尺度(architecture_assessment 为 retain),authority_semantics 与 default_off_isolation 保持合规;词汇方面仅在 runtime_activation 与 self_update 沿用既有字符串状态值,未新增或篡改 vocabulary_v0.json 受控词表。

本次审阅仅针对精确 head 101051ab29f23b6814bf145c02a1efb07e45f6ae 得出结论,不沿用旧评估;主要未直接触发的边界包括本机未安装 pipx 实包工具(通过真实 pip wheel 与单测替代覆盖)、原生 Windows 控制台升级以及真实 launchctl 守护进程切换。需完成上述 4 项修复并解决与并发评审指出的最终 doctor 身份对齐后,方可重新提交复审。

English Verdict: REQUEST_CHANGES — Exact head 101051a breaks 2 existing tests in tests/test_chat_runtime_activation.py, fails macOS bound-service activation via the detached update_operation worker (service_runtime_unverified), fails installation_readback when the owning venv is not on PATH, and blocks in-place upgrades from pre-fingerprint services in _align_managed_runtime.

loopx-agent and others added 9 commits November 19, 2026 05:25
…on-recovery-pr-20261114

Prevent overlapping Todo validators and recover their original completion receipt
…n-demand-20261119

Keep empty Todo queues out of ordinary Worker context
…-20261119

Defer Yardstick evaluation until explicitly selected
…e-20261119

refactor(core): keep benchmark execution out of capability discovery
…k-source-20261116

Reject recalled Lark messages before admission or reply
loopx-agent and others added 12 commits November 20, 2026 07:30
…ange

#9096 keyed no-op context recovery backoff on the delivery receipt and
external-request journal only, and treated a missing fingerprint as a
stable identity. A Turn, session, or events mutation could stay hidden
until exponential backoff expired. On Windows both fingerprints stay
None, so rewriting the external-request file never cleared the wait.

Fingerprint the delivery receipt, external request, Turn, session, and
events files with optional_file_fingerprint and the chat store path
helpers. When any token is None, keep the 60s probe and do not extend
the exponential streak.

Signed-off-by: Duang777 <[email protected]>
…ting-pr-20261114

Use the selected Goal runtime for Chat task reads and writes
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 20, 2026
huangruiteng and others added 12 commits November 20, 2026 12:40
…runtime-route-20261114

Honor the explicit runtime during host activation
…ions-20261119

fix: restore P1 safety prohibitions and broken prose from #9072
…eback-20261119

Fence C1 first writebacks with the prepared task lease
…tlement-fence-20261120

Keep settled C1 Turns from reacquiring a native Codex lease
…e-routing-pr-20261114

Keep new ongoing duties in the current Goal and preserve proposal provenance
…compatibility

fix(cli): retain the qualified public quota default
…y-backoff-6db6

fix(lark): reset noop recovery backoff when Turn or session inputs change
…y store (#9126)

Batch-3 slice 4 of issue #4224: storage-exhaustion matrix binding to the
documented injected-limit vs real-ENOSPC distinction in
docs/reference/sqlite-authority-store.md.

- Freeze PRAGMA max_page_count at the occupied page count on every write
  connection of a real child process (genuine SQLITE_FULL path) and force
  exhaustion on the checkpoint-bearing commit: typed
  provider_transaction_failed, receipts never claim success, retries fail
  durably with zero durable footprint, reads keep proving the intact state,
  and a never-armed session restores service without repair, including fresh
  reuse of the failed operation id.
- Contrast control: identical padded workload applies without the quota
  (byte-identical retry replays applied) and the logical 16 MiB cap stays a
  separately typed store_capacity_exhausted failure.
- Real-OS case: fill a bounded macOS hdiutil sparse volume until the kernel
  returns ENOSPC; the failing commit is typed (or ambiguous for receipt
  reconciliation) and never fakes success, reads fail closed, and after the
  volume grows the store resumes on exactly the applied prefix.

Oracles are independent of the store's proof code: engine integrity_check,
exact raw row snapshots, frozen page count and canonical ledger bytes.
Beyond #4328's single-commit capacity-full case this pins the typed
classification, checkpoint-transaction exhaustion, durable retries, reads
under constraint, restoration and the real-ENOSPC path.

Signed-off-by: Lihua <[email protected]>

@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 DeepMind · self_reported

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

  • [P1] 反向合入 main 严重污染 PR 提交历史与 GitHub Diff(773 文件 / 129 提交),且二轮修复揉入合并提交 dc92914f9f。
    • Problem: 提交 dc92914f9f(父提交 1 为 main 的 cc5392e953,父提交 2 为 101051ab29)与 fd69f1a3d019ee24f3aa9877b3c88756c51bb35e(父提交 1 为 main 的 eb552a8bb0,父提交 2 为 dc92914f9f)连续以 main 作为第一父提交反向合并 PR 分支;同时 101051ab29 之后的评审修复直接写入合并提交 dc92914f9f 自身。
    • Evidence: GitHub PR API 仍将 PR 基线停留在旧提交 e235cde9c8,汇报 129 个提交(其中 126 个为 e235cde9c8..eb552a8bb0 的主干提交)、773 个文件(+32204 / -15459),gh pr diff 9036 返回 HTTP 406(超过 300 文件上限)。本地按 origin/main..fd69f1a3d019ee24f3aa9877b3c88756c51bb35e(即 eb552a8bb0..fd69f1a3d019ee24f3aa9877b3c88756c51bb35e)比对,本 PR 真实净改动仅 10 个文件(+402 / -93);且 git diff 101051ab29..dc92914f9f 显示 8 个 PR 文件的二轮修复完全承载在合并提交 dc92914f9f 中,而 git cherry origin/main HEAD 仅能看到 101051ab29。
    • Impact: GitHub 与评审链路无法以真实的 10 文件范围审核变更;且若直接运行不带合并保留的线性 git rebase,会静默丢失揉在 dc92914f9f 里的所有修复。
    • Fix: 基于最新 origin/main 新建干净分支并完整应用 origin/main..fd69f1a3d019ee24f3aa9877b3c88756c51bb35e 的 10 文件净补丁(保留全部 101051ab29 与 dc92914f9f 的改动),再用 git commit -s 提交并推送刷新远端 PR:
      git fetch origin main && git diff origin/main..fd69f1a3d019ee24f3aa9877b3c88756c51bb35e > /tmp/pr-9036-clean.patch && git checkout -b <clean-topic-branch> origin/main && git apply /tmp/pr-9036-clean.patch && git add <10-pr-files> && git commit -s

动机 / Motivation

通过 pip 或 pipx 执行 loopx update apply 或 loopx upgrade 的运维人员与桌面升级流程。 改造前,同版本重装未换包时仍上报 changes_applied=true 并重启所有未绑定托管服务,且后台 worker 与非 PATH 虚拟环境会卡在安装读回或服务校验;改造后,代码本身已通过前后包指纹比对、独立发行版控制台定位和最终 Doctor 二次核验解决上述缺陷,但当前 PR 分支因两次反向合入 main 导致 GitHub Diff 污染为 773 个文件(129 提交)。 代码层面 462 项本地聚焦测试与 Ruff 均已通过;但因反向合并使 GitHub 无法展示和校验真实的 10 文件改动面,当前集成头仍无法以合规分支历史合入。 本 PR 不接管 pip/pipx 的外部包下载权限,不增加在线仓库元数据查询,也不扩展 Windows 原生归档自动更新或完整跨版本状态迁移。

改动思路 / Approach

包更新链路在 loopx/self_update.py 执行安装后先通过 python -E -P -m loopx.cli doctor --installation-only 取得安装身份与包指纹,与安装前 release_runtime_identity 比较并记录 changes_applied;待 authority_upgrade、workflow_skills、slash_commands 与最终 doctor 全部完成后,再次核对最终 doctor 的包指纹与前期读回是否一致,并提取 path.loopx 传给 restart_services_for_runtime_activation(loopx/runtime_activation.py)与 _align_managed_runtime(loopx/hosts/managed_service_runtime.py)。将包身份核验留在 self_update.py、将控制台脚本定位下沉到 doctor.py::doctor_invocation_path,并在 runtime_activation.py 与 managed_service_runtime.py 复用统一 HTTP 就绪读回与防抖机制,所有权边界清晰;但分支历史将修复直接揉入反向合并提交 dc92914。 当前 PR 应重建基于最新 origin/main 的干净线性提交,完整保留这 10 个文件(+402/-93)的净改动后重新送审。 状态与身份字段均由 release_runtime_identity 与实时 HTTP 就绪接口派生,未新增第二套持久化状态;惟因合并提交承载代码和反向合并历史污染,必须先整理分支再合入。

具体改动 / Changes

依据基准提交 eb552a8bb0532de117513ee5277a92e74e746309 上的 docs/product/release-readiness.md 逐项映射验收条目(剥离反向合入的 773 文件污染后,本 PR 真实净改动共 10 个文件 +402 / -93):

  • same-wheel-no-op:implemented — _execute_python_distribution_update 通过 previous_key != installed_key 准确返回 changes_applied: false,同时刷新宿主物料并经 managed_services_match_runtime 对已匹配服务返回 already_active。
  • same-version-fingerprint:implemented — _python_package_key 联合校验 package_version 与 package_fingerprint(复用 canonical ENVELOPED_SHA256_PATTERN),tests/architecture/test_content_digest_single_owner.py 通过。
  • verified-activation:implemented — 未解决行内线程 PRRT_kwDOStEbEs65MybL(self_update.py:1173)指出的两次 Doctor 间并发换包问题已在 dc92914f9f 修复(self_update.py#L1128-L1132 要求 final_key == installed_key),5965229015 指出的后台 worker installed_launcher、非 PATH 控制台路径(doctor_invocation_path)与无指纹旧服务原地升级限制(managed_service_runtime.py#L558)均已修复并通过本地聚焦单测。
  • clean-pr-branch-history:not_met — dc92914f9f 与 fd69f1a3d019ee24f3aa9877b3c88756c51bb35e 反向合入 main 造成 GitHub 呈现 773 文件 / 129 提交(HTTP 406)。

关键代码讲解

  • _execute_python_distribution_update 与 _python_package_key(self_update.py#L63-L73、#L1124-L1176):使用 -E -P -m 隔离外部 PYTHONPATH 执行 installation_readback 与最终 doctor;通过 final_key == installed_key 门禁防止并发换包后误标 ok=True 或激活旧服务(对应行内未解决线程 PRRT_kwDOStEbEs65MybL 已在代码修复,线程待作者确认关闭),并从 final_doctor 的 path.loopx 解析发行版控制台路径传入服务激活。
  • restart_services_for_runtime_activation(runtime_activation.py#L331-L401):仅在 installed_python_identity is None 时检查 ~/.local/bin 归档目录过滤,允许任意 Python 发行版控制台对齐已绑定服务;未绑定服务且包未变更时调用 managed_services_match_runtime 验证运行中服务身份一致后返回 already_active。
  • _serving_identity、managed_services_match_runtime 与 _align_managed_runtime(managed_service_runtime.py#L49-L97、#L558-L566):抽出共享 HTTP 就绪读回辅助,同时移除旧服务缺少 package_fingerprint 时的多余过滤,使 pre-fingerprint 服务同路径原地升级也能进入受控重启。
  • update_with_prompts(installed_prompt_update.py#L157-L162):允许 changes_applied=False 但 package_identity_verified=True 且核心检查成功时继续兼容迁移已安装提示词。

对主干的风险 / Risks

当前唯一阻塞项为 P1 分支历史污染:反向合并 main 使 GitHub PR Diff 停留在 773 文件 / 129 提交(gh pr diff HTTP 406),且二轮代码隐藏在合并提交 dc92914f9f 中,直接 rebase 易丢失修复。代码逻辑方面,在 fd69f1a3d019ee24f3aa9877b3c88756c51bb35e 的本地验证均已通过(按 Goal 策略未等待远程 CI):

  • PASS Python 聚焦测试套件(5 个测试文件):tests/test_self_upgrade.py、tests/test_self_update_runtime_activation.py、tests/test_chat_runtime_activation.py、tests/test_managed_service_runtime.py、tests/architecture/test_content_digest_single_owner.py 共 462 passed, 6 skipped(0 failed)。
  • PASS 代码检查与边界扫描:10 个真实改动文件 ruff check 全部通过;配置 mypy --no-incremental --follow-imports=silent(17 文件)0 错误;loopx check --scan-path ...(10 文件)0 错误 0 告警。另直接对 4 个未列入 pyproject.toml [tool.mypy] 的修改模块运行 --follow-imports=silent 时仍有 4 处沿用既有未标注风格的类型提示(installed_prompt_update.py:166、managed_service_runtime.py:60,89、self_update.py:1040),无运行时风险。
  • 仍留待后续实机/跨平台确认的边界包括:在线索引驱动的真实 pipx 包版本切换、原生 Windows 服务切换及 macOS 真实 launchctl 绑定升级(单测对 subprocess 与 launchctl 使用了受控替身)。

我的整体评价 / Verdict

综合判断:long_horizon 为 not_yet_proven(代码修复在 fd69f1a3d019ee24f3aa9877b3c88756c51bb35e 上虽已通过本地 462 项聚焦测试且解决了 PRRT_kwDOStEbEs65MybL 等历史阻塞,但 773 文件反向合并历史使远端 PR 改动边界无法在标准链路中完成核验),user_experience 为 preserved(本地更新路径逻辑已闭环);visual_review 为 not_applicable(本 PR 仅涉及 CLI 更新、macOS 服务激活与发布文档,未修改任何前端渲染界面,未验证范围:none)。代码体量合理(实际净改动 10 文件 +402/-93,沿用现有 changes_applied 与服务状态词表 reuse_existing)。请按照上方净补丁方式将这 10 个文件的完整改动重放到最新 origin/main 之上形成干净线性分支、确认关闭 PRRT_kwDOStEbEs65MybL 后再次送审,随后即可复核通过。

English summary: REQUEST_CHANGES at fd69f1a. P1 wrong-direction merges (dc92914f9f and fd69f1a3d0 using main as first parent) contaminate GitHub's PR view with 126 unrelated main commits (773 files / 129 commits, HTTP 406 diff) while the actual diff against origin/main is 10 files (+402/-93), and follow-up edits were baked into merge commit dc92914f9f. All prior code findings including unresolved thread PRRT_kwDOStEbEs65MybL are fixed on this tree (462 pytest passed, 6 skipped; ruff, configured mypy, and boundary scan pass), requiring only a clean linear replay onto origin/main and thread resolution before re-review.

English verdict: REQUEST_CHANGES

@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, xhigh)

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

动机 / Motivation

通过 pip 或 pipx 运行 LoopX 更新并使用托管服务的操作者。 原更新器用包管理器退出码判断包变化。同版本重装也显示已更新,并进入服务重启流程。 候选读取发行包版本与指纹,尝试区分实际换包、原包装置和服务恢复。稳定安装可得到准确结论。 评审覆盖 Python 更新、托管服务读回与提示词恢复。实际 pip 使用隔离 wheel,服务切换仅观测调用边界。实际 pipx 换版、Windows 和真实 LaunchAgent 未验证。

改动思路 / Approach

更新器利用同一安装环境和发行包指纹识别升级结果。已有 Doctor 选择该环境的 launcher,托管服务 owner 维持现有切换锁、HTTP 就绪读回与回滚。升降级、提示词和扩展仍有各自的结果。最小修复可以沿用这些所有者,把经过完整检查的包身份贯穿到服务事务。 既有发布契约 更新入口 服务切换

具体改动 / Changes

精确头 fd69f1a3d019ee24f3aa9877b3c88756c51bb35e。本地实际共同祖先 eb552a8bb0532de117513ee5277a92e74e746309,十个文件新增 402 行、删除 93 行,与主干 3d15059fef 可干净整合。四个实现模块覆盖 self-update、服务激活、LaunchAgent 对齐和提示词恢复。五个测试文件覆盖身份、旧服务、Chat 延后、安全摘要和提示词,发布指南解释变化标记。

  • package-identity。已实现正常条件下的包版本与指纹读回。真实离线 pip 更新通过安装、核心及扩展检查,服务请求与现场读回均指向合成版本 2.4.0.post1。
  • activation-identity。当前不满足分层部署契约。最后一次核心身份采样早于扩展 Doctor。换包后成功标记与激活目标发生错配。
  • publication-review-range。当前远端公开提案仍不能显示真实十文件范围。

关键代码讲解

  • _execute_python_distribution_update 在拥有该安装的 Python 中执行 pip/pipx 后读回版本和指纹,按检查顺序计算 changes_applied 与身份结论。当前复用扩展检查开始前的最终核心 Doctor。 安装及检查 身份判断
  • restart_services_for_runtime_activation 根据现有绑定、实际包变化和 HTTP 匹配决定是否重启。绑定路径进入 _align_managed_runtime 时会另读 launcher 当下身份,入参未携带已验证的身份,因此服务层还可能把另一代包当作切换目标。 激活分支 绑定读回
  • _serving_identity 复用本地 HTTP 与既有健康检查,支持同一路径的旧服务重新对齐。提示词恢复允许已校验的同一包继续处理,并保留上游聚合失败。 HTTP 就绪 提示词恢复

对主干的风险 / Risks

[P1] 扩展 Doctor 期间换包后仍报告通过并请求激活。 扩展 Doctor 成功时,隔离环境从已验证的 2.4.0.post1 更换回 2.4.0。更新仍报告 ok=true、package_identity_verified=true,并以旧身份请求 runtime_ready=true 激活。 实际 pip、安装与核心/扩展 Doctor 均运行,激活调用由观测器替代。另在精确头与整合树用 pip/pipx 边界测试各复现两次。隔离对照在扩展完成后补读身份,两条测试转绿。扩展 Doctor 完成后重新核对同一包身份,将预期身份传入服务切换,启动前在现有 handoff 锁内核对。身份漂移时保留实际安装结果,拒绝将其标为已验证,并提供原路由恢复。 缺陷位置 服务切换边界

[P1] GitHub 仍无法展示实际提案差异。 GitHub 当前基线缓存仍指向 e235cde,展示 773 文件及 129 提交,diff 接口返回 HTTP 406。实际共同祖先至精确头只有 10 文件 +402/-93。 两次合并的后继修复包含在合并结果中,整理分支时应从真实共同祖先保留完整净差异,然后读回新发布范围和目标头。 现有远端范围评审

精确头相关套件 462 项通过、6 项跳过,现行整合树 490 项通过、6 项跳过。标准 premerge 的安装检查仍未完成,作者记录磁盘耗尽。独立 wheel 通过构建和正常安装对照,完整安装矩阵、真正的 macOS 服务切换、Windows、在线 pipx 换版与恢复后重新接管执行仍待证。没有查询托管 CI。

我的整体评价 / Verdict

REQUEST_CHANGES。 按指纹区分真实换包和原包是有价值的改动。扩展检查之后的真实安装替换仍可穿过验证,并将旧身份交给下一步。请发布范围正确的新头,在隔离 pip 与 pipx 上复验换包、未换包、扩展检查失败及服务事务的同身份约束,并补齐已有安装验证。

English verdict: REQUEST_CHANGES at fd69f1a. A real isolated pip replacement during extension Doctor leaves the update successful and requests activation with the old validated package identity. The hosted diff also remains unavailable for the actual proposal. Complete the existing installer qualification on the replacement head.

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.

6 participants