Add structured step logging and error reporting

This commit is contained in:
2026-07-19 12:50:09 +02:00
parent e9b895366d
commit 276b5590b5
11 changed files with 289 additions and 46 deletions
+17 -2
View File
@@ -1,11 +1,15 @@
from __future__ import annotations
import logging
from agentci.domain.models import Job, JobKind
from agentci.workflows.common import Dependencies
from agentci.workflows.implement import ImplementWorkflow
from agentci.workflows.plan import PlanWorkflow
from agentci.workflows.pull_request import PullRequestWorkflow
log = logging.getLogger(__name__)
class Dispatcher:
def __init__(self, dependencies: Dependencies) -> None:
@@ -21,5 +25,16 @@ class Dispatcher:
}
async def dispatch(self, job: Job) -> None:
await self.handlers[job.kind](job)
extra = {
"operation": "workflow.dispatch",
"job_id": job.id,
"target": job.target_key,
"stage": job.kind.value,
}
log.info("workflow dispatch started", extra=extra)
try:
await self.handlers[job.kind](job)
except Exception:
log.exception("workflow dispatch failed", extra=extra)
raise
log.info("workflow dispatch completed", extra=extra)