Skip to content

[Bug]: Initial Codex Fast turns are counted as Standard when the rollout omits settings #15267

Closed

Description

@PixPMusic

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

  1. Use a build containing fix(usage): Codex Fast and Ultrafast now cost what they bill #15101 with Codex app-server 0.160.0.
  2. Start a new Codex thread with Fast selected (serviceTier: "priority").
  3. Complete its first turn, then open Usage and inspect the model's Cost by speed.
  4. Compare the provider submission with the session rollout. In affected sessions, Codex receives the priority tier but the rollout contains session_meta, turn_context, and token_count records without an initial thread_settings_applied event.
  5. 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.

Activity

  1. juliusmarminge commented on Oct 3, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Triage

    Thanks @PixPMusic for the careful timeline and the sample numbers. I confirmed this on main at 77823bd102. It's a follow-up to merged #15101, not a duplicate. That change prices a Codex rollout from thread_settings_applied, but it never sees the tier for usage that happens before the first persisted settings event.

    What's happening

    • In Codex app-server 0.160.0, turn/start emits ThreadSettingsApplied with send_event_raw_without_materializing_rollout. The live submission can carry service_tier: priority while the rollout only gets session_meta, turn_context, and token_count, and turn_context has no service tier.
    • The settings event is only persisted later (on resume, fork, compaction, goal, or revert). A second turn picks up the tier. A single-turn session can finish without the event ever being written, so a rescan can't recover it.
    • initialCodexScanState starts speed at "standard" and only updates it from thread_settings_applied. token_count uses the current speed, so the first turn is stored as Standard. usageTranscripts.test.ts currently expects that. An initial Ultrafast turn hits the same gap.

    Likely fix area

    The Codex usage scan (initialCodexScanState and the token_count handling) plus the scan cache. Some considerations:

    • As you noted, a later settings event, the thread's current selection, or config.toml aren't reliable evidence for an earlier turn. A later event can be a real tier change.
    • One candidate source is the run's saved modelSelection (serviceTier, or legacy fastMode: 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 first thread_settings_applied onward the rollout would still win. Usage with no T3 run record (for example Codex work done outside T3) would stay Standard.
    • Rollouts still on disk would need a scan-cache bump to reparse. Deleted rollouts would keep their saved Standard usage, as with the v4 upgrade in fix(usage): Codex Fast and Ultrafast now cost what they bill #15101.

    A maintainer will decide on the fix direction.

  2. added
    bug
    via-triage
    on Oct 3, 2026
  3. t3dotgg commented on Oct 21, 2026

    @t3dotgg
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcodexvia-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions