fix: expose node git mirror flush partial success

This commit is contained in:
Codex
2026-06-16 06:19:52 +00:00
parent 6f8fe9e098
commit b9ae7b4798
6 changed files with 126 additions and 9 deletions
+13 -1
View File
@@ -230,7 +230,11 @@ function summarizeJobProgress(job: JobRecord, maxBytes = 96_000, tails?: { stdou
const v02PrMonitorWorkflow = job.name === "hwlab_g14_v02_pr_monitor";
const runtimeLaneTriggerWorkflow = /^hwlab_nodes_v[0-9]{2}_control-plane_trigger-current$/u.test(job.name);
const agentRunYamlLaneTriggerWorkflow = /^agentrun_v[0-9]{2}_trigger_current$/u.test(job.name);
const gitMirrorWorkflow = job.name === "hwlab_g14_git_mirror_sync" || job.name === "hwlab_g14_git_mirror_flush" || job.name === "agentrun_v01_git_mirror_sync" || job.name === "agentrun_v01_git_mirror_flush";
const gitMirrorWorkflow = job.name === "hwlab_g14_git_mirror_sync"
|| job.name === "hwlab_g14_git_mirror_flush"
|| job.name === "agentrun_v01_git_mirror_sync"
|| job.name === "agentrun_v01_git_mirror_flush"
|| /^hwlab_nodes_v[0-9]{2}_git-mirror_(sync|flush)$/u.test(job.name);
const ciInstallWorkflow = job.name === "ci_install";
if (ciInstallWorkflow) return summarizeCiInstallJobProgress(job, tails?.stderrTail, nowMs);
if (!knownWorkflow && !v02PrMonitorWorkflow && !runtimeLaneTriggerWorkflow && !agentRunYamlLaneTriggerWorkflow && !gitMirrorWorkflow) return genericJobProgress(job, tails?.stderrTail);
@@ -318,7 +322,10 @@ function summarizeGitMirrorJobProgress(job: JobRecord, stdoutTail: string, stder
firstMatch(stdoutTail, new RegExp(`"event"\\s*:\\s*"git-mirror-${action}"[\\s\\S]{0,240}?"status"\\s*:\\s*"([^"]+)"`, "u")) ??
firstMatch(stdoutTail.replaceAll('\\"', '"').replaceAll("\\n", "\n"), new RegExp(`"event"\\s*:\\s*"git-mirror-${action}"[\\s\\S]{0,240}?"status"\\s*:\\s*"([^"]+)"`, "u"));
const pendingFlush = firstMatch(stdoutTail.replaceAll('\\"', '"'), /"pendingFlush"\s*:\s*(true|false)/u);
const partialSuccess = firstMatch(stdoutTail.replaceAll('\\"', '"'), /"partialSuccess"\s*:\s*"([^"]+)"/u);
const jobName = firstMatch(stdoutTail, /"jobName"\s*:\s*"([^"]+)"/u);
const node = firstMatch(stdoutTail.replaceAll('\\"', '"'), /"node"\s*:\s*"([^"]+)"/u);
const lane = firstMatch(stdoutTail.replaceAll('\\"', '"'), /"lane"\s*:\s*"(v[0-9]+)"/u) ?? firstMatch(job.name, /^hwlab_nodes_(v[0-9]+)_/u);
const warnings = jobProgressWarnings({
job,
eventsObserved: 0,
@@ -349,6 +356,7 @@ function summarizeGitMirrorJobProgress(job: JobRecord, stdoutTail: string, stder
summary: [
job.status,
`git-mirror-${action}${status ? `:${status}` : ""}`,
partialSuccess ? `partialSuccess=${partialSuccess}` : null,
jobName ? `job=${jobName}` : null,
pendingFlush !== null ? `pendingFlush=${pendingFlush}` : null,
elapsedSeconds !== null ? `elapsed=${elapsedSeconds}s` : null,
@@ -359,6 +367,10 @@ function summarizeGitMirrorJobProgress(job: JobRecord, stdoutTail: string, stder
? `bun scripts/cli.ts job status ${job.id} --tail-bytes 12000`
: job.name.startsWith("agentrun_")
? "bun scripts/cli.ts agentrun git-mirror status"
: job.name.startsWith("hwlab_nodes_") && node !== null && lane !== null
? partialSuccess === "push-succeeded-fetch-failed"
? `bun scripts/cli.ts hwlab nodes git-mirror sync --node ${node} --lane ${lane} --confirm --wait`
: `bun scripts/cli.ts hwlab nodes git-mirror status --node ${node} --lane ${lane}`
: "bun scripts/cli.ts hwlab g14 git-mirror status",
};
}