Add Support for Azure DevOps as Git Forge #23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Acceptance Criteria
https://dev.azure.com/...I have not started on this. The issue is too open-ended for one pull request, and a few design decisions need a human first.
Scope. A new
internal/forge/azuredevopsbackend has to implement the wholeForgeinterface. It also needs the sharedforgetestsuite extended, abackendsregistration, an ADR and README updates. The repo rules also require every method to be covered.Open questions:
dev.azure.com/<org>/<project>/_git/<repo>).forge.Repois currently owner/name. Should we map it toorg/project/repo, or add a field? Which URL forms must be supported (dev.azure.com, the older*.visualstudio.com, Azure DevOps Server)?GetIssue,ListIssues,CommentOnIssueandSetLabelsneed a decision. Should work items be mapped to issues, or should issues be unsupported with the tracker (MCP) path used instead (ADR 0006)? Pull request numbers and work item IDs can collide.PostReviewandSetLabelsmap to these?GitAuthorizationrequirement that the token appears verbatim for the egress proxy to swap (ADR 0013). A decision is needed on how to handle it.Once these are answered, it would probably help to split the work into several issues: a design/ADR first, then repo and PR operations, then work items and CI.
🤖 Written by an AI agent (factory) using this account.
Answers:
dev.azure.com. since this is the only forge so far using this I'd just map it somehow.printf ':%s' "$PAT" | base64
Refined Specification: Add Azure DevOps Backend
Goal
Add an Azure DevOps backend to the factory's forge layer, implementing the
forge.Forgeinterface for Azure DevOps Services (dev.azure.com). This enables agents to work with Azure DevOps repositories for pull request operations.Required Facts
Based on the author's answers in issue comments:
org/project/repotoforge.Repo(currentlyowner/name). Only supportdev.azure.comfor now.ErrNotFoundfor issue-related methods.PostReviewbut it may be called only from interactive sessions.Basic <token>), stored asFACTORY_FORGE_TOKEN. The backend'sGitAuthorization(token)returns"Basic " + token.Implementation Tasks (Split into Sub-items)
Sub-item 1: ADR for Azure DevOps Backend
Title: ADR: Add Azure DevOps Backend
Goal: Document the design decisions for Azure DevOps support.
Required facts:
org/project/repotoforge.Repo(useorg/projectas owner,repoas name)ErrNotFound(use MCP for project management)BasicformatDone criteria:
docs/decisions/NNNN-azure-devops-backend.mdHow to verify:
Sub-item 2: Azure DevOps Backend Implementation
Title: Add Azure DevOps Backend
Goal: Implement
internal/forge/azuredevopswith fullforge.Forgeinterface.Required facts:
dev.azure.com/<org>/<project>/_git/<repo>→Repo{Owner: "org/project", Name: "repo"}ErrNotFound(issues unsupported, use MCP)PostReviewandListReviewsCIStatus{State: CINone}(out of scope)GitAuthorization(token)returns"Basic " + tokenDone criteria:
internal/forge/azuredevops/azuredevops.goimplements allforge.Forgemethodsforgetest.Runwith a fake HTTP serverinternal/forge/backends/backends.gojust checkpassesHow to verify:
go test ./internal/forge/azuredevops/...passesjust checkpassesSub-item 3: Update Documentation
Title: Update README.md and docs for Azure DevOps Support
Goal: Document Azure DevOps as a supported forge.
Required facts:
docs/using-the-factory.mdwith Azure DevOps setupfactory.example.jsonwith Azure DevOps configuration exampleDone criteria:
How to verify:
Open Questions
Repository addressing format: The author suggested mapping
org/project/repotoowner/name. Should we use:Repo{Owner: "org/project", Name: "repo"}(simplest, keepsforge.Repounchanged)?Projectfield toRepostruct?Decision: Use
Repo{Owner: "org/project", Name: "repo"}for simplicity, keeping the existingRepostruct unchanged.Issue operations: The author said to ignore issue operations entirely. Should all issue-related methods return
ErrNotFound, or should some return empty results?Decision: All issue operations return
ErrNotFoundsince Azure DevOps uses a different system for work items.Review operations in interactive sessions: The author mentioned reviews are done in interactive sessions. Should the backend validate that reviews are only posted from interactive sessions, or is this handled by the agent/harness?
Decision: The backend implements
PostReviewwithout session validation. Interactive session handling is managed by the agent/harness, not the forge backend.URL forms: Should we support the older
*.visualstudio.comURLs, or onlydev.azure.com?Decision: Only
dev.azure.comfor now (as stated by author).Pull request URL parsing: Azure DevOps PR URLs are
dev.azure.com/<org>/<project>/_git/<repo>/pullrequest/<id>. How should we extract the repo parts?Decision: Parse
dev.azure.com/<org>/<project>/_git/<repo>→Repo{Owner: "org/project", Name: "repo"}. The pull request ID is separate.Decisions
Repo{Owner: "org/project", Name: "repo"}format, keeping the existingRepostruct unchanged.ErrNotFound.PostReviewwithout session validation.dev.azure.comsupported (no*.visualstudio.com).CIStatus{State: CINone}(out of scope).🤖 Written by the factory's refiner, an AI agent, using this account.
Repo{Owner: "org/project"}does not work as is:ParseRepo(internal/forge/forge.go) splits at the first/and allows no/in either part. How Azure's org/project/repo is passed and parsed is a design decision for the ADR, not settled yet. Propose options.ErrNotFound. The factory comments on pull requests throughCommentOnIssue(implement-issue step 6.4, run reports). On Azure, commenting on a pull request must work; only real issues are unsupported.forgetest.Runtests issue operations. A backend without issues needs a way to skip them in the suite; that is part of the work.Azure DevOps backend: refined specification
Replaces the refiner's specifications in comments 414 and 418 (its original version is in this comment's edit history). Decisions marked (decided) are my answers
(comment 415 and the refine session on 2026-11-20); (proposal) still needs my confirmation before an implementer starts on it.
Decisions
dev.azure.com. No issues (work items come from a tracker over MCP, ADR 0006), no CI, no end-to-end tests.base_url(https://dev.azure.com/<org>).-repois<project>/<repo>, soforge.RepoandParseRepo(internal/forge/forge.go:72, :82) stay unchanged:Ownerholds the Azure project,Namethe repository. Projects or repositories whose names contain charactersrepoPartdoes not allow ([A-Za-z0-9_.-], e.g. spaces) are unsupported for now; the ADR says so.FACTORY_FORGE_TOKENholds the already encoded credential (printf ':%s' "$PAT" | base64, done once on the host).GitAuthorization(token)returns"Basic " + token, and the API client sends the same header. The factory encodes nothing, so a proxy can swap the placeholder (ADR 0013).GetIssue,ListIssuesandSetLabelsreturn a clear error: not supported on Azure DevOps, use a tracker.CommentOnIssueon a pull request number creates a pull request thread: the factory comments on pull requests this way (implement-issue step 6.4, run reports).forgetestgets a capability that skips the issue tests for backends without issues (they testGetIssue,ListIssuesand labels, internal/forge/forgetest/forgetest.go:143ff). Pull request comment tests still run.forge.WithPolicy, not only in the skill."reviews": "interactive"(default"all").forge.Policy(internal/forge/policy.go:17) does not know whether a run is interactive; the dispatcher passes it in (internal/dispatch/dispatch.go:272, and tofactory mcpthrough aFACTORY_*variable read in internal/ops/env.go:87).Sub-items
Implement in this order. Each one is one pull request, with tests, docs and
just checkpassing.1. ADR: Azure DevOps backend
docs/decisions/0017-azure-devops-backend.md, including what is unsupported and why.2. Azure DevOps backend: skeleton (proposal: split from the PR operations)
config.ForgeAzureDevOps = "azuredevops"next to the existing types (internal/config/config.go:25);backends.New(internal/forge/backends/backends.go:17);internal/forge/azuredevopswithWhoami,GetRepo,GetPermission,GitAuthorization(decision 3);forgetestcapability (decision 5).forgetest.Runagainst anhttptestfake, with issue tests and the not-yet-implemented groups skipped; unit tests for the error messages and theBasicheader.docs/using-the-factory.md(Azure setup, token encoding);factory.example.json.3. Azure DevOps backend: pull request operations
CreatePullRequest,GetPullRequest(including its comments, from the pull request threads),GetPullRequestDiff,ListPullRequests,ListReviews(reviewer votes and their comments);GetCIStatusreturnsCINone(decision 1).forgetestgroups run against the fake.4. Azure DevOps backend: pull request comments
CommentOnIssuewith a pull request number creates a pull request thread (decision 4).forgetestcomment tests run against the fake; a comment on a number that is not a pull request returns the "not supported" error.5. Reviews only in interactive sessions
forge.Policygets the review setting and whether the run is interactive; the guardedPostReviewrefuses headless reviews when the setting is"interactive";factory mcppass both in (decision 7);skills/review-pr/SKILL.md: in an interactive session under this setting, propose each comment and post only the approved ones. The PR needs an Evidence section (AGENTS.md).