diff --git a/doc/architecture/SPEC/engine/steps/review.md b/doc/architecture/SPEC/engine/steps/review.md index 012928ed..0b371583 100644 --- a/doc/architecture/SPEC/engine/steps/review.md +++ b/doc/architecture/SPEC/engine/steps/review.md @@ -1,6 +1,6 @@ # engine/steps/review/ —— 规范 - + `patch gate + PR review + quality(9 个源文件) · step 库(评审) · refactor-status: ok` @@ -82,6 +82,13 @@ agent、评审结果的有界精炼、评测调优过的 prompt 数据和确定 `repo.language` 为键,**诚实降级**;裁决自洽(任何 ≥minor 的评论 ⇒ REQUEST CHANGES); 确定性的按严重度排序的评论上限。 - prompt 是仓库中立的(**A5**)。 +- **区分评审 head 与文档所述的运行版本**:共享 checklist 与文档 lens 都要求按 + recipe 或 benchmark 标明的 release、commit、补丁或容器版本查证实现和参数。 + 冻结的 PR head 仍是审查本次 diff 和可发布锚点的依据,但它没有该实现并不能反驳 + 另一个运行版本。调用外部 API 或内核时,以相关验证任务实际解析的依赖版本为准, + 检查该版本的被调实现与实参,不拿本机安装包或依赖仓库默认分支代替。不同目标 + 使用不同版本时说明证据覆盖范围。指定版本不可读时记录核验缺口;源码只证明路径存在, + 不证明测试实际执行。运行证据和命令、依赖、链接的可复现性仍须单独检查。 - 质量 step **fail-closed**:枚举/JSON/模型不可用即 BLOCKED; `needs_rework` 少于两条完整依据会机械降为低置信度 `concerns`。短描述、标题、 体量、文件数或没有测试修改任何一项都不得单独成为 needs-rework 理由;其中体量 diff --git a/src/infermatrix_copilot/engine/steps/review/prompts.py b/src/infermatrix_copilot/engine/steps/review/prompts.py index 56c29ede..627d48f3 100644 --- a/src/infermatrix_copilot/engine/steps/review/prompts.py +++ b/src/infermatrix_copilot/engine/steps/review/prompts.py @@ -101,6 +101,16 @@ inclusion/absence; a repo-wide grep falsifies "only"/"all" claims) and record the result \ as a `[claim-verified]`/`[claim-refuted]` findings line. Accepting the author's framing \ without checking is the single most measured recall failure. +13a. Distinguish the frozen PR head from the runtime that governs the claim or call \ +site. For dependent API, default, or kernel behavior, follow the relevant job or \ +recipe's resolved dependency commit, release, patch, or container; do not substitute \ +the installed package or a dependency's default branch. Check the actual callee and \ +arguments at that pin. Name which target the evidence covers when supported pins differ. \ +Absence at the PR head does not refute a claim about that runtime. If the runtime pin \ +is unavailable, record \ +a verification gap, not a confirmed contradiction. Source proves a code path, not that \ +it ran: check matching run evidence separately. Check whether commands, pins, and links \ +make a recipe or benchmark reproducible without treating local results as hosted CI. 14. Sibling contrast: when the diff ADDS a class/dataclass/config/file into a package, \ list that package and READ the closest in-tree sibling (its merged twin) — every \ invariant, validation, warning, or dedup the sibling enforces that the new code lacks \ @@ -467,8 +477,9 @@ "focus": "You review DOCUMENTATION as a skeptical user who will run every " "command. (a) CLAIMS AUDIT: every factual statement the doc " "makes about code ('X is the only consumer', 'default is Y', " - "'verified on Z') gets falsified against the tree — grep for " - "the counterexample, not the confirmation; every quantitative " + "'verified on Z') gets tested against the revision it describes " + "(checklist 13a), not automatically against the review tree; grep " + "for the counterexample, not the confirmation. Every quantitative " "claim (timing tables, memory models, fitted formulas, " "speedups) gets `calc`-checked for self-consistency (plug the " "doc's own numbers back in; flag unlabeled derived-vs-measured " diff --git a/test/test_agent_ensemble.py b/test/test_agent_ensemble.py index a067f033..e1ec4be5 100644 --- a/test/test_agent_ensemble.py +++ b/test/test_agent_ensemble.py @@ -1491,3 +1491,32 @@ def test_reducer_keeps_evidence_from_each_investigator_when_it_drops_all_comment assert output["_assessment_incomplete"] is False assert [r["claim"] for r in output["claim_checks"]] == ["raw output", "comparison"] assert [r["dimension"] for r in output["dimension_ratings"]] == ["validation", "claim_evidence"] + + +def test_recipe_review_distinguishes_runtime_pin_from_review_head( + settings, trace, tmp_path, git_repo): + """A docs-only PR can document a runtime that is not in its checkout.""" + settings.review_ensemble = True + settings.review_depth = "light" + settings.review_light_zero_yield_escalate = False + llm = ScriptedLLM([contract(review_comments=[])]) + state = { + "diff_text": "diff --git a/recipes/device.md b/recipes/device.md\n" + "--- /dev/null\n+++ b/recipes/device.md\n" + "@@ -0,0 +1 @@\n" + "+Qualified on release + patch commit 1234abc.\n", + "task_spec": {"pr": 9}, + "repo_path": str(git_repo), + } + registry = register_builtin_steps(StepRegistry()) + result = asyncio.run(registry.get("agent.review_diff").handler( + _ctx(settings, trace, tmp_path, state, llm=llm))) + + assert result.ok, result.summary + prompt = " ".join(llm.calls[0]["messages"][0]["content"].split()) + assert "Absence at the PR head does not refute a claim about that runtime" in prompt + assert "If the runtime pin is unavailable, record a verification gap" in prompt + assert "Source proves a code path, not that it ran" in prompt + assert "do not substitute the installed package or a dependency's default branch" in prompt + assert "Check the actual callee and arguments at that pin" in prompt + assert "without treating local results as hosted CI" in prompt