Fix Codex Fast mode accounting from current trace records - #2519
Fix Codex Fast mode accounting from current trace records#2519Anri-Lombard wants to merge 1 commit into
Conversation
|
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. |
There was a problem hiding this comment.
💡 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".
| guard body.contains(#"service_tier: Some(Some("priority"))"#), | ||
| let submissionRange = body.range(of: "Submission sub=Submission {") |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
CodexBar currently misses Fast/Priority mode for current Codex/Luna sessions. Those sessions record priority usage in
Submissiontrace rows withservice_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
Submissionrows in bounded and incremental SQLite scans.Validation
swift test --filter CostUsageScannerCodexPriorityTests— 21 passedswift test --filter CostUsageScannerPriorityTests— 16 passedmake check— passed, including SwiftFormat/SwiftLint and repository gatesmake test— passed, 758 selections across 64 groupsObserved 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.