Skip to content

fix: Windows tray fallback overriding fresh quota, cache history scan#79

Merged
aqua5230 merged 2 commits into
mainfrom
fix/windows-tray-quota-and-perf
Jul 16, 2026
Merged

fix: Windows tray fallback overriding fresh quota, cache history scan#79
aqua5230 merged 2 commits into
mainfrom
fix/windows-tray-quota-and-perf

Conversation

@aqua5230

Copy link
Copy Markdown
Owner

Summary

  • usage_client.py: a complete, fresh statusLine hook payload could be overridden by the .claude.json cache whenever the cache's fetchedAtMs looked newer, even when it described a different/expired session — so the Windows tray sometimes showed stale or wrong quota instead of the live hook data. A complete hook payload now always wins.
  • wintray.py: history_source_scan() was re-stat'ing every Codex/Claude session JSONL on every tray refresh tick; added a 30s cache to cut redundant disk scans (main source of reported UI jank).
  • pyproject.toml: excluded the local release-win/ build staging dir from ruff/mypy so it doesn't pollute lint/type-check runs.

Test plan

  • uv run ruff check
  • uv run mypy .
  • uv run pytest -v (754 passed, 2 skipped)
  • Rebuilt usage.exe (PyInstaller), verified --doctor reports usage v0.28.7
  • Verified fetch_once() returns data_source=hook with current_percent matching the live hook file

aqua5230 and others added 2 commits July 17, 2026 05:41
…ry scan per tick

The claude.json fallback snapshot was preferred whenever its fetchedAtMs
looked newer than the hook's timestamp, even when the hook already had a
complete, live statusLine payload for the current session — so the tray
silently fell back to a stale/expired-session cache instead of showing the
real quota. A complete hook payload now always wins.

Also cache history_source_scan() results for 30s instead of re-stat'ing
every Codex/Claude session JSONL on every tray refresh tick, which was the
main source of UI jank.

Excludes the local release-win/ build staging dir from ruff/mypy scans.
Non-numeric used_percentage values (e.g. malformed hook payloads)
passed the "complete" check via `is not None`, skipping the
.claude.json cache fallback even though _build_snapshot() would
then silently turn them into None, blanking the quota display.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aqua5230
aqua5230 merged commit 9eba10d into main Jul 16, 2026
5 checks passed
@aqua5230
aqua5230 deleted the fix/windows-tray-quota-and-perf branch July 16, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant