port: sync from Mike/pygienium@595ce48f
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user