@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
32 lines • 1.68 kB
JavaScript
/**
* Classifies a summarization failure as transient (degrade quietly through the
* compaction failure path) or terminal (surface loudly).
*
* Transient failures must not escape as extension errors: the runner would print
* a raw stack on top of the `compaction_end` message the user already saw, while
* the turn's own provider request surfaces the same outage again through the
* normal retry path.
*
* Provider `error` stops carry metadata-aware classification through
* `SummaryRequestError` (a refusal whose text merely looks retryable stays
* loud). Watchdog trips — a stalled stream, a stream that outlived its
* wall-clock budget, or a compaction that outlived its total budget — are
* infrastructure-slowness outcomes and always degrade.
* Everything else falls back to the shared message classifier.
*/
import { isRetryableErrorMessage } from "@earendil-works/pi-ai";
import { StreamDurationBudgetError, StreamIdleTimeoutError, SummarizationTotalBudgetError, } from "../../../compaction/stream-watchdog.js";
import { SummarizationOverflowExhaustedError } from "./overflow-retry.js";
import { SummaryRequestError } from "./speculative.js";
export function isTransientSummarizationFailure(error, message) {
if (error instanceof StreamDurationBudgetError || error instanceof StreamIdleTimeoutError)
return true;
if (error instanceof SummarizationTotalBudgetError)
return true;
if (error instanceof SummaryRequestError)
return error.transient;
if (error instanceof SummarizationOverflowExhaustedError)
return true;
return isRetryableErrorMessage(message);
}
//# sourceMappingURL=transient-failure.js.map