Skip to content

Fix Codex Fast mode accounting from current trace records - #2519

Open
Anri-Lombard wants to merge 1 commit into
steipete:mainfrom
Anri-Lombard:agent/fix-codex-priority-trace
Open

Fix Codex Fast mode accounting from current trace records#2519
Anri-Lombard wants to merge 1 commit into
steipete:mainfrom
Anri-Lombard:agent/fix-codex-priority-trace

Conversation

@Anri-Lombard

Copy link
Copy Markdown

Summary

CodexBar currently misses Fast/Priority mode for current Codex/Luna sessions. Those sessions record priority usage in Submission trace rows with service_tier: Some(Some("priority")), while the scanner only recognized legacy websocket request rows.

This causes current Fast mode sessions to be classified as standard-cost usage.

Changes

  • Include current priority Submission rows in bounded and incremental SQLite scans.
  • Parse the submission turn ID and thread ID without retaining prompt text.
  • Keep legacy websocket trace parsing unchanged.
  • Add parser and SQLite regression coverage.
  • Regenerate the parser hash required by the repository checks.

Validation

  • swift test --filter CostUsageScannerCodexPriorityTests — 21 passed
  • swift test --filter CostUsageScannerPriorityTests — 16 passed
  • make check — passed, including SwiftFormat/SwiftLint and repository gates
  • make test — passed, 758 selections across 64 groups

Observed local evidence: Codex logs contain service_tier: Some(Some("priority")) for current sessions, while the pre-fix CodexBar cache classified the same session as standard.

@Anri-Lombard
Anri-Lombard marked this pull request as ready for review July 30, 2026 19:03
@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Fix Codex Fast mode accounting from current trace records This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@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: d0b94e5806

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

Comment on lines +572 to +573
guard body.contains(#"service_tier: Some(Some("priority"))"#),
let submissionRange = body.range(of: "Submission sub=Submission {")

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 Restrict the priority marker to thread settings

When a standard-mode user prompt itself contains service_tier: Some(Some("priority"))—for example, while debugging or pasting a trace—the serialized Submission row includes that text in op: UserInput even though its actual ThreadSettingsOverrides uses the default tier. This whole-body check therefore marks that standard turn as Fast and overstates its cost; inspect the actual thread_settings field rather than accepting the marker anywhere in the prompt-bearing row.

Useful? React with 👍 / 👎.

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