previous-draft/collectors/codex.py
Comment 1, line 1
previous-draft/collectors/codex.py:1
# -*- coding: utf-8 -*-Comment 2, line 2
previous-draft/collectors/codex.py:2
"""Codex collector: token_usage_record in ~/.codex/sessions/**/rollout-*.jsonl.
input_tokens includes cache hits. Split input = input_tokens - cached_input_tokens,cache_read = cached_input_tokens and cache_write = cache_write_input_tokens.
Model tracking: usage records omit the model; event_msg(thread_settings_applied)and other lines provide it. An incremental block may contain only usage lines:1. Persist each file's latest known model in source_state (model:<path>) across blocks.2. For unresolved events, scan the complete file by timestamp and use the latest model line that is no later than the event."""Comment 3, line 36
previous-draft/collectors/codex.py:36
"""Scan model lines across the file in file order as (ts, model), skipping usage lines."""Comment 4, line 58
previous-draft/collectors/codex.py:58
"""Use the latest model line with ts_model <= ts; use the first line for earlier events."""Comment 5, line 81
previous-draft/collectors/codex.py:81
# Indices of events whose model is unresolved.