Skip to content

fix(tui): filter metrics (filter_raw_tokens, filter_saved_tokens, filter_applications) always zero #1939

@bug-ops

Description

@bug-ops

Problem

TUI dashboard shows zero values for output filter metrics even when tool execution occurs:

  • filter_raw_tokens — always 0
  • filter_saved_tokens — always 0
  • filter_applications — always 0

While filter_confidence_full/partial/fallback do update correctly.

Root Cause

In crates/zeph-core/src/agent/tool_execution/native.rs, all tool output paths set filter_stats: None:

line 692:   filter_stats: None,
line 793:   filter_stats: None,
line 814:   filter_stats: None,
line 835:   filter_stats: None,
line 868:   filter_stats: None,
line 985:   filter_stats: None,
line 1291:  filter_stats: None,
line 1352:  filter_stats: None,

record_filter_metrics() is guarded by if let Some(ref fs) = out.filter_stats (line 1133), so it is never called.

The FilterExecutor from zeph-tools is integrated in the legacy tool execution path but not in the native tool execution path. As a result, filtering is either not applied in native path, or the FilterStats result is not propagated back into ToolOutput.

Why confidence metrics work

filter_confidence_* counters are incremented inside record_filter_metrics() when filter_stats is Some — meaning they only update via the legacy path. If native path is used exclusively, all filter metrics including confidence should be zero too.

Affected Files

  • crates/zeph-core/src/agent/tool_execution/native.rsfilter_stats not populated
  • crates/zeph-core/src/agent/tool_execution/legacy.rsrecord_filter_metrics() correctly implemented here
  • crates/zeph-tui/src/widgets/resources.rs — reads filter_raw_tokens, filter_saved_tokens
  • crates/zeph-tui/src/widgets/status.rs — reads filter_applications

Fix

Integrate FilterExecutor into the native tool execution path and populate filter_stats in ToolOutput before calling record_filter_metrics(). The implementation in legacy.rs can serve as reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions