Skip to content

[BUG] [v0.0.7] Agent list hidden_count incorrectly includes pattern-filtered agents (list.rs:130-135) #18534

Description

@echoforge2200

Description

The hidden_count calculation in run_list computes agents.len() - filtered.len(), which incorrectly counts agents excluded by the --filter pattern as "hidden". The hidden count should only count agents with hidden: true, not agents that were filtered out for other reasons. This produces misleading output like "Showing 2 agents (5 hidden - use --all to show all)" when the user filters by pattern, when in fact those 5 agents aren't hidden - they just don't match the pattern. The message suggests using --all to see them, but --all only shows hidden agents, not agents excluded by pattern matching.

Error Message

N/A - produces incorrect informational message (not a crash)

Debug Logs

  1. Create 5 agents, none hidden
  2. Run cortex agent list --filter "xyz" where no agents match
  3. Output shows "Showing 0 agents (5 hidden - use --all to show all)" even though no agents are actually hidden

System Information

v0.0.7, any platform

Steps to Reproduce

  1. Ensure you have multiple agents installed (e.g., 3-4 agents)
  2. Run cortex agent list --filter "nonexistent-pattern-that-matches-nothing"
  3. Observe the message shows "(N hidden - use --all to show all)" where N equals the number of agents that don't match the pattern
  4. Run cortex agent list --all --filter "same-pattern" and see that no hidden agents exist

Expected Behavior

The hidden count should show only agents that are actually marked as hidden (hidden: true in their config), regardless of pattern matching. When using --filter, the message should not suggest using --all to see filtered agents.

Actual Behavior

The hidden count includes all agents excluded by any filter (pattern, mode), misleadingly suggesting they are hidden agents and can be shown with --all.

Additional Context

The bug is in list.rs lines 130-135. The fix should calculate hidden_count as agents.iter().filter(|a| a.hidden).count() instead of agents.len() - filtered.len(). Note that when --all is used, hidden agents are shown in the list, so hidden_count should be 0 in that case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions