Repository navigation
fix: report measured AI usage and stale snapshots accurately - #446
Merged
Merged
Conversation
devSejung
marked this pull request as ready for review
November 5, 2026 09:12
This was referenced Nov 5, 2026
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 #445. Follow-up to #435.
What Problem This Solves
Fixes an issue where employee and model usage reports could count display-only transcript notices as model calls, display unmeasured token usage as a measured zero, or report an expired snapshot as complete. A deterministic reproduction against main returned 31 calls and zero tokens for 31 display notices.
Why This Change Was Made
Classify usage where the transcripts are written and interpreted, then rebuild the derived SQLite rollups under a new rollup version. Count eligible retained usage records, distinguish explicit zero from missing telemetry, and mark a retained Gateway snapshot stale until refresh completes. The existing report routes, query fields, and SQLite schema are unchanged.
User Impact
AI-assisted change.
Evidence
Validated in task-owned Ubuntu Linux Docker with Node 24.18.0 and pnpm 11.15.1. The checked source is commit 1b97734 on base 3cd6c8b; its full-index patch SHA-256 is 24a04cfad23919c2262ca64b221b6ca4bd7033617ac47e5321408ccdde8bb4eb.
The corporate deployment and its historical data were not accessed. The deterministic fixture proves the code behavior, not the cause of any individual production incident.