fix(cli): always use kilo.db regardless of channel
The upstream merge in PR #7240 introduced channel-based database path separation, causing non-latest/beta channels (including local dev) to open a different DB file (e.g. kilo-local.db) instead of kilo.db. This made all existing sessions invisible. Remove the channel-based path logic and always use kilo.db. Also remove the now-unused KILO_DISABLE_CHANNEL_DB flag. Closes #7472
This commit is contained in:
@@ -57,7 +57,6 @@ export namespace Flag {
|
||||
export const KILO_EXPERIMENTAL_MARKDOWN = !falsy("KILO_EXPERIMENTAL_MARKDOWN")
|
||||
export const KILO_MODELS_URL = process.env["KILO_MODELS_URL"]
|
||||
export const KILO_MODELS_PATH = process.env["KILO_MODELS_PATH"]
|
||||
export const KILO_DISABLE_CHANNEL_DB = truthy("KILO_DISABLE_CHANNEL_DB")
|
||||
export const KILO_SKIP_MIGRATIONS = truthy("KILO_SKIP_MIGRATIONS")
|
||||
|
||||
function number(key: string) {
|
||||
|
||||
@@ -12,9 +12,7 @@ import z from "zod"
|
||||
import path from "path"
|
||||
import { readFileSync, readdirSync, existsSync } from "fs"
|
||||
import * as schema from "./schema"
|
||||
import { Installation } from "../installation"
|
||||
import { Flag } from "../flag/flag"
|
||||
import { iife } from "@/util/iife"
|
||||
|
||||
declare const KILO_MIGRATIONS: { sql: string; timestamp: number; name: string }[] | undefined
|
||||
|
||||
@@ -28,15 +26,8 @@ export const NotFoundError = NamedError.create(
|
||||
const log = Log.create({ service: "db" })
|
||||
|
||||
export namespace Database {
|
||||
export const Path = iife(() => {
|
||||
const channel = Installation.CHANNEL
|
||||
// kilocode_change start
|
||||
if (["latest", "beta"].includes(channel) || Flag.KILO_DISABLE_CHANNEL_DB)
|
||||
return path.join(Global.Path.data, "kilo.db")
|
||||
const safe = channel.replace(/[^a-zA-Z0-9._-]/g, "-")
|
||||
return path.join(Global.Path.data, `kilo-${safe}.db`)
|
||||
// kilocode_change end
|
||||
})
|
||||
// kilocode_change - always use kilo.db regardless of channel
|
||||
export const Path = path.join(Global.Path.data, "kilo.db")
|
||||
|
||||
type Schema = typeof schema
|
||||
export type Transaction = SQLiteTransaction<"sync", void, Schema>
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import path from "path"
|
||||
import { Installation } from "../../src/installation"
|
||||
import { Database } from "../../src/storage/db"
|
||||
|
||||
describe("Database.Path", () => {
|
||||
test("returns database path for the current channel", () => {
|
||||
// kilocode_change - always use kilo.db regardless of channel
|
||||
test("always uses kilo.db", () => {
|
||||
const file = path.basename(Database.Path)
|
||||
// kilocode_change start
|
||||
const expected = ["latest", "beta"].includes(Installation.CHANNEL)
|
||||
? "kilo.db"
|
||||
: `kilo-${Installation.CHANNEL.replace(/[^a-zA-Z0-9._-]/g, "-")}.db`
|
||||
// kilocode_change end
|
||||
expect(file).toBe(expected)
|
||||
expect(file).toBe("kilo.db")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user