Skip to content

Open, track and merge pull requests on Bitbucket and Azure DevOps repos - #1678

Merged
currentbits merged 3 commits into
mainfrom
coder/bitbucket-and-azure-devops-as-first-clas-2e71ce
Oct 19, 2026
Merged

currentbits merged 3 commits into
mainfrom
coder/bitbucket-and-azure-devops-as-first-clas-2e71ce

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Projects on Bitbucket Cloud or Azure DevOps can now use the same PR flow as GitHub and GitLab: open a PR, see its status and CI in the thread header, and squash-merge it. The planboard and issues stay GitHub/GitLab only, as #456 scoped. Closes #456.

Changes

  • PR create / status / checks / merge on Bitbucket Cloud. Calls the Bitbucket REST API using the SOLENTA_BITBUCKET_* tokens that Settings → Source Control already probes. Checks come from commit statuses.
  • The same for Azure DevOps. Runs az repos pr (the azure-devops extension), matching the existing Settings probe. Recognizes dev.azure.com, *.visualstudio.com, ssh v3 and the /{org}/_git/{repo} short form. Checks come from branch-policy evaluations.
  • One dispatch point. GitLab, Bitbucket and Azure all go through prForge in worktrees-pr.js for status, checks, merge, background refresh and create. PR list and checkout stay GitHub/GitLab.
  • The header gates on the repo's own forge. Create PR / checks / merge used to be disabled whenever gh wasn't signed in, whatever forge the repo is on. That blocked GitLab users and would have blocked every Bitbucket user. git.repoInfo now reports the origin's forge, and the button checks that provider's readiness.
  • Clone needed no change. The existing clone-from-URL already accepts Bitbucket and Azure https and ssh URLs.

Verification

  • npm run test:electron (CODER_* unset): 4762 pass, 3 fail. All 3 were tests that treated bitbucket.org as "not a forge" or matched the old error text; they are updated here and pass.
  • New electron/test/bitbucket-azure.test.js (12 tests) covers remote parsing, dispatch, create/view/checks/merge, the create-race fallback and auth errors, against a stubbed fetch and a fake az.
  • New renderer test: a Bitbucket repo with gh missing keeps Create PR enabled, and is blocked with the Bitbucket hint when its token is missing.
  • npm run typecheck passes.
  • Not tested against a real Bitbucket workspace or Azure DevOps org. Request and response shapes come from the REST 2.0 and az devops docs.

Notes for reviewers

  • Not included: publish (pushing a local repo that has no remote). Solenta has no publish flow for any forge yet, so it's filed as a follow-up.
  • Bitbucket Cloud only. Bitbucket Server/Data Center has a different API and still gets the "not a supported forge" error.
  • Azure quirks:
    • Descriptions over 4000 characters are truncated (Azure's limit).
    • Required-reviewer policies show up as checks.
    • Completing a PR is async, so the header can read OPEN for a moment after Merge.
    • Title and body are passed as --opt=value, so text starting with - isn't read as a flag.
  • Windows: az is az.cmd, which execFile can't launch. The existing Settings probe has the same limit.
  • Merge method: like GitLab, these forges always squash-merge; the merge-method picker and auto-merge stay gh-only.

claude-opus-5-5 via Claude Code

🤖 Generated with Claude Code

Solenta added 2 commits October 18, 2026 21:41
Solenta-Message-Id: f8cc274d-8e30-4420-88dc-ef991dfd1621
Solenta-Message-Id: 8b8dca0d-2630-4576-aa6f-90f594baad5c
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T21:28:53.574169Z 75a85ac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75a85ace11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread electron/worktrees-pr.js
Comment on lines +1475 to +1478
const forge = prForge(originUrl);
if (forge) {
// ponytail: non-gh forges always squash-merge; method/auto are gh-only.
await forge.api.mergePr(cwd, forge.remote, info.number);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Honor auto-merge before dispatching to non-GitHub forges

When a new Bitbucket or Azure DevOps PR has pending checks, NextGitActionButton.tsx:596-605 offers “Auto-merge” and calls onPrMerge({ auto: true }), but this dispatch drops opts.auto and immediately invokes the provider's merge operation. In particular, Bitbucket's merge endpoint merges immediately unless a merge queue happens to be active, so clicking the button can merge while checks are still running. Hide auto-merge for backends without that capability or implement provider-specific deferred merging.

Useful? React with 👍 / 👎.

Comment on lines +153 to +155
const repo = await existing?.git?.repoInfo?.({ threadId: id }).catch(() => null);
const kind = repo?.ok && repo.forge ? repo.forge : "github";
if (threadRef.current === id) setGithub(forgeReadiness(next, kind));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Accept Azure DevOps PAT authentication before gating actions

For an Azure origin, this now gates every PR action on the Azure provider result, but probeAzure first runs az account show and reports unauthenticated when that fails (electron/sourceControl.js:440-479). Users authenticated through az devops login or AZURE_DEVOPS_EXT_PAT therefore get a disabled Create PR button even though the newly added az repos pr backend can authenticate successfully. Microsoft explicitly documents both PAT methods, including running commands with AZURE_DEVOPS_EXT_PAT without az login; the readiness probe needs to recognize them rather than requiring an Azure account session. Azure DevOps PAT authentication documentation

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit 65b066d into main Oct 19, 2026
6 checks passed
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.

Bitbucket and Azure DevOps as first-class forges

1 participant