Show Codex Spark usage#1195
Conversation
Decode Codex OAuth additional_rate_limits lossily per element and map Codex Spark into named extra rate windows. Respect the optional extra usage setting for Spark menu metrics and cover parser/model behavior with tests.
|
Codex review: needs real behavior proof before merge. Reviewed May 28, 2026, 5:15 AM ET / 09:15 UTC. Summary Reproducibility: not applicable. as a bug reproduction; this is a feature PR. Source inspection confirms current main does not expose Codex Spark via Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep this PR as the implementation candidate, then merge only after redacted Spark-enabled live proof and fresh head validation confirm the real payload and menu presentation. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a feature PR. Source inspection confirms current main does not expose Codex Spark via Is this the best way to solve the issue? Yes, with a proof gate: reusing AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 529e25538a20. Label changesLabel justifications:
Evidence reviewedAcceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9eceaa309
ℹ️ 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".
| input: Input, | ||
| percentStyle: PercentStyle) -> [Metric] | ||
| { | ||
| guard input.showOptionalCreditsAndExtraUsage else { return [] } |
There was a problem hiding this comment.
Avoid hiding non-optional extra rate windows
When showOptionalCreditsAndExtraUsage is off, this shared helper now drops every UsageSnapshot.extraRateWindows metric, not just the new Codex Spark row. The helper is also used by the generic/Antigravity menu paths, so users who disable Codex credits/Claude extras will also lose unrelated provider data such as Antigravity’s loss-free per-model quotas and Factory core rate-limit windows that are carried only in extraRateWindows. Scope the suppression to the optional Codex/Claude extras instead of the common renderer.
Useful? React with 👍 / 👎.
Review fix (steipete#1195): the showOptionalCreditsAndExtraUsage guard was added to the shared extraRateWindowMetrics(...) helper, which hid every provider's UsageSnapshot.extraRateWindows when optional extras were off — regressing Antigravity per-model quotas and Factory core windows. Gate only the Codex provider's extra windows (Codex Spark and any future Codex additional limit are optional extra usage); other providers' extra windows always render. Codex primary/session and weekly lanes are unaffected, and percent/reset behavior is preserved. Also fixes CI lint-build-test: split the Codex additional_rate_limits / Spark parser tests out of CodexOAuthTests into CodexAdditionalRateLimitsTests to clear a SwiftLint type_body_length violation (struct body was 881 > 800). Adds an Antigravity regression test asserting per-model extra windows still render when showOptionalCreditsAndExtraUsage == false. Refs steipete#1177
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2444db2968
ℹ️ 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".
| extraRateWindows: CodexAdditionalRateLimitMapper.extraRateWindows( | ||
| from: response.additionalRateLimits, | ||
| now: updatedAt), |
There was a problem hiding this comment.
Route Spark limits through web dashboard source
This maps additional_rate_limits only on the OAuth path. When users select Codex's OpenAI web dashboard source, OpenAIDashboardFetcher.fetchDashboardUsageAPI decodes the same wham/usage response, but dashboardAPIData copies only primary/secondary limits, credits, and plan into DashboardAPIData, and OpenAIDashboardSnapshot/fromAttachedDashboard have no extra-window field. As a result Spark limits returned by the API are discarded before the menu model sees them, so Spark usage remains missing for web-source users.
Useful? React with 👍 / 👎.
|
Maintainer pass update:
I also tried live proof with the local Codex OAuth account. The {
"plan_type": "pro",
"additional_rate_limits_type": "null",
"additional_rate_limits_count": 0,
"spark_limits": []
}So the code/tests look good, but I am holding the merge until we have one Spark-enabled live proof item: either a redacted |
Codex's OpenAI web dashboard source decodes the same wham/usage response
through OpenAIDashboardFetcher.dashboardAPIData but until now only copied
primary/secondary limits, credits, and plan into DashboardAPIData. Spark
`additional_rate_limits` were silently discarded for web-source users.
Thread the existing CodexAdditionalRateLimitMapper output through:
CodexUsageResponse.additionalRateLimits
-> DashboardAPIData.extraRateWindows
-> DashboardScrapeData.extraRateWindows
-> DashboardSnapshotComponents.extraRateWindows
-> OpenAIDashboardSnapshot.extraRateWindows (Codable, nil for legacy caches)
-> CodexReconciledState.fromAttachedDashboard
-> UsageSnapshot.extraRateWindows
Behavior preservation:
- Primary/secondary limits, credits, plan mapping unchanged.
- DashboardAPIData.hasUsageData still keyed on primary/secondary/credits;
Spark windows do NOT on their own trigger a returnable dashboard payload.
- CodexReconciledState.make snapshot gate unchanged: extras alone cannot
resurrect a snapshot when primary/weekly are absent.
- Absent / non-array / per-element malformed `additional_rate_limits`
inherit the lossy decode behavior already in CodexUsageResponse, so
primary/weekly mapping is never disturbed.
- OpenAIDashboardSnapshot Codable decoder uses decodeIfPresent so existing
cached dashboard snapshots remain valid.
Adds OpenAIDashboardSparkTests covering: dashboardAPIData spark mapping,
absent/non-array/mixed-malformed inputs, toUsageSnapshot surfacing,
Codable round-trip, and legacy-cache decode.
Refs steipete#1177
|
Maintainer follow-up for current head
So my current state is: code-ready, still proof-blocked for merge. The missing proof is one Spark-enabled live item from an account that actually returns Spark data: either a redacted |
|
Spark-enabled live proof for #1195. I re-ran a live Redactions applied: no ids, email, account ids, tokens, cookies, authorization headers, or raw credential payloads are included. {
"ok": true,
"status": 200,
"plan_type": "pro",
"additional_rate_limits_type": "list",
"additional_rate_limits_count": 1,
"spark_like_count": 1,
"additional_rate_limits_redacted": [
{
"limit_name": "GPT-5.3-Codex-Spark",
"metered_feature": "codex_bengalfox",
"rate_limit": {
"primary_window": {
"used_percent": 0,
"reset_at": 1779979845,
"limit_window_seconds": 18000
},
"secondary_window": {
"used_percent": 0,
"reset_at": 1780566645,
"limit_window_seconds": 604800
}
}
}
]
} |
Addresses #1177
Summary
additional_rate_limitslossily per element so valid model-specific limits survive malformed siblings.Tests
swift build --target CodexBarCoreswift test --filter CodexOAuthTestswas attempted locally but SwiftPM failed before the filtered macOS tests becauseTestsLinux/JetBrainsParserLinuxTests.swiftcould not importTestingin this local toolchain.Notes
Package.swift, or credential/auth changes are included.