Skip to content

cachedWriteTokens missing leading to incorrect inputTokens accounting #509

Description

@joshlarsen

Cache-write tokens are counted as ordinary input

Summary

Codex app-server reports inputTokens inclusive of both cache reads and cache writes. codex-acp currently subtracts cachedInputTokens, but not cacheWriteInputTokens, and does not populate ACP's cachedWriteTokens field at all.

As a result, cache writes are reported as ordinary input and the cache-write count is lost.

Example

Given this Codex usage:

inputTokens: 100
cachedInputTokens: 40
cacheWriteInputTokens: 30
outputTokens: 10
reasoningOutputTokens: 5
totalTokens: 110

Current ACP usage:

inputTokens: 60
cachedReadTokens: 40
cachedWriteTokens: missing <---
outputTokens: 10
totalTokens: 110

Expected ACP usage:

inputTokens: 30
cachedReadTokens: 40
cachedWriteTokens: 30
outputTokens: 10
totalTokens: 110

reasoningOutputTokens remains a subset of outputTokens and is not added to the total again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions