@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
26 lines • 1.25 kB
JavaScript
import { DEFAULT_SUMMARIZATION_MAX_DURATION_MS } from "../../../compaction/stream-watchdog.js";
export const MAX_SUMMARIZATION_ATTEMPT_RETRIES = 3;
/**
* Total wall-clock all retried attempts of one summarization may consume:
* half of a single attempt's budget. Room for several fast upstream
* rejections, never room to add another full deadline to the turn.
*/
export function summarizationRetryTotalBudgetMs(attemptBudgetMs) {
return attemptBudgetMs / 2;
}
/** Faster first retry than the provider default: this route blocks the turn. */
export const DEFAULT_SUMMARIZATION_RETRY_POLICY = {
enabled: true,
maxRetries: MAX_SUMMARIZATION_ATTEMPT_RETRIES,
baseDelayMs: 1_000,
};
/**
* Whether a retry may start given the wall clock already spent on the current
* attempt set. The total budget tracks the attempt budget: a large session
* whose single attempt legitimately spans minutes keeps proportional room to
* retry, while the invariant "never another full deadline" still holds.
*/
export function allowSummarizationRetry(elapsedMs, attemptBudgetMs = DEFAULT_SUMMARIZATION_MAX_DURATION_MS) {
return elapsedMs < summarizationRetryTotalBudgetMs(attemptBudgetMs);
}
//# sourceMappingURL=summarization-retry.js.map