Skip unchanged native Codex token snapshots - #10531
Open
Brams-s wants to merge 1 commit into
Open
Conversation
This was referenced Sep 6, 2026
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.
Native Codex can emit another
token_countnotification when quota information changes while retaining the previous request'slast_token_usageandtotal_token_usage. The collector adds that request again: a 100-input/10-output request followed by an unchanged usage notification currently produces 220 tokens and two prompts instead of 110 tokens and one prompt.Track the last counted cumulative snapshot within each rollout and skip unchanged snapshots. Requests with equal token counts still count when cumulative usage advances; changed/reset counters and records without cumulative counters retain their existing behavior. Cache schema version 2 invalidates totals generated before this correction, including on
--limits-onlyrefreshes.This is limited to repeated native notifications. Pi inherited-message handling remains in #8602; its patch applies cleanly alongside this change. The model-aware hourly view discussed in #9204 remains a separate follow-up to #8862.
Validation:
git diff --checkpass../test/all: CLI suite passes; 226/228 shell test files pass. The two failures reproduce on an untouched checkout of basea62e34ea:bin-style-test.shflags existing raw command checks inomarchy-remove-ai-hermes/omarchy-remove-ai-openclaw;launch-about-test.shfails “a roomy window animates.”