[Bug]: Initial Codex Fast turns are counted as Standard when the rollout omits settings #15267
Before submitting#
- I searched existing issues and did not find a duplicate of this usage-history defect.
- I included reproduction steps and verified provider evidence.
Area#
apps/server — Usage history
Steps to reproduce#
- Use a build containing #15101 with Codex app-server 0.160.0.
- Start a new Codex thread with Fast selected (
serviceTier: "priority"). - Complete its first turn, then open Usage and inspect the model's Cost by speed.
- Compare the provider submission with the session rollout. In affected sessions, Codex receives the priority tier but the rollout contains
session_meta,turn_context, andtoken_countrecords without an initialthread_settings_appliedevent. - A second turn can introduce that settings event; a single-turn session may never contain it.
Expected behavior#
Usage with historical evidence that it requested priority is classified and priced as Fast, including the initial turn. Later native tier changes still take precedence. A later Fast setting or today's configuration must not be used to guess earlier usage.
Actual behavior#
The scan initializes CodexScanState.speed to standard and only updates it from thread_settings_applied. Initial Fast usage therefore appears as Standard and is priced at the lower rate. Updating or rescanning does not recover a settings event that was never written.
#15101 fixed reading existing settings events, but did not cover this missing-initial-event case. Its tier test currently expects Standard before the first settings event.
Supporting evidence#
Sanitized timeline from an affected session (UTC):
20:13:44 Codex TurnInput submission: service_tier = Some(Some("priority"))
20:13:49.782 rollout turn_context for the first turn
token_count events; no preceding thread_settings_applied
20:14:27.934 first thread_settings_applied: service_tier = priority
20:14:27.945 turn_context for the second turn
A separate single-turn session also received priority but never wrote a settings event. T3's saved historical run selections independently record priority.
In one 24-hour sample, 335 usage records across 12 sessions were recorded before any settings event despite historical priority selections. Those records contributed $7.73 at Standard rates. The issue concerns the local estimate and speed classification; this is not a claim about the provider's invoice.
The sample also contained delegated sessions without a requested Fast tier. Those are a separate behavior and are excluded from this report.
Impact#
Incorrect usage estimates and speed breakdowns, especially for many short or single-turn threads.
Version or commit#
Reproduced after #15101 (56914128c1); the parser still has this behavior on main at 77823bd102ae50430d4acda9a553e5743d2aa5ba.
Environment#
macOS; Codex app-server 0.160.0; GPT-6.1 Sol; T3's server-side usage scanner. The shared server result is consumed by web, desktop, and mobile.
Workaround#
None verified. Sending another turn only supplies metadata for subsequent usage; it does not establish the initial turn's historical tier.
juliusmarminge added labelsbug
juliusmarminge added labelscodex
juliusmarminge added labelsvia-triage
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Thanks for the report. One part of this is fixed on main in #21898 and #21899. Please test on the nightly built from main on 2026-10-21, or on the next stable release. One part is still open: imported V1 histories without retained V2 attempts. If that part still matters to you, please open a new issue for that part only.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Triage#
Thanks @PixPMusic for the careful timeline and the sample numbers. I confirmed this on
mainat77823bd102. It's a follow-up to merged #15101, not a duplicate. That change prices a Codex rollout fromthread_settings_applied, but it never sees the tier for usage that happens before the first persisted settings event.What's happening
turn/startemitsThreadSettingsAppliedwithsend_event_raw_without_materializing_rollout. The live submission can carryservice_tier: prioritywhile the rollout only getssession_meta,turn_context, andtoken_count, andturn_contexthas no service tier.initialCodexScanStatestartsspeedat"standard"and only updates it fromthread_settings_applied.token_countuses the current speed, so the first turn is stored as Standard.usageTranscripts.test.tscurrently expects that. An initial Ultrafast turn hits the same gap.Likely fix area
The Codex usage scan (
initialCodexScanStateand thetoken_counthandling) plus the scan cache. Some considerations:config.tomlaren't reliable evidence for an earlier turn. A later event can be a real tier change.modelSelection(serviceTier, or legacyfastMode: true), matched to the rollout session by native thread id and request time. It would cover usage before the first persisted settings event, including sessions that never get one. From the firstthread_settings_appliedonward the rollout would still win. Usage with no T3 run record (for example Codex work done outside T3) would stay Standard.A maintainer will decide on the fix direction.