Skip to content

Omit token count in checkpoint metadata when no token data exists #164

@jcleira

Description

@jcleira

Summary

SessionMetadata.TotalTokens is an int that defaults to 0 when token tracking didn't occur, making it indistinguishable from a session that genuinely used 0 tokens. Change it to *int with omitempty so the field is absent when unknown.

Source

entireio/cli PR #854: "fix: omit token count when no token data exists"

Proposed Change

  • Change SessionMetadata.TotalTokens from int to *int with json:"total_tokens,omitempty" in internal/checkpoint/metadata.go
  • Only set the pointer in the post-commit hook when JSONL parsing actually found token usage data
  • Display code in partio rewind --list treats nil as "unknown" and skips the token field rather than showing "0 tokens"

Why This Matters

Displaying "0 tokens" implies the agent ran but consumed no tokens — confusing and inaccurate. If a token count is shown, it should be real data.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions