Skip to content

Clarify error message for private Phabricator revisions#6138

Open
padenot wants to merge 2 commits into
mozilla:masterfrom
padenot:fix-issue-5992-private-revision-error
Open

Clarify error message for private Phabricator revisions#6138
padenot wants to merge 2 commits into
mozilla:masterfrom
padenot:fix-issue-5992-private-revision-error

Conversation

@padenot

@padenot padenot commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Previously, attempting to access a private revision would surface a confusing internal error. Now it raises a ToolError with an explicit message explaining the revision is private or not found.

I'm not entirely certain that it's that useful to distinguish, because our token isn't capable of seeing all revisions, but maybe that will change in the future, and feels right anyway.

Fixes #5992

Comment thread services/mcp/src/bugbug_mcp/server.py Outdated
patch = SanitizedPhabricatorPatch(revision_id=revision_id)
if not patch.is_public():
raise ToolError(
f"Revision D{revision_id} is private and cannot be accessed."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This won’t work since we will always get PhabricatorRevisionNotFoundException on secure revisions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok, but this is what I said above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the Web UI itself can differentiate between 404 and secure revisions, we could fall back to scraping the web URL when a revision is not found, if you think the distinction would be useful.

What you have for blocking secure revisions could be helpful anyway as a defensive mechanism; so if the account accidentally gains access to a secure revision, it won't be publicly available.

Nit: we do the check differently in Review Helper, we could align it for consistency:

if not patch.is_accessible() or not patch.is_public():

Previously, attempting to access a private revision would surface a
confusing internal error. Now it raises a ToolError with an explicit
message explaining the revision is private or not found.

Fixes mozilla#5992
@padenot padenot force-pushed the fix-issue-5992-private-revision-error branch from c17863c to c7ea047 Compare June 9, 2026 09:54
suhaibmujahid
suhaibmujahid previously approved these changes Jun 9, 2026

@suhaibmujahid suhaibmujahid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you please fix the linting error?

Align with the pattern used in review_processor.py.
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.

Clarify the MCP error message when requesting access to private revision

2 participants