feat: anomaly alerts panel in Tokens tab — surface cost spikes vs 7-day baseline#395
Open
vivekchand wants to merge 1 commit intomainfrom
Open
feat: anomaly alerts panel in Tokens tab — surface cost spikes vs 7-day baseline#395vivekchand wants to merge 1 commit intomainfrom
vivekchand wants to merge 1 commit intomainfrom
Conversation
…ay baseline (closes #304) Add a dedicated Anomaly Alerts panel to the Tokens tab that surfaces sessions with cost >2x their rolling 7-day average. The panel: - Only appears when anomalies are detected (hidden otherwise) - Shows session ID, cost, rolling avg, spike ratio, and timestamp - Color-codes the ratio (amber 2-3x, orange 3-5x, red 5x+) - Adds a badge count next to the section title - Fetches from the existing /api/usage/anomalies endpoint (no backend changes) The anomaly detection backend already existed (_compute_session_cost_anomalies, anomaly_daily budget alert) but had no dedicated UI surface in the Tokens tab. This closes the gap described in GH #304.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #304
What
Adds a dedicated⚠️ Anomaly Alerts panel to the Tokens tab that surfaces sessions with cost >2x their rolling 7-day average.
How
/api/usage/anomaliesendpoint — no backend changes neededWhy now
The anomaly detection backend already existed (⚠️ icons on the Sessions tab. This panel makes the signal prominent and actionable.
_compute_session_cost_anomalies,anomaly_dailybudget alert) but there was no dedicated UI surface in the Tokens tab. Users could only see anomaly warnings as smallScreenshot
The panel appears below the Cost Breakdown table when anomalies are detected, above the Plugin Cost chart.