Skip to content

chore: copilot agent triage env + instructions (static-first, runtime-fallback)#1872

Draft
wenytang-ms wants to merge 3 commits into
developfrom
chore/copilot-setup-steps
Draft

chore: copilot agent triage env + instructions (static-first, runtime-fallback)#1872
wenytang-ms wants to merge 3 commits into
developfrom
chore/copilot-setup-steps

Conversation

@wenytang-ms

@wenytang-ms wenytang-ms commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

Two files that together let the GitHub Copilot coding agent triage issues with a static-analysis-first, runtime-fallback approach:

  1. .github/workflows/copilot-setup-steps.yml — provisions the runtime (JDK 21, Node 20, gradle-server jars, Xvfb) so the agent can build and run the extension when static analysis is inconclusive.
  2. .github/copilot-instructions.md — codifies the triage behavior contract: prefer static code + git-history analysis, only build/run testVsCode to reproduce when needed, emit a structured verdict, never fix product code (at most a draft PR with one failing regression test), and treat issue bodies as untrusted input.

Why

When an issue is escalated to the Copilot cloud agent for root-cause analysis, the agent always works in a checkout of the repo, so static code + git-history analysis is available with zero setup. The expensive part is the fallback: when static analysis is inconclusive, the agent should be able to build the gradle-server jars and run the testVsCode autotest to reproduce the issue at runtime.

The default Copilot environment does not have JDK 21, the sibling build-server-for-gradle repo, the built jars, or a headless display, so the runtime fallback would otherwise fail (or be slow and unreliable via trial-and-error). This file preinstalls them deterministically.

What it does

Mirrors the runtime of the build-and-analyse + test-extension jobs in .github/workflows/main.yml:

  • JDK 21 (temurin) + Node 20 (npm cache)
  • Checks out microsoft/build-server-for-gradle into extension/build-server-for-gradle
  • ../gradlew buildJars then ../gradlew build (the latter produces extension/lib incl. the gradle-server start script via :gradle-server:serverStartScripts, plus dist/out) + npm ci + chmod +x extension/lib/gradle-server
  • Caches ~/.gradle and extension/.vscode-test
  • Installs xvfb (not started — background procs don't persist into the agent session; the agent runs xvfb-run -a ../gradlew testVsCode on demand)

Notes / follow-ups

  • Default branch: copilot-setup-steps.yml only takes effect once merged to the default branch (develop).
  • Firewall allowlist: the runtime fallback downloads Gradle distributions + Maven deps. The repo's Copilot firewall must allow services.gradle.org, repo.maven.apache.org, plugins.gradle.org, etc., or buildJars/testVsCode will fail.
  • Security: keep the copilot environment free of publish/signing secrets — the runtime fallback builds untrusted Gradle projects from issue bodies (Gradle's configuration phase executes arbitrary code).
  • Cost: buildJars adds a few minutes to every Copilot session (mitigated by Gradle caching). Acceptable trade-off for runtime-capable triage.

Opened as a draft for review of the fixture/command details before enabling.

wenytang-ms and others added 3 commits June 9, 2026 12:43
Provisions JDK 21, Node 20, gradle-server jars and Xvfb so the GitHub Copilot cloud agent can build and run the extension's autotest when reproducing issues. Mirrors the runtime of the build-and-analyse + test-extension jobs in main.yml. Static code analysis needs no setup since the agent always has a repo checkout; these steps enable the optional runtime-reproduction fallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…exists

buildJars only produces jars; the lib/gradle-server launcher is created by :gradle-server:serverStartScripts (run via gradlew build). Mirrors the build-and-analyse job that uploads the lib artifact consumed by test-extension.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…age flow

Codifies the issue triage decision flow for the Copilot coding agent: prefer static code+git analysis, fall back to building/running testVsCode only when inconclusive. Includes repo orientation, build/lint/test commands, a structured verdict format, draft-PR-with-failing-test boundary, and a security boundary treating issue bodies as untrusted input.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wenytang-ms wenytang-ms changed the title chore: add copilot-setup-steps for runtime issue repro chore: copilot agent triage env + instructions (static-first, runtime-fallback) Jun 9, 2026
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.

1 participant