Project
cortex
Description
When users run cortex logs --clear --level <level>, the --level argument is not applied during clear operations. Instead of deleting only the selected level (for example error), the command removes every log file matching the age rule, which can unexpectedly wipe unrelated logs.
Root cause (this repo)
The command dispatch enters clear-mode early and executes run_clear() before level-based selection is considered. The clear path does not read self.level, so deletion proceeds without level filtering.
Fix direction (suggested)
- Thread
--level into run_clear() filtering logic.
- If a level is provided, restrict deletion to matching filenames/categories only.
- Emit explicit output showing which levels/files were targeted before deletion.
Code snapshot
src/cortex-cli/src/logs_cmd.rs — run() early return into run_clear()
src/cortex-cli/src/logs_cmd.rs — run_clear() deletion loop without level filter checks
Error Message
Cleared 3 log file(s) older than 0 days.
Debug Logs
System Information
Platform: Windows 11
Component: cortex-cli (release build)
Reproducible: Yes (consistent)
Screenshots / Media
https://github.com/ultrahighsuper/111/blob/main/2026-04-09_10h51_49.png
Steps to Reproduce
- Verify multiple log-level files exist (for example debug/error/info).
- Run
cortex logs --clear --level error --keep-days 0.
- Observe the clear summary count.
- Run
cortex logs --paths again.
- Confirm non-error files were also deleted.
Expected Behavior
--level error should clear only error-level log files and preserve other levels.
Actual Behavior
The clear operation removes all eligible log files regardless of level, effectively ignoring --level.
Additional Context
- Impact includes unintended loss of logs users expected to keep.
- Command output currently does not warn that the provided level filter was not honored.
Project
cortex
Description
When users run
cortex logs --clear --level <level>, the--levelargument is not applied during clear operations. Instead of deleting only the selected level (for exampleerror), the command removes every log file matching the age rule, which can unexpectedly wipe unrelated logs.Root cause (this repo)
The command dispatch enters clear-mode early and executes
run_clear()before level-based selection is considered. The clear path does not readself.level, so deletion proceeds without level filtering.Fix direction (suggested)
--levelintorun_clear()filtering logic.Code snapshot
src/cortex-cli/src/logs_cmd.rs—run()early return intorun_clear()src/cortex-cli/src/logs_cmd.rs—run_clear()deletion loop withoutlevelfilter checksError Message
Debug Logs
System Information
Screenshots / Media
https://github.com/ultrahighsuper/111/blob/main/2026-04-09_10h51_49.png
Steps to Reproduce
cortex logs --clear --level error --keep-days 0.cortex logs --pathsagain.Expected Behavior
--level errorshould clear only error-level log files and preserve other levels.Actual Behavior
The clear operation removes all eligible log files regardless of level, effectively ignoring
--level.Additional Context