Skip to content

feat(pr-review): add bounded semantic triage and repair guidance - #4459

Merged
huangruiteng merged 18 commits into
loopx-project:mainfrom
songoow:codex/pr-review-semantic-alignment
Sep 16, 2026
Merged

huangruiteng merged 18 commits into
loopx-project:mainfrom
songoow:codex/pr-review-semantic-alignment

Conversation

@songoow

@songoow songoow commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Problem and behavior

Ordinary code reviews can finish semantic triage with the inspected scope, an impact reason and not_applicable, without inventing a vocabulary candidate. Shared-contract changes reuse existing evidence. Bounded scanner limitations are advisory; concrete violations and missing required validation still block approval with repair instructions.

Dependency and review scope

Depends on #4457 at d12be19c5. This branch includes that proof-domain prerequisite and is itself the prerequisite of #4480. The semantic landing sequence is #4457 → #4459 → #4480; all PR bases remain main. The review-specific delta is d12be19c5..f1c3a83a0.

Scope

  • Policy revision 5 requires compact triage for code and behavior-bearing policy changes; detailed fields depend on the verdict.
  • Validate optional semantic evidence on documentation reviews as well. Preserve explicit blockers and their minimum repair/rerun evidence.
  • Remove repository-specific path routing, static required-check names and truncated-file fallbacks from the provider-neutral review contract.
  • Keep the LoopX CI repair map as a scoped documentation example. Standardize contributor/test and semantic repair entrypoints on uv run; interpreter discovery and CI version coverage retain their meaning.
  • Reuse docs(semantics): define relative completeness boundary #4457's candidate-label and proof-boundary contract rather than overwrite it during composition.

Validation

Tested revision: f1c3a83a046763eee5f0548dc1699f5ad94744a4

  • 138 PR-review/configuration/GitHub-scan, semantic inventory/drift and isolated-channel tests passed.
  • Combined candidate d8c8988b35a40d7f9784462967d3b14391d6ce75: 467 Python tests, 187 plugin tests, Ruff, kernel mypy, plugin typechecking/build and lifecycle/docs smokes passed.

Affected entrypoints: review packet, local result-validation CLI, managed review skill and contributor instructions. No frontend/settings, solver, scorer, scheduling or permission change is introduced. No live-model benchmark or model uplift is claimed. The combined candidate is local validation evidence; main has not been changed and new-head CI/review remains required.

Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

动机

