Summary
Merging a Bitbucket Cloud pull request from T3 Code fails with Bitbucket returned HTTP 404. The failure comes from the viewer-permission gate, not the merge call: GET /2.0/user/permissions/repositories was removed by Bitbucket (CHANGE-2770), and production Bitbucket answers 404 for it — but the fallback added in #6525 only recognises 410, so the removed-endpoint path never triggers and every write action is blocked.
Version
- T3 Code
0.0.34-nightly.20260824.1179 (trace below) and 0.0.35-nightly.20260826.1195; main still has the same check at apps/server/src/pullRequest/BitbucketPullRequestApi.ts:118. - Linux (NixOS), AppImage build.
- Bitbucket Cloud, user API token.
GET /2.0/user and all PR listing calls succeed with the same credential.
Trace
From ~/.t3/userdata/logs/server.trace.ndjson:
ws.rpc.pullRequests.runAction -> Failure
PullRequestOperationError: Pull request operation runAction failed: Bitbucket returned HTTP 404.
[cause]: PullRequestProviderError: bitbucket failed in getViewerPermissions: Bitbucket returned HTTP 404.
[cause]: BitbucketResponseError: Bitbucket API failed in request: Bitbucket returned HTTP 404.
The failing HTTP span:
GET https://api.bitbucket.org/2.0/user/permissions/repositories?q=repository.full_name%3D%22<workspace>%2F<repo>%22
http.response.status_code: 404
Confirming the endpoint is gone (not a permission problem)
Unauthenticated probes, so no token is involved:
$ curl -s -o /dev/null -w '%{http_code}\n' https://api.bitbucket.org/2.0/user
401
$ curl -s -o /dev/null -w '%{http_code}\n' 'https://api.bitbucket.org/2.0/user/permissions/repositories?q=repository.full_name%3D%22x%2Fy%22'
404
$ curl -s -o /dev/null -w '%{http_code}\n' https://api.bitbucket.org/2.0/user/permissions/workspaces
404
An existing endpoint answers 401 without auth; the removed ones answer 404 regardless of auth.
Cause
#6525 (closes #6341) added:
functionisRepositoryPermissionRemovedError(error){returnerror._tag==="BitbucketResponseError"&&error.status===410;}The PR notes it was not exercised against a live Bitbucket account and was coded to the documented 410. Real Bitbucket returns 404, so getRepositoryPermission still hard-fails, getViewerPermissions fails, and PullRequestService.viewerPermissionsOf blocks merge (and other writes) before the merge request is sent.
Suggested fix
Treat 404 from /2.0/user/permissions/repositories the same as 410 in isRepositoryPermissionRemovedError (permission unknown → not blocking), and update the unit test to cover both statuses. Happy to send a PR.
Summary
Merging a Bitbucket Cloud pull request from T3 Code fails with
Bitbucket returned HTTP 404. The failure comes from the viewer-permission gate, not the merge call:GET /2.0/user/permissions/repositorieswas removed by Bitbucket (CHANGE-2770), and production Bitbucket answers 404 for it — but the fallback added in #6525 only recognises 410, so the removed-endpoint path never triggers and every write action is blocked.Version
0.0.34-nightly.20260824.1179(trace below) and0.0.35-nightly.20260826.1195;mainstill has the same check atapps/server/src/pullRequest/BitbucketPullRequestApi.ts:118.GET /2.0/userand all PR listing calls succeed with the same credential.Trace
From
~/.t3/userdata/logs/server.trace.ndjson:The failing HTTP span:
Confirming the endpoint is gone (not a permission problem)
Unauthenticated probes, so no token is involved:
An existing endpoint answers 401 without auth; the removed ones answer 404 regardless of auth.
Cause
#6525 (closes #6341) added:
The PR notes it was not exercised against a live Bitbucket account and was coded to the documented 410. Real Bitbucket returns 404, so
getRepositoryPermissionstill hard-fails,getViewerPermissionsfails, andPullRequestService.viewerPermissionsOfblocks merge (and other writes) before the merge request is sent.Suggested fix
Treat 404 from
/2.0/user/permissions/repositoriesthe same as 410 inisRepositoryPermissionRemovedError(permission unknown → not blocking), and update the unit test to cover both statuses. Happy to send a PR.