fix(server): read Azure DevOps pull requests from the app - #7316
fix(server): read Azure DevOps pull requests from the app#7316kummerer94 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved e4785c8 Straightforward bug fix for Azure DevOps integration: extracts and decodes repository names correctly for the az CLI, and specifies the correct authentication resource ID. Changes are self-contained with comprehensive unit tests. You can customize Macroscope's approvability policy. Learn more. |
The pull requests page could not list an Azure DevOps repository, and no
Azure pull request could show its conversation.
The service names a repository the way its remote does, which below an
Azure host is the whole path, `{organization}/{project}/_git/{repository}`.
That went straight to `az repos pr list --repository`, which takes a name
or an id and interpolates whatever it is given into the REST route it
builds, so Azure answered 404 and the page reported the repository as
unreadable. The name is now taken from the path and unescaped, because a
project or repository named with a space reaches this as `%20`.
Reading the conversation went through `az rest` without naming the Azure
DevOps resource. Azure does not refuse the wrong token: it answers the
sign-in page, as HTML, with a status the CLI reports as success, so the
response failed to decode and no comment was ever shown. The call now
names the resource.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
850cf19 to
e4785c8
Compare
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together. #8364 remains open as the active path for the broader Azure DevOps response, authentication, and checkout failures. The Azure resource ID, decoded repository-name case, and HTML success-response fixtures in this PR remain useful as references while that work is reviewed. If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. |
What Changed
Two independent reasons an Azure DevOps repository could not be read from the pull requests page.
az repos pr list --repositorywas given a path, not a name. The service names a repository the way its remote does, which below an Azure host is the whole path,{organization}/{project}/_git/{repository}.aztakes a name or an id there and interpolates whatever it is given straight into the REST route it builds, so it addressed a route that does not exist and Azure answered 404. The page then reported the repository as unreadable and listed nothing. The name is now taken from the path and unescaped, because a project or repository named with a space reaches this as%20, which Azure would look up literally.The conversation read did not name the Azure DevOps resource.
az restasked for a token for the resource it defaults to. Azure does not refuse the wrong one: it answers the sign-in page, as HTML, with a status the CLI reports as success, so the response failed to decode and no comment was ever shown. The call now passes--resource 499b84ac-1321-427f-aa17-267ca6975798.Both are argument fixes to the
azcalls. No error semantics change: a thread read that fails still degrades to an empty conversation exactly as it does today.Why
The sidebar's pull request pill stopped opening the browser once the multi-provider page began claiming links it recognises, so for Azure DevOps hosts the click now lands on a surface that could not read the host.
Existing Azure tests passed throughout because every fixture used a bare repository name (
web,acme/web), which the repository identity resolver never produces for an Azure remote. The added tests use the real{organization}/{project}/_git/{repository}shape, including an escaped space.Verification
Against a live Azure DevOps organization, in a checkout whose identity carries an escaped project name:
ERROR: The controller for path '/…/_apis/git/repositories/{organization}/{project}/_git/{repository}/pullRequests' was not found or does not implement IController. Operation returned a 404 status code.limit + 1rows, so the truncation probe still worksRepo checks:
pnpm exec vp test run src/pullRequest— 373 passed, 13 files (2 tests added)pnpm exec tsgo --noEmitinapps/server— exit 0, no new diagnosticspnpm exec vp lint --report-unused-disable-directiveson the two changed files — cleanNote:
src/sourceControl/PrTemplateDetection.test.ts(3) andSourceControlRepositoryService.test.ts(1) fail on this branch. I confirmed by stashing that they fail identically on unmodifiedmain— pre-existing and unrelated.Checklist
Implemented with Claude Opus 5 (1M context) through the Claude Code harness in T3 Code.
🤖 Generated with Claude Code
Note
Medium Risk
Changes how Azure DevOps
azcommands are parameterized for all PR list and thread reads; wrong mapping would break listings or conversations for Azure remotes, but scope is limited to the Azure DevOps CLI adapter.Overview
Fixes Azure DevOps pull request listing and thread reads when the app passes full remote repository paths and when
az restneeds an explicit DevOps resource.listPullRequestsnow runs remote-style paths likeacme/platform/_git/webthroughrepositoryNameOfsoaz repos pr list --repositorygets the bare repo name (web), avoiding REST routes that 404. Percent-encoded names (e.g.web%20client) are decoded before the CLI call.listThreadsadds--resource 499b84ac-1321-427f-aa17-267ca6975798onaz restso token acquisition targets Azure DevOps instead of returning an HTML sign-in page that was mistaken for JSON.Tests cover path-to-name mapping, unescaping, and the new
--resourceargument on thread fetches.Reviewed by Cursor Bugbot for commit e4785c8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix Azure DevOps pull request reading by decoding repository names and using correct resource ID
repositoryNameOfhelper inAzureDevOpsPullRequestCli.tsto extract the last path segment from a remote-style repository URL and decode any percent-encoded characters before passing it toaz, preventing 404s.--resource <AZURE_DEVOPS_RESOURCE_ID>toaz restcalls inlistThreadsso tokens are acquired for the correct Azure DevOps resource, avoiding HTML sign-in responses that caused JSON decode failures.listPullRequestsandlistThreadsnow always use the decoded repository name; callers passing full remote paths will see differentazarguments than before.Macroscope summarized e4785c8.