fix(fastwire): do not read a non-authoritative tier echo as a Fast downgrade - #2589
Conversation
The ChatGPT-internal Codex backend returns service_tier: default even on turns it scheduled as priority, so treating that echo as a verdict marked every Fast request response-declined. That is a false negative, and it also skews cost attribution because fastOutcome drives priority pricing. TierObservationContext gains responseTierAuthoritative. Absent means assume authoritative, so the public API path is unchanged; core.ts sets it false only for the canonical ChatGPT-forward destination, where the echo can neither confirm nor deny Fast. The raw echo is still recorded - this suppresses a verdict, not the evidence. Driven red first: removing the guard fails exactly the new case.
|
✅ Deterministic PR hygiene checks passed. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe change adds destination-aware response-tier authority. Canonical OpenAI forward routes mark echoed tiers as non-authoritative, while other routes retain authoritative behavior. Tests cover non-authoritative echoes, authoritative downgrades, and omitted-flag compatibility. ChangesFast tier authority
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aacd24c537
ℹ️ 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".
| // A destination whose echo is not authoritative can neither confirm nor deny Fast. The | ||
| // ChatGPT-internal Codex backend echoes "default" on priority-scheduled turns, so believing | ||
| // it reported every Fast request as `response-declined` (#2558). | ||
| && context.responseTierAuthoritative !== false; |
There was a problem hiding this comment.
Exclude non-authoritative echoes from pricing provenance
When a canonical ChatGPT Fast request receives the known service_tier: "default" echo, this guard keeps the outcome as assumed priority, but observeResponseServiceTier still stores "default". serviceTierContextFromOutcome in src/usage/cost.ts:380-384 prioritizes that stored response over the assumed canonical tier, so estimateAttemptCost sees the default tier and skips the OpenAI priority multiplier. Consequently, the cost-attribution regression described by this change remains for every affected request; preserve the echo for diagnostics while ensuring the pricing path ignores it when it is non-authoritative, and add a multiplier regression assertion.
Useful? React with 👍 / 👎.
Summary
Closes #2558.
OpenCodex reported every Codex Fast request as
fastOutcome: downgraded/fastDowngradeReason: response-declined, while the request was correctly sent asservice_tier: "priority"and observed throughput differed from a no-tier request. Theissue's suspicion was right: the ChatGPT-internal Codex backend returns
service_tier: "default"even on turns it scheduled as priority, so its echo was beingread as a verdict it cannot give.
Two consequences, not one. The visible symptom is a false negative in the diagnostics; the
quieter one is cost attribution, because
fastOutcomedrives priority pricing.TierObservationContextgainsresponseTierAuthoritative. Absent means "assumeauthoritative", so the public API path — where an echoed
defaultreally does mean therequest was declined — is unchanged.
core.tssets itfalseonly for the canonicalChatGPT-forward destination, using the existing
isCanonicalOpenAiForwardProvidercheck.The raw echo is still recorded in
responseServiceTier. This suppresses a verdict, not theevidence: an operator can still see exactly what the backend returned.
Verification
Driven red first — removing the guard fails exactly the new case and nothing else:
The three added cases pin all three states: a non-authoritative destination does not
classify a downgrade, an authoritative one still does, and an omitted flag keeps the
authoritative default.
Checklist
devdevheadSummary by CodeRabbit
Bug Fixes
Tests