Skip to content

feat(review): give the verifier a probe capability — run a runnable claim, don't just read it - #7756

Merged
wenshao merged 1 commit into
QwenLM:mainfrom
wenshao:feat/review-probe-verify
Jul 26, 2026
Merged

feat(review): give the verifier a probe capability — run a runnable claim, don't just read it#7756
wenshao merged 1 commit into
QwenLM:mainfrom
wenshao:feat/review-probe-verify

Conversation

@wenshao

@wenshao wenshao commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

What & why

Read-only verification is where this review misses its hardest bugs, and that isn't a guess — it's measured. Handed the exact low-confidence finding for a ! command that executes twice in a new task, the strongest model's full Step-3 roster (with worktree access) traced the mechanism and called it correct — 0 of 3, one attacker persona walking right into it.

Then I validated the fix directly. When the same models were allowed to WRITE AND RUN a probe instead of only reasoning:

Model Case Result
qwen3.8-max-preview the real bug (! double-execute) CONFIRMED — probe observed sendShellCommand called twice with ["git push"]; self-check: guard→1, revert→2
qwen3.8-max-preview negative control (a false "duplicate session" claim) REFUTEDcreateSession called once, no fabrication
qwen3.7-max the real bug CONFIRMED — count=2, plus a probe-verified fix

Both models confirmed the bug they had missed read-only, both did the probe-validity self-check unprompted, and the plausible-but-false control was correctly refuted. The ceiling is real and bidirectional.

How it works

This is the verifier's brief gaining one capability. When a finding's failure scenario is a runnable claim about a named unit (a function, a component, a route) and the repo has a fast unit harness (vitest/jest/pytest) and tracing-by-reading hasn't settled it, the verifier may write a probe — a minimal test that reproduces the scenario and records what actually happens — and run it. Two rules keep it evidence and not theatre:

  • Self-check (mandatory): after the probe reports the suspected-wrong behaviour, apply the fix the finding implies (or revert the change), re-run, confirm the probe flips, then restore. A probe that can't be made to flip is inconclusive and the finding stays low-confidence — it does not upgrade on a probe that proves nothing.
  • The observation is the verdict. The probe ran the code, so its output is the confirmation a Critical needs (and a probe showing the correct outcome is exactly the "quote the contradicting code" that lets a Critical be rejected). The verifier leaves the tree exactly as found — no probe file, no fix edit, reaches the diff or the build.

A finding a probe confirmed carries Source: [probe], which compose-review now treats as deterministic (a run produced it) like [build]/[test] — so it is never softened for a verification it never owed.

Scope

Phase 1: the agent-driven loop the validation exercised — no new command. The verifier already runs in the worktree with a shell (same risk tier as Build & Test, which builds and tests PR code there today); this gives it the instruction to probe. Deliberately deferred: a deterministic qwen review probe runner + artifact (sandbox hardening, proof-of-execution for compose-review), and the finding-generation side — getting an agent to emit a probeable low-confidence finding rather than concluding "correct", the one gap the validation did not cover.

