Просмотр исходного кода

Release 0.8.1.24: Linux desktop Qt Clean port & .68 deployment, SetStageIntent unique command_id, 120.efi /GNR & XML parity, and non-RMT/AMT MT-only error UI closure

XJKJ STL 2 недель назад
Родитель
Сommit
31cabc4f2a
52 измененных файлов с 1501 добавлено и 355 удалено
  1. 6 3
      DDR5_SLT_Monitor.pro
  2. 1 1
      Dockerfile
  3. 2 2
      README.md
  4. 1 1
      VERSION
  5. 1 1
      contracts/firmware-vd012.json
  6. 13 0
      deploy/linux-desktop/HOVSE_SLT_Pro.desktop
  7. 10 0
      deploy/linux-desktop/port.json
  8. 31 0
      deploy/linux-desktop/run-qt.sh
  9. 1 0
      deploy/pxe-dhcp/Dockerfile
  10. 1 0
      deploy/pxe-dhcp/entrypoint.sh
  11. 3 3
      docker-compose.yml
  12. BIN
      docs/6400高温罩快速使用说明书.docx
  13. 21 6
      docs/QT_CLIENT_API_ZH.md
  14. 4 5
      docs/WEBSOCKET_API_ZH.md
  15. 5 3
      native/stl_accel/opencl_batch.c
  16. 105 25
      native/stl_accel/parser_re2c.re
  17. 65 14
      native/stl_accel/src/actors.rs
  18. 58 28
      native/stl_accel/src/api.rs
  19. 19 18
      native/stl_accel/src/commands.rs
  20. 10 2
      native/stl_accel/src/devices.rs
  21. 51 0
      native/stl_accel/src/main.rs
  22. 156 18
      native/stl_accel/src/pxe.rs
  23. 21 8
      native/stl_accel/src/results.rs
  24. 4 2
      native/stl_accel/src/storage.rs
  25. 111 41
      native/stl_accel/src/workflow.rs
  26. 4 0
      native/stl_accel/zig_kernels.zig
  27. 67 19
      src/appconfig.h
  28. 105 39
      src/backendlink.cpp
  29. 9 2
      src/backendlink.h
  30. 13 0
      src/comworker.cpp
  31. 121 9
      src/createtaskdialog.cpp
  32. 5 0
      src/createtaskdialog.h
  33. 132 5
      src/detailview.cpp
  34. 7 0
      src/detailview.h
  35. 64 32
      src/localplans.cpp
  36. 18 2
      src/main.cpp
  37. 94 29
      src/mainwindow.cpp
  38. 2 0
      src/mainwindow.h
  39. 37 3
      src/overviewview.cpp
  40. 1 0
      src/overviewview.h
  41. 4 0
      src/powerbutton.cpp
  42. 7 0
      src/powerbutton.h
  43. 49 10
      src/stationdata.cpp
  44. 11 5
      src/stationdata.h
  45. 9 3
      tools/validate_qt_clean.py
  46. 2 1
      web/amt-controls.js
  47. 6 1
      web/app.js
  48. 6 1
      web/boot-plan-controls.js
  49. 15 7
      web/dimm-overview.js
  50. 2 1
      web/firmware-controls.js
  51. 2 2
      web/index.html
  52. 9 3
      web/stage-progress.js

+ 6 - 3
DDR5_SLT_Monitor.pro

@@ -15,7 +15,8 @@ QT       += printsupport
 
 TARGET    = DDR5_SLT_Monitor
 TEMPLATE  = app
-CONFIG   += c++11
+greaterThan(QT_MAJOR_VERSION, 5): CONFIG += c++17
+else: CONFIG += c++11
 
 # 界面代码全部由 src/mainwindow.ui 生成
 INCLUDEPATH += $$PWD/src
@@ -65,8 +66,10 @@ SOURCES += \
     src/3rdparty/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c
 
 win32: SOURCES += src/3rdparty/libxlsxwriter/third_party/minizip/iowin32.c
-QMAKE_CFLAGS   += -march=x86-64 -mtune=generic
-QMAKE_CXXFLAGS += -march=x86-64 -mtune=generic
+contains(QT_ARCH, x86_64) {
+    QMAKE_CFLAGS   += -march=x86-64 -mtune=generic
+    QMAKE_CXXFLAGS += -march=x86-64 -mtune=generic
+}
 
 SOURCES += \
     src/main.cpp \

+ 1 - 1
Dockerfile

@@ -14,7 +14,7 @@ COPY config/ ./config/
 COPY build/native/stl_native_server /usr/local/bin/stl_native_server
 
 ARG STL_BUILD_COMMIT=vd012-native
-ARG STL_VERSION=0.8.1.23
+ARG STL_VERSION=0.8.1.24
 ENV STL_BUILD_COMMIT=${STL_BUILD_COMMIT} \
     STL_VERSION=${STL_VERSION}
 

Разница между файлами не показана из-за своего большого размера
+ 2 - 2
README.md


+ 1 - 1
VERSION

@@ -1 +1 @@
-0.8.1.23
+0.8.1.24

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
contracts/firmware-vd012.json


+ 13 - 0
deploy/linux-desktop/HOVSE_SLT_Pro.desktop

@@ -0,0 +1,13 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=HOVSE SLT Pro
+GenericName=DDR5 高温内存测试监控平台
+Comment=XJKJ-STL 多工位 DDR5 高温内存测试上位机 (0.8.1.24)
+Exec=/opt/XJKJ-STL/desktop-qt/run-qt.sh
+Path=/opt/XJKJ-STL/desktop-qt
+Icon=/opt/XJKJ-STL/desktop-qt/logo-mark.png
+Terminal=false
+Categories=Utility;Development;
+StartupNotify=true
+

+ 10 - 0
deploy/linux-desktop/port.json

@@ -0,0 +1,10 @@
+{
+  "_comment": "Linux 桌面工位串口配置:数组第 1 个对应 001 工位,依次到 004。请按实际 STM32 高温罩串口填写(如 ttyUSB1 或 serialNumber);注意禁止占用 /dev/ttyUSB0。",
+  "serialPorts": [
+    { "port": "", "serialNumber": "", "baud": 115200 },
+    { "port": "", "serialNumber": "", "baud": 115200 },
+    { "port": "", "serialNumber": "", "baud": 115200 },
+    { "port": "", "serialNumber": "", "baud": 115200 }
+  ]
+}
+

+ 31 - 0
deploy/linux-desktop/run-qt.sh

@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+# 清除全局半导体工具链(如 /etc/profile.d/anlogic-td2026.sh)注入的私有 Qt/libstdc++ 与 offscreen 环境变量
+unset LD_LIBRARY_PATH QT_PLUGIN_PATH QT_QPA_PLATFORM QT_STYLE_OVERRIDE
+
+export LANG="${LANG:-C.UTF-8}"
+export LC_ALL="${LC_ALL:-C.UTF-8}"
+
+# KDE Plasma Wayland 会话下若存在 XWayland (DISPLAY),优先走 xcb 保证无边框拖拽、弹窗居中与最大化精确一致
+if [ -n "${STL_QT_PLATFORM:-}" ]; then
+    export QT_QPA_PLATFORM="${STL_QT_PLATFORM}"
+elif [ -n "${DISPLAY:-}" ]; then
+    export QT_QPA_PLATFORM=xcb
+fi
+
+# 若安装目录可写则就地保存配置/日志/client-id;若为系统只读目录则自动落盘到用户配置目录
+if [ -w "${APP_DIR}" ]; then
+    export STL_QT_CONFIG_DIR="${APP_DIR}"
+else
+    USER_CFG="${XDG_CONFIG_HOME:-$HOME/.config}/xjkj-stl"
+    mkdir -p "${USER_CFG}"
+    [ -f "${USER_CFG}/config.json" ] || cp -f "${APP_DIR}/config.json" "${USER_CFG}/config.json" 2>/dev/null || true
+    [ -f "${USER_CFG}/port.json" ] || cp -f "${APP_DIR}/port.json" "${USER_CFG}/port.json" 2>/dev/null || true
+    export STL_QT_CONFIG_DIR="${USER_CFG}"
+fi
+
+exec "${APP_DIR}/DDR5_SLT_Monitor" "$@"
+

+ 1 - 0
deploy/pxe-dhcp/Dockerfile

@@ -9,3 +9,4 @@ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
 RUN chmod +x /usr/local/bin/entrypoint.sh
 
 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
+

+ 1 - 0
deploy/pxe-dhcp/entrypoint.sh

@@ -41,3 +41,4 @@ EOF
 
 echo "[pxe-dhcp] Starting dnsmasq strictly on ${PXE_IFACE} (${PXE_SERVER_IP}/24 -> ${PXE_BOOT_FILE}, blocking ${PXE_DENY_IFACE})"
 exec dnsmasq --no-daemon --conf-file=/etc/dnsmasq.pxe.conf
+

+ 3 - 3
docker-compose.yml

@@ -3,9 +3,9 @@ services:
     build:
       context: .
       args:
-        STL_VERSION: ${STL_VERSION:-0.8.1.23}
+        STL_VERSION: ${STL_VERSION:-0.8.1.24}
         STL_BUILD_COMMIT: ${STL_BUILD_COMMIT:-vd012-native}
-    image: xjkj-stl:0.8.1.23
+    image: xjkj-stl:0.8.1.24
     container_name: xjkj-stl-backend
     restart: unless-stopped
     stop_grace_period: 30s
@@ -44,7 +44,7 @@ services:
   pxe-dhcp:
     build:
       context: ./deploy/pxe-dhcp
-    image: xjkj-pxe-dhcp:0.8.1.23
+    image: xjkj-pxe-dhcp:0.8.1.24
     container_name: xjkj-pxe-dhcp
     restart: unless-stopped
     network_mode: host

BIN
docs/6400高温罩快速使用说明书.docx


Разница между файлами не показана из-за своего большого размера
+ 21 - 6
docs/QT_CLIENT_API_ZH.md


Разница между файлами не показана из-за своего большого размера
+ 4 - 5
docs/WEBSOCKET_API_ZH.md


+ 5 - 3
native/stl_accel/opencl_batch.c

@@ -106,10 +106,11 @@ static const char *k_opencl_src =
     "    uchar flg = 0u;\n"
     "    for (uint i = base; i < lim; i++) {\n"
     "        uchar c = buf[i];\n"
-    "        if (c == 10u || c == 13u) flg |= 8u;\n"
+    "        if (c == 10u || c == 13u) flg |= 16u;\n"
     "        else if (c == 91u) flg |= 1u;\n"
     "        else if (c == 62u || c == 35u) flg |= 2u;\n"
     "        else if (c == 69u || c == 70u || c == 87u || c == 85u) flg |= 4u;\n"
+    "        else if (c >= 48u && c <= 57u) flg |= 8u;\n"
     "    }\n"
     "    block_flags[blk] = flg;\n"
     "}\n";
@@ -326,8 +327,8 @@ size_t stl_batch_rescan_logs(
         size_t base = blk << 8;
         size_t lim = base + 256u;
         if (lim > len) lim = len;
-        if ((bf & 8u) == 0 && !prev_cr) {
-            cur_tag |= (bf & 7u);
+        if ((bf & 16u) == 0 && !prev_cr) {
+            cur_tag |= (bf & 15u);
             continue;
         }
         for (size_t i = base; i < lim && line_count < max_lines; i++) {
@@ -355,6 +356,7 @@ size_t stl_batch_rescan_logs(
                 if (c == '[') cur_tag |= 1u;
                 else if (c == '>' || c == '#') cur_tag |= 2u;
                 else if (c == 'E' || c == 'F' || c == 'W' || c == 'U') cur_tag |= 4u;
+                else if (c >= '0' && c <= '9') cur_tag |= 8u;
             }
         }
     }

+ 105 - 25
native/stl_accel/parser_re2c.re

@@ -299,8 +299,67 @@ static void extract_coords_and_addr(const uint8_t *s, const uint8_t *end, StlRe2
     int bg = -1;
     int ba = -1;
     int direct_bank = -1;
+    int explicit_socket = (ev->cpu >= 0) ? (int)ev->cpu : -1;
+    int fallback_cpu = -1;
+    int ctrl_mc = -1;
+    int raw_chid = -1;
 
-    for (const uint8_t *p = s; p < end; p++) {
+    /* Check for 120.efi "/GNR ... Flag=<hex> ... Socket=<hex> ... MC=<hex> Channel=<hex> ..." (hex fields) */
+    const uint8_t *gnr_pos = NULL;
+    for (const uint8_t *p = s; p + 5 <= end; p++) {
+        if (p[0] == '/' && p[1] == 'G' && p[2] == 'N' && p[3] == 'R' && (p[4] == ' ' || p[4] == '\t')) {
+            gnr_pos = p;
+            break;
+        }
+    }
+    if (gnr_pos) {
+        int gnr_mc = -1, gnr_nmmc = -1, gnr_ch = -1, gnr_nmch = -1;
+        for (const uint8_t *p = gnr_pos + 5; p < end; p++) {
+            if (p > gnr_pos && ((p[-1] >= 'a' && p[-1] <= 'z') || (p[-1] >= 'A' && p[-1] <= 'Z') ||
+                                (p[-1] >= '0' && p[-1] <= '9') || p[-1] == '_')) {
+                continue;
+            }
+            const uint8_t *after = NULL;
+            uint64_t hv = 0;
+            if (match_ci_kw(p, end, "socket", &after)) {
+                if (parse_hex64_at(after, end, &hv) && hv <= 1) explicit_socket = (int)hv;
+            } else if (match_ci_kw(p, end, "mc", &after)) {
+                if (parse_hex64_at(after, end, &hv) && hv <= 11) gnr_mc = (int)hv;
+            } else if (match_ci_kw(p, end, "nmmc", &after)) {
+                if (parse_hex64_at(after, end, &hv) && hv <= 11) gnr_nmmc = (int)hv;
+            } else if (match_ci_kw(p, end, "channel", &after)) {
+                if (parse_hex64_at(after, end, &hv) && hv <= 23) gnr_ch = (int)hv;
+            } else if (match_ci_kw(p, end, "nmchannel", &after)) {
+                if (parse_hex64_at(after, end, &hv) && hv <= 23) gnr_nmch = (int)hv;
+            } else if (match_ci_kw(p, end, "dimm", &after) || match_ci_kw(p, end, "nmdimm", &after)) {
+                if (parse_hex64_at(after, end, &hv) && hv <= 1) ev->dimm = (int8_t)hv;
+            } else if (match_ci_kw(p, end, "rank", &after) || match_ci_kw(p, end, "cs", &after)) {
+                if (ev->rank < 0 && parse_hex64_at(after, end, &hv) && hv <= 3) ev->rank = (int8_t)hv;
+            } else if (match_ci_kw(p, end, "bg", &after)) {
+                if (parse_hex64_at(after, end, &hv) && hv <= 7) bg = (int)hv;
+            } else if (match_ci_kw(p, end, "bank", &after)) {
+                if (parse_hex64_at(after, end, &hv)) {
+                    if (hv <= 3) ba = (int)hv;
+                    else if (hv < 32) direct_bank = (int)hv;
+                }
+            }
+        }
+        int eff_mc = (gnr_mc >= 0) ? gnr_mc : gnr_nmmc;
+        int eff_ch = (gnr_ch >= 0) ? gnr_ch : gnr_nmch;
+        /* Granite Rapids-AP has 12 M2M/MCs (MC 0..11) x 1 sub-MC channel (Channel 0) */
+        if (eff_mc >= 0 && eff_mc <= 11 && eff_ch <= 0) {
+            ev->channel = (int8_t)eff_mc;
+        } else if (eff_mc == 0 && eff_ch >= 0 && eff_ch <= 11) {
+            ev->channel = (int8_t)eff_ch;
+        } else if (eff_mc > 0 && eff_ch > 0 && (eff_mc * 2 + eff_ch) <= 11) {
+            ev->channel = (int8_t)(eff_mc * 2 + eff_ch);
+        } else if (eff_ch >= 0 && eff_ch <= 11) {
+            ev->channel = (int8_t)eff_ch;
+        }
+    }
+
+    const uint8_t *kw_scan_end = gnr_pos ? gnr_pos : end;
+    for (const uint8_t *p = s; p < kw_scan_end; p++) {
         if (p > s) {
             uint8_t prev = p[-1];
             if ((prev >= 'a' && prev <= 'z') || (prev >= 'A' && prev <= 'Z') ||
@@ -310,58 +369,78 @@ static void extract_coords_and_addr(const uint8_t *s, const uint8_t *end, StlRe2
         }
         const uint8_t *after = NULL;
         int32_t v = 0;
-        if (match_ci_kw(p, end, "socket", &after) || match_ci_kw(p, end, "scktid", &after) ||
-            match_ci_kw(p, end, "node", &after) || match_ci_kw(p, end, "cpu", &after)) {
-            if (parse_i32_at(after, end, &v, NULL) && v >= 0 && v <= 1 && ev->cpu < 0) {
-                ev->cpu = (int8_t)v;
-            }
-        } else if (match_ci_kw(p, end, "channel", &after) || match_ci_kw(p, end, "ch", &after) ||
-                   match_ci_kw(p, end, "chan", &after) ||
-                   (ev->channel < 0 && match_ci_kw(p, end, "chid", &after))) {
-            if (parse_i32_at(after, end, &v, NULL) && v >= 0 && v <= 23) {
-                if (v >= 12 && ev->cpu < 0) {
-                    ev->cpu = 1;
+        if (match_ci_kw(p, kw_scan_end, "socket", &after) || match_ci_kw(p, kw_scan_end, "sock", &after) ||
+            match_ci_kw(p, kw_scan_end, "scktid", &after) || match_ci_kw(p, kw_scan_end, "node", &after)) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL) && v >= 0 && v <= 1) {
+                explicit_socket = (int)v;
+            }
+        } else if (match_ci_kw(p, kw_scan_end, "cpu", &after)) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL) && v >= 0 && v <= 1 && fallback_cpu < 0) {
+                fallback_cpu = (int)v;
+            }
+        } else if (match_ci_kw(p, kw_scan_end, "ctrl", &after) || match_ci_kw(p, kw_scan_end, "mc", &after)) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL) && v >= 0 && v <= 11) {
+                ctrl_mc = (int)v;
+            }
+        } else if (match_ci_kw(p, kw_scan_end, "channel", &after) || match_ci_kw(p, kw_scan_end, "ch", &after) ||
+                   match_ci_kw(p, kw_scan_end, "chan", &after) ||
+                   (ev->channel < 0 && match_ci_kw(p, kw_scan_end, "chid", &after))) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL) && v >= 0 && v <= 23) {
+                raw_chid = (int)v;
+                if (v >= 12 && explicit_socket < 0) {
+                    explicit_socket = 1;
                     ev->channel = (int8_t)(v - 12);
                 } else if (v <= 11) {
                     ev->channel = (int8_t)v;
                 }
             }
-        } else if (match_ci_kw(p, end, "dimm", &after) || match_ci_kw(p, end, "dimmslot", &after) ||
-                   match_ci_kw(p, end, "slot", &after) || match_ci_kw(p, end, "sl", &after)) {
-            if (parse_i32_at(after, end, &v, NULL) && v >= 0 && v <= 23) {
+        } else if (match_ci_kw(p, kw_scan_end, "dimm", &after) || match_ci_kw(p, kw_scan_end, "dimmslot", &after) ||
+                   match_ci_kw(p, kw_scan_end, "dimmsl", &after) ||
+                   match_ci_kw(p, kw_scan_end, "slot", &after) || match_ci_kw(p, kw_scan_end, "sl", &after)) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL) && v >= 0 && v <= 23) {
                 if (v <= 1) {
                     ev->dimm = (int8_t)v;
                 } else if (ev->channel < 0) {
-                    ev->cpu = (int8_t)(v / 12);
+                    explicit_socket = (int)(v / 12);
                     ev->channel = (int8_t)(v % 12);
                     ev->dimm = 0;
                 }
             }
-        } else if (match_ci_kw(p, end, "rank", &after) || match_ci_kw(p, end, "dimmrank", &after)) {
-            if (parse_i32_at(after, end, &v, NULL) && v >= 0 && v <= 3) {
+        } else if (match_ci_kw(p, kw_scan_end, "rank", &after) || match_ci_kw(p, kw_scan_end, "dimmrank", &after) ||
+                   match_ci_kw(p, kw_scan_end, "dimmrk", &after)) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL) && v >= 0 && v <= 3) {
                 ev->rank = (int8_t)v;
             }
-        } else if (match_ci_kw(p, end, "bankgroup", &after) || match_ci_kw(p, end, "bg", &after)) {
-            if (parse_i32_at(after, end, &v, NULL) && v >= 0 && v <= 7) {
+        } else if (match_ci_kw(p, kw_scan_end, "bankgroup", &after) || match_ci_kw(p, kw_scan_end, "bg", &after)) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL) && v >= 0 && v <= 7) {
                 bg = (int)v;
             }
