fix(aiops): fallback and escalate automation blockers
Some checks failed
CD Pipeline / tests (push) Successful in 2m41s
Code Review / ai-code-review (push) Successful in 24s
CD Pipeline / build-and-deploy (push) Successful in 7m51s
CD Pipeline / post-deploy-checks (push) Failing after 2m15s

This commit is contained in:
Your Name
2026-04-30 14:13:57 +08:00
parent 82649c2cbb
commit 80defbed7c
10 changed files with 311 additions and 10 deletions

View File

@@ -0,0 +1,37 @@
from types import SimpleNamespace
from src.agents.protocol import AgentSessionStatus
from src.services.decision_manager import _phase2_fallback_reason
def _package(**kwargs):
data = {
"session_status": AgentSessionStatus.COMPLETED,
"all_agents_degraded": False,
"recommended_action": "kubectl rollout restart deployment/awoooi-api -n awoooi-prod",
"requires_human_approval": False,
}
data.update(kwargs)
return SimpleNamespace(**data)
def test_phase2_timeout_continues_to_fallback() -> None:
pkg = _package(
session_status=AgentSessionStatus.TIMEOUT,
recommended_action=None,
requires_human_approval=True,
)
assert _phase2_fallback_reason(pkg) == "session_timeout"
def test_phase2_empty_manual_gate_continues_to_fallback() -> None:
pkg = _package(recommended_action="", requires_human_approval=True)
assert _phase2_fallback_reason(pkg) == "empty_action_requires_human"
def test_phase2_actionable_package_stays_primary() -> None:
pkg = _package()
assert _phase2_fallback_reason(pkg) is None