Skip to content

Commit 00184a8

Browse files
fix: re-parse 0-token Grok rows, hide Gemini from usage ledger
Two follow-ups from the live app: - Grok rows indexed by the earlier broken parser (0 tokens) were being pinned by the incremental mtime-skip, so the corrected estimate never re-applied. SessionMeta now carries total_input_tokens and the Grok + Cursor-Agent skips re-parse any 0-token row. - Gemini still appeared in the Provider usage ledger (separate table from the account list filtered earlier). Exclude google from list_provider_usage_ledger too. Combined with the all-time real-compute bar (1.1.61), after re-index the split shows Claude dominant (all-time) with Grok/Cursor present and no Gemini anywhere. Bumps desktop app to 1.1.62. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 9c0e88d commit 00184a8

5 files changed

Lines changed: 17 additions & 5 deletions

File tree

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code-reviewer/desktop",
3-
"version": "1.1.61",
3+
"version": "1.1.62",
44
"private": true,
55
"scripts": {
66
"dev": "lsof -ti:1420 | xargs kill -9 2>/dev/null; vite",

apps/desktop/src-tauri/src/commands/accounts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ pub async fn list_provider_usage_ledger(
322322
reasoning_tokens, total_tokens, cost_usd, confidence,
323323
metadata_json, observed_at
324324
FROM provider_usage_ledger
325+
WHERE provider != 'google'
325326
ORDER BY observed_at DESC
326327
LIMIT ?1",
327328
)

apps/desktop/src-tauri/src/commands/history.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,12 @@ fn index_grok_sessions(conn: &rusqlite::Connection) -> Result<(u64, u64, u64), S
13091309
let existing = queries::get_session_by_jsonl_path(conn, &source_ref)
13101310
.map_err(|e| e.to_string())?;
13111311
if let Some(ref meta) = existing {
1312-
if meta.file_mtime.as_deref() == file_mtime.as_deref() && meta.message_count > 0 {
1312+
// Re-parse 0-token rows: earlier builds estimated Grok at 0
1313+
// (token fields were nested), so don't let the mtime skip pin them.
1314+
if meta.file_mtime.as_deref() == file_mtime.as_deref()
1315+
&& meta.message_count > 0
1316+
&& meta.total_input_tokens > 0
1317+
{
13131318
skipped += 1;
13141319
continue;
13151320
}
@@ -1462,7 +1467,10 @@ fn index_cursor_agent_sessions(conn: &rusqlite::Connection) -> Result<(u64, u64,
14621467
let existing = queries::get_session_by_jsonl_path(conn, &source_ref)
14631468
.map_err(|e| e.to_string())?;
14641469
if let Some(ref meta) = existing {
1465-
if meta.file_mtime.as_deref() == file_mtime.as_deref() && meta.message_count > 0 {
1470+
if meta.file_mtime.as_deref() == file_mtime.as_deref()
1471+
&& meta.message_count > 0
1472+
&& meta.total_input_tokens > 0
1473+
{
14661474
skipped += 1;
14671475
continue;
14681476
}

apps/desktop/src-tauri/src/db/queries.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ pub struct SessionMeta {
349349
pub file_mtime: Option<String>,
350350
pub message_count: i64,
351351
pub archived_message_count: i64,
352+
pub total_input_tokens: i64,
352353
}
353354

354355
#[derive(Debug, Clone)]
@@ -366,7 +367,8 @@ pub fn get_session_by_jsonl_path(
366367
) -> Result<Option<SessionMeta>, rusqlite::Error> {
367368
conn.query_row(
368369
"SELECT id, file_mtime, message_count,
369-
(SELECT COUNT(*) FROM session_message_archive a WHERE a.session_id = cc_sessions.id)
370+
(SELECT COUNT(*) FROM session_message_archive a WHERE a.session_id = cc_sessions.id),
371+
total_input_tokens
370372
FROM cc_sessions
371373
WHERE jsonl_path = ?1",
372374
params![jsonl_path],
@@ -376,6 +378,7 @@ pub fn get_session_by_jsonl_path(
376378
file_mtime: row.get(1)?,
377379
message_count: row.get(2)?,
378380
archived_message_count: row.get(3)?,
381+
total_input_tokens: row.get(4)?,
379382
})
380383
},
381384
)

apps/desktop/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-utils/schema.json",
33
"identifier": "com.codevetter.desktop",
44
"productName": "CodeVetter",
5-
"version": "1.1.61",
5+
"version": "1.1.62",
66
"build": {
77
"beforeDevCommand": "npm run dev",
88
"beforeBuildCommand": "npm run build",

0 commit comments

Comments
 (0)