REQUEST_CHANGES。 审查 head:92f9e36c6b7de38d8163cbad87153f468df62248,merge base 为当时的 origin/main 9719dc0d4(评审结束后 main 前进到 c62b24f51,即 #4458 合入,故 gh 报 BEHIND)。

问题是真的:review 契约里原本没有记录"这次改动与语义词表/CI 约束的关系"的位置,于是重命名符号、收窄扫描根、上调 budget 这类会削弱守卫的动作可以在没有留下任何语义裁决的情况下被批准。本 PR 把这个裁决变成 review plan 的一等证据(semantic_alignment),并要求候选处置落在封闭集合里,同时还限制"把 unknown 说成 aligned"。方向我认可,但有两处越界,其中一处会让正确写法被自己的校验器拦下。

改动思路

  • 路由:build_semantic_alignment_context(files) 用路径前缀/精确成员匹配出"语义契约路径"和"CI 约束路径",注入 review_plan.applicability.semantic_alignment_context,并由 _normalize_pr 传入完整改动文件列表。
  • 要求:semantic_alignment_required = code_change or context.applicable,命中即把 semantic_alignment 加进 required_evidence_ids;not_yet_proven 进入 blocking_evidence_verdicts(=> REQUEST_CHANGES)。
  • 一致性校验:result_check 新增两条 blocker(无效候选处置、unknown 却非 not_yet_proven);REVIEW_POLICY_REVISION 3→4,使结果与策略绑定。
  • 文档:能力 README 增加语义对齐说明与 CI 失败修复表(DCO、语义 smoke、inventory、owner/parity、projection、budget/anchor、merge-gate),并对每类给出"最小修复"和"只掩盖信号的错误修法"。

具体改动

关键代码讲解

  1. loopx/capabilities/pr_review_queue/review_contract.py:30-91:新增 SEMANTIC_CONTRACT_PATH_PREFIXES、SEMANTIC_CI_CONSTRAINT_PATHS、SEMANTIC_CANDIDATE_DECISIONS 与 build_semantic_alignment_context;返回 applicable、命中的两类路径、source_of_truth、current_required_checks、current_semantic_scope。
  2. review_contract.py:249-296 新增证据行定义(字段、4 个 verdict 值、7 个候选处置、"不要用重命名/抬 budget/收窄扫描根/注册无关值来掩盖"的规则文本);build_review_plan 在 code_change or applicable 时要求该行;模板的风险段与评价段各加一句语义要求。
  3. result_check.py:150-160:对 status == "verified" 的该行校验 candidate_decision 合法性,并禁止 unknown 配非 not_yet_proven 的 verdict。
  4. loopx/pr_review.py:1003:把完整 files 交给路由函数(而不是 key_files[:10])。
  5. 8 文件 +250/-5:契约 +129/-3、README +35、测试 +67、result check +11/-1、接线 4 行、inventory 计数 +4/-1(新封闭集合已被语义清单索引,这是必要的一步)。

独立验证(exact head 92f9e36c6,worktree /private/tmp/pr4459)

  • pytest -q tests/capabilities/test_pr_review_contract.py tests/capabilities/test_pr_review_result_check.py tests/capabilities/test_pr_review_configuration.py tests/test_pr_review_github_scan.py → 97 passed。
  • examples/semantic-vocabulary-drift-smoke.py 通过(计数与新封闭集合一致);scripts/generate_semantic_inventory.py --check 在 head 与"head 并入当前 main"的合并 ref(e8be4ab7b)上都是 up to date;合并无冲突。
  • gh pr checks 4459 全部 pass(Sign-off、build、changes、checks、dashboard-acceptance、dependency-review、kernel-static-checks、merge-gate、node 兼容、pytest、stage2c、test-shard 2-4)。
  • 我另写了一个独立探针直接调用 check_review_result:verdict=not_applicable + candidate_decision=local_only → 无 blocker;同一行去掉 candidate_decision → ['semantic_alignment:invalid_candidate_decision', 'semantic_alignment:missing_field:candidate_decision'],approval_consistent=false。这就是下面第一条 P2。

对主干的风险

[P2,功能性缺陷] 契约文档要求的 not_applicable 写法无法通过契约自己的校验器。 定位:result_check.py:150-160(对每个 verified 行校验 candidate_decision,并由 _require_fields 视作必填)与 review_contract.py:283-294(对"普通代码、无语义契约影响"只要求 not_applicable + 说明检查边界,没有要求候选处置);SEMANTIC_CANDIDATE_DECISIONS 七个值里没有"没有候选值"这一项。结果是:按规则如实写 not_applicable 反而被 blocker 拦下,reviewer 被推向随手挑一个处置以通过检查——正是新规则文本自己反对的"只把信号盖住"。本 PR 的测试用 local_only 顶替,从未覆盖这条被文档承诺的路径,所以 97 个绿灯没有暴露它。最小修复:为"无候选"新增一等值(如 no_candidate),或仅在该行 verdict 非 not_applicable 时才要求候选处置,并补一条负例测试。

[P2,契约作用域错误] 把 LoopX 仓库的事实写进了"非 LoopX 专用"的能力契约。 定位:review_contract.py:30-91 的 SEMANTIC_CONTRACT_PATH_PREFIXES / SEMANTIC_CI_CONSTRAINT_PATHS(全是本仓路径)、source_of_truth(本仓文件)、current_required_checks: ["Sign-off","merge-gate"],经由 pr_review.py:1003 附加到每一个归一化后的 PR,不限仓库;README 与能力文档开头明确写着"默认是调用方当前 GitHub 项目,或显式 --repo owner/repo;命令不是 LoopX 仓库专用"。于是对别的仓库,packet 会把 LoopX 的必需检查名与语义源当作"当前事实"告诉审批 agent,同时又完全不去识别该仓库自己的约束文件——既误导又漏识别。本 PR 自带的 test_code_review_requires_semantic_alignment_even_when_no_known_path_matches 正好把这种行为固化了(applicable is False,却仍然断言 current_required_checks == ['Sign-off','merge-gate'])。另外 current_required_checks 与 packet 里每条 PR 自带的 checks 汇总重复,静态列表在 LoopX 本仓也会随时间失真。最小修复:路由路径集合与必需检查列表改为配置/按解析出的仓库决定(其它仓库默认空或缺失),或直接从 PR 自身的 checks 汇总派生;LoopX 专属默认只在解析到 LoopX 仓库时附加。

[P3] 路由信号几乎不区分,not_applicable 退路形同虚设。 semantic_alignment_required = code_change or applicable(review_contract.py:1058)使该行对每个代码 PR 强制。而本仓几乎每个 PR 都会重新生成 loopx/semantics/inventory_v0.json:今天 queue 里 3 条 actionable(#4360、#4459、#4458)全部命中该前缀。实际效果是每条 review 多一个必填块,而"普通代码可写 not_applicable"这一退路极少触发,容易退化成套话。README 又把这个被机器强制(not_yet_proven → REQUEST_CHANGES)的项描述为 "lightweight orientation block",措辞弱化了义务。最小修复:仅在 applicable 为真(可进一步收窄到 vocabulary/ smoke / RFC / CI 路径)时要求该行,其余情况保留但不强制;或者明确说明为何要全域覆盖,并把 README 的措辞与强制语义对齐。

[P3] 计划回退路径只看到前 10 个文件。 build_review_plan 在缺少归一化上下文时用 key_files(即 files[:10])重建路由(review_contract.py:1019-1026),而生产调用 pr_review.py:1003 传的是完整列表。同一 PR 经不同入口可能得出不同的 applicable,第 10 个文件之后的语义/CI 路径会被静默漏掉。当前只有测试直接调用该函数,属潜在风险。最小修复:上下文缺失时显式失败,或让回退使用完整文件列表。

**残余风险与合并门禁:**该行本身的目的与边界都写得清楚(明确不主张全程序 producer/consumer 分析、明确绿灯不等于收敛),机制成本有界,可回滚(单文件 + 策略版本绑定)。除上述两条 P2 之外我未发现行为错误:97 个相关测试、drift smoke、head 与合并 ref 的 inventory 检查全部通过,合并无冲突。主机侧因 main 前进(#4458 已合入 c62b24f51)显示 BEHIND,需先更新分支。我不会执行合并。

我的整体评价

把"这次改动与语义词表、CI 约束的关系"变成 review plan 的必填证据,并且明确禁止用重命名、抬 budget、收窄扫描根来掩盖信号,这个方向是对的,修复表也写得具体可用。但我不认为当前 head 可以合并:契约自己承诺的 not_applicable 路径在它自己的校验器下走不通(reviewer 只能靠随手选一个处置过关),而路由与"当前必需检查"这类 LoopX 专属事实被附加到面向任意仓库的 packet 上,与能力文档声明的"非 LoopX 专用"直接矛盾。这两条都不需要推翻设计,只需要给"无候选"一个合法的第一类取值、把路径与检查列表配置化或从 PR 的 checks 派生,并补上对应负例;顺带把"全域强制"与 "lightweight orientation block" 的措辞统一,并让回退路径看到完整文件列表。修好后我很愿意复审。

English verdict: REQUEST_CHANGES at 92f9e36. The semantic_alignment row is the right shape and the anti-concealment rule text is specific, but two P2 scope defects block this head. First, the documented not_applicable path cannot pass the contract's own checker: result_check requires candidate_decision for every verified row and the seven-value closed set has no "no candidate" member, so an independent probe shows ['semantic_alignment:invalid_candidate_decision', 'semantic_alignment:missing_field:candidate_decision'] for a correctly recorded not_applicable row while the head's own test substitutes local_only. Second, LoopX-repository facts (path prefixes, source_of_truth, current_required_checks: ['Sign-off', 'merge-gate']) are attached to every normalized PR for any --repo, though the capability README states the command is not LoopX-repo-specific, and the head's test pins that behaviour. Two P3s also stand: the row is mandatory for every code change while applicable is true for essentially every PR in this repository (all three actionable queue rows regenerate loopx/semantics/inventory_v0.json), and the plan fallback routes from key_files (first ten paths) instead of the full file list. Verified green: 97 related tests, the semantic drift smoke, generate_semantic_inventory.py --check at the head and at the merge into current main (clean merge), and all published checks at this head. No merge performed.

…antic-alignment

Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
@songoow songoow changed the title feat(pr-review): surface semantic alignment constraints feat(pr-review): add bounded semantic triage and repair guidance Sep 15, 2026
@songoow

songoow commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator Author

已在 673afad7d1bbb81109f1746fbe5274c8c0579fdc 完成修复,代码提交 6902499cf,中英文文档提交 940f51839;同时合入 review 所指出的 main 更新 c62b24f51,以及后续主干 2e310d768。所有 PR-range 提交均已核对 DCO。

逐项对应原 review:

  1. P2 / 无候选值:not_applicable 现在只要求 checked_scope、impact_reason、verdict(另加通用 status),无需 candidate_decision 或完整证据表。增加了不提供候选值的公共 CLI 回归用例。
  2. P2 / 仓库作用域:删除 LoopX 专属路径路由与静态 required-check 注入;能力契约要求从目标仓库当前策略确认义务,不能把 observed checks 当成 required checks。CI 修复表保留为明确标注的 LoopX 文档示例。
  3. P3 / 普遍强制:代码及行为性规则变更保留简短影响判断,目的是覆盖注册表之外的真实生产者/消费者改动;只有实际契约影响才补充对应证据,并引用已有 review 结果。普通判断无需独立报告章节或通读 RFC。advisory 报告扫描盲区;not_yet_proven / violated 针对受影响现行契约的验证缺口/违规,仍阻断并要求契约、触发修改、观察证据、最小修复、复验命令。已有必需检查与 blocking finding 不会被 advisory 覆盖。
  4. P3 / 前十个文件回退:删除整套路径推断和回退,完整列表与预览列表不再产生不同的自动语义分类。契约要求审查完整 diff 及相关定义/调用方;仅 inventory 更新不会触发详细证据表。

验证:定向测试 118 passed,8 skipped(显式 opt-in 的真实模型用例);公共 CLI 五类结果及无外部写入路径通过;Ruff、PR review smoke、semantic smoke、inventory --check 通过;loopx canary premerge 17 项通过,0 failures,0 manual holds。先加入回归用例,确认旧实现拒绝无候选值和建议性结果,再验证修复。主干同步后在最终 head 复跑定向测试、inventory、语义/review smoke 及两个 host-mode smoke,均通过;17 项 premerge 记录对应同步前的实现改动。

变更入口是 PR review packet、--check-result 和随仓库发布的 review skill,未新增设置或修改前端/solver/scorer。相关整理删除了路径推断并复用现有证据与校验器。没有运行真实模型 benchmark;成对实验要求已同步文档,不把确定性测试当作得分或效率收益。

English: Addressed both P2s and both P3s. Policy 5 provides minimal no-impact triage, repository-neutral obligations, advisory analysis gaps, and actionable current-contract blockers. The path router and truncated fallback are removed. Focused tests: 118 passed / 8 opt-in live cases skipped; premerge: 17 passed. Ready for a fresh review of the new head; no model benchmark claim or merge performed.

…antic-alignment

Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
@songoow

songoow commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

Maintenance update at c19aa767f15ff69791aa6b25d173ddddd8444832.

Merged main edcddc7aa and resolved the generated-inventory conflict by running the branch's generator against the full merged tree. Validation: 136 PR-review/configuration/GitHub-scan and semantic inventory/drift tests passed. A merge-tree check against main 1d8a72522 is conflict-free. This refresh does not change the review policy or relax budgets.

Coordination: #4457 supplies formal-model documentation fixes; #4480 supplies the bounded producer implementation. A local combined-candidate preview finds overlapping semantic RFC/registry/smoke changes when #4480 is added after those PRs, so their eventual landing requires deliberate reconciliation and regeneration. Each PR is currently independently MERGEABLE; the combined candidate is not claimed ready. Fresh exact-head review is still needed.

Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
(cherry picked from commit db58562)
Signed-off-by: song <liusongstep@gmail.com>
…nel fixture

Signed-off-by: song <liusongstep@gmail.com>
huangruiteng
huangruiteng previously approved these changes Sep 16, 2026

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

裁定(exact head f1c3a83a046763eee5f0548dc1699f5ad94744a4)

APPROVE。这一版把“语义对齐”做成了可机器检查的一行证据:普通改动走 not_applicable 快速路径,受影响契约才要详细证据,扫描盲区与确证违规被显式分开,并且没有把 LoopX 自己的检查名写进通用契约。我只发现两条非阻断项:一条文档措辞(把已发布的 rev 3 描述成“通用详细语义审阅”)、一条合并就绪问题(唯一冲突来自从父 PR 继承的测试 hunk)。

需要处理的两点(均非阻断)

P2(合并就绪)tests/test_manager_channel_binding.py:423-432 来自父提交的 hunk,是唯一的合并冲突。

git merge-tree --write-tree --name-only origin/main HEAD 只报这一个文件 CONFLICT,而 main 第 464-480 行已经有等价实现(#4483/#4492)。我另外验证了“生成物自动合并是否安全”:在临时 worktree 里真合并 main 后,python scripts/generate_semantic_inventory.py --check 仍 up to date(计数 494/2058 与生成器一致),所以合并不存在生成物陈旧问题,只剩这一处。最小修复:先让 #4457 以“丢弃该 hunk”的 head 落地,再把本 PR rebase 到新的 main;若父 PR 未落地,同样丢弃该 hunk。

P3(文档准确性)loopx/capabilities/pr_review_queue/README.md:314-318 把已发布的上一版描述成了本次被替代的对象。

原文是 “Policy revision 5 replaces the universal detailed semantic review with bounded triage…”。但已发布的上一版(main rev 3)根本没有 semantic 证据行——真正的已发布增量是“新增一行有界分类”;而 revision 4 只存在于本分支历史(34e43f1f6 设为 4、6902499cf 设为 5),从未发布。后来者 diff 3→5 会看到“新增”而不是“替代”,容易误判本次降低了严格度。最小修复二选一:把版本设为 4(下一个未使用版本,skill 同步即可),或改写为 “Revision 5 adds a required bounded semantic triage row for code and behavior-bearing policy changes; it does not require a universal detailed semantic review”。回归验证:python examples/pr-review-command-smoke.py(会按 REVIEW_POLICY_REVISION 动态校验 skill 文本)与 python scripts/generate_semantic_inventory.py --check。

动机

在此之前,loopx pr-review 的证据清单里没有任何“语义”位置。碰到改了共享值域、owner、消费域、投影或持久化的 PR,评审者只能在 failure_analysis 或评论里自由发挥——于是同一个事实(扫不到某个动态值)可能被写成“已通过”,也可能被写成“阻断”,作者拿不到可执行的修复路径,跨仓库也无法复用同一判定。这个 PR 的目标是把这类判定变成类型化结论:普通改动只填 checked_scope/impact_reason/verdict 就能以 not_applicable 收尾;影响共享契约时才读受影响的 base/head 契约,并复用 repository_reuse/observable_semantics/validation_matrix 已有证据;扫描器能力不足记为 advisory,受影响当前契约缺必需验证记为 not_yet_proven,确证违规记为 violated,后两者阻断批准并给出契约、触发改动、观察证据、最小修复与复验命令。非目标也很克制:不引入自动语义检测器,不把未来或 advisory 的 RFC 属性提升为当前合并义务,不改变 PR 触发、排序或合并权限。

改动思路

架构流是既有能力内的三段:review_contract.build_review_plan 依据 PR 行的 areas 推导 applicability,行为相关改动(behavior_bearing_change)把 semantic_alignment 追加进 required_evidence_ids,同时在 build_review_execution_contract 里给出该行的 verdict 值集与“按 verdict 分档字段”;result_check.check_review_result 再把声明变成 blockers。关键是 required_when 与 applicability 的配对是既有机制(semantic_alignment_required 就是新增的那个键),不存在第二套判定。

复用性方面:全部改动落在既有 owner(review_contract.py 拥有证据要求与 verdict policy、result_check.py 拥有校验、tests/capabilities/* 与 examples/pr-review-command-smoke.py 是既有回归面);没有新模块、新 CLI 选项或新持久状态。我确认不存在需要同步的 TypeScript 孪生(rg 在 *.ts 中 0 命中),也没有第二份证据清单。通用契约的域中立性有专门测试保证:test_semantic_triage_does_not_inject_repository_facts_or_infer_from_preview 断言通用要求文本里不含 Sign-off、merge-gate、loopx/semantics,LoopX 特有的检查名只出现在 capability README 且被明确标注为 “LoopX repository example, not a policy for every --repo”。

具体改动

exact head 相对 merge-base 是 734+/116-、17 文件,分层如下:

  • 生产运行时代码(+107/-5):review_contract.py 新增 SEMANTIC_CANDIDATE_DECISIONS 闭集、semantic_alignment 证据要求(6 个 verdict、fields_by_verdict 分档)、verdict policy 一条,并把 REVIEW_POLICY_REVISION 从 3 提到 5;result_check.py 新增“docs-only 评审若提供该行也照样校验”、候选闭集与 3 条组合校验、按 verdict 分档字段校验。
  • 文档(+369/-93):capability README 新增 “Semantic alignment and CI constraint recovery”(verdict/字段/审批效果表 + 修复表 + 中文边界);双语 RFC 增加 PR 侧段落并交叉链接;docs/development/testing-and-quality.md 新增 ### Local Validation Environment / 本地验证环境 并改写复验命令;CONTRIBUTING.md 把安装/校验命令切到 uv sync --extra test / uv run --extra test …;skills/loopx-pr-review/SKILL.md 同步 policy_revision == 5。
  • 测试与生成物:契约/检查测试 +195 行(含 5 组非法组合参数化用例与 docs-only 行仍校验的用例)、两个 smoke 小幅更新、inventory_v0.json 登记新闭集(python_closed_sets 493→494、named_string_constants 2058→2059)、vocabulary_v0.json 与漂移 smoke 的候选处置闭集(与 #4457 同源)。

关键代码讲解

  1. loopx/capabilities/pr_review_queue/review_contract.py:30 SEMANTIC_CANDIDATE_DECISIONS:reuse_existing / extend_vocabulary / create_vocabulary / local_only / external_input / compatibility_only / unknown 的 tuple 闭集,既进入证据要求载荷,也被 result_check 用于成员判定;它同时被 inventory 生成器登记,所以漂移会立刻被 --check 抓到。
  2. loopx/capabilities/pr_review_queue/review_contract.py:1003 build_review_plan:semantic_alignment_required = behavior_bearing_change,只在行为相关改动追加该行。判定不看仓库名、也不看 key_files 预览——测试里往 key_files 追加 loopx/semantics/vocabulary_v0.json 后计划保持相等,这正是“预览不能证明无影响”的实现面。
  3. loopx/capabilities/pr_review_queue/result_check.py:138 check_review_result:新增“evidence 中出现 semantic_alignment 即纳入校验”,并执行三条组合规则——候选值必须在闭集内、unknown 不得配 aligned/not_applicable、not_applicable 不得配 extend_vocabulary/create_vocabulary/compatibility_only(这三者隐含契约变更)。not_yet_proven/violated 再经 blocking_evidence_verdicts 转成审批阻断。
  4. loopx/capabilities/pr_review_queue/review_contract.py:906 blocking_evidence_verdicts['semantic_alignment']:把“扫不到”和“确证违规”明确列为阻断,而 advisory 不在其中——advisory 与强制的分界因此落在类型化数据里,而不是靠散文。
  5. docs/development/testing-and-quality.md:334 新增环境章节:我核对了它的两个关键事实断言——pyproject.toml 的 requires-python = ">=3.11",以及 scripts/loopx-python.sh 接受任意 3.11+ 解释器(候选列表含 3.13/3.12/3.11 与 .venv/bin/python),所以“无需名为 python3.11 的命令”这句是准确的;CONTRIBUTING.md 的锚点 #local-validation-environment--本地验证环境 也指向本节。

对主干的风险

最强的回归场景不是崩溃,而是评审者把“扫描没覆盖”写成“语义已对齐”,从而批准一个改变了共享值域或投影的 PR。触发状态是行为相关改动 + 只看 diff 预览与“测试全绿”;阻止路径就是上面第 3、4 条规则;blast radius 是所有用 packet 的仓库的评审结论,不触及产品运行路径、quota 或合并权限。

我做了真实路径验证而不是只跑单测:用 head 的 CLI 生成 packet(policy_revision=5、行为相关行的 required_evidence_ids 含 semantic_alignment、模板含该行),再拿空模板结果跑 --check-result,得到 semantic_alignment:not_verified 等 45 条 blocker、approval_consistent=false——说明“不填就过不了”真的在入口生效。反向证据也具备:tests/capabilities/test_pr_review_contract.py + test_pr_review_result_check.py 76 passed,examples/pr-review-command-smoke.py ok,漂移 smoke ok(twins=43/43),generate_semantic_inventory.py --check up to date,CI 23 项 pass(含 Sign-off、merge-gate、pytest、四个 test-shard)。

需要说明的证据边界:我本机全量 pytest tests/capabilities 有 21 个失败,抽样在基于 main 的 #4457 worktree 里同样失败,原因是本机已安装扩展注册表残留(报 capability implementation 'human-confirmed-operation-executor' references unknown capability),与本 PR 无关,故以 CI 结果为权威。另外 analysis_limit 是否充分只能靠评审者叙述,机器无法判定;not_applicable 与 reuse_existing/local_only/external_input 的组合被判为合法是有意不对称(这三者不要求契约变更),与规则文本一致。

语义与 CI 对齐

我把这次改动判为 candidate_decision=extend_vocabulary、verdict=new_semantics_justified:它扩展现有的评审证据契约(rev 3 → rev 5 新增一行要求),而不是新建术语体系或运行时能力,且不注入仓库特定 CI 事实——契约文本要求“从目标仓库当前策略解析 CI 义务”,具体的 Sign-off/merge-gate 只作为 README 中的 LoopX 示例。当前没有受影响义务缺必需证据,故不适用 not_yet_proven/violated。CI 侧本 head 全绿;唯一与环境有关的事实是:本轮 review 之后我无法验证其他仓库的真实 packet,但那属于未验证维度而非阻断项。

我的整体评价

按 exact head 对比基线:observable_semantics 判为 intentional_change_validated(行为相关评审多一条必需证据行、旧结果因 revision 判 stale、skill 文本同步 5,都是版本提升的既定含义且已披露);repository_reuse 判为 reused(单一 owner,无并行实现,无第二权威);change_proportionality 判为 proportionate(生产机制仅约 112 行,全部落在既有契约与校验,替代方案要么不可检查、要么超出当前证据能力);authority_semantics 判为 aligned(只约束“什么结果能用作 APPROVE”,不声称自动检测或全局证明);default_off_isolation 判为 not_applicable(非开关型改动,且非行为相关 PR 的 required_evidence_ids 与基线一致,评审负担未变)。guidance_vs_obligation 明确:advisory 不阻断,not_yet_proven/violated 由 blocking_evidence_verdicts 机器阻断。残留风险只有三条且都不是本 PR 引入:本机 21 个环境性失败(CI 已绿)、analysis_limit 无法机器校验、以及发布时需确保 host 重新取到更新后的 skill 文本(否则 host 仍按旧版本号执行)。

因此本次给 APPROVE,两条非阻断项建议在本轮或本 PR 内随手处理:文档措辞关于 3→5 应描述“新增”而非“替代”(或把版本改为 4),以及合并前先让 #4457 去掉那处测试 hunk 再 rebase。这版改动在合并后仍值得跟进的是:semantic_alignment 第一次在真实社区 PR(例如 #4457 之外的受影响的契约改动)上跑一轮,确认 advisory 与 not_yet_proven 的边界在真实判断里好用。

English verdict: APPROVE — at f1c3a83a046763eee5f0548dc1699f5ad94744a4 the review contract's new bounded semantic triage is typed, domain-neutral (no repository facts in the generic requirement, enforced by test), and machine-enforced through check_review_result (verified on the real CLI path: an unfilled row yields semantic_alignment:not_verified, while not_yet_proven/violated block approval and advisory does not); two non-blocking items remain: the README describes revision 5 as replacing a "universal detailed semantic review" that was never published (the shipped delta 3→5 is an addition; revision 4 lived only in branch history), and the only merge conflict with main is the tests/test_manager_channel_binding.py hunk inherited from #4457's head, which should be dropped before rebase.

Signed-off-by: song <liusongstep@gmail.com>
@huangruiteng
huangruiteng merged commit f6a6d11 into loopx-project:main Sep 16, 2026
27 checks passed
@songoow
songoow deleted the codex/pr-review-semantic-alignment branch September 16, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants