Skip to content

Port upstream 0.60.5: mark Claude incomplete-request usage - #707

Draft
Finesssee wants to merge 1 commit into
port/upstream-0.60.5from
port/micro-0.60.5-claude-incomplete-requests
Draft

Finesssee wants to merge 1 commit into
port/upstream-0.60.5from
port/micro-0.60.5-claude-incomplete-requests

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Found by the 0.60.4-0.69.0 port gap audit.

What upstream did

Upstream CodexBar v0.60.5, bullet 4 (steipete#3688, commit 2d93342): preliminary Claude proxy usage rows (null stop_reason, input > 0, output == 0, no cache fields) are excluded from cost and tokens, but are now counted per day and per model as incompleteRequestCount. A completed record with the same key wins over an incomplete one. A day or period that only has incomplete requests stays unavailable instead of showing $0. "Incomplete" markers then show up in the menu and tray, chart tooltips, Usage & Spend, share/export, CLI text, CLI JSON and the web dashboard.

What this ports

  • Scanner (rust/src/cost_scanner/claude_incomplete.rs, cost_scanner.rs): the existing preliminary-row filter (already matching upstream) now records each excluded row. Rows are de-duplicated by the existing Claude dedup key, dropped if a completed row with the same key was counted, and bucketed per local day and per model. CostSummary gains incomplete_request_count and incomplete_by_model; ClaudeChartSnapshot gains daily_incomplete; new get_daily_cost_and_incomplete_history.
  • Coverage logic is unchanged: any preliminary row still makes Claude coverage unknown, so an incomplete-only day is not turned into a known $0.
  • CLI text: Total: line gets · Incomplete plus a Incomplete: N requests lacked final usage and were excluded from tokens and cost. line; an incomplete-only scan prints "No completed usage data found" plus that note instead of "No usage data found".
  • CLI JSON and serve /cost JSON: incompleteRequestCount only when > 0, and per-day incompleteRequestCount on the serve daily rows.
  • Tauri bridge (commands/chart.rs): optional incompleteRequestCount on DailyCostPoint and ProviderLocalUsageSummary (omitted when zero).
  • UI: menu card local-usage block shows the Incomplete note; chart tooltips (menu mini chart and provider Charts tab cost chart) append the Incomplete marker for affected days, including days with no cost value. New locale keys IncompleteRequestsLabel and IncompleteRequestsDetail (en-US; other locales fall back).

What this leaves out, and why

  • Usage & Spend tab, share/export PNG, and the serve web dashboard HTML markers: not done in this micro PR to keep the change reviewable. The data is now available in the bridge and serve JSON for a follow-up.
  • Upstream's per-model incompleteRequestCount in modelBreakdowns JSON, and the cached-report migration: Windows has no modelBreakdowns payload or persisted Claude report cache (the scanner rebuilds from transcripts on every scan), so there is nothing to migrate. Per-model counts are kept on CostSummary only.
  • The audit's "Claude coverage flag in CLI JSON" is not part of upstream's commit 2d93342, so it was not invented here.

Tests run

  • cargo +1.98.0 fmt --all
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings on both rust/Cargo.toml and apps/desktop-tauri/src-tauri/Cargo.toml: clean
  • cargo test -p codexbar: 2165 passed (new: tracker unit tests, scan reconciliation test, CLI JSON/suffix tests, serve daily JSON test)
  • cargo test -p codexbar-desktop-tauri: 461 passed, 1 failed: the known bootstrap_payload_exposes_every_provider_variant (fixed by Isolate bootstrap payload test from real settings #684, unrelated)
  • pnpm test (405 passed, includes new incompleteRequests and MiniBarChart tests), pnpm run lint (only pre-existing warnings), pnpm run build: clean

UI proof

UI-affecting (menu card note, chart tooltips). Draft: CUA proof on a fresh debug build is still to do and is not attached yet.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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