fix(server): read Azure DevOps pull requests from the app #7316
main fromrefs/pull/7316/head·opened View on GitHubWhat Changed#
Two independent reasons an Azure DevOps repository could not be read from the pull requests page.
az repos pr list --repository was 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}. az takes 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 rest asked 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 az calls. 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:
- the previous list command →
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. - the fixed list command → exit 0,
limit + 1rows, so the truncation probe still works - the previous threads command → exit 0 with an HTML sign-in page as the body
- the fixed threads command → exit 0, valid JSON, real thread records
Repo 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 — clean
Note: src/sourceControl/PrTemplateDetection.test.ts (3) and SourceControlRepositoryService.test.ts (1) fail on this branch. I confirmed by stashing that they fail identically on unmodified main — pre-existing and unrelated.
Checklist#
- This PR is small and focused
- I explained what changed and why
- No UI changed, so there are no before/after screenshots
- No animation or interaction changes require a video
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 az commands 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 rest needs an explicit DevOps resource.
listPullRequests now runs remote-style paths like acme/platform/_git/web through repositoryNameOf so az repos pr list --repository gets the bare repo name (web), avoiding REST routes that 404. Percent-encoded names (e.g. web%20client) are decoded before the CLI call.
listThreads adds --resource 499b84ac-1321-427f-aa17-267ca6975798 on az rest so 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 --resource argument on thread fetches.
Note
Fix Azure DevOps pull request reading by decoding repository names and using correct resource ID#
- Adds
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. - Passes
--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. - Behavioral Change:
listPullRequestsandlistThreadsnow always use the decoded repository name; callers passing full remote paths will see differentazarguments than before.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
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.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
3c8bb78f-7e84-4068-bcb9-0aba5b917920You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.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.
❤️ Share