fix: add explicit isSqliteBackend guards to pruning modules
This commit is contained in:
parent
0c6fe3873c
commit
d414f6daba
@ -4,6 +4,7 @@ import type { PruningState, ToolCallSignature } from "./pruning-types"
|
|||||||
import { estimateTokens } from "./pruning-types"
|
import { estimateTokens } from "./pruning-types"
|
||||||
import { log } from "../../shared/logger"
|
import { log } from "../../shared/logger"
|
||||||
import { getMessageDir } from "../../shared/opencode-message-dir"
|
import { getMessageDir } from "../../shared/opencode-message-dir"
|
||||||
|
import { isSqliteBackend } from "../../shared/opencode-storage-detection"
|
||||||
|
|
||||||
export interface DeduplicationConfig {
|
export interface DeduplicationConfig {
|
||||||
enabled: boolean
|
enabled: boolean
|
||||||
@ -44,6 +45,7 @@ function sortObject(obj: unknown): unknown {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function readMessages(sessionID: string): MessagePart[] {
|
function readMessages(sessionID: string): MessagePart[] {
|
||||||
|
if (isSqliteBackend()) return []
|
||||||
const messageDir = getMessageDir(sessionID)
|
const messageDir = getMessageDir(sessionID)
|
||||||
if (!messageDir) return []
|
if (!messageDir) return []
|
||||||
|
|
||||||
@ -71,6 +73,11 @@ export function executeDeduplication(
|
|||||||
config: DeduplicationConfig,
|
config: DeduplicationConfig,
|
||||||
protectedTools: Set<string>
|
protectedTools: Set<string>
|
||||||
): number {
|
): number {
|
||||||
|
if (isSqliteBackend()) {
|
||||||
|
log("[pruning-deduplication] Skipping deduplication on SQLite backend")
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
if (!config.enabled) return 0
|
if (!config.enabled) return 0
|
||||||
|
|
||||||
const messages = readMessages(sessionID)
|
const messages = readMessages(sessionID)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { getOpenCodeStorageDir } from "../../shared/data-path"
|
|||||||
import { truncateToolResult } from "./storage"
|
import { truncateToolResult } from "./storage"
|
||||||
import { log } from "../../shared/logger"
|
import { log } from "../../shared/logger"
|
||||||
import { getMessageDir } from "../../shared/opencode-message-dir"
|
import { getMessageDir } from "../../shared/opencode-message-dir"
|
||||||
|
import { isSqliteBackend } from "../../shared/opencode-storage-detection"
|
||||||
|
|
||||||
interface StoredToolPart {
|
interface StoredToolPart {
|
||||||
type?: string
|
type?: string
|
||||||
@ -39,6 +40,11 @@ export function truncateToolOutputsByCallId(
|
|||||||
sessionID: string,
|
sessionID: string,
|
||||||
callIds: Set<string>,
|
callIds: Set<string>,
|
||||||
): { truncatedCount: number } {
|
): { truncatedCount: number } {
|
||||||
|
if (isSqliteBackend()) {
|
||||||
|
log("[auto-compact] Skipping pruning tool outputs on SQLite backend")
|
||||||
|
return { truncatedCount: 0 }
|
||||||
|
}
|
||||||
|
|
||||||
if (callIds.size === 0) return { truncatedCount: 0 }
|
if (callIds.size === 0) return { truncatedCount: 0 }
|
||||||
|
|
||||||
const messageIds = getMessageIds(sessionID)
|
const messageIds = getMessageIds(sessionID)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user