Repository navigation
fix: preserve Codex cache usage in Claude messages - #29
Merged
Merged
Conversation
Translate aggregate cache reads and writes into disjoint Anthropic input categories, keeping OpenAI totals and output usage unchanged. Cover terminal SSE, collected responses, optional details and inconsistent counters. Co-Authored-By: Claude Code <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Codex cache usage being reported as ordinary input when using Claude Code through ALC. The upstream response contains aggregate cache details, but the typed usage decoder discarded them and the Messages conversion always emitted zero cache counts.
Validation
input=100/read=0/write=0instead ofinput=20/read=60/write=20). They pass with the fix.u64::MAXboundaries. Original captured fixtures remain unchanged.cargo fmt -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-targets --all-features: 571 unit tests + 66 integration tests passed locally on macOS.Local Rust checks used the separately installed Command Line Tools SDK (
DEVELOPER_DIR=/Library/Developer/CommandLineTools) because the default Xcode installation requires license acceptance; no system configuration was changed.Boundaries
No pricing changes, ledger schema changes, historical JSONL rewriting, or dependency updates. This fixes newly emitted bridge usage. Existing Claude logs cannot recover discarded cache details merely by recalculating prices. Actual Claude Code JSONL persistence / live upstream HTTP behavior was not exercised; coverage here is the production SSE translation/serialization and collection path. No better-ccusage package execution or paid upstream calls were used.
🤖 Generated with Claude Code