Skip to content

[Fix] Azure DevOps connectionData requests always fail with a 400 - #896

Merged
daniel-lxs merged 1 commit into
developfrom
claude/ado-connectiondata-preview
Jul 30, 2026
Merged

[Fix] Azure DevOps connectionData requests always fail with a 400#896
daniel-lxs merged 1 commit into
developfrom
claude/ado-connectiondata-preview

Conversation

@daniel-lxs

Copy link
Copy Markdown
Member

Problem

Azure DevOps only serves /_apis/connectionData at preview api-versions. Requesting it with the shared GA version fails on every call:

connectionData api-version=7.1          -> 400 "The -preview flag must be supplied..."
connectionData api-version=7.0          -> 400 (same message)
connectionData api-version=7.1-preview  -> 200 (returns authenticatedUser)

Two features depended on that call and were silently broken:

  • Own-comment detection on ADO PR and work item comments: getAdoDeploymentUser threw on every call, so isDeploymentTokenAuthor failed open (a console.warn and false), leaving only the name-prefix check to keep Roomote from reacting to comments it posted itself.
  • Reviewer votes: submit_pull_request_review with approve/request_changes resolves the voting identity through the same resource before casting the vote, so ADO reviewer votes always failed.

Fix

A dedicated ADO_CONNECTION_DATA_API_VERSION = '7.1-preview' constant for the two connectionData call sites (packages/ado and packages/sdk), matching the constant apps/web/src/lib/server/auth.ts already uses for its vssps connectionData probe. The shared ADO_API_VERSION stays 7.1 for the GA resources. Test URL assertions now pin the -preview suffix so this cannot regress silently.

Verification

  • Reproduced the 400/400/200 matrix above against a real dev.azure.com organization, and ran the fixed getAdoDeploymentUser live: it resolves the deployment identity where it previously threw.
  • Confirmed live that the id connectionData returns for a PAT matches the id on the same user's PR-surface activity, so the id branch of isDeploymentTokenAuthor detects Roomote's own comments. (The existing normalizeAdoLinkedAccountKey docblock caveat about vssps vs org identity ids applies to Entra OAuth, not PAT.)
  • @roomote/ado suite (41), sdk pull-request-writes tests (13), and all ADO handler tests in apps/api (60) pass; tsc --noEmit clean on both packages.

Context: found as a follow-up to #888, whose credential probe hit the same 400 and deliberately switched to /_apis/git/repositories instead of touching getAdoDeploymentUser.

🤖 Generated with Claude Code

Azure DevOps only serves /_apis/connectionData at preview api-versions:
plain 7.1 (and 7.0) always answer 400 with "The -preview flag must be
supplied". That made getAdoDeploymentUser throw on every call, silently
degrading Roomote's own-comment detection on ADO PR and work item
comments (isDeploymentTokenAuthor fails open), and broke ADO
approve/request-changes reviewer votes, which resolve the voting
identity through the same resource.

Use a dedicated ADO_CONNECTION_DATA_API_VERSION = '7.1-preview' for the
two connectionData call sites, matching the constant apps/web already
uses for its vssps connectionData probe. The shared ADO_API_VERSION
stays 7.1 for the GA resources.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roomote-roomote

roomote-roomote Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

No code issues found. See task

Reviewed 8bd192c

@daniel-lxs
daniel-lxs merged commit 38dbab0 into develop Jul 30, 2026
18 checks passed
@daniel-lxs
daniel-lxs deleted the claude/ado-connectiondata-preview branch July 30, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant