Runtime memory logs (server/client) bounded only by 90-file count, no byte or age cap

Open Beginner friendly
#2,079 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend, cli

Research direction

Read crates/jcode-base/src/runtime_memory_log.rs, focusing on prune_old_server_logs and prune_old_client_logs and how they sort files. Decide on a byte cap or an age cutoff, using the existing memory_log.rs retention as a reference. Done means old logs are pruned while today's file is retained and disk usage or age is bounded.

Written by the indexing model from the issue text.

Description

Summary

prune_old_server_logs/prune_old_client_logs in crates/jcode-base/src/runtime_memory_log.rs cap the runtime memory logs at 90 files each, but there is no byte or age limit. Each daily file can reach 10-15 MB on active machines (one jsonl per day in ~/.jcode/logs/memory/), so the steady state can hold roughly 1-2 GB of diagnostics that nothing else consumes.

Steps to reproduce
  1. Use jcode daily on a busy machine for a few weeks (server runtime memory logging is on by default, JCODE_RUNTIME_MEMORY_LOG unset).
  2. Check ls ~/.jcode/logs/memory/ and du -sh ~/.jcode/logs/memory.
Expected

Log retention keeps disk usage bounded in bytes, not only in file count.

Actual

On my machine the directory reached 144 MB with 34 files, individual files up to 14 MB (server) and 10 MB (client). At the 90-file cap that pattern extrapolates to ~1 GB+. Files stay until 90 accumulate, so old diagnostics from months ago survive as long as fewer than 90 files exist.

Proposed fix

Extend the existing prune functions with a total-size cap (for example MAX_SERVER_LOG_BYTES, delete oldest files until under the cap, keep today's file) or add an age-based cutoff (for example 14 days, same as memory_log.rs uses). Both fit the current sorted-files logic, small change.

Happy to open a PR if you want.

Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 5h
Merged PRs (30d)
14

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1jehuang/jcode

All issues in 1jehuang/jcode

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.