This commit is contained in:
omp-port
2026-08-11 09:19:06 -04:00
parent 3d142ed217
commit 5b7796043e
7 changed files with 433 additions and 248 deletions

View File

@@ -142,7 +142,12 @@ export async function runCheck(
): Promise<CheckRunOutcome> {
const startMs = Date.now();
const outcome = await runCheckImpl(opts);
postCheckCompletion(opts, outcome, Date.now() - startMs);
try {
postCheckCompletion(opts, outcome, Date.now() - startMs);
} catch {
// Completion posting is best-effort chat UI: a renderer or send
// failure must never reject the run after its state was persisted.
}
return outcome;
}
@@ -383,7 +388,16 @@ async function runCheckImplInner(
error = err instanceof Error ? err.message : String(err);
markCheckStatus(state, check.name, "failed", error);
markRunStatus(state, reconcileRunStatus(state));
await saveRunState(state);
try {
await saveRunState(state);
} catch (saveErr) {
// A failing state save inside the error path must not mask the
// original error or escape as an unhandled rejection (which would
// kill the run with nothing persisted or reported).
error += `; (also failed to persist run-state: ${
saveErr instanceof Error ? saveErr.message : String(saveErr)
})`;
}
return { status: "failed", error, findings, changes, state };
} finally {
strip.done();