Skip to content

[BUG] [v0.0.7] cortex logs --paths lists all files in the logs directory, not just log files #52680

Description

@hindshi-goi

Project

cortex

Description

The run_paths function lists every file in the logs directory using only a path.is_file() check with no extension filter. The main log-reading path in run() restricts files to those ending in .log or .txt, but run_paths applies no such constraint. Any non-log file present in the cache/cortex/logs directory (e.g. .json, .lock, .tmp) is shown as if it were a log file.

Error Message

Debug Logs

System Information

"system_information": "Cortex:v0.0.7, OS: Ubuntu"

Screenshots

https://github.com/gorin-ai/images/blob/main/Screenshot%20From%202026-04-10%2008-52-42.png

Steps to Reproduce

  • "Place a non-log file in the logs directory: touch ~/.cache/cortex/logs/test.json",
    
  • "Run: cortex logs --paths",
    
  • "Observe that test.json appears in the output under 'Log Files:'"
    

Expected Behavior

Only files with .log or .txt extensions are listed, consistent with the set of files that cortex logs reads and displays.",

Actual Behavior

Every regular file in the logs directory is listed regardless of extension. Files such as .json or .lock that are not log files appear in the output as if they were logs.",

Additional Context

src/cortex-cli/src/logs_cmd.rs lines 266-286: run_paths iterates entries and pushes to log_files on path.is_file() alone, with no extension check. By contrast, run() at lines 116-122 filters with name.ends_with(\".log\") || name.ends_with(\".txt\").",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingideIssues related to IDEvalidValid issue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions