Skip to content

Price free Codex Auto-review requests at $0 - #4453

Merged
steipete merged 7 commits into
steipete:mainfrom
gabrielrojasc:bugfix/codex-auto-review-unmetered
Oct 12, 2026
Merged

steipete merged 7 commits into
steipete:mainfrom
gabrielrojasc:bugfix/codex-auto-review-unmetered

Conversation

@gabrielrojasc

@gabrielrojasc gabrielrojasc commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4452.

Summary

A codex-auto-review request is now priced at an exact $0, instead of left unpriced, when both hold:

  • its timestamp is at or after 2026-10-06T07:00:00Z (midnight US Pacific on the day OpenAI made Auto-review free for ChatGPT sign-in);
  • its rollout's leaf session_meta has a non-empty creator_account_id. Codex sets that field only for ChatGPT-backed auth, so API-key sessions don't have it.

Its tokens stay in day, model, session, and project totals. Auto-review stops turning the Usage & Spend Codex cost into a lower bound. An explicit custom-pricing rate for codex-auto-review still wins over $0.

 codexSessionMetadata(from:)
+  hasCreatorAccount = non-blank payload.creator_account_id, set from the leaf session_meta only
+                      -> CostUsageCodexSessionMetadata (cached per file, kept through dedupe filtering)

 buildCodexReportFromCache
+  report-time copy of each row: isIncludedInPlan =
+    hasCreatorAccount && knownCostNanos == nil && ts >= cutoff && model == codex-auto-review
+    && no custom-pricing rate for the row's priced model
+  any day/model group holding an included row -> requestPricingEvidenceGroups (no aggregate list price)

 codexRowCostBreakdown
+  included row -> tokens counted, priced request, cost exactly 0

 makeCodexBilledDayEntry
+  rows cover the group and include free requests -> no aggregate list-price fallback; group recorded in includedGroups

 addCodexHourly
+  included row in an includedGroups group -> exact 0 in hourly and quota slices
+  included row with tokens elsewhere -> unpriced, never list-priced
  • Unknown stays unknown. These keep a request unpriced: no creator_account_id, a blank one, no request timestamp, a cache entry written before the flag existed, or model/day rows that don't account for the billed tokens. Auto-review before the cutoff and every other unpriced model are unchanged.
  • No list price for uncovered groups. When a group's rows don't account for its billed tokens, a free request in it stays unpriced in the day, hourly, and quota-window totals. The aggregate fallback never applies a models.dev or bundled price to a group that holds a free request.
  • Leaf only. Only the rollout's leaf session_meta sets the flag, matching Codex, which never updates creator_account_id on resume. A session_meta appended later can't turn an API-key session into a free one, and incremental and full parses agree.
  • Cutoff per request. The cutoff compares request instants, not day keys, because day keys follow the statistics time zone.
  • Pricing precedence. For eligible requests the order is custom overlay, then the Auto-review waiver ($0), then models.dev, then bundled rates. docs/model-pricing.md gives custom overlays precedence over dated pricing changes, and the waiver is one. With a codex-auto-review (or openai/codex-auto-review) overlay entry, the request is priced like any custom-priced request, including the day's aggregate estimate when its rows don't cover the day. Without one, models.dev and bundled prices never apply. A retained authoritative amount (knownCostNanos) still wins.
  • Why not unmetered. Quota windows, the CLI host text, and the inline dashboard read unmeteredRequestCount > 0 as "tokens missing from totals", because missing-parent forks use it that way. Free auto-review tokens are in the totals, so a priced $0 keeps those views exact. Fork accounting is unchanged.
  • Not persisted. isIncludedInPlan exists only on report-time copies. Stored rows don't change.
  • Cache. Parser revision 13 reparses files in the scan window once to record the flag. The new parser hash is 6eedcbb17b6035b4. The f406dae284de4a55 store is adopted without a rebuild. Until the catch-up finishes, the previously retained report (with ≥) can still show, which only over-reports.

