Files
Kilo-Org_kilocode/packages/opencode/src/util
Marius 3a86e15189 fix(cli): prevent unbounded log file growth with size-based rotation (#8136)
* fix(cli): prevent unbounded log file growth with size-based rotation

Fix two issues causing log files to grow to 50+ GB:

1. Server middleware leaked a "started" log line for skipped endpoints
   because log.time() was called unconditionally — only timer.stop()
   was gated by the skipLogging flag. Restructure to early-return for
   skipped paths so no logging occurs at all.

2. Log files had no size limit within a session. A long-running
   kilo serve process (e.g. VS Code extension) would write a single
   file indefinitely. Add rotating-file-stream (50 MB, maxFiles: 1)
   to cap log file size automatically.

* fix(cli): address review feedback on log rotation

- Revert server.ts changes (handled separately in #8141)
- Add error/warning event handlers on rotating-file-stream
- Increase maxFiles from 1 to 3 for better debug headroom
- Set explicit history file path to avoid .txt side-effect

* fix(cli): revert maxFiles back to 1

maxFiles: 1 is sufficient — we only need to cap disk usage, not retain
old rotated fragments. The existing cleanup() handles session-level
file retention separately.

* fix(cli): set maxFiles to 10 for log rotation
2026-04-02 11:54:49 +02:00
..
2026-02-25 01:48:10 -05:00
2026-03-16 19:37:22 -03:00
2026-02-14 04:19:02 +00:00
2026-03-16 20:33:36 -03:00