Repository navigation
refactor(runtime): share snapshot eligibility across Python and TypeScript - #7862
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
未发现本次新增阻塞问题。CI 未作为批准条件;必要本地反例、packaged consumer 与同条件旧失败归因已执行。质量资格和合并授权仍独立。
动机 / Motivation
读取完整 Goal/Monitor 上下文、依赖 Python 与 TypeScript Effect transport 的现有 Agent 调用者。例如同一个完整来源显式使用 private snapshot,若只更新一边的 eligible methods,Python 可能允许而 Node 拒绝。当前两份列表尚未漂移;本次把相同的 25 个方法收敛到一个打包声明,让下一次变更只维护一份,同时保持完整来源、显式开关和拒绝路径。独立解包 wheel 后,两端真实 runtime 完整返回约 3.8 MB 内联与 9 MB snapshot 的 Unicode 来源及原 revision;未获 snapshot 资格的方法被拒绝,后续普通调用仍可用。这是完整、可回滚的内部维护切片,不证明安装版采用、长期模型效果或费用/延迟改善,也不关闭父级控制面迁移与真实 PostgreSQL 资格。
改动思路 / Approach
保留 Python preflight 与 TypeScript 不可信 wire 边界的独立检查,但共同读取唯一的 packaged eligibility 声明;business authority 仍由每个现有 method owner 判断,不由 allowlist 授权。当前范围是五个文件 +78/-56:两处 loader、一个 25 项 JSON 声明、一个实际 runtime 轮换负例和两个 Monitor 用例的当前 capture reader 修复;没有新增方法、配置、权限或状态迁移。
显式 snapshot 的正向路径仍经过 Python preflight、Node gate 和原 handler;普通 wire、拒绝、private-file 隐私与不确定响应恢复继续由原 owner 负责。解包后实际启动的 Node runtime 证明两个消费者都能找到资产;不是只检查 source checkout 的文件存在。Monitor 测试通过原 production reader 读取同一 capture,不重新入场或替换原 Turn。
具体改动 / Changes
精确 head f214f512e38697f5c8eaecac695ceb8c0aebbf4e,不可变 base 111519af76e56141c56eb7a27443da59def775b9;审查覆盖完整 diff,而非只核对上次发现或作者测试统计。
关键代码讲解
LOCAL_SNAPSHOT_METHODS(Python) 从相邻 packaged JSON 构造 frozenset;ordinary/snapshot 选择、8 MiB/64 MiB 和原拒绝条件不变。LOCAL_SNAPSHOT_METHODS(Node) 导入同一声明,但仍在 handler dispatch 前独立验证不可信 wire;删的是元数据重复,不是信任边界。_runtime_fingerprint_for_snapshot复用已有所有 JSON/TS 源字节与 freshness 检查,新资产进入同一 identity。实际 copied-runtime 用例移除一个 method 后观测到 fingerprint 改变、原 snapshot 被拒绝及 Node PID 替换;不声明 Python 模块有 live hot reload。_read_guard_capture通过原 reference/capture reader 验 SHA 和 private 属性;失败的 CLI exit code 在读回前就已断言。File/SQLite 仍保留完整目标、缺失 Goal intent 拒绝、同 Turn 恢复、replay 与零花费检查。
没有单独新设计 RFC;依据是已读的基线 shared RPC byte budget与当前维护目标。shared snapshot eligibility → implemented:两份基线集合与 packaged 声明逐项同为25项;full results, opt-in and recovery → implemented:完整 Unicode 来源/revision、显式 snapshot、原拒绝/恢复边界和两个真实 Monitor 路径保持。JSON 复用既有方法词汇,不创建新业务能力。
对主干的风险 / Risks
独立 wheel consumer 返回约 3.8 MB inline 与9 MB private snapshot 的完整来源和 revision;ineligible snapshot 拒绝后 ordinary ping 仍可用。wheel 资产确实进入 source fingerprint;本轮没有安装或升级 Host。首次 wheel build 因本工作树旧 Chat bundle 被拒绝,保留失败后重建既有前端 prerequisite,再构建与解包成功;这不是产品代码修复或旧失败追认为通过。
同一解释器、lock 和依赖的七模块 Python:head195 PASS/8 FAIL/1 SKIP,基线192 PASS/10 FAIL/1 SKIP。203个共同用例中,两项原 Monitor KeyError: state 在新 helper 后通过;一个新增 asset-rotation 用例通过;其余八个失败均为未改动 heartbeat-envelope reader 的 KeyError: sha256,完整失败文本逐字相同。它们仍为失败,未执行到的后续断言不冒充通过。
完整 TypeScript:5825 PASS/1 FAIL/77 SKIP(约455秒)。同一 focused17项在不可变基线与 head 均16 PASS/1 FAIL,都是 conversation_binding.ts:603 的未登记 digest matcher;该文件和 oracle blob 完全未变。不是只凭相同失败数量归因,也没有跑完整 baseline TS 后冒充通过。
类型检查、changed Python Ruff、配置的17个 mypy模块、五文件 public scan,以及6 direct+18 selected premerge命令均 PASS。整体 premerge 仍 FAIL(exit1)quality_stale_receipt、merge_gate_passed=false;作者先前 non-passing receipt 也保留。未放宽测试、字节预算或质量门,未查询/等待 CI。
我的整体评价 / Verdict
交付判断为有真实 packaged consumer 的完整维护切片。long_horizon=preserved、user_experience=preserved:原完整结果与继续/拒绝边界保持,未把去重维护成本当成已证实的长期效果或性能收益。兼容消费者是 co-deployed Python/Node,两处检查有各自信任边界,唯一声明和现有 fingerprint 已是本域有界简化;无需新增框架或状态迁移。
已检查实际 packaged transport、Monitor CLI 和既有读取/拒绝路径;没有页面、布局、用户文案或设置变化,截图不适用。未验证 Windows、最低支持 Node、安装版 Host、实际模型采用或长期完整成本;未运行真实 PostgreSQL authority-store suite,本 PR 不改变该 store/adapter,不能由 File/SQLite 或解包 wheel 推断其资格。
English verdict: APPROVE f214f51; shared packaged snapshot eligibility preserves complete results and existing boundaries. Matched pre-existing Python/TypeScript failures and stale quality qualification remain failed, separate from CI-independent code approval and merge authority.
Goal And Delivered Outcome
Python and TypeScript each maintained the same 25 snapshot-eligible methods. They currently agree, but a future one-sided edit could make an explicitly requested snapshot succeed at one transport boundary and fail at the other. Both now load one packaged declaration; the existing method set, 8 MiB ordinary wire limit, 64 MiB private snapshot limit, explicit opt-in and business authority remain unchanged.
The large Monitor CLI tests also assumed that guard decisions were always inline. They now resolve the original native capture with the existing production reader while preserving the failed exit status, full target records, recovery, replay and zero-spend assertions.
mainat111519af76e56141c56eb7a27443da59def775b9.Author Declaration
effect_runtime_snapshot_methods.json,effect_runtime.py,effect_runtime_server.tstest_monitor_target_transport.pyScope And Continuation
Author implementation is complete: replace the duplicated declaration and validate its packaged consumers. Required-suite qualification is held by the digest-owner failure below; it needs the owning native-recovery repair and a fresh passing check. Caller fallback behavior in #7788 remains separate work. This PR does not claim installed-host adoption, sustained control-session effectiveness or a latency improvement; those need their own evidence and owners. Rollback is the two signed commits.
Validation
f214f512e38697f5c8eaecac695ceb8c0aebbf4e.008fc4d59ec110f4d4ca881a6514bafde9543a49(base product code plus the repaired Monitor reader) has 318 passed / 1 skipped; final head has 319 passed / 1 skipped. All 319 shared case outcomes match; the only added case is the declaration-change test.work_item.context.projectandturn.controllerfrom the shared declaration makes two unchanged real caller tests fail; restoring the exact file makes both pass. The separate declaration test proves actual runtime rotation and snapshot rejection after a copied asset changes.npm run typecheck:control-plane; configuredpython -m mypy(17 configured modules); repository Ruff command; diff whitespace and bilingual RFC checks. Mypy is not a full Python-tree type check.npm run test:control-plane: 5825 passed / 1 failed / 77 skipped in 375.3 s. The digest single-owner check identifiescollaboration/conversation_binding.ts:603, introduced by #7856 on the stated base. A focused immutable baseline/head run reproduces the same offender with identical source and oracle hashes. This attribution does not waive the failed suite.quality_invalid_receipt. The exact scope fingerprint is2de816ca27bd3aae56536f24ee5799d2dee41a7ea0412ca582885e0a489eca8c; safe-fix permitted / 0 applied; one unresolved required-validation blocker, no warnings or advisories. No merge readiness or merge authority is claimed.Frontend / Visual Evidence
Type of Change
LoopX Area
Shared-authority RFC fixture impact
N/A: no authority-provider selection, store implementation, promotion or compatibility-projection change. No shared-authority or TypeScript migration milestone is claimed.
Boundary Checklist