Skip to content

GlobalToolLog has 30-day age prune but no per-file size cap or rotation #1625

Description

@Widthdom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions