fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

fix(shared): detect Azure DevOps SSH remotes - #5273

Closed
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream
Closed

fix(shared): detect Azure DevOps SSH remotes#5273
Brechard wants to merge 11 commits into
pingdotgg:mainfrom
Brechard:fix/azure-devops-ssh-pr-detection-upstream

Conversation

@Brechard

@BrechardBrechard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Azure DevOps repositories using standard SSH remotes (git@ssh.dev.azure.com:v3/...) were classified as an unknown source-control provider. As a result, T3 Code did not run the Azure DevOps pull-request detection path even when the Azure CLI was available.

Fix

  • Recognize ssh.dev.azure.com as an Azure DevOps host.
  • Normalize that SSH host to https://dev.azure.com for Azure DevOps pull-request URLs and CLI integration.
  • Pass explicit Azure repository context through pull-request lookup, creation, clone URL retrieval, default-branch lookup, and checkout.
  • Use Git fetch with an exact PR-head checkout for SSH-backed and fork pull requests.
  • Add a regression test for the standard Azure DevOps SSH remote format.

Verification

  • Reproduced with a real Azure DevOps-backed repository in a local T3 development environment.
  • Verified the existing active pull request appeared in the T3 Code UI after the change.
  • Focused source-control tests: 101 passed.
  • @t3tools/shared typecheck: passed.
  • git diff --check: passed.

Fixes#5272

Completed by GPT-5.6-Luna via Codex.


Note

Medium Risk
Changes Azure DevOps PR listing, checkout, and Git remote identity paths; checkout behavior diverges from az repos pr checkout when repository context is present. PAT propagation from login shell touches credential-related environment handling.

Overview
Fixes Azure DevOps repos that use standard SSH remotes (git@ssh.dev.azure.com:v3/...) being treated as unknown providers, which blocked PR detection and Azure CLI workflows.

Shared detection adds parseAzureDevOpsRepositoryCoordinates and treats ssh.dev.azure.com as Azure DevOps with base URLs normalized to https://dev.azure.com. Git identity for remotes now resolves Azure org/project/repo (not only GitHub).

Azure DevOps CLI integration passes explicit --organization, --project, and --repository (or org-only for PR show) when context is parsed from the remote, instead of --detect true, which fails for SSH clones. Checkout with context uses az repos pr show plus git fetch and git checkout -B on the PR head branch, picking fork clone URLs to match SSH vs HTTPS. Fork PRs surface cross-repo metadata in normalized PR records.

The desktop app hydrates AZURE_DEVOPS_EXT_PAT from the login shell (with inherited values preserved), so Azure CLI auth works when the app is not launched from a terminal.

Reviewed by Cursor Bugbot for commit f103a6a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Azure DevOps SSH remote detection and explicit repository context to CLI commands

  • Extends detectSourceControlProviderFromRemoteUrl and isAzureDevOpsHost in sourceControl.ts to recognize ssh.dev.azure.com as Azure DevOps, normalizing baseUrl to https://dev.azure.com for SSH remotes.
  • Adds parseAzureDevOpsRepositoryCoordinates to extract organization/project/repository from both SSH (ssh.dev.azure.com v3) and HTTPS (dev.azure.com/_git) clone URLs.
  • Replaces --detect true flags in AzureDevOpsCli with explicit org/project/repo args derived from a new repositoryContext parameter, reducing reliance on Azure CLI auto-detection.
  • checkoutPullRequest now supports SSH-backed and fork PRs by fetching directly via git fetch/git checkout instead of az repos pr checkout, with failures mapped to a new AzureDevOpsGitCommandFailedError.
  • Normalized PR records now include fork metadata (isCrossRepository, headRepositoryNameWithOwner, source clone URLs) when returned by the Azure API.
  • Adds AZURE_DEVOPS_EXT_PAT to the login-shell environment variables propagated to the desktop app.

Macroscope summarized f103a6a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Azure DevOps repository detection for SSH and HTTPS remote URLs.
    • Pull-request listings, lookups, creation, checkout, and branch detection now work reliably with SSH repositories.
    • Azure DevOps SSH remotes now display the correct provider and base URL.
    • Desktop environments now correctly load Azure DevOps authentication settings from the login shell when needed.
  • Tests
    • Added coverage for SSH remote parsing, repository operations, checkout flows, and authentication environment handling.

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Azure DevOps SSH remotes are detected and parsed into repository context. Azure CLI operations use explicit repository arguments when context exists. Context-aware checkout fetches and checks out the pull-request branch. Fork repository URLs are preserved. The desktop shell propagates AZURE_DEVOPS_EXT_PAT.

Changes

Azure DevOps SSH pull-request support

Layer / File(s)Summary
Azure DevOps SSH remote detection
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
Azure DevOps detection includes ssh.dev.azure.com and maps it to https://dev.azure.com.
Fork source repository normalization
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
Pull-request normalization accepts fork repository metadata and prefers its SSH URL over its remote URL.
Repository context parsing and CLI operations
apps/server/src/sourceControl/AzureDevOpsCli.ts, apps/server/src/sourceControl/AzureDevOpsCli.test.ts
SSH and HTTPS remotes are parsed into organization, project, and repository values. Azure CLI operations use explicit arguments when context exists. Context-aware checkout retrieves the pull-request branch, fetches it, and checks it out from FETCH_HEAD.
Provider repository-context forwarding
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts, apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
The provider forwards repository context to pull-request, clone URL, default-branch, creation, and checkout operations. Cross-repository status uses the normalized source repository URL.

Desktop Azure DevOps PAT propagation

