statusLine: cost and duration reset after navigating to agents view and back
Description
When using a custom statusLine script that reads cost.total_cost_usd and cost.total_duration_ms from the stdin JSON payload, both values reset to near-zero after navigating to the agents/subagent panel (down-arrow from the prompt) and then back to the main session view. context_window.* fields (token counts, remaining/used percentage) are unaffected and stay correct across the same navigation.
Per the statusline docs, cost.total_cost_usd is described as "estimated session cost in USD" and total_duration_ms as "total wall-clock time since the session started" - both should be cumulative for the whole session, resetting only on /clear, /compact, or a new session. Switching to the agents view and back doesn't match any of those cases, so this looks like a bug rather than intended behavior.
Steps to reproduce
- Configure a
statusLinecommand script that printscost.total_cost_usdandcost.total_duration_msfrom stdin. - Use the CLI for a while so both values are non-trivial (e.g. cost > $1, duration > 30m).
- Press the down arrow (or otherwise navigate) to the agents/subagent panel.
- Navigate back to the main session view.
- Observe the status line.
Expected behavior
cost.total_cost_usd and cost.total_duration_ms continue reflecting the full cumulative session values.
Actual behavior
Both fields reset to near-zero, while context_window fields (token counts, used/remaining percentage) remain correct and unaffected.
Environment
- Claude Code version: 2.1.211
- OS: macOS (Darwin 25.5.0, Apple Silicon)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