Skip to content

Commit d3ce600

Browse files
EvangelinkCopilot
andauthored
Fix agentic review publication and PR input contracts (#12190)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 165333f commit d3ce600

68 files changed

Lines changed: 831 additions & 198 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/test_gh_aw_runtime_contracts.py‎

Lines changed: 492 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/workflows/README.md‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,69 @@ inside the agent-visible tree. The agent reads this manifest after extraction.
9393
Do not interpolate custom-step outputs into the prompt: gh-aw renders it before
9494
those steps run. Missing inputs are incomplete analysis, not an empty scope.
9595

96+
#### Typed safe-output footer templates
97+
98+
[Run 41640057298](https://github.com/microsoft/testfx/actions/runs/41640057298/job/125933099017?pr=12185)
99+
and four other inspected test-review runs failed during review finalization with
100+
`Report nodes cannot appear in scalar fields`. Analysis and threat detection
101+
completed; the publisher failed before submitting the review.
102+
103+
The pinned gh-aw v1.0.1 runtime represents `{history_link}` as a typed inline
104+
fragment containing the separator and complete optional history link, not a URL.
105+
Insert it directly after `{ai_credits_suffix}`. Do not wrap it in
106+
`[label]({history_link})`, a code span, or another scalar field. A missing history
107+
URL produces an empty fragment, not a broken link. This applies to every custom
108+
footer, including imported shared configuration, issue/PR bodies, and failure
109+
reports; changing only the test reviewer leaves the same defect elsewhere.
110+
Attribution, AI-credit reporting, diagnostic warnings, detection, and the pinned
111+
runtime remain enabled.
112+
113+
`test_gh_aw_runtime_contracts.py` exercises these authored templates using the
114+
actual scripts installed by the pinned setup action. It also checks the review
115+
buffer's final GitHub request with isolated API doubles. Run after setup:
116+
117+
```bash
118+
python .github/scripts/test_gh_aw_runtime_contracts.py --actions-dir "$RUNNER_TEMP/gh-aw/actions"
119+
```
120+
121+
These are local component checks, not proof of hosted review permissions,
122+
publication, or GitHub UI rendering. Do not dispatch a workflow or post a test
123+
review merely to validate the template.
124+
125+
Local regression evidence (November 3, 2026) uses the unchanged v1.0.1 setup
126+
scripts at `221ba4f4319de6b8e809d1a15528b3ae6a818aa5` and Node.js v24.22.1.
127+
The same retained tests and assertions were run against an isolated archive of
128+
base `d9e38dc463365dc12f714db14815b46dedb0ed15` and the corrected sources:
129+
130+
| Contract / test | Baseline | Corrected |
131+
| --- | --- | --- |
132+
| `test_authored_test_review_footer_publishes_complete_advisory_review` | Fails inside the real renderer with `Report nodes cannot appear in scalar fields`, before an API request. | Passes; asserts the exact composed advisory review payload, attribution, credits, commit, and diagnostic-read isolation. |
133+
| `test_public_review_resolver_honors_explicit_public_only_policy` | Fails: actual minimum integrity is `approved`, not `none`. | Passes; public-only visibility remains `public`. |
134+
135+
The paired selection executed two tests in each state: baseline exit 1 with
136+
two intended failures; corrected exit 0 with two passes and no skips. With
137+
`$actions` pointing to the pinned setup scripts and `$baseline` to the isolated
138+
archive's `.github\workflows` directory, reproduce the identical selection:
139+
140+
```powershell
141+
$cases = @(
142+
'GhAwRuntimeContractTests.test_authored_test_review_footer_publishes_complete_advisory_review'
143+
'GhAwRuntimeContractTests.test_public_review_resolver_honors_explicit_public_only_policy'
144+
)
145+
python .github\scripts\test_gh_aw_runtime_contracts.py --actions-dir $actions --workflow-root $baseline @cases -v
146+
python .github\scripts\test_gh_aw_runtime_contracts.py --actions-dir $actions @cases -v
147+
python .github\scripts\test_gh_aw_runtime_contracts.py --actions-dir $actions -v
148+
```
149+
150+
The full final suite passes all 13 methods, including all 33 authored footer
151+
templates with and without history. Existing warning-contract, checkout,
152+
firewall, and review-input suites pass another 64 tests. Strict compilation
153+
passes all 37 inputs with zero warnings and ShellCheck covers 2,103 resources;
154+
the three final public-scoped expert consumers also pass 186 lint resources.
155+
The action-pin audit passes 2,759 references across 58 files. These results do
156+
not include a live model, hosted MCP access, review publication, or GitHub UI
157+
rendering.
158+
96159
#### Category-specific threat-detection evidence
97160

98161
[Run 38707575125](https://github.com/microsoft/testfx/actions/runs/38707575125)
@@ -133,6 +196,30 @@ zero afterwards. The repository-wide audit still reports 36 pre-existing finding
133196
outside these reviewers (38 before this change). No live detector replay or
134197
workflow dispatch was performed; the model's regression sensitivity is unproven.
135198

199+
### Expert-review input contract
200+
201+
[Run 41639103767](https://github.com/microsoft/testfx/actions/runs/41639103767)
202+
failed earlier: the public-repository default required `approved` integrity,
203+
so the GitHub MCP server filtered the unapproved PR diff before delegation.
204+
The three expert-review workflows now explicitly accept unapproved PR content
205+
as data, like the test reviewer, with `min-integrity: none` and shell execution
206+
disabled. The public-repository visibility filter, read-only MCP toolsets,
207+
trigger eligibility, existing credentials, threat detection, and bounded review
208+
publication remain in place. Untrusted diffs must never become instructions.
209+
210+
The shared prompt also resolves the PR number from centralized slash-command
211+
`aw_context` for `/review`, in addition to PR/comment event fields. A required
212+
diff-read failure reports both missing data and a terminal incomplete result;
213+
it must not pretend that delegation or review succeeded.
214+
Resolve the fallback in frontmatter `env.REVIEW_PR_NUMBER` and reference that
215+
environment value in the prompt: v1.0.1 rejects `fromJSON(...)` directly in
216+
runtime-imported prompt text. Keep `allowed-repos: public` explicit too;
217+
setting only `min-integrity: none` otherwise changes the compiler's repository
218+
scope default to `all`.
219+
The pinned-runtime regression suite covers public-repository policy resolution
220+
and compiled consumer controls; command identity and incomplete instructions
221+
are static contracts, not evidence that a live model follows them.
222+
136223
### Firewall access for repository work
137224

138225
`network: defaults` covers infrastructure, not package feeds or Git transport.

‎.github/workflows/add-tests.lock.yml‎

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

‎.github/workflows/add-tests.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ safe-outputs:
4949
engine:
5050
id: copilot
5151
messages:
52-
footer: "> 🤖 **Automated content by GitHub Copilot.** Generated by the [{workflow_name}]({agentic_workflow_url}) workflow.{ai_credits_suffix} · [◷]({history_link})"
52+
footer: "> 🤖 **Automated content by GitHub Copilot.** Generated by the [{workflow_name}]({agentic_workflow_url}) workflow.{ai_credits_suffix}{history_link}"
5353
noop:
5454
report-as-issue: false
5555
create-pull-request:

‎.github/workflows/address-review.agent.lock.yml‎

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

‎.github/workflows/address-review.agent.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ imports:
3333

3434
safe-outputs:
3535
messages:
36-
footer: "> 🤖 **Automated content by GitHub Copilot.** Generated by the [{workflow_name}]({agentic_workflow_url}) workflow.{ai_credits_suffix} · [◷]({history_link})"
36+
footer: "> 🤖 **Automated content by GitHub Copilot.** Generated by the [{workflow_name}]({agentic_workflow_url}) workflow.{ai_credits_suffix}{history_link}"
3737
noop:
3838
report-as-issue: false
3939

0 commit comments

Comments
 (0)