fix(watchdog): align RCA query with Metabase Q1/Q5 dashboards
loading diff…
RCA thread replies were showing extra tools compared to Metabase integration-insights dashboards. For example, Metabase Q5 (90% error rate) showed 2 tools but RCA showed 3.
The discrepancy was caused by RCA including "stale" fixable bugs - tools where a fixable error was identified in the last 14 days but the specific error pattern hadn't recurred in the last 7 days.
recently_active_fixable CTE that requires the fixable error_hash to have been seen in the last 7 daysfixable_occurrences_7d CTE for counting fixable occurrencesfixable_occurrence_count to output for additional contextThis matches the exact query structure used in Metabase Q1/Q5 cards.
# Test the query directly
PYTHONPATH=. ./agent-tools/clickhouse "WITH currently_fixable AS (...) SELECT ... HAVING error_rate >= 90"
🤖 Generated with Claude Code