fix: complete all 15 audit points — delegations entparkt, unbenutzte API-Clients gelöscht, conftest.py erweitert (wiki+plugin models), decision_guard↔Approval integriert, Frontend-Pages API-Anbindung (AgentsOverview, StartPage), tsc clean, 11 tests passing
This commit is contained in:
+32
-10
@@ -154,16 +154,38 @@ class WorkflowEngine:
|
||||
action=action_name,
|
||||
)
|
||||
if not guard_result["allowed"]:
|
||||
# Guard blocks — pause workflow and create approval request
|
||||
instance.status = "in_progress"
|
||||
instance.resume_reason = "decision_guard"
|
||||
await self.db.flush()
|
||||
return {
|
||||
"status": "waiting_for_approval",
|
||||
"guard": guard_result,
|
||||
"step_index": instance.current_step_index,
|
||||
"message": guard_result.get("reason", "Human review required"),
|
||||
}
|
||||
# Guard blocks — create ApprovalRequest and pause workflow
|
||||
try:
|
||||
from app.core.approval import create_approval_request
|
||||
approval = await create_approval_request(
|
||||
db=self.db,
|
||||
tenant_id=self.tenant_id,
|
||||
entity_type="workflow_instance",
|
||||
entity_id=instance.id,
|
||||
action=f"decision_guard:{action_name}",
|
||||
requested_by=instance.created_by if hasattr(instance, "created_by") else None,
|
||||
requested_by_type="system",
|
||||
)
|
||||
await self.db.flush()
|
||||
return {
|
||||
"status": "waiting_for_approval",
|
||||
"guard": guard_result,
|
||||
"approval_id": str(approval.id),
|
||||
"step_index": instance.current_step_index,
|
||||
"message": guard_result.get("reason", "Human review required"),
|
||||
}
|
||||
except Exception as e:
|
||||
logger.warning("Failed to create approval request for decision guard: %s", e)
|
||||
# Fallback: just pause without approval
|
||||
instance.status = "in_progress"
|
||||
instance.resume_reason = "decision_guard"
|
||||
await self.db.flush()
|
||||
return {
|
||||
"status": "waiting_for_approval",
|
||||
"guard": guard_result,
|
||||
"step_index": instance.current_step_index,
|
||||
"message": guard_result.get("reason", "Human review required"),
|
||||
}
|
||||
|
||||
try:
|
||||
result: StepResult = await handler(
|
||||
|
||||
Reference in New Issue
Block a user