Skip to content

fix(api): fail OpenAI oracle provider errors - #127

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-ab00
Draft

fix(api): fail OpenAI oracle provider errors#127
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-ab00

Conversation

@cursor

@cursor cursor Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

ai-oracle could report a successful paid response with an empty analysis when the OpenAI fallback returned a non-2xx error body or an empty response. That logs the call as success and charges credits instead of surfacing the upstream failure.

Root cause

The OpenAI provider branch parsed resp.json() and immediately returned text from choices[0] without checking resp.ok or requiring non-empty output.

Fix

  • Throw on non-2xx OpenAI responses in the ai-oracle provider branch.
  • Throw on empty OpenAI output so the route falls through to the existing oracle_failed 502 path.
  • Updated the hardening test coverage for the provider invariant and refreshed two stale source-shape assertions in the same test file.

Validation

  • cd api && npm run build && node tests/tools-credits-hardening.test.mjs
Open in Web View Automation 

Co-authored-by: Deesmo <Deesmo@users.noreply.github.com>
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