Known limitations

  • Codex Models analytics and the Workspaces view (CodexLocalProjectUsageIndexer, CodexWorkspaceUsageSidecar) rebuild session metadata from sidecar columns that don't carry the flag. They still count auto-review as unpriced. Fixing that needs a sidecar schema change, so it's out of scope here.
  • Coverage counts drop on days that become fully priced. A fully priced Codex day counts as one priced unit in coverageCounts, while a partial day counts requests (the convention from Keep priced Codex subtotals when some requests are unpriced #4279). On real history, the "priced" count drops from 9,510 to 7,065 because Oct 7 to 11 are now fully priced. Dollar and token totals don't change.

Evidence

Shipped CLI before and after, synthetic history. Three synthetic rollouts, with invented ids and token counts and no personal history:

  • a ChatGPT session on Oct 8 (fake creator_account_id) with one gpt-5.4 request and two codex-auto-review requests;
  • an API-key-like session on Oct 9 (no creator_account_id) with one codex-auto-review request;
  • a ChatGPT session on Oct 4, before the cutoff, with one codex-auto-review request.

"Before" is the shipped CodexBarCLI 0.74.0 (/Applications/CodexBar.app/Contents/Helpers/CodexBarCLI, parser hash f406dae284de4a55). "After" is swift build --product CodexBarCLI at 636af1f1f (parser hash 6eedcbb17b6035b4). Both ran cost --provider codex --days 30 in JSON and text. The "custom" runs add {"codex-auto-review":{"input":1.25,"output":10,"cacheRead":0.125}} as custom-pricing.json in the temporary HOME.

run Oct 4 auto-review (ChatGPT, before cutoff) Oct 8 auto-review (ChatGPT) Oct 8 gpt-5.4 Oct 9 auto-review (API key) 30-day cost priced / unpriced
before unpriced unpriced $0.2350 unpriced $0.2350 1 / 4
after unpriced $0.0000 $0.2350 unpriced $0.2350 1 / 2
before, custom rate $0.0405 $0.1215 $0.2350 $0.0945 $0.4915 3 / 0
after, custom rate $0.0405 $0.1215 $0.2350 $0.0945 $0.4915 3 / 0

Text output changes from Partial estimate: 4 recorded requests had no price. to Partial estimate: 2 recorded requests had no price.. The two left are the API-key and pre-cutoff requests. Oct 8 becomes fully priced, so it counts as one priced unit. With a custom rate, results match the shipped CLI.

Each run used a fresh HOME with HOME, CFFIXED_USER_HOME, CODEX_HOME, and CODEXBAR_CONFIG pointed into it, plus CODEXBAR_DISABLE_KEYCHAIN_ACCESS=1, as in Scripts/test_dashboard_private_accounts.py. sandbox-exec denied reads and writes to the live CodexBar Application Support and Caches directories, ~/.codex, and ~/.codexbar. Nothing under the live directories changed during the runs, and each CLI wrote its cost cache and models.dev catalog under the temporary HOME.

Reproduce

Write the fixtures with this script (python3 -I gen_fixture.py "$HOME_UNDER_TEST/.codex"):

import json, sys
from pathlib import Path

SESSIONS = [
    ("2026/10/08/rollout-2026-10-08T16-00-00-00000000-0000-4000-8000-00000000000a.jsonl",
     "00000000-0000-4000-8000-00000000000a", "acct-synthetic-0001", "2026-10-08T19:00:00Z",
     [("gpt-5.4", [(100_000, 20_000, 2_000)]), ("codex-auto-review", [(50_000, 0, 500), (40_000, 0, 400)])]),
    ("2026/10/09/rollout-2026-10-09T16-00-00-00000000-0000-4000-8000-00000000000b.jsonl",
     "00000000-0000-4000-8000-00000000000b", None, "2026-10-09T19:00:00Z",
     [("codex-auto-review", [(70_000, 0, 700)])]),
    ("2026/10/04/rollout-2026-10-04T16-00-00-00000000-0000-4000-8000-00000000000c.jsonl",
     "00000000-0000-4000-8000-00000000000c", "acct-synthetic-0001", "2026-10-04T19:00:00Z",
     [("codex-auto-review", [(30_000, 0, 300)])]),
]

for file, sid, creator, ts, turns in SESSIONS:
    meta = {"id": sid, "timestamp": ts, "cwd": "/tmp/synthetic-project", "originator": "codex_cli_rs"}
    if creator:
        meta["creator_account_id"] = creator
    records = [{"type": "session_meta", "timestamp": ts, "payload": meta}]
    for index, (model, usages) in enumerate(turns):
        records.append({"type": "turn_context", "timestamp": ts, "payload": {"model": model}})
        records.append({"type": "event_msg", "timestamp": ts,
                        "payload": {"type": "task_started", "turn_id": f"{sid}-turn-{index}"}})
        for input_tokens, cached, output in usages:
            records.append({"type": "event_msg", "timestamp": ts, "payload": {"type": "token_count", "info": {
                "last_token_usage": {"input_tokens": input_tokens, "cached_input_tokens": cached,
                                     "output_tokens": output}}}})
    path = Path(sys.argv[1]) / "sessions" / file
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_text("".join(json.dumps(r) + "\n" for r in records))

Then run each CLI against its own fresh HOME:

H=$(mktemp -d)
mkdir -p "$H/.codex" "$H/.codexbar"
python3 -I gen_fixture.py "$H/.codex"
echo '{"version":1,"providers":[{"id":"codex","enabled":true}]}' > "$H/.codexbar/config.json"
# Custom-rate runs only:
# mkdir -p "$H/Library/Application Support/CodexBar"
# echo '{"codex-auto-review":{"input":1.25,"output":10,"cacheRead":0.125}}' > "$H/Library/Application Support/CodexBar/custom-pricing.json"
env -i HOME="$H" CFFIXED_USER_HOME="$H" CODEX_HOME="$H/.codex" CODEXBAR_CONFIG="$H/.codexbar/config.json" \
  PATH=/usr/bin:/bin SHELL=/bin/sh CODEXBAR_DISABLE_KEYCHAIN_ACCESS=1 CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 \
  "$CLI" cost --provider codex --days 30 --format json --pretty

Real history, before and after, from an earlier head. This run predates rounds 1 and 2 (the uncovered-group fix and the custom-rate precedence) and was not repeated. I ran the in-process scanner over a real ~/.codex history, read-only. Each run used its own temporary cache root and suppressed Keychain access, so it didn't touch the app's live cache. Builds came from main (444821be5) and from this branch at 6ee04fb84, run back to back for month to date. The third run upgraded a copy of the main store in place.

run parser hash (earlier head) totalCost priced unpriced unmetered auto-review tokens
main f406dae284de4a55 $298.33 9,510 1,423 0 153,341,522
6ee04fb84, fresh cache 81dc6c7f80a36d94 $298.33 7,065 731 0 153,341,522
6ee04fb84, adopted main store 81dc6c7f80a36d94 $298.33 7,065 731 0 153,341,522

The 731 requests still unpriced are auto-review requests from Oct 1 to 6, before the cutoff. Days with unpriced requests go from Oct 1 to 11 down to Oct 1 to 6.

New tests. Each was written before the fix, and the suites fail with the fix disabled.

  • CostUsageCodexAutoReviewTests, after the cutoff in a ChatGPT session:
    • auto-review is priced at $0, keeps its tokens, and gives exact $0 hourly and quota slices;
    • the quota window has complete tokens and cost;
    • a missing-parent fork on the same day keeps fork semantics.
  • CostUsageCodexAutoReviewTests, what stays unpriced:
    • auto-review before the cutoff;
    • no creator account, an empty one, or a blank one;
    • an API-key file next to a ChatGPT file on the same day and model (only the ChatGPT one is free);
    • another unpriced model;
    • a group whose rows don't account for the billed tokens, whether reconciliation drops the rows or they undercount the day, despite a catalog price.
  • CostUsageCodexAutoReviewTests, pricing details:
    • two requests on either side of the cutoff instant on one day split;
    • a priced model next to free auto-review keeps the exact subtotal;
    • a models.dev price is ignored;
    • an explicit custom rate (bare or openai/ key) prices the request in the day, model breakdown, hourly, and quota slices, and coverage counts it as priced;
    • a custom row missing a consumed token class leaves the request unpriced;
    • with a custom rate, an uncovered group reports exactly what an API-key session reports, the custom-rate aggregate estimate;
    • a Priority-mode free row gets $0 Priority cost;
    • a retained knownCostNanos wins;
    • a row without eventIndex keeps the day unpriced and no slice claims $0.
  • CostUsageCodexAutoReviewTests, caching and parsing:
    • a stale parser-revision cache migrates;
    • an appended same-id session_meta with a creator gives the same result from incremental and full parses;
    • two files sharing one session give identical reports across three refreshes.
  • SpendDashboardCodexAutoReviewTests builds its report through the scanner. It checks that the dashboard shows no partial cost and no ≥, and that CLI JSON coverage has zero unpriced and unmetered requests.

Commands run:

make check                      # parser hash current (6eedcbb17b6035b4), 0 violations
make test-fast FILTER='CostUsageCodexAutoReviewTests|SpendDashboardCodexAutoReviewTests|CostUsageCodexPartialPricingTests|CostUsageScannerForkSplitTests|CostUsageCodexSourceRecoveryTests|CostUsageStoreTests'   # 137 passed
make test-fast FILTER='CostUsage|SpendDashboard|CLICost|CostHistory|QuotaWindow|InlineUsage'   # 1528 + 68 passed

make test stops at AmpUsageParserTests "parses current amp subscription line and keeps credits detail". That test fails the same way on main (444821be5) and is unrelated to this change.

Merge Danger

Door: two-way

Stored rows don't change. The flag lives in cached session metadata, and the classification happens at report time. Reverting restores the previous rule after the next parser-hash reparse.

Blast Radius: Codex costs

On days with codex-auto-review requests after 2026-10-06 in ChatGPT sessions, those requests move from unpriced to priced at $0. A day with no other unpriced requests stops reading as a partial estimate, and its coverage count follows the fully priced day convention. Dollar totals and token totals don't change. Users with a custom rate for codex-auto-review keep it. API-key sessions, earlier days, other models, fork accounting, and other providers are unchanged. Every user does a one-time bounded reparse of files in the scan window.

Auto-review checks stopped drawing from ChatGPT plan usage on 2026-10-06.
Price codex-auto-review requests at exactly $0 when the request is at or
after the cutoff and the rollout's leaf session_meta has creator_account_id.
API-key sessions, earlier requests, and unreconciled rows stay unpriced.
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T02:35:00.735649Z 636af1f New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR prices eligible Codex Auto-review requests at $0 while preserving tokens, saved monetary amounts, and explicit custom rates.

Example: An October 8 ChatGPT-created rollout contains two Auto-review requests alongside $0.2350 of other usage.

  • Before: The Auto-review requests are unpriced, making the cost a partial estimate.
  • After: The Auto-review requests cost $0, and the $0.2350 subtotal becomes complete.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, owner-backed shared-core repair with CLI evidence, focused coverage, and compatible cache adoption.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied isolated CodexBarCLI cost JSON/text runs exercise eligible $0 pricing, API-key-like and pre-cutoff uncertainty, and unchanged custom-rate totals; the maintainer’s current head records synthetic CLI verification of the shared-path implementation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Free Auto-review requests make otherwise priced Codex usage appear incomplete.
Reason: The maintainer accepted the pricing inference and implemented a smaller shared-path repair; the documented Workspaces/Models sidecar limitation is outside the linked dashboard and CLI problem.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a current cost-reporting bug, and the maintainer’s new commits resolve the previous pricing-policy decision. No actionable introduced defect remains.

Priority: P2
Reviewed head: 5f2af7566de5ad6ff3dfaed18eb7ea60394d9f61

Before merge

None.

Findings

None.

Agent review details

How this fits together

The shared local-cost scanner reads Codex rollout metadata and token records, retains accounting in SQLite, and produces reports consumed by the CLI and Usage & Spend dashboard.

flowchart TD
  A[Codex rollout files] --> B[Shared scanner]
  B --> C[SQLite cost cache]
  C --> D[Report time pricing]
  E[Custom pricing overlay] --> D
  D --> F[Cost CLI]
  D --> G[Usage and Spend dashboard]
Loading

Technical review

Best possible solution:

Land the scoped shared-scanner fix with the accepted pricing assumptions and existing custom-rate and cache-preservation contracts.

Do we have a high-confidence way to reproduce the issue?

The affected-release report, supplied before/after CLI output, and main’s unresolved-price path establish the lower-bound behavior; this read-only review ran no target code.

Is this the best way to solve the issue?

The current implementation uses the existing request-pricing owner, retains uncertain historical rows, and prevents uncovered free groups from falling back to list prices.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e92d0ed0ff03.

Provenance checked

  • Report-time pricing keeps the original intent (0aafe2b: Resolve estimates when reports are read rather than freezing whichever catalog loaded during scanning.)
  • Unknown-price and subtotal handling changes intended behavior with a stated reason (7881d2b: Preserve known subtotals while retaining uncertainty for historical rows without proven pricing.)
  • Filtered session metadata keeps the original intent (ea4d37a: Preserve canonical accounting and matching pricing while dropping duplicate presentation metadata.)
  • Custom-pricing precedence keeps the original intent (Integrate spend reporting series (#3015–#3019) #3026: Explicit overlays precede catalog estimates; incomplete rates remain unknown and explicit zero remains free.)
  • Leaf ownership and replay metadata keeps the original intent (9e48be0: Keep leaf identity and owned request accounting authoritative across copied prefixes and cached tails.)
  • SQLite accounting authority keeps the original intent (26fd0bb: Keep scanner accounting and report consumers on one SQLite persistence authority.)
  • Hourly and quota completeness keeps the original intent (b1f14ba: Use request timestamps and keep token completeness independent from monetary completeness.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0aafe2b adds Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+PricingRows.swift:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0aafe2b80563; files: Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+PricingRows.swift)
  • Gabriel Rojas: Raw commit 7881d2b adds Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+CacheHelpers.swift:173 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7881d2b86c1e; files: Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+CacheHelpers.swift)
  • Yuxin Qiao: Raw commit 4f8fba1 adds Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+CacheHelpers.swift:156 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4f8fba170bc7; files: Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+CacheHelpers.swift)

Review metrics

Metric Value Why it matters
Change distribution Production +58/-60; tests +116/-0; documentation +19/-0 The shared-path simplification keeps production code slightly smaller while adding focused eligibility, coverage, and adoption tests.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #4452
Summary: This PR owns the shared-scanner fix for the linked Auto-review cost-completeness report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 other: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: The bug misrepresents cost completeness while preserving recorded tokens and known monetary subtotals.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-12T00:15:15.275Z sha a10b9a0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T01:42:08.506Z sha 9999786 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T02:30:48.652Z sha 636af1f :: blocked before merge. :: none

Reviewed October 12, 2026, 12:21 AM ET / 04:21 UTC (Revision 4).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ee04fb846

ℹ️ 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".

A model/day group whose rows don't account for its billed tokens fell back
to the aggregate list price when it held a free Auto-review request, and
its hourly slices list-priced that request. Free requests now block the
aggregate fallback and stay unpriced outside honored groups; a free
request without tokens is still an exact $0.
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Oct 12, 2026
Custom-pricing overlays keep precedence over dated pricing changes, and
the 2026-10-06 Auto-review waiver is one. An eligible request whose model
has a custom rate is now priced at that rate, like any custom-priced
request; models.dev and bundled rates still never apply to it.
@gabrielrojasc

Copy link
Copy Markdown
Contributor Author

Re: ClawSweeper review

Custom rates. My decision as the author is to keep explicit custom rates. If custom-pricing.json has a codex-auto-review (or openai/codex-auto-review) entry, eligible requests are priced at that rate. Otherwise they cost $0, and models.dev and bundled prices never apply. docs/model-pricing.md gives custom overlays precedence over dated pricing changes, and the 2026-10-06 waiver is one. Changed in 636af1f1f; docs, changelog, and tests are updated.

Shipped CLI proof. cost --provider codex --days 30 on synthetic rollouts: a ChatGPT session on Oct 8 with one gpt-5.4 request and two Auto-review requests, an API-key-like session on Oct 9, and a ChatGPT session on Oct 4, before the cutoff. "Before" is the shipped CodexBarCLI 0.74.0. "After" is swift build --product CodexBarCLI at 636af1f1f. Custom runs add {"codex-auto-review":{"input":1.25,"output":10,"cacheRead":0.125}}.

run Oct 4 auto-review (before cutoff) Oct 8 auto-review (ChatGPT) Oct 8 gpt-5.4 Oct 9 auto-review (API key) 30-day cost priced / unpriced
before unpriced unpriced $0.2350 unpriced $0.2350 1 / 4
after unpriced $0.0000 $0.2350 unpriced $0.2350 1 / 2
before, custom rate $0.0405 $0.1215 $0.2350 $0.0945 $0.4915 3 / 0
after, custom rate $0.0405 $0.1215 $0.2350 $0.0945 $0.4915 3 / 0

Text output goes from Partial estimate: 4 recorded requests had no price. to Partial estimate: 2 recorded requests had no price.. The two left are the API-key and pre-cutoff requests.

env -i HOME="$H" CFFIXED_USER_HOME="$H" CODEX_HOME="$H/.codex" CODEXBAR_CONFIG="$H/.codexbar/config.json" \
  PATH=/usr/bin:/bin SHELL=/bin/sh CODEXBAR_DISABLE_KEYCHAIN_ACCESS=1 CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 \
  "$CLI" cost --provider codex --days 30 --format json --pretty   # and --format text

Each run used a fresh temporary $H. sandbox-exec denied access to the live CodexBar directories, ~/.codex, and ~/.codexbar. The fixtures are synthetic, so no personal history is published. The fixture script and full steps are in the PR body under Evidence.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Oct 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 636af1f1f1

ℹ️ 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".

CostUsagePricing.normalizeCodexModel(row.model) == self.autoReviewModel
else { return false }
let pricedModel = CostUsageScanner.codexPricedModel(for: row, priorityTurns: priorityTurns)
return customPricing.rates(providerID: CostUsagePricing.codexModelsDevProviderID, model: pricedModel) == nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply custom rates to retained Auto-review rows

When an otherwise eligible Auto-review row carries unpricedTokens from source recovery or a parser-revision migration, finding a custom rate here makes isIncluded false but does not remove that retained marker. codexRowCostBreakdown then treats the row as isMarkedUnpriced and skips codexResolvedCostUSD, so the explicit codex-auto-review overlay added by this change never applies and the request remains unknown; handle this custom override before the retained-marker guard or clear the marker on the report-time copy.

Useful? React with 👍 / 👎.

steipete and others added 2 commits October 11, 2026 20:35
Reuse exact request pricing for eligible Auto-review without losing tokens.
Keep leaf creator metadata, bounded parser migration, and focused regression
coverage; document the accepted cutoff and creation-time auth limitation.
Remove redundant metadata initialization and timestamp merge helpers.

Fixes steipete#4452
Refs steipete#4453

Co-authored-by: Gabriel Rojas <[email protected]>
Incorporate the contributor's custom-rate precedence and uncovered-group
corrections without restoring the separate included-usage subsystem.
Resolve free requests through the shared pricing path and keep hourly
coverage incomplete when the daily group cannot price its request rows.
Retain explicit user rates, saved amounts, and the existing token totals.

Verified 290 focused tests and synthetic cost CLI output. Production stays
below the base line count; the complete suite is running separately.

Fixes steipete#4452
Refs steipete#4453

Co-authored-by: Gabriel Rojas <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Oct 12, 2026
@steipete
steipete merged commit db753e8 into steipete:main Oct 12, 2026
3 checks passed
@steipete

Copy link
Copy Markdown
Owner

Thanks @gabrielrojasc! Maintainer fixes are pushed to your branch at 5f2af75, preserving your commits, including the custom-rate and uncovered-group corrections. The implementation now reuses the shared pricing resolver with a report-only eligibility flag; production is net −2 lines against main, and the test addition is 116 lines. The credited changelog entry is under 0.74.2 Unreleased, and the docs state the accepted cutoff assumption and creation-time auth limitation.

Merged into main as db753e8. The regression fails on main and passes here; all 290 focused tests and all 1,655 full-suite selections pass, as do make check and autoreview. The synthetic CLI reports $0 with unchanged tokens and no unpriced requests. CI passed on this exact head: https://github.com/steipete/CodexBar/actions/runs/38202794457. Fixes #4452.

HappyArkAsylum pushed a commit to HappyArkAsylum/Win-CodexBar that referenced this pull request Oct 17, 2026
Requests for codex-auto-review in a rollout whose session_meta names a ChatGPT creator_account_id, at or after 2026-10-06T07:00Z, are keyed apart as included usage. They keep their tokens in totals, price at exactly zero, and are not listed as unpriced. Explicit custom prices still apply. Other requests are unchanged. Bump the Codex cache schema to 7 so cached aggregates are rebuilt. Upstream steipete#4452, steipete#4453.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex cost shows ≥ for free Auto-review requests (free for ChatGPT sign-in since 2026-10-06)

2 participants