okx-auto-position: signal_queue 失败识别 (stdout 含错误标记也 mark_failed)

之前 returncode=0 就标 done, 平仓失败伪装成功 (BTC 5小时才发现的次因)
现在 stdout 含 ❌/⏭️/⚠️ 均 mark_failed, retry 机制可识别
This commit is contained in:
2026-09-25 01:25:01 +08:00
parent 7d156b8534
commit c83161d87e
+7 -4
View File
@@ -107,12 +107,15 @@ if __name__ == "__main__":
["python3", os.path.expanduser("~/.hermes/skills/trading/okx-auto-position/scripts/process_signal.py"), raw], ["python3", os.path.expanduser("~/.hermes/skills/trading/okx-auto-position/scripts/process_signal.py"), raw],
capture_output=True, text=True, timeout=120 capture_output=True, text=True, timeout=120
) )
if r.returncode == 0: # 2026-09-21: 即使 returncode=0, stdout 含 "❌" 也 mark_failed
is_failed = r.returncode != 0 or "❌" in r.stdout or "⏭️" in r.stdout or "⚠️" in r.stdout
if is_failed:
err_msg = (r.stderr or r.stdout)[:200]
mark_failed(row_id, err_msg)
print(f" ❌ 失败 (含错误标记): {err_msg[:80]}")
else:
mark_done(row_id, r.stdout[:200]) mark_done(row_id, r.stdout[:200])
print(f" ✅ 成功") print(f" ✅ 成功")
else:
mark_failed(row_id, r.stderr[:200])
print(f" ❌ 失败: {r.stderr[:100]}")
except Exception as e: except Exception as e:
mark_failed(row_id, str(e)) mark_failed(row_id, str(e))
print(f" ❌ 异常: {e}") print(f" ❌ 异常: {e}")