Issue Description
Summary
CodexBar's local log parser under-reports the total daily/monthly token usage and estimated cost when users run complex tasks. This happens because CodexBar's local scanning logic relies solely on top-level session IDs registered in ~/.codex/session_index.jsonl and fails to scan rollout files generated by spawned subagents (child threads).
How to Reproduce / Technical Details
- Run a complex coding task in Codex CLI or Claude Code via the Codex MCP plugin that triggers agentic loops (where the model defines and spawns subagents).
- Codex CLI handles these subagents by creating separate execution threads. In the filesystem, they write their own session rollout logs under:
~/.codex/sessions/YYYY/MM/DD/rollout-<subagent-session-id>.jsonl
- Because these subagents are internal child threads, their session IDs are not registered in the top-level user session index
~/.codex/session_index.jsonl.
- CodexBar's local parser reads
session_index.jsonl to locate files to parse. As a result, it completely bypasses the subagent rollout logs, leading to a massive gap in reported vs. actual token usage.
Real-world Example from Logs
On July 14, 2026 (local timezone UTC+8), I ran a task that spawned multiple subagents (Gauss, Hubble, Schrodinger, etc.).
- Actual Usage (Direct Log Sum of all files in directory): 331M tokens with an estimated cost of $269.96.
- CodexBar's Chart Output: 83M tokens with an estimated cost of $65.71.
The math behind the discrepancy:
- The parent session (
019f6137-a3e2-7c72-ace4-126c54369a4a) cost $60.07. Combined with minor VSCode / Exec sessions, it totaled exactly $65.71 (what CodexBar displayed).
- However, the subagent sessions (
Gauss costing $52.37, Hubble costing $52.04, Schrodinger costing $51.23) were completely ignored by CodexBar's scanner because their session IDs were missing from session_index.jsonl.
- Note: Although the cloud-based "Weekly/Monthly Limit" percentage (fetched via browser cookies/API) correctly counted the subagent requests, the "Estimated Cost" charts, project list, and total token usage meters were under-reported.
Expected Behavior
CodexBar's local parser should scan all rollout-*.jsonl files present in the daily session folders or discover subagent sessions by parsing parent-child relationships (e.g. checking payload.source.subagent in session_meta lines of the parent rollout files) instead of relying strictly on session_index.jsonl.
System Environment
- OS: macOS 14+ (Apple Silicon)
- Codex CLI Version: 0.144.2 (or similar)
- CodexBar Version: Latest (v0.33.0+)
Issue Description
Summary
CodexBar's local log parser under-reports the total daily/monthly token usage and estimated cost when users run complex tasks. This happens because CodexBar's local scanning logic relies solely on top-level session IDs registered in
~/.codex/session_index.jsonland fails to scan rollout files generated by spawned subagents (child threads).How to Reproduce / Technical Details
~/.codex/sessions/YYYY/MM/DD/rollout-<subagent-session-id>.jsonl~/.codex/session_index.jsonl.session_index.jsonlto locate files to parse. As a result, it completely bypasses the subagent rollout logs, leading to a massive gap in reported vs. actual token usage.Real-world Example from Logs
On July 14, 2026 (local timezone UTC+8), I ran a task that spawned multiple subagents (
Gauss,Hubble,Schrodinger, etc.).The math behind the discrepancy:
019f6137-a3e2-7c72-ace4-126c54369a4a) cost $60.07. Combined with minor VSCode / Exec sessions, it totaled exactly $65.71 (what CodexBar displayed).Gausscosting $52.37,Hubblecosting $52.04,Schrodingercosting $51.23) were completely ignored by CodexBar's scanner because their session IDs were missing fromsession_index.jsonl.Expected Behavior
CodexBar's local parser should scan all
rollout-*.jsonlfiles present in the daily session folders or discover subagent sessions by parsing parent-child relationships (e.g. checkingpayload.source.subagentinsession_metalines of the parent rollout files) instead of relying strictly onsession_index.jsonl.System Environment