Skip to content
Merged
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
5 changes: 5 additions & 0 deletions services/hackbot-api/app/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class AgentSpec:
# was; this is where that verdict is honored. Fails closed, so a run that reports
# no verdict never qualifies.
auto_apply_requires_consent: bool = False
# Whether a run that produced source changes is expected to submit those changes
# to Phabricator. Agents without Phabricator submission tools may legitimately
# leave a patch artifact behind, so they must not trigger the warning.
warn_on_unsubmitted_patch: bool = False


def model_to_env(inputs: BaseModel) -> dict[str, str]:
Expand Down Expand Up @@ -66,6 +70,7 @@ def model_to_env(inputs: BaseModel) -> dict[str, str]:
job_name="hackbot-agent-bug-fix",
input_schema=BugFixInputs,
auto_apply_actions=True,
warn_on_unsubmitted_patch=True,
),
"autowebcompat-repro": AgentSpec(
name="autowebcompat-repro",
Expand Down
7 changes: 6 additions & 1 deletion services/hackbot-api/app/routers/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ async def finalize_run(db: AsyncSession, run: Run) -> None:

await db.commit()

if _has_unsubmitted_patch(summary, artifacts):
agent_spec = AGENT_REGISTRY.get(run.agent)
if (
agent_spec is not None
and agent_spec.warn_on_unsubmitted_patch
and _has_unsubmitted_patch(summary, artifacts)
):
log.error(
"Agent run produced code changes without submitting a patch "
"(run_id=%s, agent=%s)",
Expand Down