Skip to content

[copilot] Improve test and NuGet guidance - #13817

Merged
simonrozsival merged 3 commits into
mainfrom
dev/simonrozsival/agent-instructions-2026-11-27
Nov 27, 2026
Merged

simonrozsival merged 3 commits into
mainfrom
dev/simonrozsival/agent-instructions-2026-11-27

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 02cf2aea43b49cdb4c0207dca85795ddd90fe32b

Dimension Assessment Rationale
Change confidence 8/10 ↑ Azure feed configuration and package lookup verified.
↑ Markdown diff passes whitespace checks.
↓ Agent behavior, including the reviewer workflow, remains unverified.

Context: #13778

A review of the last two days of local agent sessions found that agents in more than 12 sessions added tests that the maintainer later asked to delete. The deleted tests were overfitted to the implementation, flaky, or redundant, and each removal cost extra review turns and device-test reruns. Three sources pushed agents to add these tests:

  • Generic agent and harness defaults say to add a focused regression test.
  • Coordinator kickoffs required tests from every child session.
  • The android-reviewer workflow listed "missing tests" as a review priority above duplication. On one PR it asked for three sets of on-device tests, and the maintainer then trimmed them to one.

The guidance from #13778 rated tests by value but did not override these defaults, so agents still added tests by default. The instructions now say:

  • Default to no new tests. This explicitly overrides generic "add a regression test" defaults.
  • Add at most the single most valuable test, and only when the user asks for one or a real regression would otherwise be unprotected.
  • Push back on reviewer and bot requests for more tests.
  • Don't mandate tests in child-session kickoffs.
  • Reviewers (android-reviewer, and the code-review skill's testing rules) request a test only for an unprotected real regression, and never as a default.
  • The Java.Interop instructions defer to the top-level rule instead of repeating their own rule.

Other recurring issues:

  • Scope: "Keep it simple" now says to leave unrelated cleanups for separate PRs and to keep the user's earlier decisions. Maintainers repeatedly asked agents to shrink oversized diffs or move unrelated edits out.
  • Restore: the tests skill now says to omit --no-restore from test commands in new worktrees and scratch projects. That flag caused about 60 NETSDK1004 build failures across 19 sessions.
  • NuGet: Direct nuget.org requests by local agents can trigger blocked-access prompts even though the repo config uses Azure DevOps feeds. Direct package lookups and tool installs to those feeds, including dotnet-public, and explicitly restore scratch projects with that config.

Net change: +17/−10 lines. The android-reviewer.lock.yml file loads android-reviewer.md at runtime, so it does not need to be recompiled.

Validation:

  • git diff --check 54d669a53937974a4b0c433f3ea4f06d03bff0df...HEAD — passed.
  • dotnet nuget list source --configfile "$PWD/NuGet.config" — passed; only the repository's Azure DevOps feeds are listed.
  • dotnet package search binlogtool --exact-match --prerelease --source 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json' --format json — passed; dotnet-public returned package versions.
  • No builds or tests run; the changes are Markdown instructions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 13:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the documentation-only guidance changes.

No open issues 🎉

What changed in this PR

This documentation-only PR builds on #13778 to make “no new tests by default” explicit across dotnet/android’s agent and review guidance, aiming to reduce redundant tests and review churn. It does not change SDK or runtime code.

Changes:

  • Limits new tests to one high-value case when requested or needed to protect a real regression, and aligns reviewer and Java.Interop guidance.
  • Reinforces keeping unrelated cleanups separate and respecting earlier user decisions.
  • Advises omitting --no-restore in fresh worktrees and scratch projects to avoid missing-assets errors.
File Description
.github/​workflows/​android-reviewer.md Removes missing tests from default priorities and limits test requests.
.github/​skills/​tests/​SKILL.md Adds restore guidance for fresh worktrees and scratch projects.
.github/​skills/​code-review/​references/​testing-rules.md Discourages low-value tests and default coverage requests.
.github/​instructions/​java-interop.instructions.md Defers new-test decisions to the top-level rule while preserving existing tests.
.github/​copilot-instructions.md Establishes the no-new-tests default and reinforces scope discipline.

Review effort: Balanced

simonrozsival and others added 2 commits November 27, 2026 15:11
Local agent sessions access nuget.org directly even when the repository uses Azure DevOps feeds, triggering blocked-access notifications. Point package lookups and tool installs at the approved feeds and isolate scratch restores from inherited sources.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Distinguish test commands from scratch project creation, which suppresses its initial restore before using the repository NuGet configuration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival changed the title [docs] Default agents to no new tests [copilot] Improve test and NuGet guidance Nov 27, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto review

@PeppersMuse

Copy link
Copy Markdown

Reviewed the Markdown-only guidance changes:

  • NuGet feeds: verified the dotnet-public flat2 base URL against the repo's NuGet.config (https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json); the flat2/<id>/index.json and <id>/<version>/<id>.<version>.nupkg forms match that feed. The --configfile restore guidance is consistent with the repo config being the only source list.
  • Test guidance: the "default to no new tests" wording and the android-reviewer.md priority change (dropping "missing tests", requesting a test only for an unprotected real regression, one case at most) match the [copilot] Refine agent guidance from session review #13778 rationale in the description, and the java-interop instructions and code-review testing rules were updated to the same rule rather than restating their own.
  • tests skill: the --no-restore note for new worktrees/scratch projects matches the NETSDK1004 rationale given.
  • The git diff --check and dotnet nuget list source / dotnet package search validation steps reported in the description cover this docs-only change; no builds or tests apply. No Copilot review was posted on this PR.

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the seven changed guidance files, related agent/skill instructions, NuGet configuration, and the generated reviewer workflow integration. The workflow loads the updated Markdown at runtime, and the testing and package-source guidance remains consistent with the accepted policy. No blocking issues found. Static review only; no builds or tests were run.

@simonrozsival
simonrozsival merged commit b0d2765 into main Nov 27, 2026
39 checks passed
@simonrozsival
simonrozsival deleted the dev/simonrozsival/agent-instructions-2026-11-27 branch November 27, 2026 18:31
jonathanpeppers pushed a commit that referenced this pull request Dec 2, 2026
…13886)

