cockroachdb / cockroachdb/cockroach
autosolver: set up blathers OAuth for cockroach-teamcity so test-only backport PRs can be auto-approved
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Summary:**
Backport PRs created from autosolver PRs (authored by `cockroach-teamcity`) cannot be auto-approved by blathers because of a GitHub restriction: a user cannot approve their own PR.
**Problem:**
When blathers creates a backport PR, it checks whether the original PR author has an OAuth token registered with blathers (via `findAuthToken`). If a token exists, the backport branch is created in the author's fork, and the PR appears under the author's account — allowing blathers to later approve it.
However, `cockroach-teamcity` does not have an OAuth token registered with blathers. This causes the backport to fall back to the non-OAuth flow, where blathers creates the backport branch directly in `cockroachdb/cockroach` and the PR is authored by `blathers-crl[bot]`. When blathers later tries to approve the PR (after CI passes and `checkBackportMatchesMaster` succeeds), GitHub rejects the approval because the PR author (`blathers-crl[bot]`) is the same identity as the approver.
The result is that `backport-test-only` label gets added correctly, but the approval review is never posted, so the auto-merge workflow in `.github/workflows/auto-merge-backports.yml` skips these PRs (it requires an approval from `blathers-crl`).
**Evidence:**
- https://github.com/cockroachdb/cockroach/pull/166725 — backport PR created by `blathers-crl[bot]`, CI passed, `backport-test-only` label added, but zero reviews.
- Original PR https://github.com/cockroachdb/cockroach/pull/166674 authored by `cockroach-teamcity`.
**Fix:**
Register `cockroach-teamcity` with blathers OAuth (device flow) ([instructions](https://github.com/cockroachlabs/blathers-bot#backporting)), so that backport PRs are created from `cockroach-teamcity`'s fork rather than by `blathers-crl[bot]` directly. This allows blathers to approve the resulting PRs.
Jira issue: CRDB-62077
Contributor guide
Assessment
This issue has not been assessed yet.