Repository navigation
Conversation
…riants probe Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=max
评审对象:576af8b44def7095aaec839c5e159ed49829d88d。两项阻塞:
- [P2] 将软件扫描从默认通用健康路径隔离。
check_contract的新参数默认是True,普通 CLI 和 status 调用都不传它。一次性项目仅包含声明缺少文件的规范、没有任何显式启用操作,同输入旧基线check为 exit 0,当前为 exit 1;当前直接传False又通过。bootstrap 同时已经快照软件规则并生成 Agent 义务,所以内部 bool 也不能隔离完整行为。将源码规则从普通 check/status 的默认路径分离,通过显式、带作用域的工程检查启用;只改 Python 默认参数仍不足以隔离 bootstrap 已生成的新增义务。保留来源校验的独立 owner,并补开/关与旧版默认行为对照。 - [P2] 检查 from-import 中的实际子模块。
ImportFrom分支 只比较node.module。声明禁止pkg.db时,import pkg.db会报错,改成from pkg import db却返回ok=True/errors=[],实际 Python 导入仍加载同一个被禁止的模块。检查 ImportFrom 的模块与导入成员组合,正确处理子模块和相对导入;把 import pkg.db 与 from pkg import db 作为同一禁止依赖的成对反例,避免靠改写合法 import 绕过。
动机
把已有项目接入 LoopX、随后正常检查状态或继续修改代码的用户,会受到自动发现的仓库规范影响。旧版普通 bootstrap 后的 check 不执行这些软件规则;新版仅凭规范文件名就把源码规则接入默认健康检查,即使用户没有显式启用工程扫描。来源摘要锁能发现修改和删除,但当前 head 的默认 CLI 出现新增拒绝,同时一个普通静态导入写法能让禁止依赖检查返回干净结果。本次评审不否定来源完整性需求,也不要求完成整个 TypeScript 迁移;要求把通用完整性与可选软件检查分清,并让已声明规则可靠。
改动思路
来源完整性与软件源代码约束属于两项不同责任;后者不能仅因发现文件名就在通用健康路径默认启用。保留有用的来源校验,先把软件扫描移到显式工程检查边界,并修复已声明导入规则的漏检;无需等待整套控制面迁移。这里应区分三类机制:文件字节及历史接受版本的完整性是通用来源事实;AST/正则扫描是软件工程领域策略;文件读取是只读 provider IO。复用通用诊断容器不会让领域策略自动成为 Kernel 的默认责任。既有注册来源 witness 核的是注册字节身份,与单份文档内容锁不同,不能因同用 SHA-256 就硬合并;已有工程检查能力的显式作用域则是可复用边界。
具体改动
采用作者引用的 docs/architecture.md,固定规格版本 59464f9741fe177381743eadaaffebbb54e5472e:Runtime Responsibility Model 的 capability/domain-policy 与 Kernel 分工未满足;Guided Autonomy, Not Recommendation Lock-In 对显式 typed 强制边界的要求也未满足。修复针对上述当前默认/范围问题,不将未来整套迁移当作前置门。来源摘要在现有测试里能够发现改动、删除,并且 active-state prose 不能批准换锁,这些正向价值保留。
关键代码讲解
build_goal_entry给已存在的显式 goal 文档加摘要,并自动发现四个候选规范位置;它还保存解析规则、原理和 immutable 文件摘要。缺少的显式文档仍保持旧的无摘要注册。check_contract始终加入来源摘要诊断,并在新增参数为真时加入软件规则。默认值为真且现有公共调用方省略参数,实际行为与“Slice 2 opt-in”不符;bootstrap 的新增指令也没有同一个开关。verify_authority_source_digests保留旧无摘要记录,对缺少、不可读和内容改变产生 Goal 诊断。需要保留该兼容意义,而不是删除旧来源格式;测试里直接改字典摘要并不等同普通授权恢复旅程。_check_python_forbidden_imports区分Import/ImportFrom,后一支丢失导入成员,使同一个子模块依赖得到不同结论。文件有 381 行生产逻辑,同时维护解析、扫描、IO 和策略,不能以 268 行新测试证明整体责任合适。
对主干的风险
独立运行新增测试 13 过,现有 bootstrap/contract 与架构边界测试 601 过、1 跳过;该跳过是同一原生 Windows/PowerShell 用例,base/head 的早期条件、源码和原因相同。原生 premerge 的 6 项直接、6 项 catalog 和 8 项风险检查通过,没有手工 hold;这些绿色结果没有覆盖上述反例。按当前策略没有读取、轮询或等待 CI。
| 同输入生产路径 | 旧基线 | 当前完整 head |
|---|---|---|
| 普通 bootstrap 后默认 CLI check,无显式工程启用 | exit 0,干净 | exit 1,软件规则错误 |
| 当前内部显式停用软件 probe | 旧版无该参数 | 通过,但 bootstrap 指令/快照仍已产生 |
| 同一禁止子模块的直接 import / from-import | 尚无此规则 | 前者拒绝,后者错误通过 |
两臂都使用真实 bootstrap、公共 CLI 和一次性 File 注册/runtime,未修改活跃 Goal。首次夹具放在被忽略私有树里,两个 CLI 都因独立的 public-boundary 扫描拒绝;原失败保留,随后在全新系统临时目录完整重放两臂,没有删除或关闭生产扫描来制造结果。当前两个反例均稳定成立。修复后应重跑默认/显式开关、完整生成指令和规则元数据、来源变更/删除/合法恢复,以及直接/from/相对导入的正反矩阵。
语义与 CI 对齐
本 PR 新建了来源种类、规则 kind、快照字段及健康诊断语义,kind: str 加注释不是 typed 规则合同;静态 advisory 未报 candidate 也不能证明没有新词汇。软件策略应归显式工程 owner,通用来源完整性应复用当前 typed 边界和诊断语义。include_architecture_invariants 是机器执行分支,失败会产生健康错误,不宜表述成仅供参考的指导。现行原生校验通过仍不能覆盖默认范围和导入漏检。
我的整体评价
REQUEST_CHANGES。来源摘要锁有可验证的价值,但完整提案仍包含默认行为回归和错误的规则通过,用户的正常检查及后续恢复没有形成可用闭环。长期有效工作是否保持尚未证明;用户体验已观察到无额外启用却新增拒绝。来源完整性与软件源代码约束属于两项不同责任;后者不能仅因发现文件名就在通用健康路径默认启用。保留有用的来源校验,先把软件扫描移到显式工程检查边界,并修复已声明导入规则的漏检;无需等待整套控制面迁移。已检查 bootstrap 生成的 Agent Markdown、CLI check 和 status collection:本 PR 没有修改渲染页面组件,问题在默认策略和诊断,因此不以截图充当其正确性证据。未验证范围:原生 Windows/PowerShell、完整跨平台 CI、已安装客户端、长期扫描成本和获授权锁更新后的真实继续工作未获本次资格;这些不替代已复现的两项缺陷。这是当前精确 head 的评审结论,不要求用户代作者操作,也不授予合并、安装或额外执行权限。
English verdict: REQUEST_CHANGES 576af8b. Ordinary bootstrap/check implicitly enables the claimed optional software probe, and a normal from-import bypasses the declared forbidden submodule rule. Independent CLI counterexamples reproduce despite passing focused/regression tests and native premerge; separate the responsibility/activation boundary and repair import resolution.
Goal And Delivered Outcome
CONTRIBUTING.md#find-workand the Kernel/capability responsibility boundary indocs/architecture.md#runtime-responsibility-model.bootstrap_projectpreviously recorded an explicit--goal-docinauthority_sourceswithout a content digest lock, did not discover top-level repository specifications (architecture.md,goal-and-requirements.md), andcheck_contractdid not verify whether registered authority sources were deleted or mutated after bootstrap or whether snapshotted repository-wide invariants were violated during replans.forbid_import,forbid_pattern,must_exist,immutable_path) passedcheck_contract(ok=True,errors=[]).bootstrap_projectrecordssha256locks for existing--goal-docfiles and discoveredarchitecture.md/goal-and-requirements.mdspecifications (and renders## Repo-Wide Architecture InvariantsintoACTIVE_GOAL_STATE.md).check_contractruns domain-neutralverify_authority_source_digestsunconditionally and runsverify_executable_architecture_invariantswheninclude_architecture_invariants=True(proven bytests/test_architecture_invariants.py, 13 passed).main(self-contained contract increment; no pre-existing issue ID claimed).Author Declaration
model_agent(OpenAI GPT-6.1-sol via Codex CLI and Google Gemini pair-programming assistant, operated by@hhyykk).Implemented against
docs/architecture.mdat59464f9741fe177381743eadaaffebbb54e5472e.--goal-docand discovered top-level specs with SHA-256 at bootstrap while allowing non-existent--goal-docpaths to register without a digestimplementedbuild_goal_entryinloopx/bootstrap.py;discover_top_level_specsinloopx/control_plane/goals/architecture_invariants.pypytest -q tests/test_architecture_invariants.pyimplementedverify_authority_source_digests,verify_executable_architecture_invariantsinloopx/control_plane/goals/architecture_invariants.py;check_contractinloopx/contract.pypytest -q tests/test_architecture_invariants.pyforbid_import,forbid_pattern,must_exist, andimmutable_pathfrom bootstrap-snapshotted rules without allowing active-state prose to forge lock approvalsimplementedverify_executable_architecture_invariantsinloopx/control_plane/goals/architecture_invariants.pypytest -q tests/test_architecture_invariants.pytests/test_architecture_invariants.py, 316 existing bootstrap/contract tests (tests/test_*bootstrap*.pyandtests/test_*contract*.py), 298 architecture boundary & content-digest single-owner tests,scripts/generate_semantic_inventory.py --changed-from HEAD,scan_public_boundary,ruff check, andgit diff --check. Left full cross-platform CI matrix and live benchmark suites to GitHub Actions CI.Scope And Continuation
authority_sourcesSHA-256 digest locking and verification) and Slice 2 (opt-ininclude_architecture_invariantsprobe forforbid_import,forbid_pattern,must_exist, andimmutable_pathrules snapshotted at bootstrap).verify_executable_architecture_invariantsis already cleanly isolated fromverify_authority_source_digests.Validation
576af8b44def7095aaec839c5e159ed49829d88dfinishedsynthetic,public_fixtureunitpassedpython3 -m pytest -q tests/test_architecture_invariants.py(13 passed: covers explicit/missing--goal-docdigest locking,include_architecture_invariants=False/True,forbid_import,forbid_pattern,must_exist,immutable_path, path traversal rejection, and spec tampering recovery).regression_paritypassedpython3 -m pytest -q tests/test_*bootstrap*.py tests/test_*contract*.py(303 passed, 1 skipped on existing bootstrap/contract suites with zero regressions; A/B comparison against baseline59464f9741fe177381743eadaaffebbb54e5472econfirmed baseline missed layer-bypass imports, deleted required modules, and spec rule erasure while candidate caught all 3 invariant violations + unapproved spec mutation).staticpassedpython3 -m pytest -q tests/architecture/test_content_digest_production_owner.py tests/architecture/test_content_digest_single_owner.py tests/architecture/test_control_plane_import_boundaries.py(298 passed);python3 scripts/generate_semantic_inventory.py --changed-from 59464f9741fe177381743eadaaffebbb54e5472e(0 candidates);ruff checkon added modules andgit diff --checkpassed;scan_public_boundarypassed with 0 hits/warnings.bootstrap_project,build_goal_entry,render_state_markdown,check_contract,verify_authority_source_digests, andverify_executable_architecture_invariants. Full repository pytest shards and Windows PowerShell checks were not run locally and will run in PR CI.Frontend / Visual Evidence
nonenoneType of Change
LoopX Area
Technical Direction
authority_sourcesdigest integrity and repository-wide invariant diagnostics).Shared-authority RFC fixture impact
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).