Feat: Add Codex tiered and priority pricing#917
Conversation
6394cc9 to
aa892b5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6394cc9012
ℹ️ 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".
| var forkedFromId: String? | ||
| var inheritedTotals: CostUsageCodexTotals? | ||
| var remainingInheritedTotals: CostUsageCodexTotals? | ||
| var currentTurnID: String? |
There was a problem hiding this comment.
Persist the Codex turn across incremental scans
When scanCodexFile resumes from a cached parsedBytes offset, parseCodexFile restores initialModel and initialTotals but this new currentTurnID always starts as nil. If CodexBar scans while a priority turn is still being appended, the cached prefix may already contain the task_started event and later token_count rows commonly rely on that state instead of repeating turn_id; those newly appended rows then get cached with turnID == nil, so codexPrioritySurchargeUSD never applies priority pricing for the rest of that turn until a full rescan.
Useful? React with 👍 / 👎.
f838e59 to
7188fe8
Compare
7188fe8 to
70c6487
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70c6487f85
ℹ️ 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".
| sinceDayKey: range.sinceKey, | ||
| untilDayKey: range.untilKey) |
There was a problem hiding this comment.
Include adjacent days when loading priority turn metadata
loadCodexDaily fetches priority turn metadata only for range.sinceKey...range.untilKey, but Codex token rows can land on a new day while still belonging to a turn that started just before midnight. In that cross-day case, rows for the report day keep the prior turn ID, but priorityTurns omits that turn, so Fast/Priority surcharge is silently skipped for those rows. This under-reports cost for overnight sessions and can be fixed by loading priority metadata over the scanner window (scanSinceKey/scanUntilKey) or another boundary-safe span.
Useful? React with 👍 / 👎.
Summary
<=272,000input tokensValidation