Repository navigation
fix: correct underreported token totals in Codex Security scans - #1657
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac1689efb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac1689efb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
kmbroai
left a comment
There was a problem hiding this comment.
Reviewed worker retry/recovery accounting, inherited child history, per-response versus legacy counters, compaction, cached input/output, and completion-turn finalization including failure and cancellation paths. No blocking findings. The implementation stays within the existing accounting and workbench boundaries; the larger diff is primarily regression coverage.
Validated locally: 69 Python usage tests; 247 SDK API/finalization tests passed with 4 platform-specific skips; 26 custom-validation tests; MCP smoke test; SDK build:ci; plugin source compatibility and its 9 tests. Latest node-ci run 38845045232 is successful on this SHA. Desktop adoption of the finalization handoff remains a separate rollout requirement, as documented.
Summary
Codex Security reports how many tokens a scan used, but its accounting can miss work that actually ran. A completed scan can therefore show an "at least … tokens" lower bound instead of a complete total.
This PR fixes the accounting behind that message rather than just changing the wording. It recovers recorded usage from earlier worker attempts, includes context summarization, and lets the SDK and compatible hosts finish counting the scan's final response after it ends. The goal is a trustworthy total for understanding scan usage and comparing runs—not presenting an incomplete count as exact.
Changes
Testing
native/prebuilt/COPYRIGHT-library.html).Risk and rollout
Public disclosure review