fix: resolve #3124 #3125 #3127 session tools, cache priming, and compaction loop

- #3124: Session tools now merge SDK and file-backed sessions for SQLite backend
- #3125: Cache priming fixed for OpenCode >=1.3.14 empty workspace
- #3127: Activity-based progress detection prevents infinite compaction on Kimi/Minimax

All 29 new tests pass, 4885 total tests passing.
This commit is contained in:
YeonGyu-Kim
2026-04-05 09:30:19 +09:00
parent aeb9c97c30
commit 130f4ac080
22 changed files with 538 additions and 114 deletions
+17 -2
View File
@@ -6,6 +6,7 @@ import { randomUUID } from "node:crypto"
const TEST_STORAGE = join(tmpdir(), `omo-msgdir-test-${randomUUID()}`)
const TEST_MESSAGE_STORAGE = join(TEST_STORAGE, "message")
let sqliteBackend = false
mock.module("./opencode-storage-paths", () => ({
OPENCODE_STORAGE: TEST_STORAGE,
@@ -15,7 +16,7 @@ mock.module("./opencode-storage-paths", () => ({
}))
mock.module("./opencode-storage-detection", () => ({
isSqliteBackend: () => false,
isSqliteBackend: () => sqliteBackend,
resetSqliteBackendCache: () => {},
}))
@@ -25,6 +26,7 @@ const { getMessageDir } = await import("./opencode-message-dir")
describe("getMessageDir", () => {
beforeEach(() => {
sqliteBackend = false
mkdirSync(TEST_MESSAGE_STORAGE, { recursive: true })
})
@@ -73,6 +75,19 @@ describe("getMessageDir", () => {
expect(result).toBe(sessionDir)
})
it("returns file fallback path even when SQLite backend is active", () => {
//#given
sqliteBackend = true
const sessionDir = join(TEST_MESSAGE_STORAGE, "subdir", "ses_123")
mkdirSync(sessionDir, { recursive: true })
//#when
const result = getMessageDir("ses_123")
//#then
expect(result).toBe(sessionDir)
})
it("returns null for path traversal attempts with ..", () => {
//#given - sessionID containing path traversal
//#when
@@ -106,4 +121,4 @@ describe("getMessageDir", () => {
//#then
expect(result).toBe(null)
})
})
})