Skip to content

Remove GPT-5.2 Codex pricing warning#168

Merged
mike1858 merged 1 commit into
mainfrom
remove-gpt-52-codex-warning
May 30, 2026
Merged

Remove GPT-5.2 Codex pricing warning#168
mike1858 merged 1 commit into
mainfrom
remove-gpt-52-codex-warning

Conversation

@mike1858
Copy link
Copy Markdown
Member

@mike1858 mike1858 commented May 30, 2026

Summary

  • Remove the special GPT-5.2 Codex pricing warning from Codex CLI parsing
  • Remove the now-unused yellow warning helper

Verification

  • cargo fmt --all --quiet
  • cargo build --quiet
  • rg check for removed warning strings

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved accuracy of token cost calculations by properly normalizing cached read tokens for models with caching support.
  • New Features

    • Added support for semantic understanding of how different models handle input tokens, particularly for cached token scenarios.
  • Configuration Changes

    • Updated caching support configuration schema for improved clarity and consistency.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@mike1858, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 6 minutes and 44 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 81c1198d-f54b-4e66-b6f5-8ee95f7252fd

📥 Commits

Reviewing files that changed from the base of the PR and between b8a1e4e and 9d56ec2.

📒 Files selected for processing (2)
  • src/analyzers/codex_cli.rs
  • src/utils.rs
📝 Walkthrough

Walkthrough

This PR introduces an InputTokenSemantics enum to distinguish how different models report input token counts (whether cached-read tokens are included), refactors the CachingSupport enum variant naming from Google to Tiered, integrates token normalization into the analyzer pipeline, and removes deprecated warning utilities. The changes span type definitions, model configuration defaults, token calculation logic, and test fixtures.

Changes

Input Token Semantics Refactor

Layer / File(s) Summary
Input Token Semantics and CachingSupport Schema
src/models.rs
Introduces InputTokenSemantics enum with IncludesCacheReads and ExcludesCache variants. Replaces CachingSupport::Google(TieredCaching) with CachingSupport::Tiered(TieredCaching). Adds input_token_semantics: InputTokenSemantics field to ModelInfo with serde default.
Model Semantics Configuration
src/models.rs
Adds input_token_semantics_for_model(model_name: &str) helper to derive semantics from model name patterns. Extends populate_defaults macro to set input_token_semantics for all built-in models. Updates built-in model table entries to use CachingSupport::Tiered(...). Sets :free tier model to InputTokenSemantics::ExcludesCache.
Token Normalization in Analyzer
src/analyzers/piebald.rs, tests/analyzers/*
Imports InputTokenSemantics. Adds normalize_input_tokens(model, input_tokens, cache_read_tokens) helper that performs saturating subtraction when semantics indicate cached reads are included. Integrates normalization into convert_messages to derive normalized input_tokens for each message. Includes unit tests covering subtraction, preservation, and saturation behaviors across model types.
Validation and Cost Computation Updates
src/models.rs
Updates tier-bound validation to apply when CachingSupport::Tiered(...) is used. Updates cache cost computation branching to handle CachingSupport::Tiered(...) variant.
Test Fixture Alignment
src/models.rs
Updates all ModelInfo test fixtures to construct with input_token_semantics: InputTokenSemantics::default(). Adjusts cache-tier pointer-identity test to match CachingSupport::Tiered(...) variant naming.
Utility Function Cleanup
src/utils.rs, src/analyzers/codex_cli.rs
Removes exported warn_once_yellow(message) function from utils. Removes import of warn_once_yellow from codex_cli. Removes special-case warning branch for gpt-5.2-codex from SessionModel::explicit, leaving it to directly return Self { name }.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Poem

A rabbit hops through token streams so bright,
Semantics sorted, cached reads set right,
No golden warnings echo through the night,
Just clean abstractions, pure and tight! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main objective: removing the GPT-5.2 Codex pricing warning, which is confirmed by the PR description, commit messages, and code changes in codex_cli.rs.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-gpt-52-codex-warning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mike1858 mike1858 force-pushed the remove-gpt-52-codex-warning branch from b8a1e4e to 9d56ec2 Compare May 30, 2026 01:31
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/analyzers/piebald.rs (1)

153-162: ⚡ Quick win

Short-circuit normalization when no cache-read tokens are present.

You can return early when cache_read_tokens == 0 to avoid an unnecessary model lookup on the common path.

♻️ Suggested patch
 fn normalize_input_tokens(model: Option<&str>, input_tokens: u64, cache_read_tokens: u64) -> u64 {
+    if cache_read_tokens == 0 {
+        return input_tokens;
+    }
+
     if model
         .and_then(get_model_info)
         .is_some_and(|info| info.input_token_semantics == InputTokenSemantics::IncludesCacheRead)
     {
         input_tokens.saturating_sub(cache_read_tokens)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/analyzers/piebald.rs` around lines 153 - 162, In normalize_input_tokens,
short-circuit and return input_tokens immediately when cache_read_tokens == 0 to
avoid the model lookup; i.e., at the top of normalize_input_tokens check if
cache_read_tokens == 0 and return input_tokens, otherwise proceed with the
existing get_model_info(...).is_some_and(|info| info.input_token_semantics ==
InputTokenSemantics::IncludesCacheRead) logic to conditionally subtract
cache_read_tokens.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/analyzers/piebald.rs`:
- Around line 153-162: In normalize_input_tokens, short-circuit and return
input_tokens immediately when cache_read_tokens == 0 to avoid the model lookup;
i.e., at the top of normalize_input_tokens check if cache_read_tokens == 0 and
return input_tokens, otherwise proceed with the existing
get_model_info(...).is_some_and(|info| info.input_token_semantics ==
InputTokenSemantics::IncludesCacheRead) logic to conditionally subtract
cache_read_tokens.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ea1e440c-7f07-4582-a696-9d79bc100bc9

📥 Commits

Reviewing files that changed from the base of the PR and between 6c060b7 and b8a1e4e.

📒 Files selected for processing (4)
  • src/analyzers/codex_cli.rs
  • src/analyzers/piebald.rs
  • src/models.rs
  • src/utils.rs
💤 Files with no reviewable changes (1)
  • src/utils.rs

@mike1858 mike1858 enabled auto-merge (squash) May 30, 2026 01:32
@mike1858 mike1858 merged commit 606df53 into main May 30, 2026
6 checks passed
@mike1858 mike1858 deleted the remove-gpt-52-codex-warning branch May 30, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant