Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
from contextlib import asynccontextmanager
from typing import AsyncIterator

import bugsy
import uvicorn
from agent_tools import bugzilla
from agent_tools.bugzilla import BugzillaContext
from agent_tools.claude_sdk import build_sdk_server
from bugzilla_client import BugzillaClient, BugzillaSettings
from mcp.server.streamable_http_manager import (
Receive,
Scope,
Expand All @@ -38,8 +38,10 @@ class BrokerInputs(BaseSettings):


def build_app(inputs: BrokerInputs) -> Starlette:
client = bugsy.Bugsy(
api_key=inputs.bugzilla_api_key, bugzilla_url=inputs.bugzilla_api_url
client = BugzillaClient(
BugzillaSettings(
api_url=inputs.bugzilla_api_url, api_key=inputs.bugzilla_api_key
)
)
ctx = BugzillaContext(client=client)
sdk_config = build_sdk_server("bugzilla", ctx, bugzilla.TOOLS)
Expand All @@ -49,7 +51,7 @@ def build_app(inputs: BrokerInputs) -> Starlette:

@asynccontextmanager
async def lifespan(app: Starlette) -> AsyncIterator[None]:
async with manager.run():
async with client, manager.run():
log.info(
"bugzilla broker ready on %s:%d (read-only)",
inputs.host,
Expand Down
3 changes: 2 additions & 1 deletion agents/autowebcompat-diagnosis/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies = [
"hackbot-runtime[claude-sdk]",
"agent-tools[bugzilla]",
"autowebcompat-tools",
"bugsy",
"bugzilla-client",
"six",
"claude-agent-sdk>=0.1.30",
"mcp>=1.0.0",
Expand All @@ -18,6 +18,7 @@ dependencies = [
[tool.uv.sources]
hackbot-runtime = { workspace = true }
agent-tools = { workspace = true }
bugzilla-client = { workspace = true }
autowebcompat-tools = { workspace = true }

[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import logging
from contextlib import asynccontextmanager

import bugsy
import uvicorn
from agent_tools import bugzilla
from agent_tools import phabricator as phabricator_tools
from agent_tools.bugzilla import BugzillaContext
from agent_tools.claude_sdk import build_sdk_server
from agent_tools.phabricator import PhabricatorContext
from bugzilla_client import BugzillaClient, BugzillaSettings
from mcp.server.streamable_http_manager import StreamableHTTPSessionManager
from phabricator_client import PhabricatorClient, PhabricatorSettings
from phabricator_proxy import create_app as conduit_proxy
Expand Down Expand Up @@ -60,8 +60,10 @@ async def handler(scope, receive, send):


def build_app(inputs: BrokerInputs) -> Starlette:
client = bugsy.Bugsy(
api_key=inputs.bugzilla_api_key, bugzilla_url=inputs.bugzilla_api_url
client = BugzillaClient(
BugzillaSettings(
api_url=inputs.bugzilla_api_url, api_key=inputs.bugzilla_api_key
)
)
bugzilla_config = build_sdk_server(
"bugzilla", BugzillaContext(client=client), bugzilla.TOOLS
Expand All @@ -82,7 +84,7 @@ def build_app(inputs: BrokerInputs) -> Starlette:

@asynccontextmanager
async def lifespan(app):
async with bugzilla_manager.run(), phabricator_manager.run():
async with client, bugzilla_manager.run(), phabricator_manager.run():
log.info(
"broker ready on %s:%d (bugzilla + phabricator read-only, "
"phabricator conduit proxy)",
Expand Down
3 changes: 2 additions & 1 deletion agents/autowebcompat-intervention/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = [
"autowebcompat-tools",
"phabricator-client",
"phabricator-proxy",
"bugsy",
"bugzilla-client",
"claude-agent-sdk>=0.2.165",
"mcp>=1.0.0",
"starlette>=0.36.0",
Expand All @@ -22,6 +22,7 @@ dev = ["pytest>=8.0.0", "pytest-asyncio>=0.23.0"]
[tool.uv.sources]
hackbot-runtime = { workspace = true }
agent-tools = { workspace = true }
bugzilla-client = { workspace = true }
autowebcompat-tools = { workspace = true }
phabricator-client = { workspace = true }
phabricator-proxy = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
from contextlib import asynccontextmanager
from typing import AsyncIterator

import bugsy
import uvicorn
from agent_tools import bugzilla
from agent_tools.bugzilla import BugzillaContext
from agent_tools.claude_sdk import build_sdk_server
from bugzilla_client import BugzillaClient, BugzillaSettings
from mcp.server.streamable_http_manager import (
Receive,
Scope,
Expand All @@ -38,8 +38,10 @@ class BrokerInputs(BaseSettings):


def build_app(inputs: BrokerInputs) -> Starlette:
client = bugsy.Bugsy(
api_key=inputs.bugzilla_api_key, bugzilla_url=inputs.bugzilla_api_url
client = BugzillaClient(
BugzillaSettings(
api_url=inputs.bugzilla_api_url, api_key=inputs.bugzilla_api_key
)
)
ctx = BugzillaContext(client=client)
sdk_config = build_sdk_server("bugzilla", ctx, bugzilla.TOOLS)
Expand All @@ -49,7 +51,7 @@ def build_app(inputs: BrokerInputs) -> Starlette:

@asynccontextmanager
async def lifespan(app: Starlette) -> AsyncIterator[None]:
async with manager.run():
async with client, manager.run():
log.info(
"bugzilla broker ready on %s:%d (read-only)",
inputs.host,
Expand Down
3 changes: 2 additions & 1 deletion agents/autowebcompat-repro/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies = [
"hackbot-runtime[claude-sdk]",
"agent-tools[bugzilla]",
"autowebcompat-tools",
"bugsy",
"bugzilla-client",
"six",
"claude-agent-sdk>=0.1.30",
"mcp>=1.0.0",
Expand All @@ -18,6 +18,7 @@ dependencies = [
[tool.uv.sources]
hackbot-runtime = { workspace = true }
agent-tools = { workspace = true }
bugzilla-client = { workspace = true }
autowebcompat-tools = { workspace = true }

[build-system]
Expand Down
10 changes: 6 additions & 4 deletions agents/bug-fix/hackbot_agents/bug_fix/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import logging
from contextlib import asynccontextmanager

import bugsy
import uvicorn
from agent_tools import bugzilla
from agent_tools import phabricator as phabricator_tools
from agent_tools.bugzilla import BugzillaContext
from agent_tools.claude_sdk import build_sdk_server
from agent_tools.phabricator import PhabricatorContext
from bugzilla_client import BugzillaClient, BugzillaSettings
from mcp.server.streamable_http_manager import StreamableHTTPSessionManager
from phabricator_client import PhabricatorClient, PhabricatorSettings
from phabricator_proxy import create_app as conduit_proxy
Expand Down Expand Up @@ -60,8 +60,10 @@ async def handler(scope, receive, send):


def build_app(inputs: BrokerInputs) -> Starlette:
client = bugsy.Bugsy(
api_key=inputs.bugzilla_api_key, bugzilla_url=inputs.bugzilla_api_url
client = BugzillaClient(
BugzillaSettings(
api_url=inputs.bugzilla_api_url, api_key=inputs.bugzilla_api_key
)
)
bugzilla_config = build_sdk_server(
"bugzilla", BugzillaContext(client=client), bugzilla.TOOLS
Expand All @@ -82,7 +84,7 @@ def build_app(inputs: BrokerInputs) -> Starlette:

@asynccontextmanager
async def lifespan(app):
async with bugzilla_manager.run(), phabricator_manager.run():
async with client, bugzilla_manager.run(), phabricator_manager.run():
log.info(
"broker ready on %s:%d (bugzilla + phabricator read-only, "
"phabricator conduit proxy)",
Expand Down
3 changes: 2 additions & 1 deletion agents/bug-fix/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies = [
"agent-tools[bugzilla,firefox]",
"phabricator-client",
"phabricator-proxy",
"bugsy",
"bugzilla-client",
"claude-agent-sdk>=0.1.30",
"mcp>=1.0.0",
"starlette>=0.36.0",
Expand All @@ -24,6 +24,7 @@ a11y = ["pygobject>=3.52"]
[tool.uv.sources]
hackbot-runtime = { workspace = true }
agent-tools = { workspace = true }
bugzilla-client = { workspace = true }
phabricator-client = { workspace = true }
phabricator-proxy = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion agents/bug-fix/tests/test_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _app() -> Starlette:
return broker.build_app(
broker.BrokerInputs(
bugzilla_api_url="https://bugzilla.example.com/rest",
bugzilla_api_key="bz-key",
bugzilla_api_key="a" * 40,
phabricator=PhabricatorSettings(
url="https://phab.example.com", api_key=VALID_TOKEN
),
Expand Down
14 changes: 8 additions & 6 deletions agents/build-repair/evals/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
from functools import cached_property
from pathlib import Path

import bugsy
import weave
from agent_tools import bugzilla
from agent_tools.bugzilla import BugzillaContext
from agent_tools.claude_sdk import build_sdk_server
from agent_tools.firefox import FirefoxContext
from agent_tools.firefox.tools.build_firefox import build_firefox
from bugzilla_client import BugzillaClient, BugzillaSettings
from hackbot_agents.build_repair.agent import run_build_repair
from hackbot_agents.build_repair.config import ANALYSIS_MODEL, FIX_MODEL

Expand Down Expand Up @@ -66,11 +66,13 @@ def _bugzilla_server():
mcp_url = _broker_mcp_url()
if mcp_url:
return {"type": "http", "url": mcp_url}
client = bugsy.Bugsy(
bugzilla_url=os.environ.get(
"BUGZILLA_API_URL", "https://bugzilla.mozilla.org/rest"
),
api_key=os.environ.get("BUGZILLA_API_KEY"),
client = BugzillaClient(
BugzillaSettings(
api_url=os.environ.get(
"BUGZILLA_API_URL", "https://bugzilla.mozilla.org/rest"
),
api_key=os.environ.get("BUGZILLA_API_KEY"),
)
)
return build_sdk_server("bugzilla", BugzillaContext(client=client), bugzilla.TOOLS)

Expand Down
24 changes: 7 additions & 17 deletions agents/build-repair/hackbot_agents/build_repair/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
import logging
from contextlib import asynccontextmanager

import bugsy
import uvicorn
from agent_tools import bugzilla
from agent_tools.bugzilla import BugzillaContext
from agent_tools.claude_sdk import build_sdk_server
from bugzilla_client import BugzillaClient, BugzillaSettings
from mcp.server.streamable_http_manager import StreamableHTTPSessionManager
from pydantic import field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
from starlette.applications import Starlette
from starlette.routing import Mount
Expand All @@ -31,21 +30,12 @@ class BrokerInputs(BaseSettings):

model_config = SettingsConfigDict(extra="ignore")

@field_validator("bugzilla_api_url")
@classmethod
def _ensure_rest_base(cls, v: str) -> str:
"""Bugsy expects the REST base (``.../rest``) and just appends the path.

A bare host like ``https://bugzilla.mozilla.org`` makes every call hit
the HTML site and fail to parse as JSON, so normalize it here.
"""
v = v.rstrip("/")
return v if v.endswith("/rest") else f"{v}/rest"


def build_app(inputs: BrokerInputs) -> Starlette:
client = bugsy.Bugsy(
api_key=inputs.bugzilla_api_key, bugzilla_url=inputs.bugzilla_api_url
client = BugzillaClient(
BugzillaSettings(
api_url=inputs.bugzilla_api_url, api_key=inputs.bugzilla_api_key
)
)
ctx = BugzillaContext(client=client)
sdk_config = build_sdk_server("bugzilla", ctx, bugzilla.TOOLS)
Expand All @@ -59,7 +49,7 @@ async def lifespan(app):
# clear log line instead of an opaque JSON-decode error on every tool
# call. We stay up regardless: the agent then gets a structured error.
try:
version = client.request("version").get("version")
version = (await client.request("GET", "version")).get("version")
log.info(
"bugzilla reachable at %s (version %s)",
inputs.bugzilla_api_url,
Expand All @@ -71,7 +61,7 @@ async def lifespan(app):
"and BUGZILLA_API_KEY; tool calls will fail until this is fixed",
inputs.bugzilla_api_url,
)
async with manager.run():
async with client, manager.run():
log.info(
"bugzilla broker ready on %s:%d (read-only)",
inputs.host,
Expand Down
3 changes: 2 additions & 1 deletion agents/build-repair/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires-python = ">=3.14"
dependencies = [
"hackbot-runtime[claude-sdk,phabricator]",
"agent-tools[bugzilla,firefox]",
"bugsy",
"bugzilla-client",
"claude-agent-sdk>=0.2.165",
"mcp>=1.0.0",
"starlette>=0.36.0",
Expand All @@ -24,6 +24,7 @@ eval = [
[tool.uv.sources]
hackbot-runtime = { workspace = true }
agent-tools = { workspace = true }
bugzilla-client = { workspace = true }

[build-system]
requires = ["hatchling"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import logging
from contextlib import asynccontextmanager

import bugsy
import uvicorn
from agent_tools import bugzilla
from agent_tools.bugzilla import BugzillaContext
from agent_tools.claude_sdk import build_sdk_server
from bugzilla_client import BugzillaClient, BugzillaSettings
from mcp.server.streamable_http_manager import StreamableHTTPSessionManager
from pydantic_settings import BaseSettings, SettingsConfigDict
from starlette.applications import Starlette
Expand All @@ -32,8 +32,10 @@ class BrokerInputs(BaseSettings):


def build_app(inputs: BrokerInputs) -> Starlette:
client = bugsy.Bugsy(
api_key=inputs.bugzilla_api_key, bugzilla_url=inputs.bugzilla_api_url
client = BugzillaClient(
BugzillaSettings(
api_url=inputs.bugzilla_api_url, api_key=inputs.bugzilla_api_key
)
)
ctx = BugzillaContext(client=client)
sdk_config = build_sdk_server("bugzilla", ctx, bugzilla.TOOLS)
Expand All @@ -43,7 +45,7 @@ def build_app(inputs: BrokerInputs) -> Starlette:

@asynccontextmanager
async def lifespan(app):
async with manager.run():
async with client, manager.run():
log.info(
"bugzilla broker ready on %s:%d (read-only)",
inputs.host,
Expand Down
3 changes: 2 additions & 1 deletion agents/frontend-triage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires-python = ">=3.14"
dependencies = [
"hackbot-runtime[claude-sdk]",
"agent-tools[bugzilla,searchfox,vcs]",
"bugsy",
"bugzilla-client",
"claude-agent-sdk>=0.2.165",
"mcp>=1.0.0",
"starlette>=0.36.0",
Expand All @@ -19,6 +19,7 @@ dev = ["pytest>=8.0.0", "pytest-asyncio>=0.23.0"]
[tool.uv.sources]
hackbot-runtime = { workspace = true }
agent-tools = { workspace = true }
bugzilla-client = { workspace = true }

[build-system]
requires = ["hatchling"]
Expand Down
Loading