fix(alerts): let GCP Ollama finish before cloud fallback
All checks were successful
Code Review / ai-code-review (push) Successful in 10s
CD Pipeline / tests (push) Successful in 1m9s
CD Pipeline / build-and-deploy (push) Successful in 4m21s
CD Pipeline / post-deploy-checks (push) Successful in 1m16s

This commit is contained in:
Your Name
2026-05-06 05:27:36 +08:00
parent 1d0e80c091
commit c2c0b1ec82
11 changed files with 221 additions and 50 deletions

View File

@@ -1,7 +1,11 @@
from types import SimpleNamespace
from src.agents.protocol import AgentSessionStatus
from src.services.decision_manager import _phase2_fallback_reason
from src.services import decision_manager as decision_manager_module
from src.services.decision_manager import (
_incident_llm_timeout_seconds,
_phase2_fallback_reason,
)
def _package(**kwargs):
@@ -35,3 +39,17 @@ def test_phase2_actionable_package_stays_primary() -> None:
pkg = _package()
assert _phase2_fallback_reason(pkg) is None
def test_incident_llm_timeout_uses_configured_value(monkeypatch) -> None:
monkeypatch.setattr(decision_manager_module.settings, "INCIDENT_LLM_TIMEOUT_SECONDS", 240)
monkeypatch.setattr(decision_manager_module.settings, "OPENCLAW_TIMEOUT", 120)
assert _incident_llm_timeout_seconds() == 240.0
def test_incident_llm_timeout_never_below_openclaw_timeout(monkeypatch) -> None:
monkeypatch.setattr(decision_manager_module.settings, "INCIDENT_LLM_TIMEOUT_SECONDS", 60)
monkeypatch.setattr(decision_manager_module.settings, "OPENCLAW_TIMEOUT", 120)
assert _incident_llm_timeout_seconds() == 120.0