- handle_ci_status: fallback git branch -r --contains when branches[] empty - webhook router: handle pull_request_approved event type - handle_pr: map review.type to review.state for new Gitea format - launcher: auto-advance stage after agent completion (_try_advance_stage) - plane_sync: notify Plane on stage changes - stages.py: stage machine with QG definitions - notifications.py: stage change notifications - safe.directory fix for container git operations
29 lines
893 B
Python
29 lines
893 B
Python
"""Notifications and logging for orchestrator events."""
|
|
|
|
import logging
|
|
|
|
logger = logging.getLogger("orchestrator")
|
|
|
|
|
|
def notify_stage_change(task_id: int, old_stage: str, new_stage: str, agent: str = None):
|
|
"""Log stage transition."""
|
|
msg = f"Task {task_id}: {old_stage} → {new_stage}"
|
|
if agent:
|
|
msg += f" (launching {agent})"
|
|
logger.info(msg)
|
|
|
|
|
|
def notify_qg_failure(task_id: int, stage: str, check: str, reason: str):
|
|
"""Log QG check failure."""
|
|
logger.warning(f"Task {task_id}: QG failed at stage '{stage}', check={check}: {reason}")
|
|
|
|
|
|
def notify_agent_finished(run_id: int, agent: str, exit_code: int):
|
|
"""Log agent completion."""
|
|
logger.info(f"Agent run {run_id} ({agent}) finished with exit code {exit_code}")
|
|
|
|
|
|
def notify_error(task_id: int, error: str):
|
|
"""Log error for a task."""
|
|
logger.error(f"Task {task_id}: ERROR — {error}")
|