This commit is contained in:
@@ -297,6 +297,7 @@ def test_resource_pressure_message_is_measurement_based_not_llm_theatre():
|
||||
)
|
||||
|
||||
assert "量測指標" in msg
|
||||
assert "系統處置紀錄" in msg
|
||||
assert "主機 CPU 未達高負載門檻" in msg
|
||||
assert "未啟動 Hermes/NemoTron 價格分析" in msg
|
||||
assert "預期效益" not in msg
|
||||
@@ -388,3 +389,39 @@ def test_resource_pressure_message_reports_hygiene_result():
|
||||
assert "清理前 Action queue:100" in msg
|
||||
assert "已自動關閉過期 action_plans 91 筆" in msg
|
||||
assert "只改 status/metadata,不刪除資料" in msg
|
||||
|
||||
|
||||
def test_resource_optimization_cannot_use_legacy_autonomous_execution_template(monkeypatch):
|
||||
from services.elephant_alpha_autonomous_engine import (
|
||||
AutonomousTrigger,
|
||||
ElephantAlphaAutonomousEngine,
|
||||
)
|
||||
from services.elephant_alpha_orchestrator import StrategicDecision
|
||||
|
||||
engine = ElephantAlphaAutonomousEngine()
|
||||
sent = []
|
||||
|
||||
async def _capture_send(message):
|
||||
sent.append(message)
|
||||
|
||||
monkeypatch.setattr("services.telegram_templates._send_telegram_raw", _capture_send)
|
||||
|
||||
decision = StrategicDecision(
|
||||
priority="medium",
|
||||
agents_required=["elephant_alpha"],
|
||||
reasoning="resource pressure test",
|
||||
expected_outcome="old style outcome must not be sent",
|
||||
confidence=0.8,
|
||||
execution_plan=[{"agent": "Hermes", "action": "generate_resource_optimization_strategy"}],
|
||||
resource_requirements={},
|
||||
)
|
||||
trigger = AutonomousTrigger(
|
||||
trigger_type="resource_optimization",
|
||||
conditions={},
|
||||
threshold=0.6,
|
||||
enabled=True,
|
||||
)
|
||||
|
||||
asyncio.run(engine._notify_telegram_executed(decision, trigger))
|
||||
|
||||
assert sent == []
|
||||
|
||||
Reference in New Issue
Block a user