Independent of the script-lint PRs (#7749/#7751); branches off current main.

Validation

  • Full /review command suite green (918 tests); ESLint clean at --max-warnings 0; tsc --noEmit clean over the review tree.
  • Tests pin the capability in the verify brief (and that it does not bleed into a dimension brief), and that a [probe] body Critical is deterministic in compose-review (stands without a separate verifier).
中文说明

背景与动机

只读式验证正是本评审漏掉最难那类 bug 的地方——这不是猜测,是实测出来的。把"新任务里 ! 命令执行两次"这条低置信发现原样交给最强模型的全 Step-3 roster(带 worktree),它把机制走了一遍却判成"correct"——3 个里 0 个,攻击者视角还径直走到 bug 面前。

随后我直接验证了这个补法:给同一批模型"能写+跑 probe"的能力(而非只推理):

模型 场景 结果
qwen3.8-max-preview 真 bug(! 双执行) CONFIRMED——probe 实测 sendShellCommand 被调用两次,参数 ["git push"];自校验:加守卫→1、revert→2
qwen3.8-max-preview 负控(命题:重复建 session) REFUTED——createSession 只调 1 次,无编造
qwen3.7-max 真 bug CONFIRMED——count=2,并给出经 probe 验证的修复

两个模型都确认了它们只读下漏掉的 bug,都未经提示就做了 probe 有效性自校验,似真实假的负控被正确推翻。天花板真实、且双向。

实现方式

这是给 verifier 的 brief 增加一项能力。当一条发现的 failure scenario 是关于具名单元的可运行命题(函数/组件/路由),仓库有快速单测 harness(vitest/jest/pytest),只读追踪未能定论时,verifier 可以写一个 probe(最小复现、记录真实发生了什么)并运行。两条硬规则让它是证据而非表演:

  • 自校验(强制): probe 报出疑似错误行为后,施加该发现暗示的修复(或 revert 引入它的改动),重跑,确认 probe 翻转,再还原。无法翻转的 probe 判 inconclusive,发现维持低置信——不会靠一个证明不了什么的 probe 升级。
  • 观察即裁决。 probe 了代码,其输出就是 Critical 所需的确认(而一个显示正确结果的 probe,正是拒绝 Critical 所需的"引用打脸代码")。verifier 把工作树原样还原——probe 文件、修复编辑都不得进入 diff 或构建。

被 probe 确认的发现带 Source: [probe],compose-review 现在把它当作确定性(由一次运行产生),与 [build]/[test] 同级——因此不会因"没跑本不该跑的验证"而被降级。

范围

Phase 1:验证所跑的那个 agent 驱动闭环——不新增命令。 verifier 本就在 worktree 里带 shell 运行(与 Build & Test 同一风险级别,后者今天就在那里构建并测试 PR 代码);本 PR 给它"去 probe"的指令。刻意延后:确定性 qwen review probe 运行器 + 产物(沙箱加固、给 compose-review 的执行证明),以及 finding-generation 侧——让 agent产出一条可 probe 的低置信发现,而不是直接判"correct"(验证唯一没覆盖的那一环)。

script-lint 两个 PR(#7749/#7751)相互独立;基于当前 main

验证

  • /review 命令全量测试通过(918 项);ESLint 在 --max-warnings 0 下无告警;review 目录 tsc --noEmit 干净。
  • 测试固定了 verify brief 里的该能力(且不渗入维度 brief),以及 compose-review[probe] body Critical 的确定性处理(无独立 verifier 也成立)。

…laim, don't just read it

Measured on this repo: read-only verification is where the review misses its
hardest bugs. Handed the exact low-confidence finding for a `!` command that
executes twice, the strongest model's Step-3 agents traced the mechanism and
called it correct (0/3 across the full roster). Validated the fix directly — when
the same models (3.7-max and 3.8-max-preview) were allowed to WRITE AND RUN a
probe, both confirmed the double-execute from observed behaviour
(`sendShellCommand called twice with ["git push"]`), both did the probe-validity
self-check unprompted, and a plausible-but-false negative control was correctly
refuted with no fabrication.

So the verifier's brief now says: when a finding's failure scenario is a runnable
claim about a named unit and the repo has a fast unit harness (vitest/jest/pytest),
write a minimal probe, run it, and let the observed behaviour settle the verdict.
Two rules keep it evidence rather than theatre — a mandatory self-check that the
probe flips between buggy and correct, and leaving the tree exactly as found. A
finding a probe confirmed carries `Source: [probe]`, which compose-review treats
as deterministic (a run produced it) like `[build]`/`[test]`.

This is Phase 1: the agent-driven loop the validation exercised, no new command.
The deterministic runner + artifact and the finding-generation side (emitting a
probeable low-confidence finding rather than concluding "correct") are follow-ups.
@qwen-code-ci-bot

qwen-code-ci-bot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Qwen Triage finished — CI landed green on 2c53a92 and the deferred approval was posted. finalize run

Qwen Triage 已完成 —— 2c53a92 的 CI 全绿,延迟审批已提交。查看 finalize 运行

@yiliang114 yiliang114 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.

Review: feat(review): give the verifier a probe capability

This is a well-designed feature that addresses a measured gap in read-only verification. The approach is sound and the implementation is clean.

✅ Strengths

  1. Evidence-based design: The PR validates the problem (strongest model traced a real double-execute bug and called it correct 0/3 times) and validates the solution (probes confirmed the bug). This is excellent engineering.

  2. Two-rule guardrails: The mandatory self-check (probe must flip) and tree restoration rules keep probes as evidence rather than "theatre". This prevents false positives from probes that don't actually distinguish buggy from correct.

  3. Proper integration: Adding [probe] to deterministic sources alongside [build]/[test] is the right abstraction. A probe-run finding has the same "run produced it" nature.

  4. Good test coverage: Tests verify both the capability presence and the isolation (doesn't bleed into dimension briefs). The compose-review test confirms deterministic handling.

  5. Clear documentation: SKILL.md and the brief text explain the rules clearly.

🔶 Suggestions (non-blocking)

  1. Security documentation: The brief explicitly says "run it in the worktree". While this matches Build/Test's risk tier, it would be worth documenting in SKILL.md that probes run with the same trust assumptions as existing build/test execution (i.e., PR code is untrusted and executed). Future phases with sandbox hardening will improve this.

  2. Probe hygiene edge case: What happens if a probe crashes or times out? The brief says "fall back to the reading-based verdict" for un-runnable probes, which is correct, but explicitly mentioning cleanup on crash/timeouts could prevent stale probe files.

  3. Minor: regex readability: The regex /\[(?:build|test|probe)\]/i works, but a comment or extracted constant like DETERMINISTIC_SOURCES_PATTERN might improve maintainability as this list grows.

✅ Checklist

  • Code correctness: Logic is sound
  • Tests: Adequate coverage for the new capability
  • Documentation: SKILL.md and inline comments explain well
  • Security: Risk tier matches existing Build/Test execution
  • No breaking changes: Additive feature

Verdict

Approve — This is a thoughtful, measured addition that solves a real problem with appropriate guardrails. The measured validation gives confidence the approach works.

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

Template: the headings differ from the template (What & why / How it works / Scope / Validation vs the template's sections), but the content covers everything the template asks for — what, why, how to verify, scope, and validation evidence. Not blocking.

Problem: observed and measured, not theoretical. The PR describes a concrete case where read-only verification traced a real double-execute bug (!git push firing twice) and called it correct — 0 of 3 models caught it. The validation table shows the same models confirming the bug when allowed to run probes, and correctly refuting a false control. That's a real gap with evidence.

Direction: aligned. This improves the review command's verifier — the component whose job is exactly to catch what reading alone misses. The probe capability is scoped to the verifier's existing worktree+shell risk tier (same as Build & Test), and the PR is explicit about what's deferred (deterministic runner, finding-generation side). CHANGELOG: no direct reference, but the review command is actively developed and this is a natural capability extension.

Size: core path touched (packages/core/src/skills/bundled/review/SKILL.md, 1 line markdown). Production logic: ~18 lines (compose-review.ts: 11, agent-briefs.ts: 7). Test lines: 30. Well under any threshold.

Approach: the scope feels right — this is the minimal instruction + plumbing change. The probe instructions go into the verifier brief (where the verifier already runs with a shell), the [probe] tag gets added to the deterministic-source regex in compose-review (one regex alternation), and SKILL.md gets a one-line doc update. No unrelated changes, no scope creep. Moving on to code review. 🔍

中文说明

感谢贡献!

模板:标题与模板不同(What & why / How it works / Scope / Validation),但内容覆盖了模板要求的所有要点——做了什么、为什么、如何验证、范围、验证证据。不阻塞。

问题:已观测且有实测数据,非理论性加固。PR 描述了一个具体案例:只读验证追踪了一个真实的双执行 bug(!git push 执行两次)却判为正确——3 个模型 0 个发现。验证表显示同一批模型在允许运行 probe 后确认了该 bug,并正确推翻了一个虚假对照组。这是有证据的真实缺口。

方向:对齐。这改进了 review 命令的 verifier——其职责恰恰是捕捉仅靠阅读会遗漏的问题。probe 能力限定在 verifier 已有的 worktree+shell 风险层级(与 Build & Test 相同),PR 明确说明了延后的部分(确定性运行器、finding 生成侧)。

规模:触及核心路径(SKILL.md,1 行 markdown)。生产逻辑约 18 行,测试 30 行。远低于任何阈值。

方案:范围恰当——这是最小的指令+管道变更。无无关改动,无范围蔓延。进入代码审查 🔍

Qwen Code · qwen3.8-max-preview

Reviewed at 2c53a9260658c9a8f57b16bc6021d4a7111bfd99 · re-run with @qwen-code /triage

@qwen-code-ci-bot

qwen-code-ci-bot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Code Review

Independent proposal: given the problem (verifier misses bugs that running code would catch), I would (1) add probe instructions to the verifier brief — when a finding is a runnable claim about a named unit, the repo has a fast test harness, and reading hasn't settled it, write and run a minimal probe; (2) require a self-check that the probe flips between buggy and correct, so it's evidence not noise; (3) add [probe] to the deterministic-source regex in compose-review so probe-confirmed findings aren't softened for missing verification; (4) test both. That's exactly what this PR does.

Findings: no blockers. The diff is clean and every change earns its place:

  • agent-briefs.ts (+7): the probe paragraph slots in between step 5 ("Reject a false positive") and the verdict list — the right position, since it's an additional analysis capability before rendering a verdict. The two hard rules (self-check/flip, observation-is-verdict) and the cleanup requirement ("leave the tree as you found it") are well-specified. The Source: [probe] tag convention is clearly defined.
  • compose-review.ts (+6/-5): adds probe to the existing (?:build|test) alternation — one token in one regex. The updated comment explains why [probe] is deterministic (a run produced it). Minimal and correct.
  • SKILL.md (+1/-1): extends the existing verifier-documentation sentence with the probe capability, its justification (the measured miss), and the two hard rules. Integrates naturally into the paragraph.
  • Tests (+30): the agent-prompt test checks probe text appears in the verifier brief and does NOT bleed into dimension briefs (buildRoleBrief(PLAN, '1a')). The compose-review test checks a [probe] body Critical is treated as deterministic (not capped by criticals-unverified). Both test the right invariants.

Reuse check: the change extends the existing [build]/[test] deterministic-source pattern — no new abstraction, no parallel utility.

Testing

This is a CI run — PR code is not executed here. Evidence comes from the PR's own CI checks.

Final CI results for 2c53a92 (auto-updated by the triage finalize job after CI completed):

Check Conclusion
Classify PR ✅ success
Test (ubuntu-latest, Node 22.x) ✅ success
web-shell E2E Smoke (ubuntu-latest, Node 22.x) ✅ success

One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。

The main unit suite (Test (ubuntu-latest, Node 22.x)) is still running. The PR author reports 918 review-command tests green, ESLint clean at --max-warnings 0, and tsc --noEmit clean — that's the author's claim; CI will confirm. Windows/macOS and integration tests are skipped (likely gated on the ubuntu result).

Real-scenario testing: N/A — this is a review-infrastructure change (agent prompt text + compose-review regex), not user-visible TUI behavior.

中文说明

代码审查:无阻塞项。diff 干净,每处改动都有必要:

  • agent-briefs.ts(+7):probe 段落插入在步骤 5 和裁决列表之间——位置正确。两条硬规则(自校验/翻转、观察即裁决)和清理要求("原样还原工作树")规格清晰。
  • compose-review.ts(+6/-5):在已有的 (?:build|test) 交替中加入 probe——一个正则中的一个 token。注释更新解释了为什么 [probe] 是确定性的。最小且正确。
  • SKILL.md(+1/-1):在已有的 verifier 文档句子中扩展了 probe 能力描述。自然融入。
  • 测试(+30):agent-prompt 测试检查 probe 文本出现在 verifier brief 中且不渗入维度 brief。compose-review 测试检查 [probe] body Critical 被视为确定性来源。两个测试都验证了正确的不变量。

测试:CI 运行中,不执行 PR 代码。主要单测套件(ubuntu)仍在运行。作者报告 918 项测试通过、ESLint 和 tsc 干净——这是作者的声明,CI 将确认。

真实场景测试:不适用——这是 review 基础设施变更(agent 提示词 + compose-review 正则),非用户可见 TUI 行为。

Qwen Code · qwen3.8-max-preview

Reviewed at 2c53a9260658c9a8f57b16bc6021d4a7111bfd99 · re-run with @qwen-code /triage

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Confidence: 5/5 — clean across every stage; the change is minimal, well-motivated by measured evidence, and does exactly one thing.

This is a tight, well-evidenced capability addition. The problem is real and measured — the strongest model traced a genuine double-execute bug and called it correct, and the same model caught it immediately when allowed to run a probe. The implementation is the minimum viable version: one paragraph of verifier instructions, one regex alternation, one doc line, two focused tests. No new abstractions, no scope creep, no unrelated edits.

My independent proposal matched the PR's approach exactly — I didn't find a simpler path it missed. The probe instructions are well-specified (the self-check/flip rule is what keeps it evidence rather than theatre), the [probe] tag integrates into the existing deterministic-source pattern without a new mechanism, and the tests pin both the capability and its boundary (no bleed into dimension briefs).

If I had to maintain this in six months, I'd thank the author — the code is self-documenting, the tests explain why they exist, and the change is easy to revert if the probe approach doesn't pan out.

Approval deferred until CI lands green on 2c53a9260658c9a8f57b16bc6021d4a7111bfd99 — the ubuntu unit suite is still running.

中文说明

这是一个紧凑、有实测证据支撑的能力增强。问题真实且有度量——最强模型追踪了一个真实的双执行 bug 却判为正确,同一模型在允许运行 probe 后立即发现了它。实现是最小可行版本:一段 verifier 指令、一个正则交替项、一行文档、两个聚焦测试。无新抽象、无范围蔓延、无无关编辑。

独立提案与 PR 方案完全一致——没有找到更简路径。probe 指令规格清晰(自校验/翻转规则使其成为证据而非表演),[probe] 标签融入已有的确定性来源模式,测试固定了能力及其边界。

审批推迟至 CI 在 2c53a9260658c9a8f57b16bc6021d4a7111bfd99 上全绿——ubuntu 单测套件仍在运行。

Qwen Code · qwen3.8-max-preview

Reviewed at 2c53a9260658c9a8f57b16bc6021d4a7111bfd99 · re-run with @qwen-code /triage

@qwen-code-ci-bot qwen-code-ci-bot 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.

LGTM, looks ready to ship — CI landed green after the review. ✅

@wenshao
wenshao added this pull request to the merge queue Jul 26, 2026
Merged via the queue into QwenLM:main with commit d1988fd Jul 26, 2026
59 checks passed
wenshao pushed a commit to wenshao/qwen-code that referenced this pull request Jul 26, 2026
Reconcile compose-review with QwenLM#7756 (probe-verify): the deterministic regex keeps
`probe` and my provenance count-tracking (build/test/probe are trusted tags;
`[lint]` is not — the gate's own findings are deterministic by provenance). Keep
both the '[lint] is not deterministic' and '[probe] is deterministic' tests.
@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Released in v0.21.1.

@yiliang114

Copy link
Copy Markdown
Collaborator

⚠️ Failed to process this request. Please re-mention the bot to retry.

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.

3 participants