Pārlūkot izejas kodu

fix(events): 在 API 启动对账中补发应用规范事件

Trace API 完成工具审批和 running 状态对账后,调用 ApplicationRuntime 扫描应用根 Trace,从权威协议状态与候选账本补发缺失 run_event 并继续 cursor 投影。

对账失败只记录错误,不覆盖 Trace 运行状态或触发业务回滚。
SamLee 12 stundas atpakaļ
vecāks
revīzija
2b839f6a70
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 8 0
      cyber_agent/trace/run_api.py

+ 8 - 0
cyber_agent/trace/run_api.py

@@ -1277,6 +1277,14 @@ async def reconcile_traces():
                     result_summary="[Reconciliation] 任务由于服务重启或异常中断已自动停止。"
                 )
                 count += 1
+
+        if _application_runtime is not None:
+            try:
+                await _application_runtime.reconcile_all_events()
+            except Exception:
+                logger.exception(
+                    "[Reconciliation] Application run-event reconciliation failed"
+                )
         
         if count > 0:
             logger.info(f"[Reconciliation] Successfully reconciled {count} traces.")