Skip to content

TokenStep shows 0 when collector times out on large Codex history, and footer summary scope is inconsistent #2

Description

@Heawcyrt

Summary

TokenStep 0.1.43 shows 0 tokens when local Codex history is large and the collector times out. After investigating locally, I also found a UI consistency issue: the main ring total can include more tools than the footer summary displays, which makes the numbers look inconsistent.

Environment

  • macOS
  • TokenStep: 0.1.43
  • Codex data size on this machine:
    • ~/.codex/sessions: about 600 MB
    • ~/.codex/archived_sessions: about 89 MB
  • history_days: 180

Issue 1: collector timeout leads to 0 display

Running the helper manually:

/Applications/TokenStep.app/Contents/Helpers/TokenStepHelper collect 180

The command runs longer than the app's 120 second collector timeout.

When this happens, ~/Library/Application Support/TokenStep/data/usage.json is not generated, and the UI shows 0 tokens.

I verified that the Codex JSONL files do contain valid token usage records. After generating a compatible usage.json locally from the same data, TokenStep displays the data correctly.

Expected behavior

If collection times out or fails, TokenStep should distinguish failure from real zero usage.

Possible improvements:

  • show a collection error state
  • keep the previous valid snapshot
  • show partial results
  • make collection incremental
  • reduce the default scan window for very large histories
  • expose collector status in the UI

Issue 2: total and footer summary use different tool scopes

In my generated snapshot, today's total included multiple tools:

Codex
Kimi Code
Hermes Agent

The main ring correctly displayed the total across all tools, but the footer only showed:

Today Codex ... · Claude 0

From the source, this seems to be because the popover summary is hardcoded to only show two tool keys:

let orderedTools = [("Codex", "Codex"), ("Claude Code", "Claude")]

This can make the UI look inconsistent when the snapshot contains additional tools.

Expected behavior

The footer should either:

  • show all tools that contribute to the total
  • show the top N tools
  • group related variants
  • or explicitly label it as a Codex / Claude-only summary

Related enhancement: additional local Agent sources

While debugging this, I found additional local sources that can provide clear token usage metadata:

  • Claude Desktop local agent sessions
  • Kimi Code JSONL usage records
  • Hermes Agent logs with explicit in/out/total
  • CC Switch proxy logs
  • Cola trace logs

Some sources, such as Trae and VS Code logs, did not expose reliable token fields in my local logs, so they should not be counted without a verified parser.

Privacy note

I am intentionally not attaching raw logs because local JSONL files may contain prompts, file paths, and conversation content. I can provide anonymized file sizes, source paths, and test commands if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions