Repository navigation
Conversation
OpenRouter's /activity endpoint returns "date" as "YYYY-MM-DD HH:MM:SS", not a bare date. summarize_activity() compared this directly against today_date/recent_dates keys formatted as "YYYY-MM-DD", so the comparison never matched: recentDays (the Tokens-by-day chart) came back all-zero and todayTotalTokens/todayTokensByModel stayed empty for every management-key (tier-2) user, even with real activity in the window. Confirmed against a live account and management key before and after the fix. Slicing to the date portion fixes the comparison; the existing scanner test's fixture used a bare date and didn't reflect the real API shape, so it passed despite the bug -- updated it to use the "YYYY-MM-DD HH:MM:SS" shape the live endpoint actually returns. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016SepVLazUi3s7cegrzwJ8K
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.
Summary
Found this while testing omacom#10824 locally against a live account with a management key.
/api/v1/activityreturnsdateas"YYYY-MM-DD HH:MM:SS", not a bare date.summarize_activity()compares this string directly againsttoday_date/recent_dateskeys built fromstrftime("%Y-%m-%d"), so the comparison never matches:recentDays(the "Tokens by day" bar chart) comes back all-zero even with real activity in the window.todayTotalTokens/todayTokensByModelstay empty for every management-key (tier-2) user — the tier this PR's headline feature targets.activeDatesends up holding"2026-09-15 00:00:00"instead of"2026-09-15", which likely also affects the cross-device sync merge that unions active dates (per the agents README).modelUsage(all-time totals) is unaffected since it doesn't bucket by day.Fix
Slice to the date portion before comparing/storing:
Tests
The existing scanner test's fixture used a bare
%Y-%m-%ddate, which is why it didn't catch this — that shape doesn't match what the live endpoint actually returns. Updated the fixture to use the real"YYYY-MM-DD HH:MM:SS"shape so a regression here fails loudly:activityTodayreturns0, wants85).recentDayswent from all-zero to reflecting real per-day token counts.