azure-devops-cli: handle long comments on Windows (#2061)#2140
Open
KomalSrinivasan wants to merge 1 commit into
Open
azure-devops-cli: handle long comments on Windows (#2061)#2140KomalSrinivasan wants to merge 1 commit into
KomalSrinivasan wants to merge 1 commit into
Conversation
Contributor
🔒 PR Risk Scan ResultsScanned 2 changed file(s).
✅ No matching risk patterns were detected in changed files.
|
Contributor
🔍 Skill Validator Results
Summary
Full validator output |
On Windows 'az' is a cmd.exe batch wrapper capped at ~8191 characters, so a long --discussion / --description value silently truncates or fails. Document three verified ways out so the coding agent doesn't waste 3-5 turns falling back to raw token retrieval and REST: 1. azps.ps1 in PowerShell on Windows. Same Azure CLI, invoked through the Python entry point with no cmd.exe length cap. Pair with 'Get-Content -Raw' so the body lives in a variable, not on the command line. 2. Native --file-path flags where Azure CLI offers them. Applies to 'az devops wiki page create' and 'az devops wiki page update', both documented with --encoding. 3. 'az devops invoke --in-file' as the universal escape hatch for commands with no --file-path (work-item --discussion, PR --description). Documented example posts to the work item comments REST endpoint with api-version 7.0-preview.3. The earlier draft suggested the Azure CLI '@<file>' convention as a generic substitute for inline string args. The official docs only document it for JSON parameters and the CLI source uses 'get_file_json' specifically, so the claim is removed and replaced with an explicit warning not to rely on it for plain string args. Files touched: - skills/azure-devops-cli/SKILL.md: new 'Posting long comments on Windows' section with shell-detection table and three verified options. - skills/azure-devops-cli/references/boards-and-iterations.md: short pointer at each --discussion example back to SKILL.md, plus an inline PowerShell snippet. Closes github#2061.
e565871 to
0754522
Compare
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.
Closes #2061.
@gcapnias flagged that long Azure DevOps comments fail on Windows because
azresolves toaz.cmd, acmd.exebatch wrapper capped at ~8191 characters. The agent then burns 3-5 turns falling back to raw token retrieval and REST calls instead of reaching forazps.ps1(the PowerShell entry that bypasses the cap).This PR teaches the skill three verified ways out, picked in priority order, so the agent routes correctly the first time.
What the skill now documents
skills/azure-devops-cli/SKILL.mdpicks up aPosting long comments on Windowssection placed before the Reference Files table so it lands in the agent's context window early:cmd.exe-wrappedazon Windows) versus when plainazis fine (PowerShell or bash on macOS / Linux).azps.ps1in PowerShell on Windows. Same Azure CLI invoked through the Python entry point with nocmd.execap. Paired withGet-Content -Rawso the body lives in a variable.--file-pathflags where the Azure CLI offers them. Applies toaz devops wiki page create/update(verified against the official command reference, both take--file-pathplus--encoding).az devops invoke --in-fileas the universal escape hatch for commands with no--file-path(--discussion,--description). Worked example posts toPOST /{project}/_apis/wit/workItems/{id}/comments?api-version=7.0-preview.3, which is the documented Work Item Comments REST endpoint.skills/azure-devops-cli/references/boards-and-iterations.mdpicks up short pointers right next to the two--discussionexamples (az boards work-item createandaz boards work-item update) so the pattern is visible at point of use, plus an inline PowerShell snippet showing theGet-Content -Raw+azps.ps1flow.What changed since the first draft of this PR
The earlier draft also recommended the Azure CLI
@<file>convention as a universal substitute for inline string args. On a second pass I checked:@<file>for JSON parameters.get_file_json, which is JSON-specific.@<file>expands plain string args like--discussion.So I pulled the
@filerecommendation and added an explicitDon't rely on @<file> for plain string argswarning instead. The three options that ship now are all backed by official Microsoft documentation:azps.ps1exists in the Azure CLI repo and invokespython -m azure.clidirectly.--file-pathforaz devops wiki pageis in the official reference.--in-fileforaz devops invokeis in the official reference with a worked example.Verification
npm run buildexits 0, regeneratesmarketplace.jsoncleanly.npm run skill:validatereportsazure-devops-clias valid. (The validator surfaces an unrelated upstream issue inaws-cloudwatch-investigation; out of scope here.)git diff --stat mainshows 2 files touched. No README diff because the skilldescriptionfield is unchanged.Out of scope
az repos pr create / update --description. The same routing applies (useazps.ps1oraz devops invoke) and SKILL.md says so generically, but I left therepos-and-prs.mdexamples alone to keep the diff tight. Happy to extend if maintainers want.