fix: address Codex PR review findings

This commit is contained in:
gitea committed 2026-10-25 22:32:45 +08:00
1 parent 0f164b6de5
commit a7974abb08
44 files changed
+3317 -667

No files matched your search

+8 -5
View File
@@ -39,18 +39,21 @@ export async function handleLogs(parsed: CliParsedArgs, runtime: CliRuntime): Pr
});
const stateOption = stringOption(parsed.options, ["state"]);
const hasErrorFilter = booleanOption(parsed.options, ["has-error", "hasError", "errors"]);
const isJobError = (job: any): boolean => {
const s = (job.status || "").toUpperCase();
if (s === "STARTED" || s === "RUNNING") return false;
const hasJobError = (job: any): boolean => {
if (job.hasError === true || job.hasError === "存在" || job.hasError === "true") return true;
if (typeof job.errorTaskCount === "number" && job.errorTaskCount > 0) return true;
if (job.state === "FAILED" || job.status === "FAILED") return true;
return false;
};
// Preserve the existing terminal-state filters while --has-error also sees in-flight errors.
const isJobError = (job: any): boolean => {
const s = (job.status || "").toUpperCase();
return s !== "STARTED" && s !== "RUNNING" && hasJobError(job);
};
let filteredJobList = rawResult.jobList;
if (hasErrorFilter) {
filteredJobList = filteredJobList.filter(isJobError);
filteredJobList = filteredJobList.filter(hasJobError);
} else if (stateOption) {
const norm = stateOption.trim().toUpperCase();
if (norm === "FAILED" || norm === "FAIL" || norm === "ERROR") {
@@ -115,8 +118,8 @@ export async function handleLogs(parsed: CliParsedArgs, runtime: CliRuntime): Pr
const formatErrorColumn = (job: any): string => {
const s = (job.status || "").toUpperCase();
if (hasJobError(job)) return "⚠️ 包含错误";
if (s === "STARTED" || s === "RUNNING") return "⏳ 执行中";
if (isJobError(job)) return "⚠️ 包含错误";
return "正常";
};