mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-07 16:19:09 +00:00
Bring back ci_autofix.py and the ci_monitor graph that #1621 deleted, re-wiring the fork's security-reviewed PR-babysitting onto the new structure: the CI-event, autofix-toggle, and review-feedback handlers move into webhooks/github.py and the github_webhook router re-gains the check_run/check_suite/workflow_run/status routing plus the autofix command and actionable-review branches. Auto-fix runs now dispatch through dispatch_agent_run (durability + completion webhook) while keeping the deliberate batch-while-busy skip-rule via get_thread_active_status. Restore langgraph.json's ci_monitor entry and the fork autofix tests (dispatch mock + import paths re-pointed). Refs: #80
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""LangGraph entrypoint that polls open agent PRs for CI failures / conflicts.
|
|
|
|
A fallback for deployments where CI webhooks (``check_run`` / ``workflow_run``)
|
|
aren't reliably delivered, and the only path that can react to base-branch
|
|
merge conflicts (GitHub emits no webhook for those). Register it on a cron to
|
|
sweep periodically; each tick calls :func:`agent.ci_autofix.sweep_open_prs`.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
from typing import Any, TypedDict
|
|
|
|
from langgraph.graph import END, START, StateGraph
|
|
from langgraph.graph.state import RunnableConfig
|
|
|
|
from .ci_autofix import sweep_open_prs
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class CIMonitorState(TypedDict, total=False):
|
|
result: dict[str, Any]
|
|
|
|
|
|
async def _sweep(_state: CIMonitorState, _config: RunnableConfig) -> dict[str, Any]:
|
|
return {"result": await sweep_open_prs()}
|
|
|
|
|
|
def get_ci_monitor(config: RunnableConfig | None = None):
|
|
builder = StateGraph(CIMonitorState)
|
|
builder.add_node("sweep", _sweep)
|
|
builder.add_edge(START, "sweep")
|
|
builder.add_edge("sweep", END)
|
|
return builder.compile().with_config(config or {})
|