fix(parser): support gemini-cli JSONL format (#144)#145
Merged
Conversation
1 task
gemini-cli migrated chat recording from single-object `.json` to streaming `.jsonl` on 2026-04-09 (google-gemini/gemini-cli#23749). The legacy parser only matched `*/chats/session-*.json` so new sessions were silently dropped — issue #144 (v2.7.0). - `collect_files`: 3-glob union (main `.jsonl`, legacy `.json`, subagent `.jsonl` under nested parent-session dirs) - `parse_file`: extension dispatch — `.jsonl` streams line-by-line and ignores metadata, `\$set`, `\$rewindTo`, and non-`gemini` message lines - `tokens.tool` (toolUsePromptTokenCount, added in the same gemini-cli release) is folded into input_tokens so totals match gemini-cli's own - `GEMINI_CLI_HOME` env var honored, matching gemini-cli paths.ts - Cache invalidates via CACHE_VERSION 12 → 13
dae0dee to
d376ded
Compare
2 tasks
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
.jsonto streaming.jsonlon 2026-04-09 (feat(core): migrate chat recording to JSONL streaming google-gemini/gemini-cli#23749). toktrack's parser only matched*/chats/session-*.json, so new gemini sessions were silently dropped → issue [Bug] Gemini usage not showing up #144 (reported on v2.7.0)..jsonlsupport (line-by-line streaming, metadata +$set+$rewindTo+ non-geminitypes skipped) while keeping legacy.jsonworking for users who haven't resumed yet.{chatsDir}/{parentSessionId}/{id}.jsonl(nosession-prefix).tokens.tool(new toolUsePromptTokenCount) is folded intoinput_tokensso user-visible totals match gemini-cli's own.GEMINI_CLI_HOMEenv var (matches gemini-clipaths.ts).CACHE_VERSION12 → 13.Closes #144.
Test plan
make check(fmt + clippy + 489 unit tests) — all greencargo run --releasepicks up gemini usage from~/.gemini/tmp/*/chats/*.jsonl(reporter's reproduction)Out of scope
tokens.toolas a distinct field onUsageEntry(would ripple into aggregator/TUI/JSON output)🤖 Reviewed by independent sub-agent review — P0/P1 findings dismissed as pre-existing repo conventions (env-var test pattern matches
src/services/pricing.rs; cache mismatch semantics match issue #134).