Skip to content

claude: establish local history coverage after a complete scan - #12

Merged
marcus7989 merged 1 commit into
vibetvfrom
codex/claude-history-coverage
Oct 20, 2026
Merged

marcus7989 merged 1 commit into
vibetvfrom
codex/claude-history-coverage

Conversation

@marcus7989

Copy link
Copy Markdown
Owner

Win-CodexBar never marks Claude's local token history as complete, so the VibeTV Control Center on Windows always shows "Token history is unavailable" for Claude, even though cost --json returns real Claude daily tokens (VibeTV issue DreamyTalesPAN/CodexBar-Display#820, reported by a customer).

Cause: scan_claude_with_cancel starts from CostSummary::default() and never sets history_coverage_established; only the Codex scan sets it. The Companion only trusts a daily series when that flag is true (so padded zeroes never show as real usage), so Claude history is dropped on every Windows machine.

Change (only rust/src/cost_scanner.rs + tests): the Claude scan now establishes coverage when the projects folder exists, the walk was not cancelled, and every folder, file timestamp and file could be read. knownZero is set only for such a complete scan that found no usage (after the pi-compatible rows are added). A missing folder, a cancelled scan or a read error keeps coverage unestablished, as before. This follows upstream main (claude_scan.rs finalize_claude_summary), without its malformed-line and incomplete-request tracking. cli/cost.rs is unchanged (no overlap with #11).

Tests: 5 new unit tests (usage → coverage, empty → known zero, missing folder, cancelled scan, read error). cargo test --lib cost_scanner 75/75 on macOS. The 4 macOS-only path test failures and the clippy findings under local Rust 1.91 are identical on the base d22db28c; the Windows PR check is the gate.

Released as pre-release v0.60.3-vibetv.12 from this head for the VibeTV pin; the merge stays with the reviewer.

The Claude cost scan never set history_coverage_established, so callers that only trust complete history (VibeTV Companion on Windows) dropped Claude's token history. A finished, non-cancelled walk over an existing projects folder without read errors now establishes coverage; knownZero only for such a scan without usage. VibeTV DreamyTalesPAN/CodexBar-Display#820.
@marcus7989 marcus7989 self-assigned this Oct 20, 2026
@marcus7989

Copy link
Copy Markdown
Owner Author

@codex review

@marcus7989

Copy link
Copy Markdown
Owner Author

Tested as v0.60.3-vibetv.12 (built from a9ce1a0) on real Windows 11 (Beelink), with one test Claude transcript (three entries, 13,500 tokens). cost --json --days 30 --provider all, Claude entry: vibetv.11 historyCoverageEstablished: false, vibetv.12 true; both report the same 3 days and 13,500 tokens, knownZero false on both. With vibetv.12 bundled, the VibeTV Control Center shows Claude's token history instead of "Token history is unavailable" (screenshots in DreamyTalesPAN/CodexBar-Display#824). cost_scanner tests cross-built for x86_64-pc-windows-msvc pass natively: 75/75, including the 5 new ones.

This repository has no Codex review connector (no answer to @codex review, same as #10), so the code review is yours.

@DreamyTalesPAN

Copy link
Copy Markdown
Collaborator

@marcus7989 Tested in DreamyTalesPAN/CodexBar-Display#824 on the Windows bench: with v0.60.3-vibetv.12 (built from this PR's head a9ce1a0) cost --json --provider claude reports historyCoverageEstablished: true (vibetv.11: false) for the same 21988 tokens, and the Mac + Windows cold/warm runs of nesszer#824 pass. Please merge this PR; if the merged head stays a9ce1a0, the existing vibetv.12 tag can stay as it is (otherwise a rebuilt tag + new SHA in nesszer#824).

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.

2 participants