Skip to content

Add agent tools to read revisions from Phabricator - #6438

Merged
marco-c merged 4 commits into
mozilla:masterfrom
suhaibmujahid:worktree-phabricator-read-tools
Jul 31, 2026
Merged

Add agent tools to read revisions from Phabricator#6438
marco-c merged 4 commits into
mozilla:masterfrom
suhaibmujahid:worktree-phabricator-read-tools

Conversation

@suhaibmujahid

Copy link
Copy Markdown
Member

Resolves #6433

@suhaibmujahid
suhaibmujahid requested a review from a team as a code owner July 30, 2026 19:51
Copilot AI review requested due to automatic review settings July 30, 2026 19:51

Copilot AI 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.

Pull request overview

This PR adds a read-only Phabricator (Differential) MCP tool surface and wires it into the bug-fix agent’s broker so follow-up runs triggered by Phabricator comments can fetch revision metadata, the full comment thread (including inline anchors), and the reviewed diff content.

Changes:

  • Add new phabricator read-only tools: get_revision, get_revision_comments, get_revision_diff, including diff-size truncation and inline comment positioning.
  • Extend the shared phabricator-client with revision lookup by ID and batched user PHID → username resolution.
  • Update the bug-fix broker to mount separate Bugzilla and Phabricator MCP endpoints and pass the Phabricator MCP server config into follow-up runs.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libs/phabricator-client/phabricator_client/client.py Adds revision lookup by numeric id and user PHID resolution helper.
libs/phabricator-client/tests/test_client.py Adds test coverage for the new client methods.
libs/agent-tools/agent_tools/phabricator.py Introduces read-only Phabricator MCP tools and supporting parsing/helpers.
libs/agent-tools/tests/test_phabricator.py Adds comprehensive tests for the new Phabricator tools.
agents/bug-fix/hackbot_agents/bug_fix/broker.py Mounts /bugzilla/mcp and /phabricator/mcp plus reworks patch endpoint creation.
agents/bug-fix/hackbot_agents/bug_fix/config.py Defines the Phabricator read-only MCP tool allowlist for follow-up runs.
agents/bug-fix/hackbot_agents/bug_fix/agent.py Plumbs an optional Phabricator MCP server into the agent and investigator toolsets.
agents/bug-fix/hackbot_agents/bug_fix/main.py Derives the Phabricator MCP URL from the broker URL for follow-up runs.
agents/bug-fix/hackbot_agents/bug_fix/prompts/follow-up.md Instructs follow-up runs to read full Phabricator context before acting.
agents/bug-fix/tests/test_inputs.py Tests derivation of the Phabricator MCP endpoint URL.
agents/bug-fix/tests/test_broker.py Updates broker tests for new mounts and refactored patch route wiring.
agents/bug-fix/compose.yml Updates Bugzilla MCP URL to the new /bugzilla/mcp mount.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/phabricator-client/phabricator_client/client.py
Comment thread libs/agent-tools/agent_tools/phabricator.py
@suhaibmujahid
suhaibmujahid force-pushed the worktree-phabricator-read-tools branch from fd3c70a to fe1d6ef Compare July 30, 2026 20:17
evgenyrp
evgenyrp previously approved these changes Jul 30, 2026

@evgenyrp evgenyrp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think at this point we should maintain concise, easily human-readable documentation on Hackbot and available functionality in /docs. When a change is made, this doc should also be changed. It can help with code reviews, understanding the state of the system, and obviously onboarding. It can even be sort of a changelog of what's happening.

Comment thread agents/bug-fix/hackbot_agents/bug_fix/prompts/follow-up.md Outdated
Comment thread agents/bug-fix/compose.yml
Comment thread libs/agent-tools/agent_tools/phabricator.py Outdated
Updates the bug-fix follow-up prompt to make reviewer-comment handling clearer and more concise.

@marco-c marco-c left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving on behalf of Evgeny since he already approved before, so we can merge.

@marco-c
marco-c merged commit 5516800 into mozilla:master Jul 31, 2026
7 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.

Add new agent tools to read revisions from Phabricator

4 participants