-        } else if (match_ci_kw(p, end, "bank", &after) || match_ci_kw(p, end, "ba", &after)) {
-            if (parse_i32_at(after, end, &v, NULL)) {
+        } else if (match_ci_kw(p, kw_scan_end, "bank", &after) || match_ci_kw(p, kw_scan_end, "ba", &after)) {
+            if (parse_i32_at(after, kw_scan_end, &v, NULL)) {
                 if ((after - p) == 2 && v >= 0 && v <= 3) {
                     ba = (int)v;
                 } else if (v >= 0 && v < 32) {
                     direct_bank = (int)v;
                 }
             }
-        } else if (match_ci_kw(p, end, "addr", &after) || match_ci_kw(p, end, "address", &after) ||
-                   match_ci_kw(p, end, "checkpoint", &after)) {
+        } else if (match_ci_kw(p, kw_scan_end, "addr", &after) || match_ci_kw(p, kw_scan_end, "address", &after) ||
+                   match_ci_kw(p, kw_scan_end, "checkpoint", &after)) {
             uint64_t a = 0;
-            if (parse_hex64_at(after, end, &a)) {
+            if (parse_hex64_at(after, kw_scan_end, &a)) {
                 ev->addr = a;
             }
         }
     }
 
+    if (!gnr_pos && ctrl_mc > 0 && ctrl_mc <= 11 && raw_chid == 0) {
+        ev->channel = (int8_t)ctrl_mc;
+    }
+    if (explicit_socket >= 0 && explicit_socket <= 1) {
+        ev->cpu = (int8_t)explicit_socket;
+    } else if (!gnr_pos && fallback_cpu >= 0 && fallback_cpu <= 1 && ev->cpu < 0) {
+        ev->cpu = (int8_t)fallback_cpu;
+    }
+
     if (bg >= 0 && ba >= 0) {
         int combined = bg * 4 + ba;
         if (combined >= 0 && combined < 32) ev->bank = (int8_t)combined;
@@ -787,6 +866,7 @@ scan_anywhere:
                 continue;
             }
             "Channel/Slot:" | "Channel-Slot:" |
+            "/GNR " ("DDR(hex)" | "raw(hex)" | "Decode=") |
             "(Chan,Slot,Rank,Bank,Row," | "(Channel,Slot,Rank,Bank,Row," | "(Ch,Sl,Rk,Bk,Rw," {
                 ev->subkind = 5; /* 2nd-line MT ECC/Data Error coordinate continuation */
                 extract_coords_and_addr(s, end, ev);

+ 65 - 14
native/stl_accel/src/actors.rs

@@ -53,6 +53,8 @@ pub struct StationPublishedView {
     pub raw_write_offset: u64,
     pub clean_base_offset: u64,
     pub clean_write_offset: u64,
+    pub expected_mt_report_name: String,
+    pub mt_efi_path: String,
 }
 
 pub struct UartOffsets {
@@ -324,6 +326,10 @@ pub fn build_published_view(st: &StationState) -> StationPublishedView {
         raw_write_offset: st.raw_ring.write_offset(),
         clean_base_offset: st.clean_ring.base_offset(),
         clean_write_offset: st.clean_ring.write_offset(),
+        expected_mt_report_name: st.expected_mt_report_name.clone(),
+        mt_efi_path: st
+            .mt_selection
+            .get_str_or("efi_path", "118.efi"),
     }
 }
 
@@ -846,8 +852,31 @@ pub(crate) fn build_qt_clean_station_entry(st: &StationState) -> JsonVal {
     } else {
         "idle"
     };
+    let verdict_scope = if has_any_err {
+        if !st.last_err_stage.is_empty() {
+            st.last_err_stage.clone()
+        } else {
+            ["mt", "amt", "rmt", "training"]
+                .iter()
+                .find(|&&k| st.stage_errors.get(k).map(|v| !v.is_empty()).unwrap_or(false))
+                .copied()
+                .unwrap_or("")
+                .to_string()
+        }
+    } else if st.hot.mt_pass_complete {
+        "mt".to_string()
+    } else if st.hot.amt_complete {
+        "amt".to_string()
+    } else if st.hot.rmt_complete {
+        "rmt".to_string()
+    } else if st.hot.training_complete {
+        "training".to_string()
+    } else {
+        String::new()
+    };
     s.set("verdict", JsonVal::Str(verdict_str.to_string()));
-    s.set("verdict_scope", JsonVal::Str(String::new()));
+    s.set("verdict_scope", JsonVal::Str(verdict_scope));
+    s.set("mt_result", strip_private_keys_recursive(&st.mt_result));
     s.set(
         "can_start",
         JsonVal::Bool(
@@ -1510,7 +1539,7 @@ pub fn spawn_station_actor(
                             if method == "ConfigureConnections" {
                                 next_ipmi_poll_ms = 0;
                             }
-                            uart_clone.publish(&st, false);
+                            uart_clone.publish(&st, method == "ClearTerminalView");
                             if let Ok(mut guard) = view_clone.write() {
                                 *guard = build_published_view(&st);
                             }
@@ -1638,7 +1667,13 @@ pub fn spawn_station_actor(
                                 }
                             }
                             if let Some(pwr) = power {
-                                if pwr == "off" || pwr == "unknown" {
+                                if pwr == "off" {
+                                    st.clear_all_dimm_temps();
+                                    if !st.is_run_active() && !st.awaiting_dimm_replacement {
+                                        st.reset_all_dimm_stages();
+                                    }
+                                    state_dirty = true;
+                                } else if pwr == "unknown" {
                                     st.clear_bmc_sdr_temps();
                                 }
                                 if st.server_power != pwr {
@@ -1800,6 +1835,21 @@ pub fn spawn_station_actor(
                         ) {
                             st.apply_mt_html_report(&report, &full_path, true);
                             state_dirty = true;
+                        } else if !st.expected_mt_report_name.is_empty() {
+                            st.mt_report_sync_pending = true;
+                            st.mt_waiting_report_until_ms = now + 6_000;
+                            state_dirty = true;
+                        } else if st
+                            .mt_selection
+                            .get_str_or("efi_path", "118.efi")
+                            .trim()
+                            .to_ascii_uppercase()
+                            .ends_with("118.EFI")
+                            && st.mt_waiting_report_until_ms == 0
+                        {
+                            st.mt_report_sync_pending = true;
+                            st.mt_waiting_report_until_ms = now + 2_500;
+                            state_dirty = true;
                         }
                     } else if pxe_rpt_inflight
                         .compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
@@ -1907,7 +1957,8 @@ pub fn spawn_station_actor(
                     if bmc_disconnected && serial_disconnected {
                         if st.has_stale_station_state() {
                             let since = *offline_since_ms.get_or_insert(now);
-                            if now.saturating_sub(since) >= 1500 {
+                            let grace_ms = if st.is_run_active() { 12_000 } else { 1_500 };
+                            if now.saturating_sub(since) >= grace_ms {
                                 st.reset_on_disconnect();
                                 offline_since_ms = None;
                                 state_dirty = true;
@@ -2096,16 +2147,16 @@ fn handle_actor_start_test(
     }
 
     st.command = strip_private_keys_recursive(clean_cmd_projection);
-    let audit = if has_task_params {
-        Some(AuditRecordDraft {
-            category: "start_test".to_string(),
-            action: "start_test_with_profile".to_string(),
-            summary: format!("启动单次全自动测试任务 (boot_id={})", st.boot_id),
-            details: strip_private_keys_recursive(params),
-        })
-    } else {
-        None
-    };
+    let audit = Some(AuditRecordDraft {
+        category: "start_test".to_string(),
+        action: if has_task_params {
+            "start_test_with_profile".to_string()
+        } else {
+            "start_test".to_string()
+        },
+        summary: format!("启动测试任务 (boot_id={})", st.boot_id),
+        details: strip_private_keys_recursive(params),
+    });
 
     Ok((
         StartTestActorReply {

+ 58 - 28
native/stl_accel/src/api.rs

@@ -59,6 +59,7 @@ pub struct AppHub {
     pub queue_book: RwLock<QueueBook>,
     pub audit_book: Mutex<AuditEventBook>,
     pub pxe_state: RwLock<JsonVal>,
+    pub auto_cmd_seq: AtomicU64,
 }
 
 pub type ServerContext = AppHub;
@@ -228,6 +229,7 @@ impl AppHub {
                 client_sessions: BTreeMap::new(),
             }),
             pxe_state: RwLock::new(pxe_state),
+            auto_cmd_seq: AtomicU64::new(1),
         });
 
         // Prime initial zero-copy QtClean state snapshot immediately
@@ -539,6 +541,11 @@ impl AppHub {
         }
     }
 
+    fn next_auto_cmd_id(&self, prefix: &str) -> String {
+        let seq = self.auto_cmd_seq.fetch_add(1, Ordering::Relaxed);
+        format!("{}-{}-{}", prefix, now_ms(), seq)
+    }
+
     fn execute_actor_command(
         &self,
         sid: &str,
@@ -769,7 +776,7 @@ impl AppHub {
                 info.set("server_id", JsonVal::Str(self.server_id.clone()));
                 info.set("station_count", JsonVal::Num(self.stations.len() as f64));
                 info.set("mode", JsonVal::Str("hardware".to_string()));
-                info.set("started_unix_ms", JsonVal::Num(self.started_ms as f64));
+                info.set("started_unix_ms", JsonVal::Str(self.started_ms.to_string()));
                 Ok(info)
             }
             "ListStations" => {
@@ -899,7 +906,7 @@ impl AppHub {
                 };
 
                 // Blocking pseudo-push live tail: wait on Condvar without touching any Actor lock!
-                if wait_ms > 0 && req_offset > 0 {
+                if wait_ms > 0 {
                     if let Ok(guard) = handle.uart_notify.state.lock() {
                         if guard.clean_write <= req_offset
                             && guard.clean_clear_offset <= req_offset
@@ -971,7 +978,12 @@ impl AppHub {
                 Ok(self.build_qt_clean_state())
             }
             "StartTest" => {
-                let cmd_id = params.get_str_or("command_id", &format!("qt-start-{}", now_ms()));
+                let op_role = if is_qt_clean { "qt" } else { "web" };
+                let cmd_id = params
+                    .get_str("command_id")
+                    .filter(|s| !s.trim().is_empty())
+                    .map(|s| s.to_string())
+                    .unwrap_or_else(|| self.next_auto_cmd_id("qt-start"));
                 let sid = params.get_str_or("station_id", "S1");
                 let Some(handle) = self.stations.get(&sid) else {
                     return Err(("NOT_FOUND".to_string(), format!("未知工位: {}", sid)));
@@ -984,7 +996,7 @@ impl AppHub {
                     &sid,
                     "StartTest",
                     "start",
-                    "qt",
+                    op_role,
                     None,
                     true,
                 );
@@ -1020,7 +1032,7 @@ impl AppHub {
                             }
                         }
                         if let Some(audit) = actor_rep.audit {
-                            self.commit_audit(&sid, "qt", audit);
+                            self.commit_audit(&sid, op_role, audit);
                         }
                         let mut res_obj = JsonVal::obj();
                         res_obj.set("previous_power", JsonVal::Str(actor_rep.prev_power));
@@ -1059,7 +1071,12 @@ impl AppHub {
                 }
             }
             "StageAction" | "ConfirmDimmReplacement" | "SetStageIntent" => {
-                let cmd_id = params.get_str_or("command_id", &format!("qt-stage-{}", now_ms()));
+                let op_role = if is_qt_clean { "qt" } else { "web" };
+                let cmd_id = params
+                    .get_str("command_id")
+                    .filter(|s| !s.trim().is_empty())
+                    .map(|s| s.to_string())
+                    .unwrap_or_else(|| self.next_auto_cmd_id("qt-stage"));
                 let sid = params.get_str_or("station_id", "S1");
                 if !self.stations.contains_key(&sid) {
                     return Err(("NOT_FOUND".to_string(), format!("未知工位: {}", sid)));
@@ -1069,21 +1086,15 @@ impl AppHub {
                 } else if method == "SetStageIntent" {
                     "set_stage_intent".to_string()
                 } else {
-                    params.get_str_or("action", "continue_uip")
+                    let act_raw = params.get_str_or("action", "");
+                    if act_raw.trim().is_empty() {
+                        return Err((
+                            "INVALID_ARGUMENT".to_string(),
+                            "StageAction 缺少 action 参数".to_string(),
+                        ));
+                    }
+                    act_raw
                 };
-                let (replayed, pending_item) = self.register_running_command(
-                    &cmd_id,
-                    &sid,
-                    method,
-                    &action,
-                    "qt",
-                    None,
-                    false,
-                );
-                if replayed {
-                    return Ok(pending_item);
-                }
-
                 let mapped_method = match action.as_str() {
                     "continue_uip" => "ContinueUip",
                     "apply_uip" => "ApplyUipParameters",
@@ -1096,10 +1107,27 @@ impl AppHub {
                     "set_stage_intent" => "SetStageIntent",
                     "submit_task_batch" | "submit_batch" => "SubmitTaskBatch",
                     "control_task_batch" | "control_batch" => "ControlTaskBatch",
-                    _ => "ContinueUip",
+                    other => {
+                        return Err((
+                            "INVALID_ARGUMENT".to_string(),
+                            format!("未知 StageAction 动作: {}", other),
+                        ));
+                    }
                 };
+                let (replayed, pending_item) = self.register_running_command(
+                    &cmd_id,
+                    &sid,
+                    method,
+                    &action,
+                    op_role,
+                    None,
+                    false,
+                );
+                if replayed {
+                    return Ok(pending_item);
+                }
 
-                let exec_res = self.execute_actor_command(&sid, mapped_method, params, "qt");
+                let exec_res = self.execute_actor_command(&sid, mapped_method, params, op_role);
                 let completed_item = match exec_res {
                     Ok(res_val) => self.finalize_command(&cmd_id, |item| {
                         item.set("state", JsonVal::Str("succeeded".to_string()));
@@ -1137,10 +1165,12 @@ impl AppHub {
                 Ok(completed_item)
             }
             "SubmitTaskBatch" | "ControlTaskBatch" => {
-                let cmd_id = params.get_str_or(
-                    "command_id",
-                    &format!("qt-cmd-{}-{}", method, now_ms()),
-                );
+                let op_role = if is_qt_clean { "qt" } else { "web" };
+                let cmd_id = params
+                    .get_str("command_id")
+                    .filter(|s| !s.trim().is_empty())
+                    .map(|s| s.to_string())
+                    .unwrap_or_else(|| self.next_auto_cmd_id(&format!("qt-cmd-{}", method)));
                 let sid = params.get_str_or("station_id", "S1");
                 if !self.stations.contains_key(&sid) {
                     return Err(("NOT_FOUND".to_string(), format!("未知工位: {}", sid)));
@@ -1150,14 +1180,14 @@ impl AppHub {
                     &sid,
                     method,
                     &method.to_lowercase(),
-                    "qt",
+                    op_role,
                     None,
                     method == "SubmitTaskBatch",
                 );
                 if replayed {
                     return Ok(pending_item);
                 }
-                match self.execute_actor_command(&sid, method, params, "qt") {
+                match self.execute_actor_command(&sid, method, params, op_role) {
                     Ok(tb) => {
                         let completed_item = self.finalize_command(&cmd_id, |item| {
                             item.set("state", JsonVal::Str("succeeded".to_string()));

+ 19 - 18
native/stl_accel/src/commands.rs

@@ -12,9 +12,9 @@ use crate::pxe::{
 use crate::results::{now_ms, AsyncScriptStep, StationState};
 use crate::storage::save_station_settings;
 use crate::workflow::{
-    apply_profile_to_station, build_uefi_efi_probe_steps, build_uefi_mt_steps, control_boot_plan,
-    control_boot_plan_impl, needs_uefi_efi_probe, normalize_boot_plan, start_async_script,
-    submit_task_batch,
+    apply_profile_to_station, build_uefi_efi_probe_steps_for, build_uefi_mt_steps,
+    control_boot_plan, control_boot_plan_impl, needs_uefi_efi_probe, normalize_boot_plan,
+    start_async_script, submit_task_batch,
 };
 use std::path::Path;
 use std::sync::mpsc;
@@ -469,7 +469,7 @@ pub fn handle_station_command_nonblocking(
                     "commands",
                     JsonVal::Arr(extra_lines.into_iter().map(JsonVal::Str).collect()),
                 );
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_phase_action = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -482,7 +482,7 @@ pub fn handle_station_command_nonblocking(
                 res.set("confirmation", JsonVal::Str("submitted".to_string()));
                 res.set("commands", JsonVal::Arr(Vec::new()));
                 res.set("responses", JsonVal::Arr(Vec::new()));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_phase_action = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -542,7 +542,7 @@ pub fn handle_station_command_nonblocking(
                 res.set("action", JsonVal::Str("SkipAmt".to_string()));
                 res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
                 res.set("sequence", JsonVal::Num(seq as f64));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_phase_action = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -554,7 +554,7 @@ pub fn handle_station_command_nonblocking(
             let mut res = JsonVal::obj();
             res.set("action", JsonVal::Str("SkipAmt".to_string()));
             res.set("confirmation", JsonVal::Str("submitted".to_string()));
-            res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
             st.last_phase_action = Some(res.clone());
             StationCmdExec::Immediate(Ok(res), None)
         }
@@ -657,7 +657,7 @@ pub fn handle_station_command_nonblocking(
                 );
                 res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
                 res.set("sequence", JsonVal::Num(seq as f64));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_uip_apply = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -777,7 +777,7 @@ pub fn handle_station_command_nonblocking(
                     "commands",
                     JsonVal::Arr(cmds.into_iter().map(JsonVal::Str).collect()),
                 );
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_amt_apply = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -786,7 +786,7 @@ pub fn handle_station_command_nonblocking(
                 res.set("confirmation", JsonVal::Str("unchanged".to_string()));
                 res.set("commands", JsonVal::Arr(Vec::new()));
                 res.set("responses", JsonVal::Arr(Vec::new()));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_amt_apply = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -834,7 +834,7 @@ pub fn handle_station_command_nonblocking(
                 let mut res = JsonVal::obj();
                 res.set("action", JsonVal::Str("SkipAmt".to_string()));
                 res.set("confirmation", JsonVal::Str("submitted".to_string()));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 return StationCmdExec::Immediate(Ok(res), None);
             }
             let line = format!("{} {}", name, val).trim().to_string();
@@ -876,7 +876,7 @@ pub fn handle_station_command_nonblocking(
                     res.set("action", JsonVal::Str("SkipAmt".to_string()));
                     res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
                     res.set("sequence", JsonVal::Num(seq as f64));
-                    res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                    res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                     st.last_phase_action = Some(res.clone());
                     return StationCmdExec::Immediate(Ok(res), None);
                 }
@@ -886,7 +886,7 @@ pub fn handle_station_command_nonblocking(
                 let mut res = JsonVal::obj();
                 res.set("action", JsonVal::Str("SkipAmt".to_string()));
                 res.set("confirmation", JsonVal::Str("submitted".to_string()));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_phase_action = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -911,7 +911,7 @@ pub fn handle_station_command_nonblocking(
                     "setup_commands",
                     JsonVal::Arr(setup_cmds.into_iter().map(JsonVal::Str).collect()),
                 );
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_amt_start = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -968,7 +968,7 @@ pub fn handle_station_command_nonblocking(
                 res.set("action", JsonVal::Str("SkipMt".to_string()));
                 res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
                 res.set("sequence", JsonVal::Num(seq as f64));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 st.last_phase_action = Some(res.clone());
                 return StationCmdExec::Immediate(Ok(res), None);
             }
@@ -987,7 +987,7 @@ pub fn handle_station_command_nonblocking(
             let mut res = JsonVal::obj();
             res.set("action", JsonVal::Str("SkipMt".to_string()));
             res.set("confirmation", JsonVal::Str("submitted".to_string()));
-            res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
             st.last_phase_action = Some(res.clone());
             StationCmdExec::Immediate(Ok(res), None)
         }
@@ -1021,14 +1021,15 @@ pub fn handle_station_command_nonblocking(
                 res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
                 res.set("sequence", JsonVal::Num(seq as f64));
                 res.set("command", JsonVal::Str(raw_path));
-                res.set("observed_unix_ms", JsonVal::Num(now_ms() as f64));
+                res.set("observed_unix_ms", JsonVal::Str(now_ms().to_string()));
                 return StationCmdExec::Immediate(Ok(res), None);
             }
             let (tag, steps, allow_partial, mut meta, mark_mt_started) =
                 if needs_uefi_efi_probe(st, &sel) {
-                    let probe_steps = build_uefi_efi_probe_steps(st);
+                    let (probe_steps, base_efi) = build_uefi_efi_probe_steps_for(st, &sel);
                     let mut m = JsonVal::obj();
                     m.set("start_mt_sel", sel.clone());
+                    m.set("probe_efi_basename", JsonVal::Str(base_efi));
                     ("probe_mt_efi", probe_steps, false, m, false)
                 } else {
                     let mt_steps = build_uefi_mt_steps(st, &sel);

+ 10 - 2
native/stl_accel/src/devices.rs

@@ -390,8 +390,8 @@ pub fn flush_tx_pacer(st: &mut StationState, now: i64) -> Result<(), String> {
         let n_take = st.tx_pacer.queue.len().min(chunk_sz);
         let mut chunk = [0u8; 64];
         let take_capped = n_take.min(chunk.len());
-        for slot in chunk.iter_mut().take(take_capped) {
-            if let Some(b) = st.tx_pacer.queue.pop_front() {
+        for (i, slot) in chunk.iter_mut().take(take_capped).enumerate() {
+            if let Some(&b) = st.tx_pacer.queue.get(i) {
                 *slot = b;
             }
         }
@@ -400,6 +400,14 @@ pub fn flush_tx_pacer(st: &mut StationState, now: i64) -> Result<(), String> {
             close_station_pty(st);
             return Err("串口写入失败,连接已断开".to_string());
         }
+        let written = (rc as usize).min(take_capped);
+        for _ in 0..written {
+            st.tx_pacer.queue.pop_front();
+        }
+        if written == 0 {
+            st.tx_pacer.next_send_ms = now + gap_ms.max(5);
+            break;
+        }
         if gap_ms > 0 {
             st.tx_pacer.next_send_ms = now + gap_ms;
             break;

+ 51 - 0
native/stl_accel/src/main.rs

@@ -2336,4 +2336,55 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
 
         let _ = std::fs::remove_dir_all(&tmp_dir);
     }
+
+    #[test]
+    fn test_v08124_gnr_mt_error_and_bare_efi_and_xml_coords() {
+        use crate::pxe::parse_mt86_xml_report;
+        use crate::workflow::build_uefi_mt_steps;
+
+        // 1. 120.efi `/GNR DDR(hex)` with `CPU: 0` testing `Socket=1 MC=2 Channel=0` (CPU1_CHC / slot 14)
+        let gnr_line = b"2026-11-16 23:35:01 - [Data Error] Test: 3, CPU: 0, Address: 60400004000/GNR DDR(hex) Flag=21a003fbf MemType=1 DimmType=1 Socket=1 DPA=N/A MC=2 Channel=0 DIMM=0 Rank=1 CS=1 BG=3 Bank=2 Row=2000 Col=40 SubRank=N/A, Expected: FFFFFFFFFFFFFFFF, Actual: FFFFFFFFFFFFFFEF";
+        let ev = lib::re2c_parse_line(gnr_line, 0xFF);
+        assert_eq!(ev.kind, lib::STL_LK_MT_ERROR);
+        assert_eq!(ev.cpu, 1);
+        assert_eq!(ev.channel, 2);
+        assert_eq!(ev.dimm, 0);
+        assert_eq!(ev.rank, 1);
+        assert_eq!(ev.bank, 14);
+        assert_eq!(ev.addr, 0x60400004000);
+
+        // 2. 118.efi `{Socket: 1, Ctrl: 10, ChId: 0, DimmSlot: 0, DimmRank: 0}` with `CPU: 0` -> CPU1_CHK (ch=10)
+        let ims_line = b"[MEM ERROR - Data] Test: 4, CPU: 0, Address: 4080000100{Socket: 1, Ctrl: 10, ChId: 0, DimmSlot: 0, DimmRank: 0}, Expected: 00000000, Actual: 00000001";
+        let ev2 = lib::re2c_parse_line(ims_line, 0xFF);
+        assert_eq!(ev2.kind, lib::STL_LK_MT_ERROR);
+        assert_eq!(ev2.cpu, 1);
+        assert_eq!(ev2.channel, 10);
+        assert_eq!(ev2.dimm, 0);
+        assert_eq!(ev2.rank, 0);
+        assert_eq!(ev2.addr, 0x4080000100);
+
+        // 3. XML LogEntry with `/GNR` extracts clean hex `address` and `(cpu=1, channel=2)`
+        let xml_fail = r#"<?xml version="1.0" encoding="UTF-8" ?>
+<PMP><TestResult><MT86Result>
+<Result>FAIL</Result>
+<Test><Errors>1</Errors></Test>
+<ErrorLog><LogEntry>2026-11-16 23:35:01 - [Data Error] Test: 3, CPU: 0, Address: 60400004000/GNR DDR(hex) Flag=21a003fbf Socket=1 MC=2 Channel=0 DIMM=0 Rank=0 CS=0 BG=0 Bank=0 Row=0 Col=0, Expected: 0, Actual: 1</LogEntry></ErrorLog>
+</MT86Result></TestResult></PMP>"#;
+        let parsed = parse_mt86_xml_report("test.TestResult.xml", xml_fail);
+        assert_eq!(parsed.get_str_or("verdict", ""), "fail");
+        let details = parsed.get_arr("error_details").unwrap();
+        assert_eq!(details[0].get_str_or("address", ""), "0x60400004000");
+        assert_eq!(details[0].get_i64("cpu"), Some(1));
+        assert_eq!(details[0].get_i64("channel"), Some(2));
+
+        // 4. Bare `"efi_path": "118.efi"` when already in `FS0:\EFI\>` NEVER executes `cd \`!
+        let mut st = StationState::new("S1", "Test", "", "");
+        st.observed_detail = "uefi_shell_efi".to_string();
+        st.prompt_evidence = "FS0:\\EFI\\>".to_string();
+        let mut sel = JsonVal::obj();
+        sel.set("efi_path", JsonVal::Str("118.efi".to_string()));
+        let steps = build_uefi_mt_steps(&st, &sel);
+        assert!(!steps.iter().any(|s| s.line == "cd \\"));
+        assert_eq!(steps.last().unwrap().line, "118.efi");
+    }
 }

+ 156 - 18
native/stl_accel/src/pxe.rs

@@ -297,18 +297,23 @@ pub fn render_mt86_cfg_text(cfg: &JsonVal, tftp_server_ip: &str) -> String {
         }
     }
 
-    let lo = cfg
-        .get_str("addr_lim_lo")
-        .or_else(|| cfg.get_str("ADDRLIMLO"))
-        .or_else(|| cfg.get_str("addr_lo"))
-        .unwrap_or("")
-        .trim();
-    let hi = cfg
-        .get_str("addr_lim_hi")
-        .or_else(|| cfg.get_str("ADDRLIMHI"))
-        .or_else(|| cfg.get_str("addr_hi"))
-        .unwrap_or("")
-        .trim();
+    let get_addr_opt = |keys: &[&str]| -> String {
+        for k in keys {
+            if let Some(s) = cfg.get_str(k) {
+                let t = s.trim();
+                if !t.is_empty() {
+                    return t.to_string();
+                }
+            } else if let Some(n) = cfg.get_i64(k) {
+                if n >= 0 {
+                    return format!("0x{:X}", n);
+                }
+            }
+        }
+        String::new()
+    };
+    let lo = get_addr_opt(&["addr_lim_lo", "ADDRLIMLO", "addr_lo"]);
+    let hi = get_addr_opt(&["addr_lim_hi", "ADDRLIMHI", "addr_hi"]);
     let mem_range = cfg.get_str_or("memory_range", "all");
     if mem_range != "all" || !lo.is_empty() || !hi.is_empty() {
         if !lo.is_empty() {
@@ -684,7 +689,7 @@ pub fn parse_mt86_xml_report(filename: &str, xml: &str) -> JsonVal {
         if let Some(ap) = msg_low.find("address:") {
             let raw_tok = entry_msg[ap + 8..]
                 .trim_start()
-                .split(|c: char| c == ',' || c.is_whitespace())
+                .split(|c: char| c == ',' || c == '/' || c == '{' || c.is_whitespace())
                 .next()
                 .unwrap_or("")
                 .trim_start_matches("0x")
@@ -965,6 +970,92 @@ fn parse_tuple_coords_after_keyword(line: &str, kw: &str) -> (Option<i64>, Optio
 }
 
 fn parse_n_ch_slot_coords(line: &str) -> (Option<i64>, Option<i64>, Option<i64>) {
+    // 0. Check 120.efi `/GNR ... Socket=<hex> ... MC=<hex> Channel=<hex> DIMM=<hex>` (hex fields)
+    if let Some(gpos) = line.find("/GNR ") {
+        let gnr_tail = &line[gpos + 5..];
+        let mut g_sock: Option<i64> = None;
+        let mut g_mc: Option<i64> = None;
+        let mut g_nmmc: Option<i64> = None;
+        let mut g_ch: Option<i64> = None;
+        let mut g_nmch: Option<i64> = None;
+        let mut g_dimm: Option<i64> = None;
+        for tok in gnr_tail.split(|c: char| c.is_whitespace() || c == ',') {
+            if let Some((k, v)) = tok.split_once('=') {
+                let kl = k.trim().to_ascii_lowercase();
+                let vt = v.trim().trim_start_matches("0x").trim_start_matches("0X");
+                if vt.is_empty() || vt.eq_ignore_ascii_case("n/a") {
+                    continue;
+                }
+                if let Ok(hv) = i64::from_str_radix(vt, 16) {
+                    match kl.as_str() {
+                        "socket" if (0..=1).contains(&hv) => g_sock = Some(hv),
+                        "mc" if (0..=11).contains(&hv) => g_mc = Some(hv),
+                        "nmmc" if (0..=11).contains(&hv) => g_nmmc = Some(hv),
+                        "channel" if (0..=23).contains(&hv) => g_ch = Some(hv),
+                        "nmchannel" if (0..=23).contains(&hv) => g_nmch = Some(hv),
+                        "dimm" | "nmdimm" if (0..=1).contains(&hv) => g_dimm = Some(hv),
+                        _ => {}
+                    }
+                }
+            }
+        }
+        let eff_mc = g_mc.or(g_nmmc);
+        let eff_ch = g_ch.or(g_nmch);
+        let flat_ch = match (eff_mc, eff_ch) {
+            (Some(mc), Some(ch)) if (0..=11).contains(&mc) && ch <= 0 => Some(mc),
+            (Some(0), Some(ch)) if (0..=11).contains(&ch) => Some(ch),
+            (Some(mc), Some(ch)) if mc > 0 && ch > 0 && (mc * 2 + ch) <= 11 => Some(mc * 2 + ch),
+            (Some(mc), None) if (0..=11).contains(&mc) => Some(mc),
+            (_, Some(ch)) if (0..=11).contains(&ch) => Some(ch),
+            _ => None,
+        };
+        if g_sock.is_some() || flat_ch.is_some() {
+            return (g_sock, flat_ch, g_dimm);
+        }
+    }
+
+    // 0b. Check `{Socket/Sock: <d>, Ctrl: <d>, ChId: <d>, DimmSlot/DimmSl: <d>}`
+    if let (Some(lb), Some(rb)) = (line.find('{'), line.find('}')) {
+        if rb > lb {
+            let inner = &line[lb + 1..rb];
+            let mut b_sock: Option<i64> = None;
+            let mut b_ctrl: Option<i64> = None;
+            let mut b_chid: Option<i64> = None;
+            let mut b_dimm: Option<i64> = None;
+            for part in inner.split(',') {
+                if let Some((k, v)) = part.split_once(':') {
+                    let kl = k.trim().to_ascii_lowercase();
+                    if let Ok(dv) = v.trim().parse::<i64>() {
+                        match kl.as_str() {
+                            "socket" | "sock" if (0..=1).contains(&dv) => b_sock = Some(dv),
+                            "ctrl" | "mc" if (0..=11).contains(&dv) => b_ctrl = Some(dv),
+                            "chid" | "channel" if (0..=23).contains(&dv) => b_chid = Some(dv),
+                            "dimmslot" | "dimmsl" | "dimm" | "slot" if (0..=1).contains(&dv) => {
+                                b_dimm = Some(dv)
+                            }
+                            _ => {}
+                        }
+                    }
+                }
+            }
+            let flat_ch = match (b_ctrl, b_chid) {
+                (Some(mc), Some(0)) if (0..=11).contains(&mc) => Some(mc),
+                (_, Some(ch)) if (12..=23).contains(&ch) => {
+                    if b_sock.is_none() {
+                        b_sock = Some(1);
+                    }
+                    Some(ch - 12)
+                }
+                (_, Some(ch)) if (0..=11).contains(&ch) => Some(ch),
+                (Some(mc), None) if (0..=11).contains(&mc) => Some(mc),
+                _ => None,
+            };
+            if b_sock.is_some() || flat_ch.is_some() {
+                return (b_sock, flat_ch, b_dimm);
+            }
+        }
+    }
+
     let bytes = line.as_bytes();
     for i in 0..bytes.len() {
         if (bytes[i] == b'N' || bytes[i] == b'n')
@@ -1010,9 +1101,9 @@ fn parse_n_ch_slot_coords(line: &str) -> (Option<i64>, Option<i64>, Option<i64>)
             return (c, ch, sl);
         }
     }
-    // Fall back to `CPU: <0|1>` (e.g. `[Data Error] Test: 4, CPU: 0, Address: ...`)
+    // Check explicit `Socket:` / `Node:` BEFORE falling back to logical `CPU:`
     let lower = line.to_ascii_lowercase();
-    for pat in ["cpu:", "cpu "] {
+    for pat in ["socket:", "socket ", "node:", "node "] {
         if let Some(cp) = lower.find(pat) {
             let d: String = lower[cp + pat.len()..]
                 .trim_start()
@@ -1026,6 +1117,22 @@ fn parse_n_ch_slot_coords(line: &str) -> (Option<i64>, Option<i64>, Option<i64>)
             }
         }
     }
+    if !lower.contains("/gnr ") {
+        for pat in ["cpu:", "cpu "] {
+            if let Some(cp) = lower.find(pat) {
+                let d: String = lower[cp + pat.len()..]
+                    .trim_start()
+                    .chars()
+                    .take_while(|c| c.is_ascii_digit())
+                    .collect();
+                if let Ok(cval) = d.parse::<i64>() {
+                    if (0..=1).contains(&cval) {
+                        return (Some(cval), None, None);
+                    }
+                }
+            }
+        }
+    }
     (None, None, None)
 }
 
@@ -1105,6 +1212,7 @@ fn parse_mt86_html_error_rows(body_src: &str) -> Vec<JsonVal> {
             || row_txt_lower.contains("[mem error")
             || row_txt_lower.contains("[data error]")
             || row_txt_lower.contains("[parity error]")
+            || row_txt_lower.contains("/gnr ")
             || row_txt_lower.contains("ecc corrected:")
             || row_txt_lower.contains("channel-slot:")
             || row_txt_lower.contains("channel/slot:")
@@ -1123,7 +1231,7 @@ fn parse_mt86_html_error_rows(body_src: &str) -> Vec<JsonVal> {
             if let Some(ap) = row_txt_lower.find("address:") {
                 let raw_tok = row_txt[ap + 8..]
                     .trim_start()
-                    .split(|c: char| c == ',' || c.is_whitespace())
+                    .split(|c: char| c == ',' || c == '/' || c == '{' || c.is_whitespace())
                     .next()
                     .unwrap_or("")
                     .trim_start_matches("0x")
@@ -1654,12 +1762,38 @@ fn handle_tftp_wrq(
         );
     }
 
-    // Deliver HTML report to stations actively running MT/UEFI (or single active online station)
+    // Deliver HTML/XML report strictly to the originating station without cross-contaminating concurrent stations
     let full_path_str = dest_path.to_string_lossy().to_string();
+    let mut exact_name_targets: Vec<String> = Vec::new();
+    let mut sn_match_targets: Vec<String> = Vec::new();
     let mut mt_or_uefi_targets: Vec<String> = Vec::new();
     let mut online_targets: Vec<String> = Vec::new();
+    let lower_clean = clean_name.to_ascii_lowercase();
+    let lower_rpt = report_str.to_ascii_lowercase();
     for (sid, handle) in &hub.stations {
         if let Ok(v) = handle.view.read() {
+            let exp_base = Path::new(v.expected_mt_report_name.trim())
+                .file_name()
+                .and_then(|s| s.to_str())
+                .unwrap_or("")
+                .to_ascii_lowercase();
+            if !exp_base.is_empty() && exp_base == lower_clean {
+                exact_name_targets.push(sid.clone());
+                continue;
+            }
+            if let Some(dimms) = v.control_base.get_arr("dimms") {
+                let any_sn = dimms.iter().any(|d| {
+                    let sn = d.get_str_or("sn", "").trim().trim_start_matches("0x").to_ascii_lowercase();
+                    sn.len() >= 8 && lower_rpt.contains(&sn)
+                });
+                if any_sn {
+                    sn_match_targets.push(sid.clone());
+                }
+            }
+            let efi_up = v.mt_efi_path.trim().to_ascii_uppercase();
+            if !efi_up.is_empty() && !efi_up.ends_with("118.EFI") {
+                continue;
+            }
             let phase = v.qt_clean_station.get_str_or("phase", "");
             let run_state = v.qt_clean_station.get_str_or("run_state", "");
             let mt_started = v
@@ -1676,7 +1810,11 @@ fn handle_tftp_wrq(
         }
     }
 
-    let force_targets = if !mt_or_uefi_targets.is_empty() {
+    let force_targets = if !exact_name_targets.is_empty() {
+        exact_name_targets
+    } else if !sn_match_targets.is_empty() {
+        sn_match_targets
+    } else if !mt_or_uefi_targets.is_empty() {
         mt_or_uefi_targets
     } else if online_targets.len() == 1 {
         online_targets

+ 21 - 8
native/stl_accel/src/results.rs

@@ -785,6 +785,18 @@ impl StationState {
         }
     }
 
+    pub fn clear_all_dimm_temps(&mut self) {
+        for idx in 0..24 {
+            if self.dimms[idx].value_c.is_some() {
+                self.dimms[idx].value_c = None;
+                self.dimms[idx].quality = "unavailable".to_string();
+                self.dimms[idx].source.clear();
+                self.dimms[idx].received_ms = 0;
+                self.sync_dimm_to_soa(idx);
+            }
+        }
+    }
+
     pub fn has_stale_station_state(&self) -> bool {
         self.is_run_active()
             || self.awaiting_dimm_replacement
@@ -853,6 +865,7 @@ impl StationState {
         self.resolved_mt_efi_path = None;
         self.efi_probe_done = false;
         self.awaiting_dimm_replacement = false;
+        self.hot.awaiting_dimm_replacement = false;
         self.task_status = "not_started".to_string();
         self.rmt_results.clear();
         self.amt_results.clear();
@@ -1472,7 +1485,7 @@ impl StationState {
         }
         self.mt_result.set("errors", JsonVal::Num(max_errors as f64));
         self.mt_result.set("complete", JsonVal::Bool(true));
-        self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+        self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
 
         if has_mt_err {
             self.hot.mt_fail_complete = true;
@@ -2459,7 +2472,7 @@ impl StationState {
                     }
                     self.mt_result.set("complete", JsonVal::Bool(false));
                 }
-                self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+                self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
                 *self.stage_step_counts.entry("mt".to_string()).or_insert(0) += 1;
             }
             lib::STL_LK_MT_ERROR => {
@@ -2475,7 +2488,7 @@ impl StationState {
                     let prev_errs = self.mt_result.get_i64("errors").unwrap_or(0);
                     self.mt_result.set("errors", JsonVal::Num(prev_errs.max(sum) as f64));
                     self.mt_result.set("status", JsonVal::Str("fail".to_string()));
-                    self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+                    self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
                     self.record_stage_error("mt", None, None, "mt_test_error", trimmed);
                 } else {
                     let mut cpu = if ev.cpu >= 0 { Some(ev.cpu as i64) } else { None };
@@ -2497,7 +2510,7 @@ impl StationState {
                     let sum: i64 = self.mt_per_test_errs.values().sum();
                     self.mt_result.set("errors", JsonVal::Num((prev_errs + 1).max(sum) as f64));
                     self.mt_result.set("status", JsonVal::Str("fail".to_string()));
-                    self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+                    self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
                 }
             }
             lib::STL_LK_MT_PASS_COMPLETE => {
@@ -2532,7 +2545,7 @@ impl StationState {
                         }
                     }
                 }
-                self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+                self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
             }
             lib::STL_LK_MT_FAIL_COMPLETE => {
                 if ev.subkind == 3 {
@@ -2542,7 +2555,7 @@ impl StationState {
                         self.hot.mt_fail_complete = true;
                         self.mt_result.set("status", JsonVal::Str("fail".to_string()));
                         self.mt_result.set("complete", JsonVal::Bool(true));
-                        self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+                        self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
                         self.record_stage_error("mt", None, None, "mt_efi_not_found", trimmed);
                         let _ = self.check_and_latch_stage_failure("mt");
                     }
@@ -2562,7 +2575,7 @@ impl StationState {
                     }
                     self.mt_result.set("status", JsonVal::Str("fail".to_string()));
                     self.mt_result.set("complete", JsonVal::Bool(true));
-                    self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+                    self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
                     self.record_stage_error("mt", None, None, "mt_summary_fail", trimmed);
                     if !boot_active {
                         let _ = self.check_and_latch_stage_failure("mt");
@@ -2680,7 +2693,7 @@ impl StationState {
                         }
                     }
                     self.mt_result.set("complete", JsonVal::Bool(true));
-                    self.mt_result.set("observed_unix_ms", JsonVal::Num(now as f64));
+                    self.mt_result.set("observed_unix_ms", JsonVal::Str(now.to_string()));
                 }
 
                 self.observed_phase = "uefi".to_string();

+ 4 - 2
native/stl_accel/src/storage.rs

@@ -353,12 +353,14 @@ pub fn archive_task_run(
     }
 
     let sum_path = dir.join("summary.json");
+    let sum_path_str = sum_path.to_string_lossy().to_string();
+    disk_summary.set("summary_path", JsonVal::Str(sum_path_str.clone()));
     let _ = fs::write(&sum_path, disk_summary.to_json());
 
     let state_summary = strip_private_keys_recursive(&disk_summary);
     (
         raw_path.to_string_lossy().to_string(),
-        sum_path.to_string_lossy().to_string(),
+        sum_path_str,
         state_summary,
     )
 }
@@ -472,7 +474,7 @@ pub fn record_audit_log(
     rec.set("category", JsonVal::Str(category.to_string()));
     rec.set("action", JsonVal::Str(action.to_string()));
     rec.set("summary", JsonVal::Str(summary.to_string()));
-    rec.set("details", details);
+    rec.set("details", strip_private_keys_recursive(&details));
 
     let line = format!("{}\n", rec.to_json());
     let p = data_dir.join("config_audit.jsonl");

+ 111 - 41
native/stl_accel/src/workflow.rs

@@ -122,17 +122,23 @@ pub fn tick_async_script(st: &mut StationState) {
                 || lower_out.contains("is not a directory");
             let has_dir_listing =
                 lower_out.contains("directory of:") || lower_out.contains("file(s)");
-            let found_118 = !not_found
+            let target_base = st
+                .async_script
+                .extra_meta
+                .get_str("probe_efi_basename")
+                .unwrap_or("118.efi")
+                .to_ascii_lowercase();
+            let found_efi = !not_found
                 && has_dir_listing
                 && out_str.lines().any(|ln| {
                     let t = ln.trim().to_ascii_lowercase();
                     let after_prompt = t.rsplit_once('>').map(|(_, r)| r.trim()).unwrap_or(t.as_str());
                     !t.starts_with("ls ")
                         && !after_prompt.starts_with("ls ")
-                        && t.contains("118.efi")
-                        && (t.ends_with("118.efi") || t.contains(" 118.efi"))
+                        && t.contains(&target_base)
+                        && (t.ends_with(&target_base) || t.contains(&format!(" {}", target_base)))
                 });
-            if found_118 {
+            if found_efi {
                 if let Some(cand) = st.async_script.step_sent_line.strip_prefix("ls ") {
                     let mut resolved = cand.trim().to_string();
                     if let Some(colon) = resolved.find(':') {
@@ -251,7 +257,7 @@ pub fn tick_async_script(st: &mut StationState) {
                         "responses",
                         JsonVal::Arr(st.async_script.collected_responses.clone()),
                     );
-                    fail_res.set("observed_unix_ms", JsonVal::Num(now as f64));
+                    fail_res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
                     st.last_uip_apply = Some(fail_res);
                 }
                 if let Some(tx) = st.async_script.completion_tx.take() {
@@ -361,7 +367,7 @@ fn finish_async_script(st: &mut StationState, now: i64) {
             "unsupported_commands",
             JsonVal::Arr(st.unsupported_commands.clone()),
         );
-        uip_res.set("observed_unix_ms", JsonVal::Num(now as f64));
+        uip_res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
         st.last_uip_apply = Some(uip_res);
     }
 
@@ -382,7 +388,7 @@ fn finish_async_script(st: &mut StationState, now: i64) {
                 "unsupported_commands",
                 JsonVal::Arr(st.unsupported_commands.clone()),
             );
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
             st.last_uip_apply = Some(res.clone());
         }
         "interactive_continue_uip" => {
@@ -393,7 +399,7 @@ fn finish_async_script(st: &mut StationState, now: i64) {
                 JsonVal::Arr(lines.into_iter().map(JsonVal::Str).collect()),
             );
             res.set("responses", JsonVal::Arr(responses));
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
             st.last_phase_action = Some(res.clone());
         }
         "interactive_amt" => {
@@ -403,7 +409,7 @@ fn finish_async_script(st: &mut StationState, now: i64) {
                 JsonVal::Arr(lines.into_iter().map(JsonVal::Str).collect()),
             );
             res.set("responses", JsonVal::Arr(responses));
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
             st.last_amt_apply = Some(res.clone());
         }
         "interactive_amt_cmd" => {
@@ -421,7 +427,7 @@ fn finish_async_script(st: &mut StationState, now: i64) {
                 "prompt_observed",
                 JsonVal::Bool(first_resp.get_bool("prompt_observed").unwrap_or(false)),
             );
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
         }
         "interactive_start_amt" => {
             let test_cmd = meta.get_str_or("test_command", "amemdiag 1");
@@ -432,13 +438,13 @@ fn finish_async_script(st: &mut StationState, now: i64) {
                 JsonVal::Arr(lines.into_iter().map(JsonVal::Str).collect()),
             );
             res.set("responses", JsonVal::Arr(responses));
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
             st.last_amt_start = Some(res.clone());
         }
         "interactive_start_mt" => {
             res.set("confirmation", JsonVal::Str("submitted".to_string()));
             res.set("command", JsonVal::Str(meta.get_str_or("command", "FS0:\\EFI\\118.efi")));
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
         }
         "interactive_uefi_ls" => {
             let path = meta.get_str_or("path", "");
@@ -498,11 +504,11 @@ fn finish_async_script(st: &mut StationState, now: i64) {
             res.set("filesystems", JsonVal::Arr(filesystems));
             res.set("complete", JsonVal::Bool(complete));
             res.set("evidence", JsonVal::Str(out));
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
         }
         _ => {
             res.set("confirmation", JsonVal::Str(confirmation.to_string()));
-            res.set("observed_unix_ms", JsonVal::Num(now as f64));
+            res.set("observed_unix_ms", JsonVal::Str(now.to_string()));
         }
     }
     let _ = tx.send(Ok(res));
@@ -671,17 +677,41 @@ pub fn control_boot_plan_impl(
     }
 }
 
+pub fn normalize_uefi_efi_path(raw: &str) -> String {
+    let trimmed = raw.trim().replace('/', "\\");
+    if trimmed.is_empty() {
+        return "FS0:\\EFI\\118.efi".to_string();
+    }
+    if !trimmed.contains('\\') && !trimmed.contains(':') && trimmed.to_ascii_lowercase().ends_with(".efi") {
+        return format!("FS0:\\EFI\\{}", trimmed);
+    }
+    trimmed
+}
+
+pub fn extract_efi_basename(norm_path: &str) -> String {
+    norm_path
+        .rsplit('\\')
+        .next()
+        .filter(|s| !s.trim().is_empty())
+        .unwrap_or("118.efi")
+        .trim()
+        .to_string()
+}
+
 pub fn needs_uefi_efi_probe(st: &StationState, sel: &JsonVal) -> bool {
     if st.efi_probe_done || st.resolved_mt_efi_path.is_some() {
         return false;
     }
-    let raw_path = sel
+    let raw_cfg = sel
         .get_str("efi_path")
         .filter(|s| !s.trim().is_empty())
-        .unwrap_or("FS0:\\EFI\\118.efi")
-        .trim()
-        .replace('/', "\\");
-    if raw_path.to_ascii_uppercase() != "FS0:\\EFI\\118.EFI" {
+        .unwrap_or("FS0:\\EFI\\118.efi");
+    let norm_path = normalize_uefi_efi_path(raw_cfg);
+    if !norm_path.to_ascii_uppercase().ends_with(".EFI") {
+        return false;
+    }
+    let explicit_non_fs0 = norm_path.contains(':') && !norm_path.to_ascii_uppercase().starts_with("FS0:\\EFI\\");
+    if explicit_non_fs0 {
         return false;
     }
     let cur_prompt = st.prompt_evidence.to_ascii_uppercase();
@@ -691,16 +721,27 @@ pub fn needs_uefi_efi_probe(st: &StationState, sel: &JsonVal) -> bool {
     st.uefi_fs_candidates.len() > 1 || (!already_in_efi && !cur_prompt.contains("\\EFI"))
 }
 
-pub fn build_uefi_efi_probe_steps(st: &StationState) -> Vec<AsyncScriptStep> {
+pub fn build_uefi_efi_probe_steps_for(st: &StationState, sel: &JsonVal) -> (Vec<AsyncScriptStep>, String) {
+    let raw_cfg = sel
+        .get_str("efi_path")
+        .filter(|s| !s.trim().is_empty())
+        .unwrap_or("FS0:\\EFI\\118.efi");
+    let base_efi = extract_efi_basename(&normalize_uefi_efi_path(raw_cfg));
     let mut cands: Vec<String> = st.uefi_fs_candidates.clone();
     if cands.is_empty() {
         cands.push("FS0:".to_string());
         cands.push("FS1:".to_string());
+    } else {
+        for fallback in ["FS0:", "FS1:"] {
+            if !cands.iter().any(|c| c.eq_ignore_ascii_case(fallback)) {
+                cands.push(fallback.to_string());
+            }
+        }
     }
     let mut steps = Vec::new();
     for fs in &cands {
         steps.push(AsyncScriptStep {
-            line: format!("ls {}\\EFI\\118.efi", fs.to_ascii_lowercase()),
+            line: format!("ls {}\\EFI\\{}", fs.to_ascii_lowercase(), base_efi),
             expected_prompt_kind: "uefi".to_string(),
             timeout_ms: 2500,
             reject_on_fw_error: false,
@@ -708,26 +749,32 @@ pub fn build_uefi_efi_probe_steps(st: &StationState) -> Vec<AsyncScriptStep> {
     }
     for fs in &cands {
         steps.push(AsyncScriptStep {
-            line: format!("ls {}\\118.efi", fs.to_ascii_lowercase()),
+            line: format!("ls {}\\{}", fs.to_ascii_lowercase(), base_efi),
             expected_prompt_kind: "uefi".to_string(),
             timeout_ms: 2500,
             reject_on_fw_error: false,
         });
     }
-    steps
+    (steps, base_efi)
+}
+
+pub fn build_uefi_efi_probe_steps(st: &StationState) -> Vec<AsyncScriptStep> {
+    build_uefi_efi_probe_steps_for(st, &st.mt_selection).0
 }
 
 pub fn build_uefi_mt_steps(st: &StationState, sel: &JsonVal) -> Vec<AsyncScriptStep> {
-    let configured_path = sel
+    let raw_cfg = sel
         .get_str("efi_path")
         .filter(|s| !s.trim().is_empty())
-        .unwrap_or("FS0:\\EFI\\118.efi")
-        .trim()
-        .replace('/', "\\");
-    let raw_path = if configured_path.to_ascii_uppercase() == "FS0:\\EFI\\118.EFI" {
-        st.resolved_mt_efi_path
-            .clone()
-            .unwrap_or(configured_path)
+        .unwrap_or("FS0:\\EFI\\118.efi");
+    let configured_path = normalize_uefi_efi_path(raw_cfg);
+    let configured_base = extract_efi_basename(&configured_path);
+    let raw_path = if let Some(ref resolved) = st.resolved_mt_efi_path {
+        if extract_efi_basename(resolved).eq_ignore_ascii_case(&configured_base) {
+            resolved.clone()
+        } else {
+            configured_path
+        }
     } else {
         configured_path
     };
@@ -738,7 +785,12 @@ pub fn build_uefi_mt_steps(st: &StationState, sel: &JsonVal) -> Vec<AsyncScriptS
         || cur_prompt.contains("\\EFI>");
     let upper_raw = raw_path.to_ascii_uppercase();
 
-    if upper_raw.ends_with("118.EFI") {
+    if upper_raw.ends_with(".EFI") {
+        let efi_basename = extract_efi_basename(&raw_path);
+        let efi_stem = efi_basename
+            .strip_suffix(".efi")
+            .or_else(|| efi_basename.strip_suffix(".EFI"))
+            .unwrap_or("118");
         let target_fs = raw_path
             .split('\\')
             .next()
@@ -771,7 +823,8 @@ pub fn build_uefi_mt_steps(st: &StationState, sel: &JsonVal) -> Vec<AsyncScriptS
                 reject_on_fw_error: false,
             });
         }
-        let cfg_lines: Vec<String> = render_mt86_cfg_text(sel, "")
+        let tftp_ip = sel.get_str_or("pxe_server_ip", "192.168.0.10");
+        let cfg_lines: Vec<String> = render_mt86_cfg_text(sel, &tftp_ip)
             .lines()
             .map(|l| l.trim().to_string())
             .filter(|l| !l.is_empty())
@@ -785,8 +838,13 @@ pub fn build_uefi_mt_steps(st: &StationState, sel: &JsonVal) -> Vec<AsyncScriptS
                 reject_on_fw_error: false,
             });
         }
-        // Mirror mt86.cfg to common MemTest86 v11.x candidate config filenames inside \EFI\
-        for cand in ["118.cfg", "memtest86.cfg", "\"Default string-mt86.cfg\""] {
+        // Mirror mt86.cfg to common MemTest86 v11.x candidate config filenames inside target directory
+        let stem_cfg = format!("{}.cfg", efi_stem);
+        let mut cands = vec!["118.cfg".to_string(), "memtest86.cfg".to_string(), "\"Default string-mt86.cfg\"".to_string()];
+        if !stem_cfg.eq_ignore_ascii_case("118.cfg") && !stem_cfg.eq_ignore_ascii_case("mt86.cfg") {
+            cands.insert(0, stem_cfg);
+        }
+        for cand in cands {
             steps.push(AsyncScriptStep {
                 line: format!("cp -q mt86.cfg {}", cand),
                 expected_prompt_kind: "uefi".to_string(),
@@ -794,8 +852,14 @@ pub fn build_uefi_mt_steps(st: &StationState, sel: &JsonVal) -> Vec<AsyncScriptS
                 reject_on_fw_error: false,
             });
         }
+        let args_tail = sel.get_str_or("arguments", "");
+        let launch_line = if args_tail.trim().is_empty() {
+            efi_basename
+        } else {
+            format!("{} {}", efi_basename, args_tail.trim())
+        };
         steps.push(AsyncScriptStep {
-            line: "118.efi".to_string(),
+            line: launch_line,
             expected_prompt_kind: String::new(),
             timeout_ms: 2000,
             reject_on_fw_error: false,
@@ -1155,14 +1219,16 @@ pub fn step_boot_plan(st: &mut StationState, contract: &FirmwareContract) {
         "uefi" => {
             if mt_enabled && !st.plan_mt_started {
                 if needs_uefi_efi_probe(st, &st.mt_selection) {
-                    let probe_steps = build_uefi_efi_probe_steps(st);
+                    let (probe_steps, base_efi) = build_uefi_efi_probe_steps_for(st, &st.mt_selection);
+                    let mut pmeta = JsonVal::obj();
+                    pmeta.set("probe_efi_basename", JsonVal::Str(base_efi));
                     start_async_script(
                         st,
                         "probe_mt_efi",
                         probe_steps,
                         false,
                         Vec::new(),
-                        JsonVal::Null,
+                        pmeta,
                         None,
                     );
                     return;
@@ -1237,14 +1303,16 @@ fn consume_pending_stage_intent(st: &mut StationState, contract: &FirmwareContra
                     }
                 }
                 if needs_uefi_efi_probe(st, &preview_sel) {
-                    let probe_steps = build_uefi_efi_probe_steps(st);
+                    let (probe_steps, base_efi) = build_uefi_efi_probe_steps_for(st, &preview_sel);
+                    let mut pmeta = JsonVal::obj();
+                    pmeta.set("probe_efi_basename", JsonVal::Str(base_efi));
                     start_async_script(
                         st,
                         "probe_mt_efi",
                         probe_steps,
                         false,
                         Vec::new(),
-                        JsonVal::Null,
+                        pmeta,
                         None,
                     );
                     return;
@@ -1835,7 +1903,9 @@ fn emit_complete_signal(
     sig.set("stage_completions", st.stage_completions_json());
     sig.set(
         "summary_path",
-        JsonVal::Str(summary_obj.get_str_or("log_clean_path", "")),
+        JsonVal::Str(
+            summary_obj.get_str_or("summary_path", &summary_obj.get_str_or("log_clean_path", "")),
+        ),
     );
     let now = now_ms();
     sig.set("observed_unix_ms", JsonVal::Str(now.to_string()));

+ 4 - 0
native/stl_accel/zig_kernels.zig

@@ -207,6 +207,8 @@ pub export fn zig_batch_rescan_logs_cpu(
     const v_F: Vec16 = @splat('F');
     const v_W: Vec16 = @splat('W');
     const v_U: Vec16 = @splat('U');
+    const v_0: Vec16 = @splat('0');
+    const v_9: Vec16 = @splat('9');
 
     var line_count: usize = 0;
     var line_start: usize = 0;
@@ -224,6 +226,7 @@ pub export fn zig_batch_rescan_logs_cpu(
             if ((@as(u16, @bitCast(chunk == v_gt)) | @as(u16, @bitCast(chunk == v_hash))) != 0) cur_tag |= 2;
             if ((@as(u16, @bitCast(chunk == v_E)) | @as(u16, @bitCast(chunk == v_F)) |
                 @as(u16, @bitCast(chunk == v_W)) | @as(u16, @bitCast(chunk == v_U))) != 0) cur_tag |= 4;
+            if (@as(u16, @bitCast((chunk >= v_0) & (chunk <= v_9))) != 0) cur_tag |= 8;
             i += 16;
         }
         if (i >= len) break;
@@ -256,6 +259,7 @@ pub export fn zig_batch_rescan_logs_cpu(
             if (c == '[') cur_tag |= 1;
             if (c == '>' or c == '#') cur_tag |= 2;
             if (c == 'E' or c == 'F' or c == 'W' or c == 'U') cur_tag |= 4;
+            if (c >= '0' and c <= '9') cur_tag |= 8;
         }
         i += 1;
     }

+ 67 - 19
src/appconfig.h

@@ -4,17 +4,19 @@
 #include <QCoreApplication>
 #include <QDir>
 #include <QFileInfo>
+#include <QStandardPaths>
 #include <QString>
 
 /**
  * 运行期配置文件定位(config.json / port.json)
  * ------------------------------------------------------------------
- * 从 exe 所在目录开始,逐级向上找,命中即返回;都没命中再看当前工作目录。
- * 这样三种放法都能找到:
- *   · 部署目录:exe 与 json 同级(推荐)
- *   · 开发期:exe 在 build-win/debug,json 在源码根,向上几级即可碰到
- *   · 从命令行启动:工作目录里放 json
- * 越靠近 exe 的文件优先级越高,方便临时用一份配置覆盖默认值。
+ * 查找顺序:
+ *   1. 环境变量 STL_QT_CONFIG_DIR(外层启动器 / .desktop 指定)
+ *   2. 可写运行目录(用户已修改过配置如管理员密码)
+ *   3. exe 同级目录
+ *   4. 若运行在源码/构建目录树(含 DDR5_SLT_Monitor.pro 或 VERSION),向上最多找 4 层
+ *   5. 当前工作目录
+ *   6. Linux 安装兜底 /opt/XJKJ-STL
  */
 inline QString appConfigPath(const QString &fileName)
 {
@@ -25,32 +27,78 @@ inline QString appConfigPath(const QString &fileName)
             return envCandidate;
     }
 
-    QDir dir(QCoreApplication::applicationDirPath());
-    for (int i = 0; i < 6; ++i) {          // exe 同级算第 0 层,最多再向上 5 层
-        const QString candidate = dir.filePath(fileName);
-        if (QFileInfo::exists(candidate))
-            return candidate;
+    const QString appDataDir = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
+    if (!appDataDir.isEmpty()) {
+        const QString userCandidate = QDir(appDataDir).filePath(fileName);
+        if (QFileInfo::exists(userCandidate))
+            return userCandidate;
+    }
+
+    const QString appDirPath = QCoreApplication::applicationDirPath();
+    const QString besideExe = QDir(appDirPath).filePath(fileName);
+    if (QFileInfo::exists(besideExe))
+        return besideExe;
+
+    // 仅在开发/构建树内向上探测仓库根配置,避免装到桌面/系统目录时误读 ~/config.json
+    QDir dir(appDirPath);
+    const QString leaf = dir.dirName().toLower();
+    const bool inBuildSubdir = (leaf == QLatin1String("qt") || leaf == QLatin1String("debug")
+                                || leaf == QLatin1String("release")
+                                || leaf.startsWith(QLatin1String("build")));
+    for (int i = 0; i < 4; ++i) {
         if (!dir.cdUp())
             break;
+        const bool isRepoRoot = QFileInfo::exists(dir.filePath(QStringLiteral("DDR5_SLT_Monitor.pro")))
+                                || QFileInfo::exists(dir.filePath(QStringLiteral("VERSION")));
+        if ((isRepoRoot || (i == 0 && inBuildSubdir)) && QFileInfo::exists(dir.filePath(fileName)))
+            return dir.filePath(fileName);
     }
+
     const QString inCwd = QDir::current().filePath(fileName);
-    return QFileInfo::exists(inCwd) ? inCwd : QString();
+    if (QFileInfo::exists(inCwd))
+        return inCwd;
+
+#ifdef Q_OS_LINUX
+    const QString optCandidate = QDir(QStringLiteral("/opt/XJKJ-STL")).filePath(fileName);
+    if (QFileInfo::exists(optCandidate))
+        return optCandidate;
+#endif
+    return QString();
 }
 
 /**
- * 运行期可写落盘目录(qt-plans.json / client-id.txt / app.log / 密码保存)
+ * 运行期可写落盘目录(qt-plans.json / client-id.txt / app.log / 密码覆盖)
  * ------------------------------------------------------------------
- * 单文件自解压启动器会把外层 EXE 所在交付目录通过 STL_QT_CONFIG_DIR 传进来:
- * 用户保存的计划、固定客户端标识、运行日志都落在外层 EXE 同级,升级内层缓存目录也不丢。
+ * 优先使用 STL_QT_CONFIG_DIR(自动创建目录并验证可写),其次主配置目录(若可写),
+ * 其次 exe 目录(若可写),最终回落到用户可写 AppConfigLocation(如 ~/.config/XJKJ/HOVSE SLT Pro),
+ * 确保系统目录(/opt、/usr/local/bin)只读部署时桌面普通用户仍可正常保存。
  */
 inline QString appWritableDir()
 {
     const QString envDir = qEnvironmentVariable("STL_QT_CONFIG_DIR").trimmed();
-    if (!envDir.isEmpty() && QFileInfo(envDir).isDir())
-        return QDir(envDir).absolutePath();
+    if (!envDir.isEmpty()) {
+        QDir().mkpath(envDir);
+        const QFileInfo fi(envDir);
+        if (fi.isDir() && fi.isWritable())
+            return QDir(envDir).absolutePath();
+    }
+
     const QString cfg = appConfigPath(QStringLiteral("config.json"));
-    return cfg.isEmpty() ? QCoreApplication::applicationDirPath()
-                         : QFileInfo(cfg).absolutePath();
+    if (!cfg.isEmpty()) {
+        const QString cfgDir = QFileInfo(cfg).absolutePath();
+        if (QFileInfo(cfgDir).isWritable())
+            return cfgDir;
+    }
+
+    const QString exeDir = QCoreApplication::applicationDirPath();
+    if (QFileInfo(exeDir).isWritable())
+        return exeDir;
+
+    QString fallback = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
+    if (fallback.isEmpty())
+        fallback = QDir::home().filePath(QStringLiteral(".config/xjkj-stl"));
+    QDir().mkpath(fallback);
+    return fallback;
 }
 
 #endif // APPCONFIG_H

+ 105 - 39
src/backendlink.cpp

@@ -55,13 +55,17 @@ qint64 nowMs()
     return QDateTime::currentMSecsSinceEpoch();
 }
 
-// stage_errors 里每一项转成一句人能读的话。
-// 文档没规定元素结构(可能是字符串,也可能是 {channel,code,message,...}),
-// 所以:字符串原样用;对象优先给「通道 + 其余键值」,保证信息不丢。
-QString describeStageError(const QJsonValue &value)
+// stage_errors 里每一项转成一句人能读的话,并提取原始 message 作为续行合并键。
+QString describeStageError(const QJsonValue &value, QString *rawKeyOut = nullptr)
 {
-    if (value.isString())
-        return value.toString().trimmed();
+    if (rawKeyOut)
+        rawKeyOut->clear();
+    if (value.isString()) {
+        const QString s = value.toString().trimmed();
+        if (rawKeyOut)
+            *rawKeyOut = s;
+        return s;
+    }
     if (value.isBool())
         return value.toBool() ? QStringLiteral("true") : QStringLiteral("false");
     if (value.isDouble())
@@ -69,30 +73,68 @@ QString describeStageError(const QJsonValue &value)
 
     if (value.isObject()) {
         const QJsonObject obj = value.toObject();
-        QStringList parts;
-        const QString channel = obj.value(QStringLiteral("channel")).toString();
-        if (!channel.isEmpty())
-            parts << channel;
-        for (auto it = obj.begin(); it != obj.end(); ++it) {
-            if (it.key() == QLatin1String("channel"))
-                continue;
-            const QJsonValue v = it.value();
-            QString text;
-            if (v.isString())
-                text = v.toString();
-            else if (v.isBool())
-                text = v.toBool() ? QStringLiteral("true") : QStringLiteral("false");
-            else if (v.isDouble())
-                text = QString::number(v.toDouble());
-            else if (v.isObject())
-                text = QString::fromUtf8(QJsonDocument(v.toObject()).toJson(QJsonDocument::Compact));
-            else if (v.isArray())
-                text = QString::fromUtf8(QJsonDocument(v.toArray()).toJson(QJsonDocument::Compact));
-            if (text.isEmpty())
-                continue;
-            parts << QStringLiteral("%1=%2").arg(it.key(), text);
+        const QString msg = obj.value(QStringLiteral("message")).toString().trimmed();
+        if (rawKeyOut)
+            *rawKeyOut = msg;
+
+        QStringList meta;
+        const QJsonValue cpuVal = obj.value(QStringLiteral("cpu"));
+        const QJsonValue chVal = obj.value(QStringLiteral("channel"));
+        bool hasCpu = false;
+        int cpuIdx = -1;
+        if (cpuVal.isDouble()) {
+            cpuIdx = cpuVal.toInt(-1);
+            hasCpu = (cpuIdx >= 0 && cpuIdx <= 1);
+        } else if (cpuVal.isString()) {
+            bool ok = false;
+            const int v = cpuVal.toString().trimmed().toInt(&ok);
+            if (ok && v >= 0 && v <= 1) {
+                cpuIdx = v;
+                hasCpu = true;
+            }
+        }
+        QString chRaw = chVal.isString() ? chVal.toString().trimmed()
+                                         : (chVal.isDouble() ? QString::number(chVal.toInt(-1)) : QString());
+        int chIdx = -1;
+        if (!chRaw.isEmpty()) {
+            bool ok = false;
+            const int v = chRaw.toInt(&ok);
+            if (ok && v >= 0 && v < 12)
+                chIdx = v;
         }
-        return parts.join(QStringLiteral("  "));
+        if (hasCpu && chIdx >= 0) {
+            const QChar letter = QLatin1Char('A' + chIdx);
+            meta << QStringLiteral("CPU%1_CH%2 (CH%3)").arg(cpuIdx).arg(letter).arg(chIdx);
+        } else if (hasCpu) {
+            meta << QStringLiteral("CPU%1").arg(cpuIdx);
+        } else if (!chRaw.isEmpty()) {
+            meta << QStringLiteral("CH%1").arg(chRaw);
+        }
+
+        const QJsonValue dimmVal = obj.value(QStringLiteral("dimm"));
+        if (dimmVal.isDouble() && dimmVal.toInt(-1) >= 0)
+            meta << QStringLiteral("DIMM%1").arg(dimmVal.toInt());
+        const QJsonValue rankVal = obj.value(QStringLiteral("rank"));
+        if (rankVal.isDouble() && rankVal.toInt(-1) >= 0)
+            meta << QStringLiteral("Rank%1").arg(rankVal.toInt());
+        const QJsonValue bankVal = obj.value(QStringLiteral("bank"));
+        if (bankVal.isDouble() && bankVal.toInt(-1) >= 0)
+            meta << QStringLiteral("Bank%1").arg(bankVal.toInt());
+        const QString addr = obj.value(QStringLiteral("address")).toString().trimmed();
+        if (!addr.isEmpty())
+            meta << QStringLiteral("Addr=%1").arg(addr);
+        const QString kind = obj.value(QStringLiteral("kind")).toString().trimmed();
+
+        QString head = meta.join(QStringLiteral(" · "));
+        if (head.isEmpty() && !kind.isEmpty() && msg.isEmpty())
+            head = kind;
+        if (!head.isEmpty() && !msg.isEmpty())
+            return QStringLiteral("[%1] %2").arg(head, msg);
+        if (!msg.isEmpty())
+            return msg;
+        if (!head.isEmpty())
+            return head;
+        return QString::fromUtf8(QJsonDocument(obj).toJson(QJsonDocument::Compact));
     }
 
     if (value.isArray())
@@ -147,7 +189,11 @@ BackendLink::BackendLink(QObject *parent)
     connect(&m_ws, &QWebSocket::connected, this, &BackendLink::onConnected);
     connect(&m_ws, &QWebSocket::disconnected, this, &BackendLink::onDisconnected);
     connect(&m_ws, &QWebSocket::textMessageReceived, this, &BackendLink::onTextMessage);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+    connect(&m_ws, &QWebSocket::errorOccurred,
+#else
     connect(&m_ws, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error),
+#endif
             this, [this](QAbstractSocket::SocketError) {
         const QString err = m_ws.errorString();
         qInfo().noquote() << "[backend]" << err;
@@ -352,6 +398,7 @@ void BackendLink::onDisconnected()
         // ready 也不能在重连后被当成当前轮次已可靠预置。
         m_stageIntentPending[i].clear();
         m_stageIntentReady[i].clear();
+        m_startRpcInFlight[i] = false;
     }
 
     if (m_reportedConnected && !m_disconnectDebounce.isActive())
@@ -609,6 +656,7 @@ void BackendLink::confirmDimmReplacement(int station)
     // ConfirmDimmReplacement 只要求 command_id + station_id。
     // 该工位可能因为 blocked 被暂停自动下发,确认换条后恢复(下一轮 boot_id 也会再清一次)。
     m_stationPaused[station] = false;
+    m_blockedWarned[station] = false;
     emit logLine(station, QStringLiteral("[qt] 提交更换异常内存条确认(%1)").arg(commandId));
 
     sendRequest(QStringLiteral("ConfirmDimmReplacement"), params,
@@ -733,9 +781,10 @@ void BackendLink::applyStation(int station, const QJsonObject &st)
                                               .arg(QString::fromLatin1(stage), detail));
                 // 同时落成一条条可读的异常记录(详情页第二个标签页)
                 for (const QJsonValue &item : errors) {
-                    const QString text = describeStageError(item);
+                    QString rawKey;
+                    const QString text = describeStageError(item, &rawKey);
                     if (!text.isEmpty())
-                        emit alarmReported(station, QString::fromLatin1(stage), text);
+                        emit alarmReported(station, QString::fromLatin1(stage), text, rawKey);
                 }
             }
         }
@@ -805,6 +854,8 @@ void BackendLink::stageStationIntents(int station)
         m_stageIntentPending[station].insert(stage);
 
         QJsonObject params;
+        params.insert(QStringLiteral("command_id"),
+                      newCommandId(QStringLiteral("intent-") + stage, station));
         params.insert(QStringLiteral("station_id"), stationId(station));
         params.insert(QStringLiteral("stage"), stage);
         params.insert(QStringLiteral("action"), action);
@@ -815,19 +866,22 @@ void BackendLink::stageStationIntents(int station)
                     [this, station, stage, action](const QJsonObject &result) {
             m_stageIntentPending[station].remove(stage);
             const QString confirmation = result.value(QStringLiteral("confirmation")).toString();
+            const QString respStage = result.value(QStringLiteral("stage")).toString();
             QString stageText = ui::inputStageText(stage);
             if (stageText == stage)
                 stageText = stage.toUpper();
-            if (confirmation == QStringLiteral("staged")) {
+            if (confirmation == QStringLiteral("staged")
+                && (respStage.isEmpty() || respStage == stage)) {
                 m_stageIntentReady[station].insert(stage);
                 emit logLine(station, QStringLiteral("[qt] 阶段意图已预置:%1 / %2(staged)")
                                           .arg(stageText, action));
             } else {
-                // 只有明确返回 staged 才能认定后端已接管;否则保留 input.ready 回退路径。
+                // 只有明确返回 staged 且阶段匹配才能认定后端已接管;否则保留 input.ready 回退路径。
                 m_stageIntentReady[station].remove(stage);
-                emit logLine(station, QStringLiteral("[qt] %1 阶段未确认预置(confirmation=%2),到达提示符后回退普通动作")
-                                          .arg(stageText, confirmation.isEmpty()
-                                               ? QStringLiteral("missing") : confirmation));
+                emit logLine(station, QStringLiteral("[qt] %1 阶段未确认预置(confirmation=%2, stage=%3),到达提示符后回退普通动作")
+                                          .arg(stageText,
+                                               confirmation.isEmpty() ? QStringLiteral("missing") : confirmation,
+                                               respStage.isEmpty() ? QStringLiteral("missing") : respStage));
             }
         }, [this, station, stage, action](const QString &code, const QString &message) {
             // 旧版后端不支持 SetStageIntent 时自动回退到 input.ready -> StageAction。
@@ -894,7 +948,7 @@ void BackendLink::stageStationIntents(int station)
 
 void BackendLink::autoPlan(int station, const QJsonObject &st)
 {
-    if (m_autoPaused || m_stationPaused[station])
+    if (m_autoPaused || m_stationPaused[station] || m_startRpcInFlight[station])
         return;
 
     // 一个动作到终态才处理下一个输入节点:有在途阶段动作就先等着,
@@ -947,7 +1001,6 @@ void BackendLink::autoPlan(int station, const QJsonObject &st)
         extra.insert(QStringLiteral("run_rmt"), wantRmt);
         if (!m_rmtParams[station].isEmpty())
             extra.insert(QStringLiteral("rmt"), m_rmtParams[station]);
-        const bool firstCpu = m_appliedCpu[station].isEmpty();
         if (!m_appliedCpu[station].contains(cpu) && !m_memoryParams[station].isEmpty()) {
             extra.insert(QStringLiteral("memory_params"), m_memoryParams[station]);
             m_appliedCpu[station].insert(cpu);
@@ -1141,7 +1194,7 @@ bool BackendLink::startTest(int station, bool continueTimer)
     }
 
     // 同一工位已有未结束的 StartTest:拒绝重复排入(后端也会拒),直接告诉调用方
-    if (m_startPending[station]) {
+    if (m_startPending[station] || m_startRpcInFlight[station]) {
         qInfo().noquote() << "[backend]" << stationId(station) << "已有未完成的 StartTest"
                           << m_startCmd[station] << ",忽略本次点击";
         emit logLine(station, QStringLiteral("[qt] 该工位已有未完成的 StartTest,忽略本次点击"));
@@ -1159,6 +1212,7 @@ bool BackendLink::startTest(int station, bool continueTimer)
     m_stageIntentPending[station].clear();
     m_stageIntentReady[station].clear();
     m_stationPaused[station] = false;
+    m_blockedWarned[station] = false;
     m_autoPaused = false;
     m_waitingNewBoot[station] = true;
 
@@ -1179,10 +1233,12 @@ bool BackendLink::startTest(int station, bool continueTimer)
 
     trackCommand(commandId, station);
     m_startPending[station] = true;
+    m_startRpcInFlight[station] = true;
     m_startCmd[station] = commandId;
     emit logLine(station, QStringLiteral("[qt] 已请求后端 StartTest(%1)").arg(commandId));
 
     sendRequest(QStringLiteral("StartTest"), params, [this, station, commandId](const QJsonObject &result) {
+        m_startRpcInFlight[station] = false;
         const QString state = result.value(QStringLiteral("state")).toString();
         qInfo().noquote() << "[backend] StartTest" << commandId << "state =" << state;
         reportCommandProgress(station, commandId, result);   // 手册 9.2:complete / task_status
@@ -1197,6 +1253,7 @@ bool BackendLink::startTest(int station, bool continueTimer)
         } else if (state == QStringLiteral("failed") || state == QStringLiteral("interrupted")) {
             forgetCommand(commandId);
             m_startPending[station] = false;
+            m_waitingNewBoot[station] = false;
             if (m_startCmd[station] == commandId)
                 m_startCmd[station].clear();
             m_stationPaused[station] = true;
@@ -1207,6 +1264,13 @@ bool BackendLink::startTest(int station, bool continueTimer)
             emit startTestReplied(station, false, QStringLiteral("%1 %2").arg(code, msg).trimmed());
         } else if (state == QStringLiteral("succeeded")) {
             forgetCommand(commandId);
+            const QJsonObject resObj = result.value(QStringLiteral("result")).toObject();
+            const QString prevBoot = resObj.value(QStringLiteral("previous_boot_id")).toString();
+            const QString newBoot = resObj.value(QStringLiteral("boot_id")).toString();
+            if (!newBoot.isEmpty() && newBoot == prevBoot) {
+                // 纯串口无 BMC 复位工位 StartTest 不递增 boot_id,避免 m_waitingNewBoot 吞掉本轮终态
+                m_waitingNewBoot[station] = false;
+            }
             // 直接终态(复位/开机已确认并进入可交互窗口),仍先预置后续阶段意图。
             stageStationIntents(station);
             m_startPending[station] = false;
@@ -1215,6 +1279,8 @@ bool BackendLink::startTest(int station, bool continueTimer)
             emit startTestReplied(station, true, state);
         }
     }, [this, station, commandId](const QString &code, const QString &message) {
+        m_startRpcInFlight[station] = false;
+        m_waitingNewBoot[station] = false;
         forgetCommand(commandId);
         // 后端在 RPC 层直接拒掉 StartTest(典型:FAILED_PRECONDITION,
         // 该工位正被另一个客户端/网页端执行)。此时不会有任何命令记录,

+ 9 - 2
src/backendlink.h

@@ -47,6 +47,11 @@ public:
      *  continueTimer=true 表示多任务队列延续同一批总计时,不重置后端 started_unix_ms。
      *  该工位已有未结束的 StartTest 时返回 false(防重复点击排入两次重启)。 */
     bool startTest(int station, bool continueTimer = false);
+    bool canSubmitStart(int station) const
+    {
+        return isConnected() && station >= 0 && station < 4
+               && !m_startPending[station] && !m_startRpcInFlight[station];
+    }
 
     /** 0.8.1.19:换条停机挂起时确认已更换 DIMM,清掉后端 blocked 状态。
      *  旧版后端没有这个方法时只会记一条 UNIMPLEMENTED 日志,不影响继续点开始测试。 */
@@ -95,8 +100,9 @@ signals:
      *  没有这个信号的话,按钮只会靠 20 s 兜底复位,期间看起来「点了没反应」。 */
     void startTestReplied(int station, bool ok, const QString &message);
     /** 一条异常记录:来自 stage_errors(training/rmt/amt/mt)或 verdict=fail。
-     *  stage 为空表示整体判定(没有可归属的阶段)。 */
-    void alarmReported(int station, const QString &stage, const QString &text);
+     *  stage 为空表示整体判定(没有可归属的阶段);rawKey 用于多行续行原地合并去重。 */
+    void alarmReported(int station, const QString &stage, const QString &text,
+                       const QString &rawKey = QString());
     /** 0.8.1.14 list_uefi_files 的结果:path 是查询的目录,files 只有文件名 */
     void uefiFilesArrived(int station, bool ok, const QString &path,
                           const QStringList &files, const QString &message);
@@ -227,6 +233,7 @@ private:
     bool m_autoPaused = false;          // 断线时暂停全部自动下发
     bool m_stationPaused[4] = {false, false, false, false};   // 某工位失败后单独暂停
     bool m_startPending[4] = {false, false, false, false};    // 该工位 StartTest 未到终态
+    bool m_startRpcInFlight[4] = {false, false, false, false}; // StartTest RPC 往返中,等待预置阶段意图
     bool m_blockedWarned[4] = {false, false, false, false};   // 本轮换条停机已提示过(boot_id 变化才重置)
     QString m_startCmd[4];              // 该工位在途 StartTest 的 command_id(放弃跟踪时要一并放开)
     QJsonObject m_memoryParams[4];      // 各工位本地保存的内存参数(ICT1 下发)

+ 13 - 0
src/comworker.cpp

@@ -267,6 +267,19 @@ void ComWorker::tick()
                 if (index < m_slots.size())
                     handleReply(index, m_slots[index]);
             });
+            connect(slot.sp, &QSerialPort::errorOccurred, this,
+                    [this, index](QSerialPort::SerialPortError err) {
+                if (err == QSerialPort::NoError || index >= m_slots.size())
+                    return;
+                Slot &s = m_slots[index];
+                if (err == QSerialPort::ResourceError
+                    || err == QSerialPort::DeviceNotFoundError
+                    || err == QSerialPort::PermissionError) {
+                    qInfo().noquote() << "[com] 串口设备错误" << shortName(s.port) << err
+                                      << (s.sp ? s.sp->errorString() : QString());
+                    closeSlot(s);
+                }
+            });
         }
 
         slot.sp->setPortName(target);

+ 121 - 9
src/createtaskdialog.cpp

@@ -17,6 +17,7 @@
 #include <QGraphicsDropShadowEffect>
 #include <QGridLayout>
 #include <QGroupBox>
+#include <QGuiApplication>
 #include <QHBoxLayout>
 #include <QIntValidator>
 #include <QJsonArray>
@@ -28,6 +29,7 @@
 #include <QListWidgetItem>
 #include <QMimeData>
 #include <QPushButton>
+#include <QScreen>
 #include <QTabWidget>
 #include <QTimer>
 #include <QToolButton>
@@ -104,6 +106,8 @@ QJsonObject withSelection(const QJsonObject &base, const QStringList &selected)
     QJsonObject o = base;
     o.insert(QStringLiteral("selected"), toArray(selected));
     o.insert(QStringLiteral("enabled"), !selected.isEmpty());
+    o.remove(QStringLiteral("only_tests"));
+    o.remove(QStringLiteral("skip_tests"));
     return o;
 }
 
@@ -120,6 +124,13 @@ void ensureDefaultSelection(QJsonObject &cfg, const QString &key, const QStringL
     QJsonObject sec = cfg.value(key).toObject();
     if (sec.contains(QStringLiteral("selected")))
         return;
+    // 尊重 config.json 里显式配置的 enabled=false(如默认不开启 RMT/AMT 时,不能强行全选)
+    if (sec.contains(QStringLiteral("enabled")) && !sec.value(QStringLiteral("enabled")).toBool(true)) {
+        sec.insert(QStringLiteral("selected"), QJsonArray());
+        sec.insert(QStringLiteral("enabled"), false);
+        cfg.insert(key, sec);
+        return;
+    }
     sec.insert(QStringLiteral("selected"), toArray(all));
     sec.insert(QStringLiteral("enabled"), !all.isEmpty());
     cfg.insert(key, sec);
@@ -147,14 +158,18 @@ public:
     explicit TaskSourceList(QWidget *parent = nullptr) : QListWidget(parent) {}
 
 protected:
-    QStringList mimeTypes() const
+    QStringList mimeTypes() const override
     {
         return QStringList() << QString::fromLatin1(kTaskMime);
     }
 
-    // Qt 5.14 的这个虚函数是「按值传参」,Qt 6 才改成 const 引用。
+    // Qt 5 的这个虚函数是「按值传参」,Qt 6 才改成 const 引用。
     // 写成引用等于没覆盖,拖出去的会是 Qt 默认 MIME,任务框就收不到了。
-    QMimeData *mimeData(const QList<QListWidgetItem *> items) const
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+    QMimeData *mimeData(const QList<QListWidgetItem *> &items) const override
+#else
+    QMimeData *mimeData(const QList<QListWidgetItem *> items) const override
+#endif
     {
         QMimeData *m = new QMimeData();
         if (!items.isEmpty() && items.first())
@@ -471,6 +486,49 @@ CreateTaskDialog::CreateTaskDialog(QWidget *parent)
     ui->amtBadge->setVisible(false);
     ui->rmtBadge->setVisible(false);
 
+    // 在 MT 算法卡片底部增加 ADDRLIMLO / ADDRLIMHI 区间配置行(支持快速短区间测试与自定义内存范围)
+    if (QVBoxLayout *mtLay = qobject_cast<QVBoxLayout *>(ui->mtBox->layout())) {
+        QHBoxLayout *rangeRow = new QHBoxLayout();
+        rangeRow->setSpacing(6);
+        m_mtCustomRange = new QCheckBox(QStringLiteral("限制地址"), ui->mtBox);
+        m_mtCustomRange->setProperty("role", "paramCheck");
+        m_mtCustomRange->setToolTip(QStringLiteral("勾选后下发 ADDRLIMLO / ADDRLIMHI(如 0x10000000 ~ 0x14000000)"));
+        m_mtAddrLoEdit = new QLineEdit(ui->mtBox);
+        m_mtAddrLoEdit->setProperty("role", "paramEdit");
+        m_mtAddrLoEdit->setPlaceholderText(QStringLiteral("0x10000000"));
+        m_mtAddrLoEdit->setMinimumWidth(96);
+        QLabel *dash = new QLabel(QStringLiteral("~"), ui->mtBox);
+        m_mtAddrHiEdit = new QLineEdit(ui->mtBox);
+        m_mtAddrHiEdit->setProperty("role", "paramEdit");
+        m_mtAddrHiEdit->setPlaceholderText(QStringLiteral("0x14000000"));
+        m_mtAddrHiEdit->setMinimumWidth(96);
+        auto syncRangeEnabled = [this](bool on) {
+            if (m_mtAddrLoEdit) m_mtAddrLoEdit->setEnabled(on);
+            if (m_mtAddrHiEdit) m_mtAddrHiEdit->setEnabled(on);
+        };
+        connect(m_mtCustomRange, &QCheckBox::toggled, this, syncRangeEnabled);
+        syncRangeEnabled(false);
+        rangeRow->addWidget(m_mtCustomRange);
+        rangeRow->addWidget(m_mtAddrLoEdit, 1);
+        rangeRow->addWidget(dash);
+        rangeRow->addWidget(m_mtAddrHiEdit, 1);
+        const int insertAt = qMax(0, mtLay->count() - 1);
+        mtLay->insertLayout(insertAt, rangeRow);
+    }
+
+    // 适配小分辨率/高 DPI 桌面(1366x768 或 1080p @ 125%/150%):约束弹窗不超出屏幕可用区域
+    if (QScreen *sc = (parent && parent->screen()) ? parent->screen() : QGuiApplication::primaryScreen()) {
+        const QRect avail = sc->availableGeometry();
+        if (avail.width() > 320 && avail.height() > 240
+            && (width() > avail.width() - 24 || height() > avail.height() - 24)) {
+            ui->algoList->setMinimumHeight(200);
+            ui->amtList->setMinimumHeight(200);
+            ui->rmtList->setMinimumHeight(140);
+            resize(qMin(width(), qMax(900, avail.width() - 32)),
+                   qMin(height(), qMax(620, avail.height() - 32)));
+        }
+    }
+
     // 「创建任务」/「关闭」按钮。点创建任务只生成任务,不写文件、不关窗。
     QPushButton *ok = ui->buttonBox->button(QDialogButtonBox::Ok);
     ok->setText(QStringLiteral("创建任务"));
@@ -973,9 +1031,41 @@ void CreateTaskDialog::clearStation(int station)
 QJsonObject CreateTaskDialog::currentConfig() const
 {
     QJsonObject cfg = m_baseCfg;
-    cfg.insert(QStringLiteral("memory_params"), params());
-    cfg.insert(QStringLiteral("mt"),
-               withSelection(cfg.value(QStringLiteral("mt")).toObject(), algorithms()));
+    const QJsonObject mem = params();
+    cfg.insert(QStringLiteral("memory_params"), mem);
+
+    QJsonObject mtObj = withSelection(cfg.value(QStringLiteral("mt")).toObject(), algorithms());
+    mtObj.insert(QStringLiteral("ecc"), mem.value(QStringLiteral("ecc")).toBool());
+    mtObj.insert(QStringLiteral("debuglog"), mem.value(QStringLiteral("debuglog")).toBool());
+    if (m_mtCustomRange && m_mtCustomRange->isChecked()) {
+        const QString lo = m_mtAddrLoEdit ? m_mtAddrLoEdit->text().trimmed() : QString();
+        const QString hi = m_mtAddrHiEdit ? m_mtAddrHiEdit->text().trimmed() : QString();
+        if (!lo.isEmpty() || !hi.isEmpty()) {
+            mtObj.insert(QStringLiteral("memory_range"), QStringLiteral("custom"));
+            if (!lo.isEmpty())
+                mtObj.insert(QStringLiteral("addr_lim_lo"), lo);
+            else
+                mtObj.remove(QStringLiteral("addr_lim_lo"));
+            if (!hi.isEmpty())
+                mtObj.insert(QStringLiteral("addr_lim_hi"), hi);
+            else
+                mtObj.remove(QStringLiteral("addr_lim_hi"));
+        } else {
+            mtObj.insert(QStringLiteral("memory_range"), QStringLiteral("all"));
+            mtObj.remove(QStringLiteral("addr_lim_lo"));
+            mtObj.remove(QStringLiteral("addr_lim_hi"));
+        }
+    } else {
+        mtObj.insert(QStringLiteral("memory_range"), QStringLiteral("all"));
+        mtObj.remove(QStringLiteral("addr_lim_lo"));
+        mtObj.remove(QStringLiteral("addr_lim_hi"));
+    }
+    mtObj.remove(QStringLiteral("ADDRLIMLO"));
+    mtObj.remove(QStringLiteral("ADDRLIMHI"));
+    mtObj.remove(QStringLiteral("addr_lo"));
+    mtObj.remove(QStringLiteral("addr_hi"));
+    cfg.insert(QStringLiteral("mt"), mtObj);
+
     cfg.insert(QStringLiteral("amt"),
                withSelection(cfg.value(QStringLiteral("amt")).toObject(), amtAlgorithms()));
     cfg.insert(QStringLiteral("rmt"),
@@ -1030,9 +1120,21 @@ void CreateTaskDialog::loadUiFrom(const QJsonObject &cfg)
         for (QCheckBox *cb : cbs)
             cb->setChecked(sel.contains(cb->text()));
     };
-    apply(ui->algoList, cfg.value(QStringLiteral("mt")).toObject());
+    const QJsonObject mtCfg = cfg.value(QStringLiteral("mt")).toObject();
+    apply(ui->algoList, mtCfg);
     apply(ui->amtList,  cfg.value(QStringLiteral("amt")).toObject());
     apply(ui->rmtList,  cfg.value(QStringLiteral("rmt")).toObject());
+    if (m_mtCustomRange && m_mtAddrLoEdit && m_mtAddrHiEdit) {
+        QString lo = mtCfg.value(QStringLiteral("addr_lim_lo")).toString().trimmed();
+        if (lo.isEmpty()) lo = mtCfg.value(QStringLiteral("ADDRLIMLO")).toString().trimmed();
+        QString hi = mtCfg.value(QStringLiteral("addr_lim_hi")).toString().trimmed();
+        if (hi.isEmpty()) hi = mtCfg.value(QStringLiteral("ADDRLIMHI")).toString().trimmed();
+        const bool custom = (mtCfg.value(QStringLiteral("memory_range")).toString() == QLatin1String("custom"))
+                            || !lo.isEmpty() || !hi.isEmpty();
+        m_mtCustomRange->setChecked(custom);
+        m_mtAddrLoEdit->setText(lo);
+        m_mtAddrHiEdit->setText(hi);
+    }
     refreshAll();
 }
 
@@ -1062,10 +1164,20 @@ QJsonObject CreateTaskDialog::params() const
         o = configMemoryParams();
 
     for (int i = 0; i < kKeyCount; ++i) {
+        const QString key = QString::fromLatin1(kKeys[i]);
         QLineEdit *ed = findChild<QLineEdit *>(QStringLiteral("paramEdit_%1").arg(i));
-        if (!ed || ed->text().trimmed().isEmpty())
+        if (!ed)
             continue;
-        o.insert(QString::fromLatin1(kKeys[i]), ed->text().trimmed().toInt());
+        const QString txt = ed->text().trimmed();
+        if (txt.isEmpty()) {
+            o.remove(key);
+            continue;
+        }
+        const int v = txt.toInt();
+        if (v > 0)
+            o.insert(key, v);
+        else
+            o.remove(key);
     }
     o.insert(QStringLiteral("errhandle"), ui->errBox->isChecked());
     o.insert(QStringLiteral("ap"), ui->apBox->isChecked());

+ 5 - 0
src/createtaskdialog.h

@@ -8,7 +8,9 @@
 
 #include <functional>
 
+class QCheckBox;
 class QLabel;
+class QLineEdit;
 class QListWidget;
 class QToolButton;
 class QVBoxLayout;
@@ -91,6 +93,9 @@ private:
     QVector<QToolButton *> m_stationClearBtns;   // 每个机台的「清空」按钮
     std::function<bool(int)> m_onlineProbe;      // 机台是否可用(离线则拒收任务)
     std::function<bool(const QString &)> m_runningProbe;  // 任务是否执行中
+    QCheckBox *m_mtCustomRange = nullptr;        // MT 自定义地址区间开关(ADDRLIMLO/ADDRLIMHI)
+    QLineEdit *m_mtAddrLoEdit = nullptr;
+    QLineEdit *m_mtAddrHiEdit = nullptr;
     bool m_saved = false;
 };
 

+ 132 - 5
src/detailview.cpp

@@ -168,10 +168,52 @@ DetailView::DetailView(Ui::MainWindow *ui, StationStore *store, QObject *parent)
     connect(m_store, &StationStore::infoChanged, this, &DetailView::onInfoChanged);
     connect(m_store, &StationStore::temperatureChanged, this, &DetailView::onTemperatureChanged);
     connect(m_store, &StationStore::alarmsChanged, this, [this](int index) {
-        if (index == m_index && m_ui->detailTabStack->currentIndex() == 1)
+        if (index != m_index)
+            return;
+        updateStatusIndicators();
+        if (m_ui->detailTabStack->currentIndex() == 1)
             renderAlarms();
     });
 
+    // 在 24 通道卡片头部和上方加入 MT 报告摘要 + 异常/等待换条醒目横幅(避免未映射通道时 24 格全绿产生误导)
+    if (m_ui->detailChHead) {
+        m_mtSummaryLabel = new QLabel(m_ui->detailChCard);
+        m_mtSummaryLabel->setProperty("role", "fieldSub");
+        m_mtSummaryLabel->setVisible(false);
+        m_ui->detailChHead->addWidget(m_mtSummaryLabel);
+    }
+    if (m_ui->detailChCardLayout) {
+        m_failBanner = new QFrame(m_ui->detailChCard);
+        m_failBanner->setStyleSheet(QStringLiteral(
+            "QFrame { background:#fdf0ef; border:1px solid #f3cdcb; border-radius:4px; }"));
+        QHBoxLayout *fbLay = new QHBoxLayout(m_failBanner);
+        fbLay->setContentsMargins(10, 5, 10, 5);
+        fbLay->setSpacing(8);
+        m_failBannerLabel = new QLabel(m_failBanner);
+        m_failBannerLabel->setStyleSheet(QStringLiteral("color:#c92f2f; font-size:13px; font-weight:600; border:none; background:transparent;"));
+        m_failBannerLabel->setWordWrap(true);
+        m_failViewAlarmsBtn = new QPushButton(QStringLiteral("查看异常记录"), m_failBanner);
+        m_failViewAlarmsBtn->setProperty("role", "alarmExport");
+        m_failViewAlarmsBtn->setStyleSheet(QStringLiteral("padding:3px 10px; font-size:13px; min-width:0;"));
+        m_failViewAlarmsBtn->setCursor(Qt::PointingHandCursor);
+        m_failConfirmBtn = new QPushButton(QStringLiteral("已更换 · 确认继续"), m_failBanner);
+        m_failConfirmBtn->setProperty("role", "alarmExport");
+        m_failConfirmBtn->setStyleSheet(QStringLiteral("padding:3px 10px; font-size:13px; min-width:0; color:#c92f2f; border-color:#e8a2aa;"));
+        m_failConfirmBtn->setCursor(Qt::PointingHandCursor);
+        m_failConfirmBtn->setVisible(false);
+        connect(m_failViewAlarmsBtn, &QPushButton::clicked, this, [this] { selectTab(1); });
+        connect(m_failConfirmBtn, &QPushButton::clicked, this, [this] {
+            if (m_index >= 0)
+                emit confirmDimmRequested(m_index);
+        });
+        fbLay->addWidget(m_failBannerLabel, 1);
+        fbLay->addWidget(m_failViewAlarmsBtn, 0);
+        fbLay->addWidget(m_failConfirmBtn, 0);
+        m_failBanner->setVisible(false);
+        const int insertIdx = qMin(1, m_ui->detailChCardLayout->count());
+        m_ui->detailChCardLayout->insertWidget(insertIdx, m_failBanner);
+    }
+
     setupAlarmPage();
     setupCurvePlot();
 }
@@ -207,6 +249,7 @@ void DetailView::renderTasks(int station)
     const StationData &cur = m_store->station(station);
     m_lastTaskDone = cur.taskDone;
     m_lastTaskCurrent = cur.taskCurrent;
+    m_lastTaskFailed = cur.taskFailed;
     m_lastBackendTaskStatus = cur.taskStatus;
     m_lastAwaitingDimm = cur.awaitingDimmReplacement;
 
@@ -252,7 +295,10 @@ void DetailView::renderTasks(int station)
         const QString name = t.value(QStringLiteral("name")).toString();
         QString state = QStringLiteral("pending");
         QString stateText = QStringLiteral("未开始");
-        if (d.taskCurrent >= 0 && i == d.taskCurrent) {
+        if (d.taskFailed >= 0 && i == d.taskFailed) {
+            state = QStringLiteral("failed");
+            stateText = d.awaitingDimmReplacement ? QStringLiteral("等待换条") : QStringLiteral("执行失败");
+        } else if (d.taskCurrent >= 0 && i == d.taskCurrent) {
             state = QStringLiteral("running");
             stateText = QStringLiteral("执行中");
             // 手册 9.2:后端 task_status / awaiting_dimm_replacement 比本地进度更精确,
@@ -643,6 +689,80 @@ void DetailView::renderAll()
     renderCurve();
     renderLogs();
     renderAlarms();
+    updateStatusIndicators();
+}
+
+void DetailView::updateStatusIndicators()
+{
+    if (m_index < 0 || m_index >= m_store->count())
+        return;
+
+    const StationData &d = m_store->station(m_index);
+    const int nAlarms = d.alarms.size();
+    if (m_ui->detailTab_1) {
+        m_ui->detailTab_1->setText(nAlarms > 0
+            ? QStringLiteral("异常记录 (%1)").arg(nAlarms)
+            : QStringLiteral("异常记录"));
+    }
+
+    if (m_mtSummaryLabel) {
+        const QString mtStatus = d.mtResult.value(QStringLiteral("status")).toString();
+        const int errs = d.mtResult.value(QStringLiteral("errors")).toInt(0);
+        const QString rpt = d.mtResult.value(QStringLiteral("report_file")).toString();
+        const QString passed = d.mtResult.value(QStringLiteral("tests_passed")).toString();
+        QStringList parts;
+        if (!mtStatus.isEmpty())
+            parts << QStringLiteral("MT:%1").arg(mtStatus.toUpper());
+        if (errs > 0 || mtStatus == QLatin1String("fail"))
+            parts << QStringLiteral("errs=%1").arg(errs);
+        if (d.mtResult.contains(QStringLiteral("ecc_correctable_errors")))
+            parts << QStringLiteral("ECC_CE=%1").arg(d.mtResult.value(QStringLiteral("ecc_correctable_errors")).toInt(0));
+        if (d.mtResult.contains(QStringLiteral("ecc_uncorrectable_errors")))
+            parts << QStringLiteral("ECC_UE=%1").arg(d.mtResult.value(QStringLiteral("ecc_uncorrectable_errors")).toInt(0));
+        if (!passed.isEmpty())
+            parts << QStringLiteral("pass=%1").arg(passed);
+        if (!rpt.isEmpty())
+            parts << rpt;
+        m_mtSummaryLabel->setText(parts.join(QStringLiteral(" · ")));
+        m_mtSummaryLabel->setVisible(!parts.isEmpty());
+        m_mtSummaryLabel->setStyleSheet(mtStatus == QLatin1String("fail") || errs > 0
+                                            ? QStringLiteral("color:#c92f2f; font-weight:600;")
+                                            : QString());
+    }
+
+    if (m_failBanner && m_failBannerLabel) {
+        int failSlots = 0;
+        for (const ChannelInfo &ch : d.channels) {
+            if (ch.state == ChannelInfo::Fail)
+                ++failSlots;
+        }
+        const bool isFail = (d.verdict == QLatin1String("fail")
+                             || d.taskStatus == QLatin1String("failed")
+                             || d.awaitingDimmReplacement
+                             || failSlots > 0
+                             || nAlarms > 0);
+        if (!isFail) {
+            m_failBanner->setVisible(false);
+        } else {
+            const QString scope = d.verdictScope.isEmpty() ? QString() : QStringLiteral("%1 阶段 · ").arg(d.verdictScope.toUpper());
+            QString msg;
+            if (d.awaitingDimmReplacement) {
+                msg = (failSlots == 0)
+                          ? QStringLiteral("⚠ %1检出 FAIL 并停机等待换条(%2 条异常未映射具体通道,请核对异常记录中的物理地址)").arg(scope).arg(nAlarms)
+                          : QStringLiteral("⚠ %1检出 %2 通道 FAIL 并停机等待更换内存条(异常记录 %3 条)").arg(scope).arg(failSlots).arg(nAlarms);
+            } else if (failSlots == 0) {
+                msg = QStringLiteral("⚠ %1测试 FAIL(%2 条异常未映射具体通道,请点右侧查看异常记录与原始地址)").arg(scope).arg(nAlarms);
+            } else {
+                msg = QStringLiteral("⚠ %1检出 %2 个通道异常(异常记录 %3 条)").arg(scope).arg(failSlots).arg(nAlarms);
+            }
+            m_failBannerLabel->setText(msg);
+            if (m_failConfirmBtn)
+                m_failConfirmBtn->setVisible(d.awaitingDimmReplacement);
+            if (m_failViewAlarmsBtn)
+                m_failViewAlarmsBtn->setVisible(nAlarms > 0 && m_ui->detailTabStack->currentIndex() != 1);
+            m_failBanner->setVisible(true);
+        }
+    }
 }
 
 void DetailView::renderTitle()
@@ -851,10 +971,13 @@ void DetailView::exportAlarms()
         path += QStringLiteral(".xlsx");
 
     // ---------------------------------------------------------------- 写 xlsx
-    // 文件名编码:libxlsxwriter 在 MinGW 下会 `#undef _WIN32`、退回普通 fopen,
-    // 不会做 UTF-8→UTF-16 转换,所以这里必须传本地编码(中文 Windows 就是 GBK),
-    // 传 UTF-8 会得到"寮傚父璁板綍"这种乱码文件名。
+    // Windows MinGW 下 libxlsxwriter 退回 ANSI/GBK fopen,需本地编码;
+    // Linux 下按 UTF-8 原样写路径,防止 POSIX locale 下中文文件名变成 ????。
+#ifdef Q_OS_WIN
     const QByteArray localPath = QFile::encodeName(path);
+#else
+    const QByteArray localPath = path.toUtf8();
+#endif
     lxw_workbook *wb = workbook_new(localPath.constData());
     if (!wb) {
         QMessageBox::warning(dlgParent, QStringLiteral("导出失败"),
@@ -942,6 +1065,7 @@ void DetailView::selectTab(int index)
         renderAlarms();  // 异常记录只在看得见的时候铺,省得后台白建控件
     else if (index == 2 && m_index >= 0)
         loadParams(m_index);   // 每次进参数页都重新铺一遍,避免看到过期值
+    updateStatusIndicators();
 }
 
 // ---------------------------------------------------------------------------
@@ -1015,15 +1139,18 @@ void DetailView::flushPending()
     const StationData &d = m_store->station(m_index);
     if (m_confirmDimmBtn)
         m_confirmDimmBtn->setVisible(d.awaitingDimmReplacement);
+    updateStatusIndicators();
 
     // 「机台任务」页开着时,进度变了(进行中 → 已完成、下一个开始)就重铺一次;
     // 没变不动,免得每秒的 state 推送都在重建控件。
     if (m_ui->detailTabStack->currentIndex() == 2) {
         if (d.taskDone != m_lastTaskDone || d.taskCurrent != m_lastTaskCurrent
+            || d.taskFailed != m_lastTaskFailed
             || d.taskStatus != m_lastBackendTaskStatus
             || d.awaitingDimmReplacement != m_lastAwaitingDimm) {
             m_lastTaskDone = d.taskDone;
             m_lastTaskCurrent = d.taskCurrent;
+            m_lastTaskFailed = d.taskFailed;
             m_lastBackendTaskStatus = d.taskStatus;
             m_lastAwaitingDimm = d.awaitingDimmReplacement;
             renderTasks(m_index);

+ 7 - 0
src/detailview.h

@@ -74,12 +74,14 @@ private:
     void renderLogs();
     void setupAlarmPage();           // 异常记录页:把 .ui 里的占位换成可滚动列表
     void renderAlarms();             // 按模型里的 alarms 重铺(条数很少,整列表重建)
+    void updateStatusIndicators();   // 更新异常徽标、未映射 FAIL 提示条及 MT 报告摘要
     void exportAlarms();             // 把当前工位这一轮的异常记录导出成文件(CSV / TXT)
     void selectTab(int index);
     void requestFlush();
 
     int m_lastTaskDone = -1;        // 上次铺任务列表时的进度,用来避免每秒重铺
     int m_lastTaskCurrent = -2;
+    int m_lastTaskFailed = -2;
     QString m_lastBackendTaskStatus;  // 手册 9.2:后端 task_status 变化也要重铺任务条
     bool m_lastAwaitingDimm = false;
 
@@ -103,6 +105,11 @@ private:
     QVBoxLayout *m_alarmList = nullptr;
     QPushButton *m_alarmExport = nullptr;   // 异常记录页右上角「导出」
     QPushButton *m_confirmDimmBtn = nullptr;// 异常记录页「已更换异常内存条 · 确认继续」
+    QFrame *m_failBanner = nullptr;
+    QLabel *m_failBannerLabel = nullptr;
+    QPushButton *m_failViewAlarmsBtn = nullptr;
+    QPushButton *m_failConfirmBtn = nullptr;
+    QLabel *m_mtSummaryLabel = nullptr;
 
     // 温控曲线当前看的是哪个通道,默认 CPU0_CHA
     QString m_curveChannel = QStringLiteral("CPU0_CHA");

+ 64 - 32
src/localplans.cpp

@@ -118,11 +118,17 @@ QJsonObject LocalPlans::defaultsFromConfig()
 QJsonObject LocalPlans::stationParams(int station)
 {
     const QString key = QStringLiteral("S%1").arg(station + 1);
+    const QJsonObject defs = defaultsFromConfig();
     const QJsonObject saved = readRoot()
             .value(QStringLiteral("stations")).toObject()
             .value(key).toObject()
             .value(QStringLiteral("memory_params")).toObject();
-    return saved.isEmpty() ? defaultsFromConfig() : saved;
+    if (saved.isEmpty())
+        return defs;
+    QJsonObject merged = defs;
+    for (auto it = saved.constBegin(); it != saved.constEnd(); ++it)
+        merged.insert(it.key(), it.value());
+    return merged;
 }
 
 QJsonObject LocalPlans::amtDefaultsFromConfig()
@@ -180,12 +186,18 @@ QJsonObject LocalPlans::stationAmt(int station)
 QJsonObject LocalPlans::stationMt(int station)
 {
     const QString key = QStringLiteral("S%1").arg(station + 1);
+    const QJsonObject defs = mtDefaultsFromConfig();
     const QJsonObject saved = readRoot()
             .value(QStringLiteral("stations")).toObject()
             .value(key).toObject()
             .value(QStringLiteral("mt")).toObject();
-    // 没保存过就用 config.json 的 mtParams(默认启用,跑 118.efi)
-    return saved.isEmpty() ? mtDefaultsFromConfig() : saved;
+    // 没保存过就用 config.json 的 mtParams(默认启用,跑 118.efi);已保存时补齐 config.json 新增默认键
+    if (saved.isEmpty())
+        return defs;
+    QJsonObject merged = defs;
+    for (auto it = saved.constBegin(); it != saved.constEnd(); ++it)
+        merged.insert(it.key(), it.value());
+    return merged;
 }
 
 // ---------------------------------------------------------------------------
@@ -212,19 +224,38 @@ QJsonObject LocalPlans::mtStagePayload(const QJsonObject &mt)
     if (memRange == QStringLiteral("all") || memRange == QStringLiteral("custom"))
         out.insert(QStringLiteral("memory_range"), memRange);
 
-    // 自定义地址区间:按手册示例保持字符串形式(如 "0x10000000")
-    // 兼容文档中的大写别名 ADDRLIMLO / ADDRLIMHI;
-    // JSON 保存仍统一使用小写键,避免新旧配置产生两份互相覆盖的值。
-    QString addrLo = mt.value(QStringLiteral("addr_lim_lo")).toString().trimmed();
-    QString addrHi = mt.value(QStringLiteral("addr_lim_hi")).toString().trimmed();
-    if (addrLo.isEmpty())
-        addrLo = mt.value(QStringLiteral("ADDRLIMLO")).toString().trimmed();
-    if (addrHi.isEmpty())
-        addrHi = mt.value(QStringLiteral("ADDRLIMHI")).toString().trimmed();
+    auto readAddrVal = [&mt](const char *k1, const char *k2, const char *k3) -> QString {
+        const char *keys[3] = {k1, k2, k3};
+        for (const char *k : keys) {
+            const QJsonValue v = mt.value(QLatin1String(k));
+            if (v.isString()) {
+                const QString t = v.toString().trimmed();
+                if (!t.isEmpty())
+                    return t;
+            } else if (v.isDouble()) {
+                const qint64 n = v.toVariant().toLongLong();
+                if (n >= 0)
+                    return QStringLiteral("0x%1").arg(QString::number(n, 16).toUpper());
+            }
+        }
+        return QString();
+    };
+    const QString addrLo = readAddrVal("addr_lim_lo", "ADDRLIMLO", "addr_lo");
+    const QString addrHi = readAddrVal("addr_lim_hi", "ADDRLIMHI", "addr_hi");
     if (!addrLo.isEmpty())
         out.insert(QStringLiteral("addr_lim_lo"), addrLo);
     if (!addrHi.isEmpty())
         out.insert(QStringLiteral("addr_lim_hi"), addrHi);
+    if (memRange.isEmpty() && (!addrLo.isEmpty() || !addrHi.isEmpty()))
+        out.insert(QStringLiteral("memory_range"), QStringLiteral("custom"));
+
+    // ecc / eccpoll / debuglog:透传给后端写 mt86.cfg(ECCPOLL / REPORTNUMWARN)
+    if (mt.contains(QStringLiteral("eccpoll")))
+        out.insert(QStringLiteral("eccpoll"), mt.value(QStringLiteral("eccpoll")).toInt());
+    else if (mt.contains(QStringLiteral("ecc")))
+        out.insert(QStringLiteral("ecc"), mt.value(QStringLiteral("ecc")).toBool());
+    if (mt.contains(QStringLiteral("debuglog")))
+        out.insert(QStringLiteral("debuglog"), mt.value(QStringLiteral("debuglog")).toBool());
 
     // exit_mode:2 退回 UEFI Shell / 1 关机 / 0 重启
     bool exitOk = false;
@@ -232,27 +263,11 @@ QJsonObject LocalPlans::mtStagePayload(const QJsonObject &mt)
     if (exitOk && exitMode >= 0 && exitMode <= 2)
         out.insert(QStringLiteral("exit_mode"), exitMode);
 
-    // only_tests / skip_tests:0..25 的整数数组,过滤越界值;空数组不下发
-    const char *const kTestLists[] = {"only_tests", "skip_tests"};
-    for (const char *name : kTestLists) {
-        const QJsonArray in = mt.value(QLatin1String(name)).toArray();
-        QJsonArray filtered;
-        QList<int> seen;
-        for (const QJsonValue &v : in) {
-            const int test = parseMtTestValue(v);
-            if (test >= 0 && test <= 25 && !seen.contains(test)) {
-                seen.append(test);
-                filtered.append(test);
-            }
-        }
-        if (!filtered.isEmpty())
-            out.insert(QLatin1String(name), filtered);
-    }
-
     // CreateTaskDialog 把用户勾选的 MT 项存在 mt.selected(字符串数组)。
-    // 若未显式指定 only_tests,但勾选了部分子项(0 < count < 26),映射成 only_tests 传给后端;
-    // 全选(26 项)时省略,由后端写默认 TSTLIST=0..25。
-    if (!out.contains(QStringLiteral("only_tests"))) {
+    // 当 mt.selected 存在时以勾选结果为准(全选 26 项则清空限制走默认 0..25;部分选择映射为 only_tests),
+    // 防止旧的 only_tests / skip_tests 覆盖掉用户在界面上的新勾选。
+    const bool hasSelected = mt.contains(QStringLiteral("selected"));
+    if (hasSelected) {
         const QJsonArray selArr = mt.value(QStringLiteral("selected")).toArray();
         if (!selArr.isEmpty()) {
             QJsonArray mapped;
@@ -267,6 +282,23 @@ QJsonObject LocalPlans::mtStagePayload(const QJsonObject &mt)
             if (!mapped.isEmpty() && mapped.size() < 26)
                 out.insert(QStringLiteral("only_tests"), mapped);
         }
+    } else {
+        // 未通过 selected 勾选时,透传显式配置的 only_tests / skip_tests(0..25 整数数组)
+        const char *const kTestLists[] = {"only_tests", "skip_tests"};
+        for (const char *name : kTestLists) {
+            const QJsonArray in = mt.value(QLatin1String(name)).toArray();
+            QJsonArray filtered;
+            QList<int> seen;
+            for (const QJsonValue &v : in) {
+                const int test = parseMtTestValue(v);
+                if (test >= 0 && test <= 25 && !seen.contains(test)) {
+                    seen.append(test);
+                    filtered.append(test);
+                }
+            }
+            if (!filtered.isEmpty())
+                out.insert(QLatin1String(name), filtered);
+        }
     }
 
     return out;

+ 18 - 2
src/main.cpp

@@ -55,8 +55,12 @@ static void applyAppFont(QApplication &app)
         << QStringLiteral("WenQuanYi Micro Hei")
         << QStringLiteral("Segoe UI");
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+    const QStringList installed = QFontDatabase::families();
+#else
     QFontDatabase db;
     const QStringList installed = db.families();
+#endif
 
     QFont f = app.font();
     for (int i = 0; i < prefer.size(); ++i) {
@@ -80,13 +84,25 @@ static void applyStyleSheet(QApplication &app)
 
 int main(int argc, char *argv[])
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+#ifdef Q_OS_LINUX
+    // 防止系统全局脚本(如 /etc/profile.d/anlogic-td2026.sh)残留的 offscreen/第三方 Qt 插件污染真实桌面启动
+    if ((!qEnvironmentVariableIsEmpty("DISPLAY") || !qEnvironmentVariableIsEmpty("WAYLAND_DISPLAY"))
+        && qEnvironmentVariableIsEmpty("STL_QT_ALLOW_OFFSCREEN")
+        && qEnvironmentVariable("QT_QPA_PLATFORM") == QLatin1String("offscreen")) {
+        qunsetenv("QT_QPA_PLATFORM");
+    }
+    if (qEnvironmentVariable("QT_PLUGIN_PATH").contains(QLatin1String("/anlogic/")))
+        qunsetenv("QT_PLUGIN_PATH");
+#endif
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
     QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
 #endif
     // 去掉所有对话框标题栏右上角的「?」帮助按钮:
     // 这套界面里没人用上下文帮助,留着只是多余的一个按钮。
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
     QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton);
+#endif
 
     QApplication app(argc, argv);
 
@@ -95,7 +111,7 @@ int main(int argc, char *argv[])
 
     app.setApplicationName(QStringLiteral("HOVSE SLT Pro"));
     app.setOrganizationName(QStringLiteral("XJKJ"));
-    app.setApplicationVersion(QStringLiteral("0.8.1.23"));
+    app.setApplicationVersion(QStringLiteral("0.8.1.24"));
 
     applyAppFont(app);
     applyStyleSheet(app);

+ 94 - 29
src/mainwindow.cpp

@@ -54,6 +54,7 @@
 #include <QStyle>
 #include <QTimer>
 #include <QVBoxLayout>
+#include <QWindow>
 
 namespace {
 
@@ -120,8 +121,17 @@ void addPasswordVisibilityToggle(QLineEdit *edit)
 inline bool phaseAfterTraining(const QString &phase)
 {
     return phase == QLatin1String("rmt") || phase == QLatin1String("amt")
-           || phase == QLatin1String("post") || phase == QLatin1String("uefi")
-           || phase == QLatin1String("mt");
+           || phase == QLatin1String("uip2") || phase == QLatin1String("post")
+           || phase == QLatin1String("uefi") || phase == QLatin1String("mt");
+}
+
+inline QPoint mouseEventGlobalPos(const QMouseEvent *me)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+    return me->globalPosition().toPoint();
+#else
+    return me->globalPos();
+#endif
 }
 
 // 圆形徽标:成功画对勾,失败画感叹号。按 2 倍分辨率画再交回,
@@ -380,8 +390,8 @@ MainWindow::MainWindow(QWidget *parent)
     });
     // 后端阶段错误 / FAIL 判定 → 详情页「异常记录」
     connect(m_backend, &BackendLink::alarmReported, this,
-            [this](int station, const QString &stage, const QString &text) {
-        m_store->appendAlarm(station, stage, text);
+            [this](int station, const QString &stage, const QString &text, const QString &rawKey) {
+        m_store->appendAlarm(station, stage, text, rawKey);
     });
     connect(m_backend, &BackendLink::taskCompleteArrived, this,
             [this](int station, const QJsonObject &result) {
@@ -581,7 +591,10 @@ MainWindow::MainWindow(QWidget *parent)
             m_store->appendLog(station,
                 QStringLiteral("[qt] 第 %1/%2 个任务的 StartTest 未成功,本次队列中止")
                     .arg(m_taskIndex[station] + 1).arg(m_taskQueue[station].size()));
-            m_store->setTaskProgress(station, m_taskIndex[station], -1);
+            if (m_nextTaskTimer[station] && m_nextTaskTimer[station]->isActive())
+                m_nextTaskTimer[station]->stop();
+            m_taskFailed[station] = m_taskIndex[station];
+            m_store->setTaskProgress(station, m_taskIndex[station], -1, m_taskFailed[station]);
             m_taskIndex[station] = -1;
             m_taskQueue[station] = QJsonArray();
         }
@@ -738,6 +751,15 @@ void MainWindow::startTest(int index)
                            QStringLiteral("后端未连接,本次开始测试没有下发任务。"));
         return;
     }
+    if (!m_backend->canSubmitStart(index)) {
+        const StationData &busy = m_store->station(index);
+        m_store->appendLog(index, QStringLiteral("[qt] %1 已有正在提交的 StartTest,保留当前界面与队列等待响应")
+                                      .arg(busy.deviceId));
+        return;
+    }
+
+    if (m_nextTaskTimer[index] && m_nextTaskTimer[index]->isActive())
+        m_nextTaskTimer[index]->stop();
 
     // 新一轮测试:清空上一轮 24 路内存通道的 PASS/FAIL、温度和曲线。
     // 只重置内存测试结果,不清空 CT7428 腔体温度,也不停止本地串口采集。
@@ -747,9 +769,10 @@ void MainWindow::startTest(int index)
     // 没配任务时保持原来的单任务行为(用 stations.Sn 的扁平配置)。
     m_taskQueue[index] = LocalPlans::stationConfig(index).value(QStringLiteral("tasks")).toArray();
     m_taskIndex[index] = m_taskQueue[index].isEmpty() ? -1 : 0;
+    m_taskFailed[index] = -1;
     m_taskAdvanceGuard[index] = false;      // 新一轮允许再推进一次
     const int taskTotal = m_taskQueue[index].size();
-    m_store->setTaskProgress(index, 0, taskTotal > 0 ? 0 : -1);
+    m_store->setTaskProgress(index, 0, taskTotal > 0 ? 0 : -1, -1);
 
     // 装载当前任务(没有任务时回落到扁平配置)到后端链路。
     // 参数在 StartTest 后优先通过 SetStageIntent 预置(失败时回退 StageAction)下发。
@@ -932,8 +955,12 @@ void MainWindow::finishCurrentTask(int station, bool failed, const QString &reas
         m_store->appendLog(station,
             QStringLiteral("[qt] %1 换条停机(%2):队列停止自动下发,请更换异常内存条后点「开始测试」重启新一轮")
                 .arg(d.deviceId, reason));
-        if (m_taskIndex[station] >= 0)
-            m_store->setTaskProgress(station, m_taskIndex[station], -1);
+        if (m_nextTaskTimer[station] && m_nextTaskTimer[station]->isActive())
+            m_nextTaskTimer[station]->stop();
+        if (m_taskIndex[station] >= 0) {
+            m_taskFailed[station] = m_taskIndex[station];
+            m_store->setTaskProgress(station, m_taskIndex[station], -1, m_taskFailed[station]);
+        }
         m_taskIndex[station] = -1;
         m_taskQueue[station] = QJsonArray();
         return;
@@ -951,15 +978,19 @@ void MainWindow::advanceTask(int station, bool failed)
     if (m_taskIndex[station] < 0)
         return;                                  // 单任务流程,不归这里管
 
+    const int curIdx = m_taskIndex[station];
     const int total = m_taskQueue[station].size();
-    const int done = m_taskIndex[station] + 1;
+    const int done = curIdx + 1;
     const QString dev = m_store->station(station).deviceId;
 
     if (failed) {
         m_store->appendLog(station,
             QStringLiteral("[qt] %1 第 %2/%3 个任务失败,本次队列中止,后续 %4 个任务不再下发")
                 .arg(dev).arg(done).arg(total).arg(total - done));
-        m_store->setTaskProgress(station, done, -1);
+        if (m_nextTaskTimer[station] && m_nextTaskTimer[station]->isActive())
+            m_nextTaskTimer[station]->stop();
+        m_taskFailed[station] = curIdx;
+        m_store->setTaskProgress(station, curIdx, -1, curIdx);
         m_taskIndex[station] = -1;
         m_taskQueue[station] = QJsonArray();
         return;
@@ -967,7 +998,8 @@ void MainWindow::advanceTask(int station, bool failed)
 
     if (done >= total) {
         m_store->appendLog(station, QStringLiteral("[qt] %1 全部 %2 个任务已完成").arg(dev).arg(total));
-        m_store->setTaskProgress(station, total, -1);
+        m_taskFailed[station] = -1;
+        m_store->setTaskProgress(station, total, -1, -1);
         m_taskIndex[station] = -1;
         m_taskQueue[station] = QJsonArray();
         return;
@@ -976,13 +1008,21 @@ void MainWindow::advanceTask(int station, bool failed)
     // 还有下一个:先把进度标成「下一个任务进行中」,等一小会儿再发新一轮。
     // 给后端/主机一点缓冲,避免刚进终态就立刻复位开机。
     m_taskIndex[station] = done;
-    m_store->setTaskProgress(station, done, done);
+    m_taskFailed[station] = -1;
+    m_store->setTaskProgress(station, done, done, -1);
     const QString nextName = m_taskQueue[station].at(done).toObject()
                                  .value(QStringLiteral("name")).toString();
     m_store->appendLog(station,
         QStringLiteral("[qt] %1 第 %2/%3 个任务结束,1.5 s 后开始下一个任务「%4」")
             .arg(dev).arg(done).arg(total).arg(nextName));
-    QTimer::singleShot(1500, this, [this, station]() { startNextTask(station); });
+    if (!m_nextTaskTimer[station]) {
+        m_nextTaskTimer[station] = new QTimer(this);
+        m_nextTaskTimer[station]->setSingleShot(true);
+        connect(m_nextTaskTimer[station], &QTimer::timeout, this, [this, station]() {
+            startNextTask(station);
+        });
+    }
+    m_nextTaskTimer[station]->start(1500);
 }
 
 // 起下一轮:重新装载下一个任务,清掉上一轮的日志/计时/下发标记,再发 StartTest。
@@ -999,7 +1039,8 @@ void MainWindow::startNextTask(int station)
     if (!m_backend->isConnected()) {
         m_store->appendLog(station,
             QStringLiteral("[qt] %1 后端未连接,下一个任务无法下发,本次队列中止").arg(dev));
-        m_store->setTaskProgress(station, m_taskIndex[station], -1);
+        m_taskFailed[station] = m_taskIndex[station];
+        m_store->setTaskProgress(station, m_taskIndex[station], -1, m_taskFailed[station]);
         m_taskIndex[station] = -1;
         m_taskQueue[station] = QJsonArray();
         m_startClicked[station] = false;
@@ -1189,7 +1230,9 @@ void MainWindow::saveAdminPassword(const QString &pwd)
             obj = QJsonDocument::fromJson(f.readAll()).object();
     }
     obj.insert(QStringLiteral("adminPassword"), pwd);
-    const QString writePath = QDir(appWritableDir()).filePath(QStringLiteral("config.json"));
+    QString writePath = (!readPath.isEmpty() && QFileInfo(readPath).isWritable())
+                            ? readPath
+                            : QDir(appWritableDir()).filePath(QStringLiteral("config.json"));
     QSaveFile f(writePath);
     if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
         ResultToast::popup(this, false, QStringLiteral("保存失败"),
@@ -1520,6 +1563,8 @@ void MainWindow::centerOnScreen()
         return;
 
     const QRect avail = screen->availableGeometry();
+    if (avail.width() <= 0 || avail.height() <= 0)
+        return;
     const QSize sz = size().boundedTo(avail.size());
     resize(sz);
     move(avail.x() + (avail.width() - sz.width()) / 2,
@@ -1538,18 +1583,32 @@ void MainWindow::setMaximized(bool on)
         // 最大化只占"可用区域"(1080 屏上就是 1030),任务栏正常显示。
         // 无边框窗口调 showMaximized() 偶尔不生效(仍停在 .ui 的默认尺寸),
         // 所以先把几何摆到可用区域再显示,再补一帧兜底。
-        if (QScreen *sc = screen() ? screen() : QGuiApplication::primaryScreen())
-            setGeometry(sc->availableGeometry());
+        const bool isWayland = QGuiApplication::platformName().startsWith(QLatin1String("wayland"));
+        if (!isWayland) {
+            if (QScreen *sc = screen() ? screen() : QGuiApplication::primaryScreen()) {
+                const QRect avail = sc->availableGeometry();
+                if (avail.width() > 0 && avail.height() > 0)
+                    setGeometry(avail);
+            }
+        }
         showMaximized();
-        QTimer::singleShot(0, this, [this] {
-            QScreen *sc = screen() ? screen() : QGuiApplication::primaryScreen();
-            if (sc && m_maximized && geometry() != sc->availableGeometry())
-                setGeometry(sc->availableGeometry());
-        });
+        if (!isWayland) {
+            QTimer::singleShot(0, this, [this] {
+                QScreen *sc = screen() ? screen() : QGuiApplication::primaryScreen();
+                if (sc && m_maximized) {
+                    const QRect avail = sc->availableGeometry();
+                    if (avail.width() > 0 && avail.height() > 0 && geometry() != avail)
+                        setGeometry(avail);
+                }
+            });
+        }
     } else {
         m_maximized = false;
         showNormal();                   // 先退出全屏态,否则 setGeometry 不生效
-        setGeometry(m_normalGeometry);
+        if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland"))
+            && m_normalGeometry.isValid()) {
+            setGeometry(m_normalGeometry);
+        }
     }
 
     if (m_grip)
@@ -1585,30 +1644,36 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
         if (hit && qobject_cast<QAbstractButton *>(hit))
             break;
         if (me->button() == Qt::LeftButton) {
+            if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"))
+                && windowHandle() && windowHandle()->startSystemMove()) {
+                m_dragging = false;
+                return true;
+            }
+            const QPoint gpos = mouseEventGlobalPos(me);
             m_dragging = true;
             m_dragStarted = false;              // 只是「准备拖」,位移够远才真的动窗口
-            m_dragOrigin = me->globalPos();
-            m_offset = me->globalPos() - frameGeometry().topLeft();
+            m_dragOrigin = gpos;
+            m_offset = gpos - frameGeometry().topLeft();
         }
         break;
     }
     case QEvent::MouseMove: {
         QMouseEvent *me = static_cast<QMouseEvent *>(event);
         if (m_dragging && (me->buttons() & Qt::LeftButton)) {
+            const QPoint gpos = mouseEventGlobalPos(me);
             // 关菜单 / 单纯点一下时鼠标常有几像素抖动,不能据此把最大化窗口还原成小窗。
             // 只有位移超过阈值才认作拖动。
             if (!m_dragStarted) {
-                if ((me->globalPos() - m_dragOrigin).manhattanLength() < 6)
+                if ((gpos - m_dragOrigin).manhattanLength() < 6)
                     break;
                 m_dragStarted = true;
             }
             if (m_maximized) {
                 // 最大化状态下拖动标题栏:先还原,再让窗口继续跟随鼠标
-                const QPoint global = me->globalPos();
                 setMaximized(false);
-                m_offset = global - frameGeometry().topLeft();
+                m_offset = gpos - frameGeometry().topLeft();
             }
-            move(me->globalPos() - m_offset);
+            move(gpos - m_offset);
             return true;
         }
         break;

+ 2 - 0
src/mainwindow.h

@@ -117,6 +117,8 @@ private:
     // m_taskIndex < 0 表示不在多任务流程里(没配任务,或队列已跑完/中止)。
     QJsonArray m_taskQueue[4];
     int m_taskIndex[4] = {-1, -1, -1, -1};
+    int m_taskFailed[4] = {-1, -1, -1, -1};
+    QTimer *m_nextTaskTimer[4] = {nullptr, nullptr, nullptr, nullptr};
     // 手册 9.2:后端命令的 complete=true 与 state 的 run_state 终态会先后到达,
     // 两处都可能触发队列推进。每轮任务只允许推进一次,避免重复发 StartTest。
     bool m_taskAdvanceGuard[4] = {false, false, false, false};

+ 37 - 3
src/overviewview.cpp

@@ -53,6 +53,7 @@ OverviewView::OverviewView(Ui::MainWindow *ui, StationStore *store, QObject *par
     connect(m_store, &StationStore::channelsChanged, this, &OverviewView::onChannelsChanged);
     connect(m_store, &StationStore::temperatureChanged, this, &OverviewView::onTemperatureChanged);
     connect(m_store, &StationStore::infoChanged, this, &OverviewView::onInfoChanged);
+    connect(m_store, &StationStore::alarmsChanged, this, &OverviewView::onInfoChanged);
 
     // 先把已有数据铺一遍,首屏就是实时值而不是 .ui 里的占位
     for (int i = 0; i < m_store->count(); ++i)
@@ -96,6 +97,7 @@ void OverviewView::cacheWidgets()
     m_temp = QVector<QLabel *>(count, nullptr);
     m_runtime = QVector<QLabel *>(count, nullptr);
     m_phase = QVector<QLabel *>(count, nullptr);
+    m_chTitles = QVector<QLabel *>(count, nullptr);
     m_start = QVector<PowerButton *>(count, nullptr);
 
     for (int i = 0; i < count; ++i) {
@@ -117,6 +119,7 @@ void OverviewView::cacheWidgets()
         }
         m_temp[i] = m_ui->contentArea->findChild<QLabel *>(QStringLiteral("infoValue_%1_temp").arg(i));
         m_runtime[i] = m_ui->contentArea->findChild<QLabel *>(QStringLiteral("infoValue_%1_runtime").arg(i));
+        m_chTitles[i] = m_ui->contentArea->findChild<QLabel *>(QStringLiteral("ovChTitle_%1").arg(i));
 
         // 开始测试圆钮:点它发信号,不再冒泡到卡片(否则会顺带跳进详情页)
         m_start[i] = m_ui->contentArea->findChild<PowerButton *>(QStringLiteral("startTest_%1").arg(i));
@@ -199,24 +202,55 @@ void OverviewView::renderInfo(int index)
         const bool offline = !m_backendOnline
                              || (d.consoleOnline == 0)
                              || (!consoleConfirmed && (linkLost || text.isEmpty()));
+        const bool isFail = (d.verdict == QLatin1String("fail")
+                             || d.taskStatus == QLatin1String("failed"));
+        const bool hasErr = isFail || d.awaitingDimmReplacement || !d.alarms.isEmpty();
+        QString scopeLabel = d.verdictScope.isEmpty() ? text : d.verdictScope.toUpper();
+        if (scopeLabel.isEmpty())
+            scopeLabel = QStringLiteral("本轮");
+
         if (offline) {
             text = QStringLiteral("控制台离线");
         } else if (d.awaitingDimmReplacement) {
-            // 9.2/9.5:某阶段 FAIL 后后端挂起本轮(run_state=blocked),等测试员换条。
-            text = QStringLiteral("等待换条");
+            text = QStringLiteral("%1 FAIL · 等待换条").arg(scopeLabel);
+        } else if (isFail) {
+            text = d.alarms.isEmpty()
+                       ? QStringLiteral("%1 FAIL").arg(scopeLabel)
+                       : QStringLiteral("%1 FAIL · 异常 %2").arg(scopeLabel).arg(d.alarms.size());
+        } else if (!d.alarms.isEmpty()) {
+            text = QStringLiteral("%1 · 异常 %2")
+                       .arg(text.isEmpty() ? QStringLiteral("在线") : text)
+                       .arg(d.alarms.size());
         } else if (text.isEmpty()) {
             text = QStringLiteral("在线");   // 控制台确认在线但阶段未知:标题右边不留空白
         }
         m_phase[index]->setText(text);
         m_phase[index]->setVisible(!text.isEmpty());
 
-        const QString st = (offline || d.awaitingDimmReplacement)
+        const QString st = (offline || hasErr)
                                ? QStringLiteral("offline") : QStringLiteral("normal");
         if (m_phase[index]->property("state").toString() != st) {
             m_phase[index]->setProperty("state", st);
             m_phase[index]->style()->unpolish(m_phase[index]);
             m_phase[index]->style()->polish(m_phase[index]);
         }
+
+        if (m_chTitles[index]) {
+            int failSlots = 0;
+            for (const ChannelInfo &ch : d.channels) {
+                if (ch.state == ChannelInfo::Fail)
+                    ++failSlots;
+            }
+            if ((isFail || d.awaitingDimmReplacement) && failSlots == 0) {
+                m_chTitles[index]->setText(
+                    QStringLiteral("内存通道状态 · 测试 FAIL(%1 条异常未映射具体通道,点查看详情)")
+                        .arg(d.alarms.size()));
+                m_chTitles[index]->setStyleSheet(QStringLiteral("color:#c92f2f;"));
+            } else {
+                m_chTitles[index]->setText(QStringLiteral("内存通道状态"));
+                m_chTitles[index]->setStyleSheet(QString());
+            }
+        }
     }
 }
 

+ 1 - 0
src/overviewview.h

@@ -65,6 +65,7 @@ private:
     QVector<QLabel *> m_temp;
     QVector<QLabel *> m_runtime;
     QVector<QLabel *> m_phase;                  // [工位] 卡片标题右侧的当前阶段标签
+    QVector<QLabel *> m_chTitles;               // [工位] 24通道标题栏(未映射 FAIL 时给出明确红字提示)
     QVector<PowerButton *> m_start;             // [工位] 开始测试圆钮
 };
 

+ 4 - 0
src/powerbutton.cpp

@@ -37,7 +37,11 @@ void PowerButton::setRunning(bool running)
     update();
 }
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+void PowerButton::enterEvent(QEnterEvent *event)
+#else
 void PowerButton::enterEvent(QEvent *event)
+#endif
 {
     QAbstractButton::enterEvent(event);
     update();

+ 7 - 0
src/powerbutton.h

@@ -2,6 +2,9 @@
 #define POWERBUTTON_H
 
 #include <QAbstractButton>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include <QEnterEvent>
+#endif
 
 /**
  * 开机按钮样式的圆形按钮(总览卡右下角「开始测试」)
@@ -28,7 +31,11 @@ public:
 
 protected:
     void paintEvent(QPaintEvent *event) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+    void enterEvent(QEnterEvent *event) override;
+#else
     void enterEvent(QEvent *event) override;
+#endif
     void leaveEvent(QEvent *event) override;
 
 private:

+ 49 - 10
src/stationdata.cpp

@@ -80,21 +80,39 @@ void StationStore::clearLogs(int index)
 // ---------------------------------------------------------------------------
 // 异常记录:后端 stage_errors / verdict=fail 落成一条条可读记录
 // ---------------------------------------------------------------------------
-void StationStore::appendAlarm(int index, const QString &stage, const QString &text)
+void StationStore::appendAlarm(int index, const QString &stage, const QString &text,
+                               const QString &rawKey)
 {
-    if (index < 0 || index >= m_stations.size() || text.trimmed().isEmpty())
+    const QString trimmed = text.trimmed();
+    if (index < 0 || index >= m_stations.size() || trimmed.isEmpty())
         return;
 
     QVector<AlarmInfo> &list = m_stations[index].alarms;
-
-    // 去重:同一阶段 + 同一内容只留一条。state 每秒推送一次,
-    // 不去重的话一轮下来会堆出几百条一样的。
-    for (const AlarmInfo &a : list) {
-        if (a.stage == stage && a.text == text)
+    const QString keyTrimmed = rawKey.trimmed();
+
+    // 去重 + 多行续行原地升级:
+    // 1. 同一阶段 + 同一内容只留一条;
+    // 2. 若后端 /GNR 坐标在下一拍续行追加到同一条 message(newRawKey 以 old.rawKey + " | " 开头),
+    //    原地更新该条异常描述与时间,避免详情页出现「半条无坐标 + 完整带坐标」重复告警。
+    for (AlarmInfo &a : list) {
+        if (a.stage != stage)
+            continue;
+        if (a.text == trimmed)
+            return;
+        if (!keyTrimmed.isEmpty() && !a.rawKey.isEmpty()
+            && (keyTrimmed == a.rawKey
+                || keyTrimmed.startsWith(a.rawKey + QLatin1String(" | "))
+                || keyTrimmed.startsWith(a.rawKey + QLatin1Char('\n'))
+                || keyTrimmed.startsWith(a.rawKey + QLatin1String("\r\n")))) {
+            a.text = trimmed;
+            a.rawKey = keyTrimmed;
+            a.time = QDateTime::currentDateTime();
+            emit alarmsChanged(index);
             return;
+        }
     }
 
-    list.append(AlarmInfo(QDateTime::currentDateTime(), stage, text.trimmed()));
+    list.append(AlarmInfo(QDateTime::currentDateTime(), stage, trimmed, keyTrimmed));
     emit alarmsChanged(index);
 }
 
@@ -246,14 +264,16 @@ void StationStore::applyBackendTiming(int index, const QJsonObject &obj)
     }
 }
 
-void StationStore::setTaskProgress(int index, int done, int current)
+void StationStore::setTaskProgress(int index, int done, int current, int failed)
 {
     if (index < 0 || index >= m_stations.size())
         return;
-    if (m_stations.at(index).taskDone == done && m_stations.at(index).taskCurrent == current)
+    if (m_stations.at(index).taskDone == done && m_stations.at(index).taskCurrent == current
+        && m_stations.at(index).taskFailed == failed)
         return;
     m_stations[index].taskDone = done;
     m_stations[index].taskCurrent = current;
+    m_stations[index].taskFailed = failed;
     emit infoChanged(index);
 }
 
@@ -276,6 +296,7 @@ void StationStore::resetChannelResults(int index)
     d.verdictScope.clear();
     d.taskStatus.clear();
     d.firmwareFamily.clear();
+    d.mtResult = QJsonObject();
     d.awaitingDimmReplacement = false;
 
     // 主界面 24 格、详情页 24 格及详情曲线共用 channelsChanged,统一刷新。
@@ -408,6 +429,7 @@ void StationStore::applyBackendState(int index, const QJsonObject &station)
         d.verdictScope.clear();
         d.firmwareFamily.clear();
         d.taskStatus.clear();
+        d.mtResult = QJsonObject();
         d.awaitingDimmReplacement = false;
         channelsChangedFlag = true;
     }
@@ -427,6 +449,7 @@ void StationStore::applyBackendState(int index, const QJsonObject &station)
     const QString verdictScope = station.value(QStringLiteral("verdict_scope")).toString();
     const QString firmwareFamily = station.value(QStringLiteral("firmware_family")).toString();
     const QJsonObject stageCompletions = station.value(QStringLiteral("stage_completions")).toObject();
+    const QJsonObject mtResult = station.value(QStringLiteral("mt_result")).toObject();
     if (d.verdict != verdict) { d.verdict = verdict; infoDirty = true; }
     if (d.verdictScope != verdictScope) { d.verdictScope = verdictScope; infoDirty = true; }
     if (d.firmwareFamily != firmwareFamily) { d.firmwareFamily = firmwareFamily; infoDirty = true; }
@@ -434,6 +457,10 @@ void StationStore::applyBackendState(int index, const QJsonObject &station)
         d.stageCompletions = stageCompletions;
         infoDirty = true;
     }
+    if (d.mtResult != mtResult) {
+        d.mtResult = mtResult;
+        infoDirty = true;
+    }
 
     // 手册 9.2 新增字段:只在值变化时刷新界面,state 每秒一包,不做无谓重绘。
     // 旧版后端没有这些字段:consoleOnline 留 -1(老判据),其余保持默认空值。
@@ -608,7 +635,15 @@ void StationStore::applyTaskComplete(int index, const QJsonObject &result)
     }
     const QString taskStatus = result.value(QStringLiteral("task_status")).toString();
     const QString verdict = result.value(QStringLiteral("verdict")).toString();
+    const QString verdictScope = result.value(QStringLiteral("verdict_scope")).toString();
     const QJsonObject completions = result.value(QStringLiteral("stage_completions")).toObject();
+    if (result.contains(QStringLiteral("awaiting_dimm_replacement"))) {
+        const bool awaiting = result.value(QStringLiteral("awaiting_dimm_replacement")).toBool();
+        if (d.awaitingDimmReplacement != awaiting) {
+            d.awaitingDimmReplacement = awaiting;
+            changed = true;
+        }
+    }
 
     if (!taskStatus.isEmpty() && d.taskStatus != taskStatus) {
         d.taskStatus = taskStatus;
@@ -618,6 +653,10 @@ void StationStore::applyTaskComplete(int index, const QJsonObject &result)
         d.verdict = verdict;
         changed = true;
     }
+    if (!verdictScope.isEmpty() && d.verdictScope != verdictScope) {
+        d.verdictScope = verdictScope;
+        changed = true;
+    }
     if (!completions.isEmpty() && d.stageCompletions != completions) {
         d.stageCompletions = completions;
         changed = true;

+ 11 - 5
src/stationdata.h

@@ -45,10 +45,12 @@ struct AlarmInfo {
     QDateTime time;
     QString stage;      // training / rmt / amt / mt;空 = 未分类(整体判定)
     QString text;       // 可读描述
+    QString rawKey;     // 原始 message(用于多行 /GNR 续行到达时原地更新而不重复堆积)
 
     AlarmInfo() {}
-    AlarmInfo(const QDateTime &t, const QString &s, const QString &x)
-        : time(t), stage(s), text(x) {}
+    AlarmInfo(const QDateTime &t, const QString &s, const QString &x,
+              const QString &k = QString())
+        : time(t), stage(s), text(x), rawKey(k) {}
 };
 
 // 一个工位的全部实时数据
@@ -83,6 +85,7 @@ struct StationData {
     QString taskStatus;                    // not_started / queued / running / completed / failed
     QJsonObject taskBatch;                 // 后端托管批次队列快照(前端自维护队列时仅留档)
     QJsonArray taskHistory;                // 已完成轮次归档摘要
+    QJsonObject mtResult;                  // MT 执行摘要(report_file / errors / tests_passed / ecc_*)
 
     QVector<double> tempHistory;   // 最近 kTempHistorySize 个腔体温度,最老的在前
 
@@ -98,8 +101,10 @@ struct StationData {
     // 多任务执行进度(由主窗口维护):
     //   taskDone    本轮队列里已经跑完的任务数
     //   taskCurrent 当前正在跑的任务下标,-1 = 不在多任务流程里
+    //   taskFailed  最近一次失败的任务下标(-1 = 无)
     int taskDone = 0;
     int taskCurrent = -1;
+    int taskFailed = -1;
 
     QVector<ChannelInfo> channels;      // 24 个
     QStringList logs;                   // 完整日志,只增不减
@@ -128,7 +133,8 @@ public:
     // ---- 异常记录(详情页第二个标签页) ----
     // 来源:后端 stage_errors(training/rmt/amt/mt)与 verdict=fail。
     // 同一条内容只记一次(state 每秒推送一次,不去重会刷屏)。
-    void appendAlarm(int index, const QString &stage, const QString &text);
+    void appendAlarm(int index, const QString &stage, const QString &text,
+                     const QString &rawKey = QString());
     void clearAlarms(int index);
     void setCurrentTemp(int index, double temperature);
     void setPort(int index, const QString &port);
@@ -139,8 +145,8 @@ public:
     void applyBackendTiming(int index, const QJsonObject &obj);
     // 当前应显示的运行时长(毫秒);<0 表示空闲未启动(界面显示 00:00:00)。
     qint64 runtimeMs(int index) const;
-    // 多任务进度:done = 已完成任务数,current = 当前任务下标(-1 表示没有在跑的任务)
-    void setTaskProgress(int index, int done, int current);
+    // 多任务进度:done = 已完成任务数,current = 当前任务下标(-1 表示没有在跑的任务),failed = 失败任务下标
+    void setTaskProgress(int index, int done, int current, int failed = -1);
     // 新一轮测试开始时清空 24 路内存通道的状态、当前温度和历史曲线;不影响 CT7428 腔体温度采集。
     void resetChannelResults(int index);
     // 只通知界面「这个工位的运行时间该重画了」,不改任何数据(给每秒走表的定时器用)

+ 9 - 3
tools/validate_qt_clean.py

@@ -3,7 +3,7 @@
 
 No firmware parameters or AMT/MT algorithms are submitted by this driver.
 --start explicitly authorizes one host start/reset. --drive-default-plan additionally
-continues UIP with CR and exits AMT, ending at the actual UEFI Shell prompt.
+continues ICT with CR and exits AMT, ending at the actual UEFI Shell prompt.
 Protocol PASS never means that memory tests passed.
 """
 from __future__ import annotations
@@ -278,9 +278,15 @@ async def readonly_checks(client, evidence, args, session, token):
     ids = [row.get("station_id") for row in stations]
     evidence.check("station_ids_unique_and_requested_present", args.station in ids and len(ids) == len(set(ids)), ids)
     required = {"station_id", "connection", "power", "phase", "run_state", "started_unix_ms",
-                "boot_id", "verdict", "input", "command", "channels"}
+                "boot_id", "verdict", "input", "command", "channels",
+                "console_online", "task_status", "awaiting_dimm_replacement",
+                "stage_completions", "stage_errors"}
     missing = {row.get("station_id", "?"): sorted(required - set(row)) for row in stations if required - set(row)}
     evidence.check("minimal_station_contract", not missing, missing)
+    str_ts_bad = [row.get("station_id", "?") for row in stations
+                  if not isinstance(row.get("started_unix_ms"), str)
+                  or ("ended_unix_ms" in row and not isinstance(row.get("ended_unix_ms"), str))]
+    evidence.check("qt_clean_timestamps_are_decimal_strings", not str_ts_bad, str_ts_bad)
     forbidden = private_fields(state)
     evidence.check("no_internal_or_secret_fields_in_clean_state", not forbidden, forbidden)
     await reject_check(client, evidence, "unknown_rpc_rejected", "NotARealQtMethod", {}, {"UNIMPLEMENTED", "INVALID_ARGUMENT"})
@@ -449,7 +455,7 @@ def main():
     parser.add_argument("--station", default="S1")
     parser.add_argument("--timeout", type=float, default=900, help="Seconds per host start / local plan")
     parser.add_argument("--start", action="store_true", help="Actually start/reset the server host once")
-    parser.add_argument("--drive-default-plan", action="store_true", help="With --start: CR at UIP; exit AMT; stop at UEFI")
+    parser.add_argument("--drive-default-plan", action="store_true", help="With --start: CR at ICT; exit AMT; stop at UEFI")
     parser.add_argument("--check-unconfigured", metavar="STATION", help="Explicitly try StartTest on a station with bmc_power=false")
     parser.add_argument("--token-env", help="Environment variable containing API bearer token; never written to evidence")
     args = parser.parse_args()

+ 2 - 1
web/amt-controls.js

@@ -160,7 +160,8 @@
     const f=c.firmware||{},p=f.console_prompt||{};
     const fwFam=f.firmware_family||'unknown';
     if(fwFam!==lastFamily){lastFamily=fwFam;syncFamilyUI();if(!current().dirty)fill();}
-    $('amt-phase-state').textContent=p.ready&&p.kind==='amt'?`CPU${p.cpu??'?'} · AMT 菜单等待操作`:f.observed_detail==='amt_test'?'AMT 算法输出中':f.observed_phase==='amt'?'AMT · '+(f.observed_detail||'观察中'):'当前 '+(f.observed_phase||'未知')+' · 等待 AMT 菜单';
+    const phaseDisp = f.observed_phase === 'uip' ? 'ICT' : f.observed_phase === 'uip1' ? 'ICT1' : f.observed_phase === 'uip2' ? 'ICT2' : (f.observed_phase || '未知');
+    $('amt-phase-state').textContent=p.ready&&p.kind==='amt'?`CPU${p.cpu??'?'} · AMT 菜单等待操作`:f.observed_detail==='amt_test'?'AMT 算法输出中':f.observed_phase==='amt'?'AMT · '+(f.observed_detail||'观察中'):'当前 '+phaseDisp+' · 等待 AMT 菜单';
     const results=Array.isArray(f.amt_results)?f.amt_results:[], algorithms=Array.isArray(f.algorithm_progress)?f.algorithm_progress:[];
     const active=Array.isArray(f.active_amt_cpus)?f.active_amt_cpus:[];
     const cpus=[...new Set(results.concat(algorithms).map(row=>row.cpu).filter(cpu=>cpu!=null).concat(active))].sort((a,b)=>Number(a)-Number(b));

+ 6 - 1
web/app.js

@@ -385,6 +385,8 @@
       dimm_replacement:'停机换条确认',
       stage_intent:'阶段预设覆盖',
       error_preset:'时序拉偏预设',
+      start_test:'测试启动',
+      power:'电源控制',
     };
     const open = new Set([...document.querySelectorAll('#audit-logs-tbody details[open]')].map(n => n.dataset.seq));
     $('audit-logs-tbody').innerHTML = auditItems.map(item => {
@@ -532,7 +534,7 @@
     uartPumpActive = true;
     try {
       const key = `diag:${selectedStation}:${snapshot.session_id}`, state = runLog(key);
-      const reqWait = state.offset > 0 ? waitMs : 0;
+      const reqWait = waitMs;
       const chunk = await callApi('ReadCleanedUart', {
         station_id: selectedStation,
         offset: state.offset,
@@ -678,8 +680,11 @@
         const res = await command('ClearTerminalView', {station_id: stationId}, '锚定清空控制台窗口');
         const cleanOff = Number(res?.result?.clean_offset || 0);
         if (log && cleanOff > 0) {
+          log.text = '';
           log.offset = cleanOff;
           log.clearAnchor = cleanOff;
+          $('sol-terminal').dataset.renderedOffset = '';
+          renderLog();
         }
       } catch (e) {
         status(`清空锚点同步失败:${e.message}`, true);

+ 6 - 1
web/boot-plan-controls.js

@@ -304,7 +304,12 @@
       const fmtElapsed = api.formatElapsed ? api.formatElapsed(c.elapsed_ms || 0) : `${Math.floor((Number(c.elapsed_ms || 0)) / 1000)}s`;
       $('tb-live-detail').textContent = tb.batch_id ? `批次编号 ${tb.batch_id} · 状态 ${stateNames[tbState] || tbState} · 已完成 ${done}/${planned} 轮 · 总用时 ${fmtElapsed}` : '添加 1 组或多组 Profile 后,点击下方按钮立即按序自动重启并执行。';
     }
-    const runs = Array.isArray(tb.runs) && tb.runs.length ? tb.runs : (Array.isArray(c.task_history) ? c.task_history.slice(-20) : []);
+    const tbRuns = Array.isArray(tb.runs) ? tb.runs : [];
+    const histRuns = Array.isArray(c.task_history) ? c.task_history : [];
+    const seenIds = new Set(tbRuns.map(r => r.run_id).filter(Boolean));
+    const runs = tbRuns.length
+      ? histRuns.filter(r => r.run_id && !seenIds.has(r.run_id)).concat(tbRuns).slice(-20)
+      : histRuns.slice(-20);
     if ($('tb-runs-tbody')) {
       $('tb-runs-tbody').innerHTML = runs.slice().reverse().map(r => `<tr>
         <td><code>${esc(r.run_id || '-')}</code></td>

+ 15 - 7
web/dimm-overview.js

@@ -12,23 +12,31 @@
     const freshCount=rows.filter(fresh).length;
     const passCount=rows.filter(r=>r.state==='pass').length;
     const failCount=rows.filter(r=>r.state==='fail').length;
-    $('dimm-stage-badge').textContent=`PASS ${passCount} / FAIL ${failCount} · 温度 ${freshCount}/${rows.length}`;
-    $('dimm-stage-badge').classList.toggle('connected',freshCount>0 && failCount===0);
-    $('dimm-stage-badge').classList.toggle('error',failCount>0);
+    const stObj=window.stlFirmware?.station?.() || {};
+    const awaiting=!!(control.awaiting_dimm_replacement || stObj.awaiting_dimm_replacement);
+    const hasFailure=failCount>0 || awaiting || control.verdict==='fail' || control.task_status==='failed' || stObj.task_status==='failed';
+    const mtRes=control.firmware?.mt_result || {};
+    const mtTag=mtRes.status?` · MT:${String(mtRes.status).toUpperCase()}${mtRes.errors>0?'('+mtRes.errors+' errs)':''}`:'';
+    $('dimm-stage-badge').textContent=`PASS ${passCount} / FAIL ${failCount}${hasFailure&&failCount===0?' (未映射通道 FAIL)':''} · 温度 ${freshCount}/${rows.length}${mtTag}`;
+    $('dimm-stage-badge').classList.toggle('connected',freshCount>0 && !hasFailure);
+    $('dimm-stage-badge').classList.toggle('error',hasFailure);
     $('dimm-temperature-note').textContent='DIMM 温度由 BMC SDR / RMT 采集映射;工位实时腔体温度仅取高温罩本地串口数据。';
     const status=$('dimm-snapshot-status');if(status)status.textContent=rows.length===24?'后端完整快照 · CPU0 / CPU1 各 12 槽 (刚启动 IDLE → Training通过 PASS → 异常 FAIL)':rows.length?`后端返回 ${rows.length} 槽位,等待完整快照`:'尚未收到后端完整槽位快照';
 
     const banner=$('dimm-replacement-banner');
     if(banner){
-      const awaiting=!!control.awaiting_dimm_replacement;
       const stgErrs=control.firmware?.stage_errors || {};
       const errEntries=Object.entries(stgErrs).flatMap(([stg,arr])=>(Array.isArray(arr)?arr:[]).map(e=>({stg,...e})));
-      if(awaiting || errEntries.length){
+      if(awaiting || errEntries.length || hasFailure){
         banner.classList.remove('hidden');
-        const errHtml=errEntries.slice(-8).map(e=>`<div style="font-family:monospace;font-size:12px;color:#991b1b;margin-top:2px">[${esc(stageLabels[e.stg]||e.stg)}] ${e.cpu!=null?`CPU${esc(e.cpu)}`:''}${e.channel!=null?` CH${esc(e.channel)}`:''}: ${esc(e.message||e.code||'error')}</div>`).join('');
+        const chName=ch=>{const n=Number(ch);return Number.isInteger(n)&&n>=0&&n<12?`CH${'ABCDEFGHIJKL'[n]}(${n})`:`CH${ch}`;};
+        const errHtml=errEntries.slice(-8).map(e=>{
+          const loc=[e.cpu!=null?`CPU${e.cpu}`:'',e.channel!=null?chName(e.channel):'',e.address?`Addr=${e.address}`:''].filter(Boolean).join(' ');
+          return `<div style="font-family:monospace;font-size:12px;color:#991b1b;margin-top:2px">[${esc(stageLabels[e.stg]||e.stg)}]${loc?' '+esc(loc):''}: ${esc(e.message||e.code||'error')}</div>`;
+        }).join('');
         banner.innerHTML=`<div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap">
           <div>
-            <strong style="color:#b91c1c">${awaiting?'⚠️ 当前阶段测试完成并检出 FAIL,已停机挂起等待更换内存条 (awaiting_dimm_replacement)':'阶段错误记录 ('+errEntries.length+' 条)'}</strong>
+            <strong style="color:#b91c1c">${awaiting?'⚠️ 当前阶段测试完成并检出 FAIL,已停机挂起等待更换内存条 (awaiting_dimm_replacement)':errEntries.length?'阶段错误记录 ('+errEntries.length+' 条)':'⚠️ 测试判定 FAIL (详见日志/报告)'}</strong>
             ${errHtml}
           </div>
           ${awaiting?'<button type="button" class="btn btn-danger btn-sm" id="btn-confirm-dimm-replacement">已更换异常内存条 · 确认并解除停机</button>':''}

+ 2 - 1
web/firmware-controls.js

@@ -391,7 +391,8 @@
     allowed('btn-start-mt',online && !!d && previewMt(d.mt).ready,'需完整启动命令(当前在 UEFI 则立即执行,未到 UEFI 则存入待消费意图)');
     const prompt=snapshot().firmware?.console_prompt || {};
     const uip = uipLabel(prompt.ready&&prompt.kind==='uip'?prompt.uip_stage:snapshot().firmware?.observed_uip_stage);
-    $('uip-phase-state').textContent = observed === 'uip' ? `当前 ${uip} · 可配置` : `当前 ${observed} · 可预设 ICT 意图`;
+    const phaseLabel = observed === 'uip' ? 'ICT' : observed === 'uip1' ? 'ICT1' : observed === 'uip2' ? 'ICT2' : (observed || '未知');
+    $('uip-phase-state').textContent = observed === 'uip' ? `当前 ${uip} · 可配置` : `当前 ${phaseLabel} · 可预设 ICT 意图`;
     $('mt-phase-state').textContent = observed === 'uefi' ? '当前 UEFI Shell' : observed === 'mt' ? 'MT 运行中' : '等待 UEFI Shell (可预设意图)';
     const node = prompt.ready ? prompt.cpu : snapshot().firmware?.observed_cpu ?? api.diagnostic()?.current_details?.cpu;
     $('uip-current-node').textContent = node !== null && node !== undefined && node !== '' && Number.isInteger(Number(node)) ? `当前提示:CPU${node}${observed === 'uip' ? ' · ' + uip : ''}` : observed === 'uip' ? `当前提示:${uip} · CPU 未识别` : '当前控制台提示所在节点';

Разница между файлами не показана из-за своего большого размера
+ 2 - 2
web/index.html


+ 9 - 3
web/stage-progress.js

@@ -64,7 +64,11 @@
         ['mt_pass_complete', '7. MT PASS 完成'],
       ];
       compStrip.innerHTML = '<strong style="color:#475569">7 阶段独立完成判定:</strong>' + compDefs.map(([key, labelText]) => {
+        const isMtFail = key === 'mt_pass_complete' && sc.mt_fail_complete === true && sc[key] !== true;
         const done = sc[key] === true;
+        if (isMtFail) {
+          return `<span class="badge error" data-completion-flag="mt_fail_complete" style="background:#fee2e2;color:#991b1b;border-color:#fca5a5">✗ 7. MT FAIL</span>`;
+        }
         return `<span class="badge ${done ? 'connected' : ''}" data-completion-flag="${esc(key)}" style="${done ? 'background:#dcfce7;color:#166534;border-color:#86efac' : 'opacity:0.75'}">${done ? '✓ ' : '○ '}${esc(labelText)}</span>`;
       }).join('');
     }
@@ -94,7 +98,8 @@
       const parts = [];
       for (const [stg, obj] of Object.entries(intents)) {
         if (obj && typeof obj === 'object' && obj.action) {
-          parts.push(`${stg.toUpperCase()}→${obj.action}(rev#${obj.revision || 1})`);
+          const stgName = stg === 'uip1' ? 'ICT1' : stg === 'uip2' ? 'ICT2' : stg === 'uip' ? 'ICT' : stg.toUpperCase();
+          parts.push(`${stgName}→${obj.action}(rev#${obj.revision || 1})`);
         }
       }
       $('stage-intent-summary').textContent = parts.length ? `待消费预置: ${parts.join(' · ')}` : '当前待消费预置: 无';
@@ -142,9 +147,10 @@
   }
   function renderHistory(firmware) {
     const entries = list(firmware.phase_transitions).slice(-100).reverse();
+    const dispPhase = p => (p === 'uip' ? 'ICT' : p === 'uip1' ? 'ICT1' : p === 'uip2' ? 'ICT2' : (p || ''));
     $('observation-count').textContent = `本次启动 ${entries.length} 条`;
-    $('boot-observations').innerHTML = entries.map(row => `<li><time>${time(row.observed_unix_ms)}</time><span>${esc(row.phase || '')}${row.cpu != null ? ' · ' + esc(cpuName(row.cpu)) : ''}${row.uip_stage != null ? ' · ICT' + esc(row.uip_stage) : ''}</span><code>${esc(api.terminalText(row.evidence || ''))}</code></li>`).join('') || '<li>尚无本次启动的阶段变化记录。</li>';
-    $('boot-history').innerHTML = list(firmware.boot_history).slice(-12).reverse().map(row => `<li><time>${time(row.started_unix_ms)}</time><span>第 ${esc(row.boot_sequence)} 次 · ${esc(row.last_phase || '未确认')}</span><code>${esc(row.evidence || row.boot_id || '')}</code></li>`).join('') || '<li>尚无此前启动记录。实际的新启动证据才建立新一轮。</li>';
+    $('boot-observations').innerHTML = entries.map(row => `<li><time>${time(row.observed_unix_ms)}</time><span>${esc(dispPhase(row.phase))}${row.cpu != null ? ' · ' + esc(cpuName(row.cpu)) : ''}${row.uip_stage != null ? ' · ICT' + esc(row.uip_stage) : ''}</span><code>${esc(api.terminalText(row.evidence || ''))}</code></li>`).join('') || '<li>尚无本次启动的阶段变化记录。</li>';
+    $('boot-history').innerHTML = list(firmware.boot_history).slice(-12).reverse().map(row => `<li><time>${time(row.started_unix_ms)}</time><span>第 ${esc(row.boot_sequence)} 次 · ${esc(dispPhase(row.last_phase) || '未确认')}</span><code>${esc(row.evidence || row.boot_id || '')}</code></li>`).join('') || '<li>尚无此前启动记录。实际的新启动证据才建立新一轮。</li>';
   }
   function render(control, context = {}) {
     if (!api) return;