log-pruning-7-day-default#1785
Closed
aboimpinto wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a log retention mechanism for the TUI, allowing the system to automatically prune log files older than a specified number of days (defaulting to 7). The implementation includes a new prune_old_logs function and corresponding unit tests. A potential integer overflow was identified in the duration calculation, which could lead to incorrect log pruning or application panics if a very large retention value is provided.
cb4757a to
d94b8f1
Compare
aboimpinto
added a commit
to aboimpinto/CodeWhale
that referenced
this pull request
May 21, 2026
Builds on the env-var-based log pruning from PR Hmbown#1785 (already in main) with a proper config.toml section. Changes: - Add LogsConfig struct to config.rs with retention_days field (default 7) - Wire config.logs_config().retention_days into runtime_log::init() - Env var DEEPSEEK_LOG_RETENTION_DAYS retains priority over config value - Add [logs] section to config.example.toml with documentation - Updated and added tests for the new config path
aboimpinto
added a commit
to aboimpinto/CodeWhale
that referenced
this pull request
May 21, 2026
Builds on the env-var-based log pruning from PR Hmbown#1785 (already in main) with a proper config.toml section. Changes: - Add LogsConfig struct to config.rs with retention_days field (default 7) - Wire config.logs_config().retention_days into runtime_log::init() - Env var DEEPSEEK_LOG_RETENTION_DAYS retains priority over config value - Add [logs] section to config.example.toml with documentation - Updated and added tests for the new config path
aboimpinto
added a commit
to aboimpinto/CodeWhale
that referenced
this pull request
May 21, 2026
Builds on the env-var-based log pruning from PR Hmbown#1785 (already in main) with a proper config.toml section. Changes: - Add LogsConfig struct to config.rs with retention_days field (default 7) - Wire config.logs_config().retention_days into runtime_log::init() - Env var DEEPSEEK_LOG_RETENTION_DAYS retains priority over config value - Add [logs] section to config.example.toml with documentation - Updated and added tests for the new config path
Owner
|
This PR was opened before the v0.8.41 rebrand and is now stale. Feel free to rebase onto current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Automatically prune old TUI log files on startup to prevent unbounded disk accumulation.
Problem
With PID-based log filenames (PR #1783), each TUI instance writes to its own file. Without cleanup, logs accumulate indefinitely.
Fix
prune_old_logs(log_dir, max_age)— deletestui-*.logfiles older thanmax_ageinit()with retention fromDEEPSEEK_LOG_RETENTION_DAYS(default: 7 days)Configuration
DEEPSEEK_LOG_RETENTION_DAYSTests (5)
prune_old_logs_deletes_old_filesprune_old_logs_keeps_recent_filesprune_old_logs_ignores_non_log_filestui-*.logfiles affectedretention_days_defaults_to_sevenprune_old_logs_tolerates_missing_directoryTesting Strategy
Without old log files: set
DEEPSEEK_LOG_RETENTION_DAYS=0before launching. All existingtui-*.logfiles will be deleted on startup. Then check~/.deepseek/logs/— only the current session's file should remain.Closes #1784