
















@@ -41,12 +41,7 @@ export type ResolvedSessionMaintenanceConfig = {
4141mode: SessionMaintenanceMode;
4242pruneAfterMs: number;
4343maxEntries: number;
44-// Optional so external plugin callers that construct a pre-#88632 maintenanceConfig
45-// (without the model-run fields) still compile; the resolver always sets both, and all
46-// internal readers treat an absent value as "unset" (model-run pruning disabled).
47-modelRunPruneAfterMs?: number | null;
48-/** True when modelRunPruneAfter was explicitly set instead of using the pressure-gated default. */
49-modelRunPruneAfterConfigured?: boolean;
44+modelRunPruneAfterMs: number;
5045resetArchiveRetentionMs: number | null;
5146maxDiskBytes: number | null;
5247highWaterBytes: number | null;
@@ -84,24 +79,6 @@ function resolveResetArchiveRetentionMs(
8479}
8580}
868187-function resolveModelRunPruneAfterMs(maintenance?: SessionMaintenanceConfig): number | null {
88-const raw = maintenance?.modelRunPruneAfter;
89-if (raw === false) {
90-return null;
91-}
92-const normalized = normalizeStringifiedOptionalString(raw);
93-if (!normalized) {
94-return DEFAULT_MODEL_RUN_PRUNE_AFTER_MS;
95-}
96-try {
97-return parseDurationMs(normalized, { defaultUnit: "d" });
98-} catch {
99-// The schema rejects invalid explicit values. Keep direct resolver callers fail-closed
100-// rather than silently enabling the default 24h model-run cleanup.
101-return null;
102-}
103-}
104-10582function resolveMaxDiskBytes(maintenance?: SessionMaintenanceConfig): number | null {
10683const raw = maintenance?.maxDiskBytes;
10784const normalized = normalizeStringifiedOptionalString(raw);
@@ -163,8 +140,7 @@ export function resolveMaintenanceConfigFromInput(
163140mode: maintenance?.mode ?? DEFAULT_SESSION_MAINTENANCE_MODE,
164141 pruneAfterMs,
165142maxEntries: maintenance?.maxEntries ?? DEFAULT_SESSION_MAX_ENTRIES,
166-modelRunPruneAfterMs: resolveModelRunPruneAfterMs(maintenance),
167-modelRunPruneAfterConfigured: maintenance?.modelRunPruneAfter !== undefined,
143+modelRunPruneAfterMs: DEFAULT_MODEL_RUN_PRUNE_AFTER_MS,
168144resetArchiveRetentionMs: resolveResetArchiveRetentionMs(maintenance, pruneAfterMs),
169145 maxDiskBytes,
170146highWaterBytes: resolveHighWaterBytes(maintenance, maxDiskBytes),
@@ -198,24 +174,15 @@ export function shouldRunSessionEntryMaintenance(params: {
198174}
199175200176export function shouldRunModelRunPrune(params: {
201-maintenance: Pick<
202-ResolvedSessionMaintenanceConfig,
203-"maxEntries" | "modelRunPruneAfterConfigured" | "modelRunPruneAfterMs"
204->;
177+maintenance: Pick<ResolvedSessionMaintenanceConfig, "maxEntries">;
205178entryCount: number;
206179/**
207180 * True when the caller caps immediately to `maxEntries` in the same pass (forced
208181 * maintenance / `sessions cleanup`) rather than using the batched high-water trigger.
209182 */
210183force?: boolean;
211184}): boolean {
212-if (params.maintenance.modelRunPruneAfterMs == null) {
213-return false;
214-}
215-if (params.maintenance.modelRunPruneAfterConfigured) {
216-return true;
217-}
218-// Unset default is pressure-gated, and must align with whichever cap step runs alongside it.
185+// Model-run cleanup is pressure-gated, and must align with whichever cap step runs alongside it.
219186// Forced maintenance caps immediately down to `maxEntries`, so prune stale probes first whenever
220187// that cap would actually evict; otherwise stale probes would survive while real sessions get
221188// capped (the inverse of #88632). Batched runtime writes instead use the high-water trigger.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。