-
Notifications
You must be signed in to change notification settings - Fork 2
fix(tui): filter metrics (filter_raw_tokens, filter_saved_tokens, filter_applications) always zero #1939
Description
Problem
TUI dashboard shows zero values for output filter metrics even when tool execution occurs:
filter_raw_tokens— always 0filter_saved_tokens— always 0filter_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.rs—filter_statsnot populatedcrates/zeph-core/src/agent/tool_execution/legacy.rs—record_filter_metrics()correctly implemented herecrates/zeph-tui/src/widgets/resources.rs— readsfilter_raw_tokens,filter_saved_tokenscrates/zeph-tui/src/widgets/status.rs— readsfilter_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.