Layer / File(s)Summary
Azure DevOps PAT environment propagation
apps/desktop/src/shell/DesktopShellEnvironment.ts, apps/desktop/src/shell/DesktopShellEnvironment.test.ts
The desktop shell loads AZURE_DEVOPS_EXT_PAT from the POSIX login shell when absent and preserves an inherited value when present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
participant Repository
participant AzureDevOpsSourceControlProvider
participant AzureDevOpsCli
participant AzureDevOps
participant Git
Repository->>AzureDevOpsSourceControlProvider: provide remoteUrl
AzureDevOpsSourceControlProvider->>AzureDevOpsCli: pass parsed repositoryContext
AzureDevOpsCli->>AzureDevOps: retrieve pull-request branch with explicit repository arguments
AzureDevOps-->>AzureDevOpsCli: return branch and source repository URL
AzureDevOpsCli->>Git: fetch branch from source repository
Git-->>AzureDevOpsCli: return FETCH_HEAD
AzureDevOpsCli->>Git: checkout FETCH_HEAD
Git-->>AzureDevOpsCli: return command result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe changes satisfy [#5272] by detecting Azure DevOps SSH remotes and enabling active pull-request detection through explicit repository context.
Out of Scope Changes check✅ PassedThe CLI, checkout, fork handling, and desktop PAT changes support the linked issue’s Azure DevOps SSH pull-request workflow.
Title check✅ PassedThe title clearly identifies the main change: Azure DevOps SSH remote detection.
Description check✅ PassedThe description explains the problem, fix, scope, and verification, although it uses different headings from the template.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-actionsgithub-actionsBot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp

macroscopeappBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new capability for Azure DevOps SSH remote detection and handling, affecting runtime behavior across multiple Azure DevOps CLI operations. The changes enable a previously non-functional code path and modify how repository context is passed to CLI commands.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 12:52

Dismissing prior approval to re-evaluate db68732

@github-actionsgithub-actionsBot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 3, 2026
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 13:25

Dismissing prior approval to re-evaluate c4bdf94

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 3, 2026 14:14

Dismissing prior approval to re-evaluate 77ab0c4

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

macroscopeapp[bot]
macroscopeappBot previously approved these changes Aug 3, 2026
@Brechard
Brechardforce-pushed the fix/azure-devops-ssh-pr-detection-upstream branch from 77ab0c4 to c665bcbCompareAugust 4, 2026 11:54
@macroscopeapp
macroscopeappBot dismissed their stale reviewAugust 4, 2026 11:55

Dismissing prior approval to re-evaluate c665bcb

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@github-actionsgithub-actionsBot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/sourceControl/AzureDevOpsCli.ts`:
- Around line 234-236: Update the message returned by the error class’s get
message accessor to identify Git, not Azure DevOps CLI, as the failed command
while preserving the existing operation and detail values.
- Around line 122-124: Update the repository argument construction around
repositoryDetectionArgs so repositoryContext supplies only organization and
project while the repository parameter is always used for --repository,
preserving the requested selector when both values differ. Add a regression test
covering distinct repositoryContext and repository values and verify the
generated arguments target the requested repository.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3501c46a-1867-4f67-a45e-cbf701fcf862

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 7e69451.

📒 Files selected for processing (4)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macroscopeappmacroscopeappBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new Effect error introduced in apps/server/src/sourceControl/AzureDevOpsCli.ts. The rest of the touched service code (namespace imports, Foo["Service"] typing, dependency acquisition via yield* VcsProcess.VcsProcess, layer export, inline error construction at the failure boundary, bounded error attributes) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
Comment threadapps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts Outdated
Comment threadapps/server/src/sourceControl/azureDevOpsPullRequests.ts Outdated
Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/server/src/sourceControl/azureDevOpsPullRequests.ts (1)

151-165: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the fork clone transport through checkout.

The PR normalizer drops the HTTPS clone URL when Azure returns both sshUrl and remoteUrl. AzureDevOpsCli.checkoutPullRequest then uses that single sourceRepositoryUrl for the fork git fetch, so an HTTPS checkout without SSH credentials fails.

Retain both fork clone URLs and choose the transport only during checkout. Include focused HTTPS and SSH fork-checkout tests for the selected fetch URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts` around lines 151 -
165, Update the Azure DevOps pull-request model and normalizer in
apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/sourceControl/azureDevOpsPullRequests.ts`:
- Around line 151-165: Update the Azure DevOps pull-request model and normalizer
in apps/server/src/sourceControl/azureDevOpsPullRequests.ts:18-19 and 151-165 to
retain both fork SSH and HTTPS clone URLs instead of selecting one. Update
AzureDevOpsSourceControlProvider.ts:76-83 and 240-247 to propagate both values
through the provider and let AzureDevOpsCli.checkoutPullRequest choose the URL
matching the configured checkout transport. Extend
AzureDevOpsCli.test.ts:590-666 with focused HTTPS and SSH fork-checkout cases
asserting the selected fetch URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b81124-5404-4927-8003-5eac02c4bd5c

📥 Commits

Reviewing files that changed from the base of the PR and between c665bcb and 595ca4d.

📒 Files selected for processing (5)
  • apps/server/src/sourceControl/AzureDevOpsCli.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
  • apps/server/src/sourceControl/azureDevOpsPullRequests.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
  • apps/server/src/sourceControl/AzureDevOpsCli.ts

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai resume

@Brechard

Copy link
Copy Markdown
ContributorAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@github-actionsgithub-actionsBot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026

@cursorcursorBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 545281d. Configure here.

Comment threadapps/server/src/sourceControl/AzureDevOpsCli.ts
@t3-code

t3-codeBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

closing as already addressed. Azure DevOps SSH remote detection merged in #6187.

@t3-codet3-codeBot closed this Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL500-999 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps PRs are not detected for SSH remotes

2 participants

@Brechard@rodrigoB-CB