fix: normalize codex tool in-progress spans

This commit is contained in:
lyon
2026-06-20 15:52:58 +08:00
parent 8af244761c
commit b557016473
+4 -1
View File
@@ -1120,7 +1120,10 @@ function toolCallPayload(method: string, item: JsonRecord): JsonRecord {
}
function toolCallStatus(method: string, item: JsonRecord): string | null {
if (typeof item.status === "string" && item.status.trim().length > 0) return item.status;
const status = typeof item.status === "string" ? item.status.trim().toLowerCase() : "";
if (status === "inprogress" || status === "in_progress" || status === "running" || status === "pending") return "started";
if (status === "completed" || status === "succeeded" || status === "success") return "completed";
if (status === "failed" || status === "error" || status === "cancelled" || status === "canceled") return "failed";
if (method === "item/started") return "started";
if (method === "item/completed") return "completed";
return null;