Files
multica/server
importcppandimportcpp cf52ba33cc fix(codex): MUL-7374 avoid double-counting reasoning output tokens (#8416)
Codex reports reasoning tokens as a breakdown inside `output_tokens`, but both the
app-server event path and the rollout JSONL fallback added them on top of the
output total, inflating recorded output usage and the usage-based cost estimate.

Consolidate both readers onto one shared conversion that keeps the provider's
inclusive output total, preserving cache-bucket exclusivity, resume baselines and
duplicate-snapshot handling. Add cross-provider contract tests covering both Codex
sources and both Claude result formats.

Verified against a live codex app-server session (codex-cli 0.144.6): the provider's
own totalTokens equals input + output with reasoning not added, and the recorded
buckets now sum to that total exactly. Previously persisted rows are not rewritten.

Co-authored-by: importcpp <[email protected]>
2026-09-15 01:30:58 +08:00
..