From 03a1285c698e0bd08788e30fe2113f4068478c19 Mon Sep 17 00:00:00 2001 From: Vishal Kumar Singh Date: Thu, 23 Apr 2026 13:07:01 +0530 Subject: [PATCH] fix(cli): stop doubling the log directory in rotating-file-stream history path On every kilo CLI startup the process writes an error like: log stream error: ENOENT: no such file or directory, open '//.log-history' Log rotation is effectively disabled because rotating-file-stream cannot open its history file. Root cause: rotating-file-stream (3.2.x) treats the `history` option as a filename resolved against the `path` option. In `packages/opencode/src/util/log.ts` we were passing an absolute path (`path.join(dir, '.log-history')`) for `history` while also setting `path: dir`, so the library concatenated the two and produced the `//.log-history` path that ENOENTs. Passing the relative filename `.log-history` lets the library resolve the history file under the configured `path` directory, matches the docs, and restores the 50 MB / 10-file rotation cap. Fixes #8252 Fixes #8275 Fixes #9321 --- packages/opencode/src/util/log.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/util/log.ts b/packages/opencode/src/util/log.ts index 3ed4b29dc55..a703b44ae5b 100644 --- a/packages/opencode/src/util/log.ts +++ b/packages/opencode/src/util/log.ts @@ -71,7 +71,7 @@ export async function init(options: Options) { const stream = createStream(path.basename(logpath), { size: "50M", maxFiles: 10, - history: path.join(dir, ".log-history"), + history: ".log-history", path: dir, }) stream.on("error", (err: Error) => {