Summary
GlobalToolLog opens a daily file in append mode with AutoFlush=true and prunes files older than 30 days, but there is no per-file size cap and no mid-day rotation. A long-running MCP session, or a script that invokes CodeIndex tens of thousands of times in a day, can grow a single log file to gigabytes before the next-day rollover.
Where
src/CodeIndex/Cli/GlobalToolLog.cs:24-29 (file open)
src/CodeIndex/Cli/GlobalToolLog.cs:114 (age-based pruning, no size check)
Suggested approach
(1) Add a configurable per-file size cap (default e.g. 50 MB) via CDIDX_GLOBAL_TOOL_LOG_MAX_BYTES. (2) On overflow, roll to stderr-{date}-{n}.log with monotonically increasing n. (3) Apply the existing 30-day prune to all rolled files. Document in USER_GUIDE.md.
Summary
GlobalToolLogopens a daily file in append mode withAutoFlush=trueand prunes files older than 30 days, but there is no per-file size cap and no mid-day rotation. A long-running MCP session, or a script that invokes CodeIndex tens of thousands of times in a day, can grow a single log file to gigabytes before the next-day rollover.Where
src/CodeIndex/Cli/GlobalToolLog.cs:24-29(file open)src/CodeIndex/Cli/GlobalToolLog.cs:114(age-based pruning, no size check)Suggested approach
(1) Add a configurable per-file size cap (default e.g. 50 MB) via
CDIDX_GLOBAL_TOOL_LOG_MAX_BYTES. (2) On overflow, roll tostderr-{date}-{n}.logwith monotonically increasingn. (3) Apply the existing 30-day prune to all rolled files. Document inUSER_GUIDE.md.