-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Low
-
Component/s: API Framework - Authentication
-
None
-
Severity 3 - Minor
Issue Summary
When a pull request originates from a forked repository and the fork becomes inaccessible (e.g. because the PR author's account has been deactivated, taking their personal workspace and forked repo with it), clicking the "Rerun" button on a failed custom merge check result returns a 404 Resource not found error. The error is returned by Bitbucket's internal proxy layer before the request reaches the Forge app.
This is an inconsistency/bug because the exact same merge check runs successfully when triggered via Approve/Unapprove reviewer events on the same PR — those code paths do not enforce write access to the source fork repository, but the Rerun button does.
Additionally, the error message shown to the user — "Failed to retry custom merge check." — is not descriptive and gives no indication that the underlying cause is an inaccessible fork repository.
Steps to Reproduce
- Create a Forge app with a bitbucket:mergeCheck module (triggers: on-code-pushed, on-reviewer-status-changed)
- In workspace A, create a repository (e.g. templates)
- In workspace B (a different user's personal workspace), fork the repository to create templates-forked
- Open a pull request from templates-forked (workspace B) → templates (workspace A)
- Trigger the merge check so it returns a FAILED result (visible in the PR checks UI)
- Deactivate the account of the PR author (workspace B owner) — this also deactivates their personal workspace and the forked repository
- As a workspace A member, click the "Rerun" button on the failed merge check result
Expected Results
One of the following should happen:
- The "Rerun" button applies the same permission model as the Approve/Unapprove trigger path — i.e. write access to the source fork is not required to retry a merge check manually, consistent with how automatic triggers work.
- OR, if write access to the fork is intentionally required for the Rerun path, the error message should clearly explain why the retry failed — e.g. "Unable to retry merge check: the source repository is no longer accessible." — rather than the generic "Failed to retry custom merge check."
Actual Results
- POST /!api/internal/repositories/{workspace}/{repo}/pullrequests/{id}/checks/results/{uuid}/retry returns:
{
"type": "error",
"error": {
"message": "Resource not found"
}
}
- HTTP status: 404
- The Forge app's merge-check-function never receives the request — the 404 is returned by Bitbucket's internal proxy layer (x-view-name: bitbucket.apps.proxy.views.proxypass)
- The UI displays: "Failed to retry custom merge check." with no further detail
Workaround
Trigger the merge check via a reviewer action (approving or unapproving the PR) instead of using the Rerun button. This code path does not enforce write access to the source fork repository and will successfully invoke the Forge app's merge-check-function.
Note: This workaround is only applicable when the PR itself is still open and reviewers can take action on it.