headroom/.github/workflows
Michael Sam 6d3f39f213
feat: add dashboard agent usage stats (#814)
## Description

Add a clear dashboard view for per-agent token usage so end users can
see Cursor, Claude, Codex, and other detected clients with before/after
token counts, tokens saved, and savings percentages. The stats API now
exposes a stable `agent_usage` object that the dashboard renders near
the top of the session view.

Fixes #

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

### New Files

**Tests:**
- `tests/test_dashboard_agent_usage.py` — Covers agent classification,
exact per-request aggregation, and aggregate fallback behavior.

### Modified Files

- `headroom/proxy/server.py` — Adds per-agent usage aggregation to
`/stats` with before tokens, after tokens, output tokens, saved tokens,
savings percentage, source, providers, and models.
- `headroom/dashboard/templates/dashboard.html` — Adds a prominent Agent
Usage panel with totals, coverage status, per-agent token-flow bars,
request counts, before/after tokens, saved tokens, and share of savings.

## Testing

- [x] Unit tests pass: `.venv312/bin/pytest
tests/test_dashboard_agent_usage.py`
- [x] Linting passes: `.venv312/bin/ruff check headroom/proxy/server.py
tests/test_dashboard_agent_usage.py`
- [x] Diff whitespace check passes: `git diff --check
origin/main...HEAD`
- [x] Dashboard smoke render: local proxy on `127.0.0.1:8790`, captured
Chrome headless screenshot of `/dashboard`
- [x] New tests added for new functionality

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing relevant unit tests pass locally with my changes
- [ ] I have made corresponding changes to the documentation
- [ ] I have updated the CHANGELOG.md if applicable

## Additional Notes

The agent usage panel uses exact request-log data when available. If
detailed request logs are empty, it falls back to aggregate
provider/model request counts and labels the coverage as aggregate
fallback so users are not misled.
2026-06-12 14:12:22 -05:00
..
ci.yml feat: add dashboard agent usage stats (#814) 2026-06-12 14:12:22 -05:00
devcontainers.yml ci: speed up GitHub Actions — path filters, caching, timeouts, version upgrades (#620) 2026-06-05 14:32:53 -08:00
docker.yml ci(docker): push :dev image tags on every main-branch commit (#529) 2026-06-10 21:13:23 -05:00
docs.yml ci: speed up GitHub Actions — path filters, caching, timeouts, version upgrades (#620) 2026-06-05 14:32:53 -08:00
eval.yml ci: bump dtolnay/rust-toolchain from 1.95.0 to 1.100.0 in the actions-minor-patch group (#849) 2026-06-11 19:44:15 -05:00
init-e2e.yml chore(deps): loosen over-pinned constraints and add upper bounds (#538) 2026-06-08 22:06:24 -08:00
init-native-e2e.yml ci: speed up GitHub Actions — path filters, caching, timeouts, version upgrades (#620) 2026-06-05 14:32:53 -08:00
install-native-e2e.yml fix(ci): correct comments, timeouts, and pip reliability in native e2e workflows (#878) 2026-06-11 21:02:05 -07:00
network-diff-capture.yml feat: add differential network capture harness (#761) 2026-06-08 22:18:31 -07:00
pr-health.yml ci: add PR and issue grooming workflows (#797) 2026-06-09 16:06:09 -08:00
publish.yml ci: bump dtolnay/rust-toolchain from 1.95.0 to 1.100.0 in the actions-minor-patch group (#849) 2026-06-11 19:44:15 -05:00
release-please.yml ci: speed up GitHub Actions — path filters, caching, timeouts, version upgrades (#620) 2026-06-05 14:32:53 -08:00
release.yml feat: support Python 3.14+ via pyo3 abi3 stable ABI (#516) 2026-06-09 06:33:16 -08:00
rust.yml ci: speed up GitHub Actions — path filters, caching, timeouts, version upgrades (#620) 2026-06-05 14:32:53 -08:00
stale.yml ci: bump actions/stale from 9 to 10 (#850) 2026-06-11 12:53:46 -05:00
wrap-e2e.yml ci: speed up GitHub Actions — path filters, caching, timeouts, version upgrades (#620) 2026-06-05 14:32:53 -08:00
wrap-native-e2e.yml fix(ci): correct comments, timeouts, and pip reliability in native e2e workflows (#878) 2026-06-11 21:02:05 -07:00