Repository navigation
Restrict issue-investigation draft PRs to docs and test sources - #1925
Open
Elliot (theelliotm) wants to merge 3 commits into
Open
Elliot (theelliotm) wants to merge 3 commits into
Elliot (theelliotm) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83e19dbb-1bf5-41ad-80f0-47fe416d8093
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The Markdown allowlist permits changes to a PowerShell example executed by CI, allowing an apparently documentation-only PR to run agent-modified code when a maintainer starts checks.
2 open issues
What changed in this PR
Hardens MXC’s /investigate workflow by narrowing draft PR changes and deferring CI until maintainer action.
Changes:
- Restrict edits to selected Markdown, JSON fixtures, and SDK test sources.
- Use
GITHUB_TOKENfor PR creation and disable the extra CI-triggering commit. - Document the restricted scope and manual CI steps.
| File | Description |
|---|---|
CONTRIBUTING.md |
Explain scope restrictions and how maintainers start CI. |
.github/workflows/issue-investigation.md |
Narrow the allowlist, pin tokens, and update agent guidance. |
.github/workflows/issue-investigation.lock.yml |
Apply compiled restrictions and token settings while preserving action pins. |
Review effort: Max
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The command guard accepts commented-out flags and empty quoted refs, allowing invalid commands to pass validation, while the new file and token restrictions lack CI-wired regression coverage.
2 open issues
2 resolved since last review
Review effort: Max
| assert.equal(result.status, 0, result.stdout + result.stderr); | ||
| const args = JSON.parse(result.stdout); | ||
| const command = example[1].replace(/`\r?\n/g, " ").trim(); | ||
| assert.ok(!/[\r\n;|&$`(){}<>]/.test(command), `expected one literal command: ${command}`); |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



📖 Description
Narrows what the
/investigateagentic workflow can change in its draft PRs, and stops those PRs from starting CI on their own.allowed-files(docs/**,tests/**,sdk/node/tests/**,sdk/dotnet/Microsoft.Mxc.Sdk.Tests/**) with an explicit allowlist: Markdown underdocs/andtests/, JSON undertests/policy/andtests/fixtures/,.tsundersdk/node/tests/, and.csundersdk/dotnet/Microsoft.Mxc.Sdk.Tests/. Each scope lists bothdir/*.extanddir/**/*.ext, because gh-aw's matcher requires at least one subdirectory for**/.tests/scripts/**,tests/regression_tests/**/*.ps1), e2e configs read by those scripts (tests/configs/**,tests/examples/**), or build/package files (*.csproj,Directory.Build.*,package.json,package-lock.json,.npmrc,tsconfig.json, runner scripts).GITHUB_TOKENand setgithub-token-for-extra-empty-commit: ${{ '' }}so agent PRs never start CI through a PAT. gh-aw v0.81.6 has nononevalue; an empty token makes the runtime skip the extra commit.draft: trueis unchanged.CONTRIBUTING.mdlist the narrower scope.CONTRIBUTING.mdalso says how to start CI: after review, close and reopen the PR or push a commit to it. The CI workflows use the defaultpull_requestevents, and marking the draft ready doesn't start them.issue-triage.mdhas no PR or bash output; unchanged.git merge-file, which keeps Dependabot's pins. Delta: allowlist and token in both safe-outputs configs,GH_AW_CI_TRIGGER_TOKENremoved from the secrets manifest, safe_outputs checkout/git token →GITHUB_TOKEN, hashes.Limitations: allowed SDK test sources still run in CI when a maintainer starts it, so review the draft first. No suitable PR label exists.
🔗 References
* @microsoft/tessera-code-reviewers; consider a dedicated owner fortests/scripts/and.github/workflows/.GH_AW_CI_TRIGGER_TOKENorGH_AW_GITHUB_TOKENsecret exists (other workflow steps still fall back toGH_AW_GITHUB_TOKEN).🔍 Validation
gh aw compile issue-investigation(v0.81.6): passed, 0 errors, 0 warnings. Recompiling the final source reproduces the compiler delta used in the lock exactly.gh aw compile issue-investigation --no-emit --strict --validate: passed, 0 errors, 0 warnings.git merge-filecheck: non-intended lock delta (new compile → committed lock) is identical to (unchanged-source compile →mainlock), i.e. only Dependabot pins (60 lines).actionlint -shellcheck= -pyflakes= .github/workflows/issue-investigation.lock.yml(v1.7.12): 3 findings (copilot-requestsscope ×2,concurrency.queue), identical tomain; no new findings.globPatternToRegex(v0.85.1 runtime) againstgit ls-files: all 185 tracked files in the intended scopes match (including root-level files such astests/policy/*.json), and nothing outside them matches.tests/scripts/*.sh,tests/configs/*.json,*.csproj,package.json,src/**and.github/workflows/*are rejected.git ls-files --eol -m -o --exclude-standard: all changed files LF./investigaterun (requires a maintainer comment on a live issue).✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type