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
+4 -4
View File
@@ -64,7 +64,7 @@ describe("runBunInstallWithDetails", () => {
expect(result).toEqual({ success: true })
expect(getOpenCodeCacheDirSpy).toHaveBeenCalledTimes(1)
expect(spawnWithWindowsHideSpy).toHaveBeenCalledWith(["bun", "install"], {
cwd: "/tmp/opencode-cache",
cwd: "/tmp/opencode-cache/packages",
stdout: "pipe",
stderr: "pipe",
})
@@ -81,7 +81,7 @@ describe("runBunInstallWithDetails", () => {
// then
expect(result).toEqual({ success: true })
expect(spawnWithWindowsHideSpy).toHaveBeenCalledWith(["bun", "install"], {
cwd: "/tmp/opencode-cache",
cwd: "/tmp/opencode-cache/packages",
stdout: "pipe",
stderr: "pipe",
})
@@ -98,7 +98,7 @@ describe("runBunInstallWithDetails", () => {
// then
expect(result).toEqual({ success: true })
expect(spawnWithWindowsHideSpy).toHaveBeenCalledWith(["bun", "install"], {
cwd: "/tmp/opencode-cache",
cwd: "/tmp/opencode-cache/packages",
stdout: "inherit",
stderr: "inherit",
})
@@ -174,7 +174,7 @@ describe("runBunInstallWithDetails", () => {
expect(outcome.result).toEqual({
success: false,
timedOut: true,
error: 'bun install timed out after 60 seconds. Try running manually: cd "/tmp/opencode-cache" && bun i',
error: 'bun install timed out after 60 seconds. Try running manually: cd "/tmp/opencode-cache/packages" && bun i',
} satisfies BunInstallResult)
expect(killCallCount).toBe(1)
} finally {
+6 -1
View File
@@ -1,4 +1,5 @@
import { existsSync } from "node:fs"
import { join } from "node:path"
import { getOpenCodeCacheDir } from "../../shared/data-path"
import { log } from "../../shared/logger"
@@ -40,6 +41,10 @@ export async function runBunInstall(): Promise<boolean> {
return result.success
}
function getDefaultWorkspaceDir(): string {
return join(getOpenCodeCacheDir(), "packages")
}
function readProcessOutput(stream: ProcessOutputStream): Promise<string> {
if (!stream) {
return Promise.resolve("")
@@ -67,7 +72,7 @@ function logCapturedOutputOnFailure(outputMode: BunInstallOutputMode, output: Bu
export async function runBunInstallWithDetails(options?: RunBunInstallOptions): Promise<BunInstallResult> {
const outputMode = options?.outputMode ?? "pipe"
const cacheDir = options?.workspaceDir ?? getOpenCodeCacheDir()
const cacheDir = options?.workspaceDir ?? getDefaultWorkspaceDir()
const packageJsonPath = `${cacheDir}/package.json`
if (!existsSync(packageJsonPath)) {