落地系统异常:大模型/TMS/建群故障停住本单并告警,后台可重试失败步骤。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-21 14:01:49 +08:00
co-authored by Cursor
parent a5e73c01ae
commit 4381966c4e
26 changed files with 2098 additions and 72 deletions
+31 -1
View File
@@ -123,6 +123,36 @@ def _wrap_route_failed(message: InboundMessage) -> None:
)
def _wrap_route_model_failed(message: InboundMessage) -> None:
"""路由模型超时/报错/空结果:大模型异常(无工单不建单)。"""
from agent.policy.system_exception import confirm_llm_if_tech
from agent.ledger.http_ledger import HttpLedger
from agent.config import get_settings
from agent.channel.queue import get_message_store
def reply(text: str) -> None:
get_message_store().enqueue_outbound(
touser=message.sender_id,
content=text,
dedupe_key=f"route-llm:{message.message_id}",
)
ledger = None
try:
if (get_settings().ledger_backend or "").lower() != "memory":
ledger = HttpLedger()
except Exception:
ledger = None
confirm_llm_if_tech(
ledger=ledger,
reply=reply,
sender_id=message.sender_id,
reason="模型返回空结果",
conversation_kind="group" if getattr(message, "chat_id", "") else "private",
conversation_target=getattr(message, "chat_id", "") or message.sender_id,
)
# 意图 → handler(空壳或联调 echo);扩展时只改表,不改 ChannelRuntime 分支森林
HANDLER_REGISTRY: dict[str, HandlerFn] = {
"echo_text": _wrap_echo,
@@ -142,7 +172,7 @@ HANDLER_REGISTRY: dict[str, HandlerFn] = {
"reject_no_sender": _noop,
"ignore_empty": _noop,
"stub_needs_model": _wrap_echo,
"route_model_failed": _wrap_route_failed,
"route_model_failed": _wrap_route_model_failed,
"route_parse_failed": _wrap_route_failed,
}