fix(agent): auto-authorize noncritical alert control
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m38s
CD Pipeline / build-and-deploy (push) Successful in 6m58s
CD Pipeline / post-deploy-checks (push) Successful in 1m42s

This commit is contained in:
ogt
2026-07-11 11:46:38 +08:00
parent 044c8c732a
commit d3fa6feef4
10 changed files with 542 additions and 97 deletions

View File

@@ -143,7 +143,7 @@ def normalize_operator_outcome(outcome: dict[str, Any] | None) -> dict[str, Any]
if isinstance(normalized.get("notification"), dict)
else {}
)
notification["mode"] = "action_required"
notification["mode"] = "human_action_required" if break_glass else "automation_progress"
notification["channels"] = list(_ACTION_REQUIRED_CHANNELS)
notification["reason"] = str(normalized["human_action_reason"])
normalized["notification"] = notification
@@ -200,11 +200,10 @@ def _build_notification(
"channels": list(channels),
"reason": reason,
"source_id": source_id,
"telegram": (
"reply_to_original_or_standalone_action_required"
if mode == "action_required"
else "reply_to_original_or_standalone_result"
),
"telegram": {
"human_action_required": "reply_to_original_or_standalone_action_required",
"automation_progress": "reply_to_original_or_standalone_automation_progress",
}.get(mode, "reply_to_original_or_standalone_result"),
"awooop": "status_chain_panel",
}
@@ -607,8 +606,13 @@ def build_operator_outcome(
"monitor_for_regression",
"monitor_or_reopen_if_alert_recurs",
}
mode = "action_required" if needs_human or ai_action_required else "result_only"
channels = _ACTION_REQUIRED_CHANNELS if mode == "action_required" else _RESULT_ONLY_CHANNELS
if needs_human:
mode = "human_action_required"
elif ai_action_required:
mode = "automation_progress"
else:
mode = "result_only"
channels = _ACTION_REQUIRED_CHANNELS if mode != "result_only" else _RESULT_ONLY_CHANNELS
return {
"schema_version": "operator_outcome_v1",
"state": state,