Repository navigation
Description
Operating system
macOS
Orca version
v1.4.162
Details
Short summary: The Azure DevOps integration cannot authenticate against on-prem Azure DevOps Server (TFS). Every request is sent with api-version=7.1, which Server rejects with HTTP 400 unless the -preview suffix is supplied. The integration card therefore sits on "Auth failed" forever, even with a valid PAT, and no PRs or build statuses are ever fetched.
There is a second, related problem underneath it: connectionData and the Git endpoints live at different scopes on Server, so a single ORCA_AZURE_DEVOPS_API_BASE_URL cannot serve both.
What happened?
With ORCA_AZURE_DEVOPS_TOKEN and ORCA_AZURE_DEVOPS_API_BASE_URL set for an on-prem Azure DevOps Server, the integration card shows:
Azure DevOps credentials are configured but could not authenticate. Check the token, API base URL, and repository permissions, then restart Orca if environment variables changed.
The PAT is fine. The request is not. getAzureDevOpsAuthStatus() probes /_apis/connectionData, and apiUrl() appends a hardcoded version:
const params = {
...searchParams,
'api-version': searchParams?.['api-version'] ?? '7.1',
}Azure DevOps Server answers that with:
{
"message": "The requested version \"7.1\" of the resource is under preview. The -preview flag must be supplied in the api-version for such requests. For example: \"7.1-preview\"",
"typeKey": "VssInvalidPreviewVersionException"
}requestAzureDevOpsJsonAtBase() turns the non-OK response into null, getAzureDevOpsAuthStatus() reads that as authenticated: false, and the card renders "Auth failed". The failure is indistinguishable from a bad token, which is what makes it hard to diagnose from the UI.
Verified with curl against a real Server instance (host anonymized), same PAT for every row:
| Request | Result |
|---|---|
/_apis/connectionData (no api-version) |
200, valid authenticatedUser |
/_apis/connectionData?api-version=7.1 — what Orca sends |
400 VssInvalidPreviewVersionException |
/_apis/connectionData?api-version=7.1-preview |
200 |
/_apis/connectionData?api-version=7.0 / 6.0 / 5.0 |
400 |
<project>/_apis/git/repositories/<repo>?api-version=7.1-preview |
200 |
<project>/_apis/git/repositories/<repo>/pullrequests?api-version=7.1-preview |
200 |
Second problem: connectionData and Git endpoints need different scopes
On Server the two endpoints do not live at the same level:
| URL | connectionData |
_apis/git/* |
|---|---|---|
.../tfs/MyCollection (collection) |
200 | 400 — "A project name is required in order to reference a Git repository by name." |
.../tfs/MyCollection/MyProject (project) |
401 | 200 |
configuredApiBaseUrl() lets the env var win over the base URL derived from the remote:
function configuredApiBaseUrl(repo) {
const configured = getAzureDevOpsAuthConfig().apiBaseUrl
return configured ? normalizeAzureDevOpsApiBaseUrl(configured) : repo.apiBaseUrl
}So whichever value is set breaks the other half, and because the env var is global it also overrides the correctly derived per-repo base for every Azure DevOps repo — including repos in a different project, which then get the wrong project silently substituted.
Note that parseGitHttpPath() already derives the right project-level base from a Server remote on its own (.../tfs/MyCollection/MyProject/_git/my-repo → prefix tfs/MyCollection, project MyProject). The env var mainly exists because getAzureDevOpsAuthStatus() needs a base URL before any repo is known.
How can we reproduce it?
- Point a repo at an on-prem Azure DevOps Server remote, e.g.
https://ado.example.com:8443/tfs/MyCollection/MyProject/_git/my-repo - Set
ORCA_AZURE_DEVOPS_TOKENto a valid PAT (Code: Read, Build: Read) andORCA_AZURE_DEVOPS_API_BASE_URLtohttps://ado.example.com:8443/tfs/MyCollection - Restart Orca, open the Azure DevOps integration card, hit Re-check
- Card reports "Auth failed". No PR or build status appears on any worktree card.
Suggested fix
- api-version: on
VssInvalidPreviewVersionException(or any 400 from a version-bearing request), retry once with-previewappended and remember the result per host. Alternatively detect Server vs. Services fromconnectionData(Server exposesdeploymentType/deploymentId) and pick the suffix accordingly, or simply expose the version asORCA_AZURE_DEVOPS_API_VERSION. There is no env override today — the bundle only readsORCA_AZURE_DEVOPS_{TOKEN,PAT,ACCESS_TOKEN,USERNAME,API_BASE_URL}. - Scope: treat the configured base URL as collection-level for
connectionDataonly, and keep using the per-repoapiBaseUrlderived from the remote for the Git endpoints instead of letting the env var override it. That also fixes the multi-project case. - Error surfacing: the card cannot distinguish "bad token" from "server rejected the request". Carrying the upstream HTTP status and
typeKeyinto the status text would have made this a one-minute diagnosis.
Worth flagging for whoever picks this up: both open Azure CLI auth PRs — #12201 (feat(azure-devops): authenticate via az CLI Entra login with token fallback) and #6735 (Connect Azure DevOps with the Azure CLI without a PAT) — carry url.searchParams.set('api-version', '7.1') through unchanged. They swap the auth mechanism, not the version, so on-prem Server stays broken after either one merges. The line dates back to #2028, which added the integration and looks to have been tested only against dev.azure.com.
Anything else that might help
Current workaround here is a loopback rewrite proxy that ORCA_AZURE_DEVOPS_API_BASE_URL points at. It appends -preview to the api-version and lifts _apis/git/* from collection to project level, passing Orca's Authorization header straight through. With that in place the card authenticates and PR/build statuses work, which confirms nothing else in the integration is Server-incompatible — it really is just the version suffix and the scope split.
Activity