Context: #13817

A review of about 110 recent local agent sessions in this repo found three recurring wastes that the agent instructions either didn't cover or got wrong.

### Backports

One backport to `release/11.0` cost about 30% of the reviewed agent spend. The agent ported main-only renames, refactors, a C# rewrite of native logic, and new tests. The user then had to remove them over several rounds. "Keep it simple" now adds: backports port only the fix, keeping the target branch's design, names, and native code, with no main-only refactors or new tests.

### Parallel builds

After a coordinator asked about 70 sessions to rebase onto main, many started full `make prepare && make leeroy` builds at once. One session reported free disk space dropping from 67 GiB to 47 GiB within minutes. Sessions then made up a disk-space "admission" rule and polled for it: about 150 `df` and 110 `ps` checks across about 20 sessions. The `local-build` parallel-sessions guidance now says:

  * Prefer per-project rebuilds or an existing SDK.
  * Start a build once and wait on its process or log.
  * Don't poll `df`/`ps` in sleep loops, and don't broadcast disk or admission rules to other sessions.

This section is one line shorter.

### Standalone test command

`global.json` selects Microsoft.Testing.Platform, so `dotnet test <project>.csproj` fails:

    global.json defines test runner to be Microsoft.Testing.Platform. All projects must use that test runner.
    The following test projects are using VSTest test runner: ...

The `tests` skill and its catalog now use `dotnet test --project <project>.csproj`.

Net change across the four instruction files: −1 line.

Validation: documentation-only, so nothing was built or tested. The `--project` form was confirmed by an agent session after the MTP migration: 142 tests passed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

5 participants