fix(shipping-process-gates): 收口技术重试并补齐运维 UI

跨 Job 累计技术失败次数,耗尽后将 Attempt/Gate 置为 failed_terminal;
收缩旧 action_buttons;healthcheck 增加 Worker 领取探针;恢复卡展示责任方与审计,Admin 诊断改主从布局。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-01 13:54:14 +08:00
1 parent 323928626b
commit cef3d5b26a
15 files changed
+489 -150

No files matched your search

+13 -5
View File
@@ -513,8 +513,8 @@ def workspace_create_shipping_task_from_notice():
task_no=task_id,
)
if not intake.accepted:
from app.services.shipping_notice.state_machine import action_buttons_for_checkpoint
return jsonify({'status': 'needs_human', 'task_id': task_id, 'message': '未能从附件抽取到可解析文本(可能是扫描件/OCR 不可用)。请复制粘贴文本,或更换清晰版文件后重试。', 'data': {'notice_upload': intake.to_notice_upload_meta()}, 'human_options': ['reparse', 'reject'], 'checkpoint': CP_NOTICE_TEXT_EXTRACTION_FAILED, 'action_buttons': action_buttons_for_checkpoint(CP_NOTICE_TEXT_EXTRACTION_FAILED)})
# 旧 action_buttons 业务调用清零:仅保留 human_options 文案提示,不再下发可点击恢复按钮。
return jsonify({'status': 'needs_human', 'task_id': task_id, 'message': '未能从附件抽取到可解析文本(可能是扫描件/OCR 不可用)。请复制粘贴文本,或更换清晰版文件后重试。', 'data': {'notice_upload': intake.to_notice_upload_meta()}, 'human_options': ['reparse', 'reject'], 'checkpoint': CP_NOTICE_TEXT_EXTRACTION_FAILED, 'action_buttons': []})
task = ShippingTask.query.filter_by(task_no=task_id).first()
if task:
task.raw_content = intake.text
@@ -915,9 +915,17 @@ def workspace_match_shipping_inventory(task_no: str):
if options is not None:
matched['human_options'] = options
if 'action_buttons' not in matched:
buttons = action_buttons_for_checkpoint(checkpoint)
if buttons:
matched['action_buttons'] = buttons
# [STEP] 已有 ProcessExecution 时不再补充旧 STP 恢复按钮。
from app.models import ShippingProcessExecution
has_execution = (
ShippingProcessExecution.query
.filter_by(task_id=int(task.id))
.first()
) is not None
if not has_execution:
buttons = action_buttons_for_checkpoint(checkpoint)
if buttons:
matched['action_buttons'] = buttons
return jsonify(matched)