Skip to content

Investigate Codex usage across interrupted, replayed and resumed turns #1946

Closed

Description

@currentbits

Verify Codex usage accounting independently of context occupancy and subscription quota display.

A pure-parser probe shows codex.extractUsage returns null for a token_usage_record with payload.usage while a turn.completed direct usage control parses correctly. Establish whether that record shape reaches the actual app-server/live or transcript-import path before claiming a production undercount. Existing token_count total snapshots are already treated differently from request deltas.

Acceptance criteria:

  • Exercise interrupted requests without following token_count, subsequent cumulative snapshots, replay of a sequence's first request, genuine resets, forks and restart/resume baselines.
  • Count each measured request once; preserve original timestamp, provider, observed model and any known tier. Unknown values remain unknown.
  • Keep cache/reasoning subsets and context-window occupancy separate from billable turn/session totals.
  • Audit compressed .jsonl.zst discovery in session import, but do not claim the current application ledger aggregates every external transcript. Coordinate import work with Investigate: Rewound Codex history import #1906/Add projects from Claude Code / Codex / Cursor history #1858.
  • Make skipped/inconsistent-record coverage visible if a transcript accounting path is introduced; deduplicate sources by identity and bound rescans/cache invalidation.
  • Capture focused failures against the baseline before changing runtime accounting.

Coordinate with #1928 for per-model ledger storage and #1904 for limits/recovery. Tracked by #1926. Tests should use isolated fixtures without paid turns or real account data.

Activity

  1. currentbits commented on Nov 8, 2026

    @currentbits
    OwnerAuthor

    Note

    🤖 gpt-6.1-sol responding on behalf of currentbits

    Additional normalization evidence: an isolated extractUsage(turn.completed) input with input_tokens=100, cached_input_tokens=80, output_tokens=2 and reasoning_output_tokens=1 yields only inputTokens=100/outputTokens=2/contextTokens=102, dropping the cache/reasoning subsets. The app-server breakdownToJsonl adapter similarly copies input/output/total only.

    Add cache/reasoning preservation to the fixture matrix and distinguish inclusive provider input tokens from Solenta's uncached-input ledger convention before pricing. This confirms field loss at those helper boundaries; a live billing discrepancy and all provider event variants remain unverified. Keep this implementation separate from the #1928 ledger/filter worker's current scope.

  2. added and removed on Nov 8, 2026
  3. added and removed on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions