Skip to content

fix(server): read Azure DevOps pull requests from the app - #7316

Closed
kummerer94 wants to merge 1 commit into
pingdotgg:mainfrom
kummerer94:t3code/fix-azure-devops-pr-sidebar
Closed

fix(server): read Azure DevOps pull requests from the app#7316
kummerer94 wants to merge 1 commit into
pingdotgg:mainfrom
kummerer94:t3code/fix-azure-devops-pr-sidebar

Conversation

@kummerer94

@kummerer94 kummerer94 commented Aug 17, 2026

Copy link
Copy Markdown

What 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 + 1 rows, 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 --noEmit in apps/server — exit 0, no new diagnostics
  • pnpm exec vp lint --report-unused-disable-directives on 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.

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

  • Adds repositoryNameOf helper in AzureDevOpsPullRequestCli.ts to extract the last path segment from a remote-style repository URL and decode any percent-encoded characters before passing it to az, preventing 404s.
  • Passes --resource <AZURE_DEVOPS_RESOURCE_ID> to az rest calls in listThreads so tokens are acquired for the correct Azure DevOps resource, avoiding HTML sign-in responses that caused JSON decode failures.
  • Behavioral Change: listPullRequests and listThreads now always use the decoded repository name; callers passing full remote paths will see different az arguments than before.

Macroscope summarized e4785c8.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c8bb78f-7e84-4068-bcb9-0aba5b917920

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 17, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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.

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>
@kummerer94
kummerer94 force-pushed the t3code/fix-azure-devops-pr-sidebar branch from 850cf19 to e4785c8 Compare August 17, 2026 12:24
@t3dotgg

t3dotgg commented Aug 28, 2026

Copy link
Copy Markdown
Member

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 t3dotgg closed this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants