Skip to content

Commit 3b89857

Browse files
EvangelinkCopilot
andcommitted
Skip detection for patchless no-op expert reviews
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 129aff7 commit 3b89857

6 files changed

Lines changed: 60 additions & 16 deletions

File tree

‎.github/scripts/test_agentic_workflow_warning_contracts.py‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ def commit(self, message: str) -> str:
258258

259259

260260
class CompiledWarningContractTests(unittest.TestCase):
261-
def assert_noop_detection_gate(self, name: str) -> None:
262-
source, _ = authored(name + ".md")
261+
def assert_noop_detection_gate(self, name: str, source_name: str | None = None) -> None:
262+
source, _ = authored(source_name or name + ".md")
263263
jobs = compiled(name + ".lock.yml")["jobs"]
264264
gate = ("(needs.agent.outputs.output_types != '' && "
265265
"needs.agent.outputs.output_types != 'noop') || "
@@ -280,8 +280,13 @@ def test_pipeline_triage_detection_skips_noop_only_runs(self) -> None:
280280
def test_resource_lock_detection_skips_noop_only_runs(self) -> None:
281281
self.assert_noop_detection_gate("resource-lock-refactoring")
282282

283-
def assert_detection_security_controls(self, name: str) -> None:
284-
source, _ = authored(name + ".md")
283+
def test_expert_review_detection_skips_noop_only_runs(self) -> None:
284+
for name in ("review.agent", "review-on-open.agent", "review-after-autofix.agent"):
285+
with self.subTest(workflow=name):
286+
self.assert_noop_detection_gate(name, "shared/review-shared.md")
287+
288+
def assert_detection_security_controls(self, name: str, source_name: str | None = None) -> None:
289+
source, _ = authored(source_name or name + ".md")
285290
jobs = compiled(name + ".lock.yml")["jobs"]
286291
detection = source["safe-outputs"]["threat-detection"]
287292
self.assertEqual("detection", detection["model"])
@@ -304,6 +309,14 @@ def test_pipeline_triage_noop_skip_preserves_detection_security_controls(self) -
304309
def test_resource_lock_noop_skip_preserves_detection_security_controls(self) -> None:
305310
self.assert_detection_security_controls("resource-lock-refactoring")
306311

312+
def test_expert_review_noop_skip_preserves_detection_security_controls(self) -> None:
313+
for name in ("review.agent", "review-on-open.agent", "review-after-autofix.agent"):
314+
with self.subTest(workflow=name):
315+
self.assert_detection_security_controls(name, "shared/review-shared.md")
316+
source, _ = authored(name + ".md")
317+
self.assertIs(False, source["safe-outputs"]["noop"]["report-as-issue"],
318+
"Skipping detection for noop-only output must not publish an issue")
319+
307320
def test_build_publisher_checkouts_have_direct_identity_dependency(self) -> None:
308321
jobs = compiled("build-failure-analysis.lock.yml")["jobs"]
309322
output = jobs["safe_outputs"]

‎.github/workflows/README.md‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,28 @@ emits only `noop` without a patch, ResourceLock uses the same eligibility guard
682682
as Pipeline Test Triage. Incomplete reports, other outputs, mixed outputs, and
683683
every patch still require detection.
684684

685+
Expert Code Review hit the same eligibility defect in
686+
[run 42848192058](https://github.com/microsoft/testfx/actions/runs/42848192058),
687+
tracked by [#12320](https://github.com/microsoft/testfx/issues/12320).
688+
Its collector emitted only `noop` with `has_patch=false`, but detection still
689+
started. Unlike the download failures above, threat-detect v0.5.3 installed
690+
successfully and resolved `detection` to `claude-haiku-5.5`. The engine then
691+
timed out after five minutes without recording a verdict or inference usage.
692+
The tracker classified this as `detector_execution_failure` / `agent_failure`,
693+
not a threat finding; the assessment remained incomplete.
694+
695+
The shared expert-review configuration now applies the same no-op exclusion to
696+
the ready-PR, `/review`, and after-autofix workflows. Real reviews, incomplete
697+
reports, mixed outputs such as `noop,submit_pull_request_review`, and every
698+
patch remain eligible. Existing runs
699+
[42886380382](https://github.com/microsoft/testfx/actions/runs/42886380382) and
700+
[42886933282](https://github.com/microsoft/testfx/actions/runs/42886933282)
701+
recorded verdicts for mixed review outputs using the same detector, CLI,
702+
firewall, and resolved model. The guard avoids unnecessary detection; it does
703+
not claim to repair the unproven cause of the engine stall. The failing run also
704+
had a separate unsupported reviewer subagent model error before its no-op;
705+
changing detection eligibility does not repair that delegation.
706+
685707
**What to do.** For workflows where a no-op has no downstream side effects, gate threat detection
686708
on the presence of an actual safe output or patch:
687709

@@ -699,7 +721,13 @@ skipped conclusion behavior.
699721
The offline `CompiledWarningContractTests.test_pipeline_triage_detection_skips_noop_only_runs`
700722
case checks both the authored guard and the generated job condition.
701723
`test_pipeline_triage_noop_skip_preserves_detection_security_controls` keeps the detector
702-
and safe-output gates intact. On November 5, 2026, the same two retained tests ran against
724+
and safe-output gates intact. The equivalent expert-review cases are
725+
`test_expert_review_detection_skips_noop_only_runs` and
726+
`test_expert_review_noop_skip_preserves_detection_security_controls`; both cover
727+
all three consumers of `shared/review-shared.md`, including the no-op's
728+
non-publishing policy.
729+
730+
On November 5, 2026, the same two retained Pipeline Test Triage tests ran against
703731
an isolated workflow archive of base `88a31ec394abe9f5c5dcf596f0a150ff998d3a0e`: the eligibility
704732
case failed both guard assertions and the security-controls case passed (exit 1).
705733
Both cases passed against the corrected source and regenerated lock (exit 0, no skips).

‎.github/workflows/review-after-autofix.agent.lock.yml‎

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)