Skip to content

Conversation

@peyton-alt
Copy link
Contributor

@peyton-alt peyton-alt commented Feb 5, 2026

Note

Medium Risk
Touches condensation logic that writes checkpoint metadata and changes transcript parsing/token accounting paths for multiple agent formats; mistakes could skew stored metadata or summaries but do not affect core git history or authentication/security.

Overview
Manual-commit condensation now threads CheckpointTranscriptStart into extractSessionData and uses it to compute checkpoint-scoped token usage for both Claude (JSONL line offsets) and Gemini (JSON message indexes).

Transcript processing is refactored to centralize format-aware counting (countTranscriptItems), prompt extraction (extractUserPrompts with IDE-tag stripping), and token calculation (calculateTokenUsage), and commit summarization avoids line-slicing for Gemini transcripts to prevent malformed input.

Tests are updated and expanded with new Gemini condensation coverage, including a multi-checkpoint regression test that verifies token usage only counts messages after the checkpoint start.

Written by Cursor Bugbot for commit 8bfa341. This will update automatically on new commits. Configure here.

@peyton-alt peyton-alt requested a review from a team as a code owner February 5, 2026 21:59
Copilot AI review requested due to automatic review settings February 5, 2026 21:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes missing Gemini token usage calculation in the manual commit strategy's metadata.json. Previously, token usage was only calculated for Claude Code transcripts (JSONL format), but not for Gemini CLI transcripts (JSON format).

Changes:

  • Added agent-specific token calculation that detects Gemini JSON format and uses the appropriate parser
  • Removed TODO comments indicating the missing Gemini token usage implementation
  • Imported the geminicli package to access Gemini-specific token calculation

@peyton-alt peyton-alt force-pushed the fix/gemini-token-usage-metadata-json branch from 4869e39 to 653bd44 Compare February 7, 2026 00:29
@Soph Soph force-pushed the fix/gemini-token-usage-metadata-json branch from 653bd44 to 43948cd Compare February 9, 2026 15:44
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@khaong khaong force-pushed the fix/gemini-token-usage-metadata-json branch from 4658987 to 318a41a Compare February 10, 2026 05:02
countTranscriptLines was added on main and referenced the deleted
isGeminiJSONTranscript function. Replace call sites with the PR's
countTranscriptItems(agentType, content), remove the redundant
function and its test, and drop the unused geminicli import.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: eba6021005ae
@khaong khaong merged commit 21e374c into main Feb 10, 2026
4 checks passed
@khaong khaong deleted the fix/gemini-token-usage-metadata-json branch February 10, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants