Skip to content

feat(models): map thinkingBudget to reasoning_effort for OpenAI reasoning models - #201

Merged
devarshishimpi merged 1 commit into
devarshishimpi:mainfrom
MaxonT:contrib/177-auto
Nov 29, 2026
Merged

devarshishimpi merged 1 commit into
devarshishimpi:mainfrom
MaxonT:contrib/177-auto

Conversation

@MaxonT

@MaxonT MaxonT commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Hello, I traced this one down and the change is short.

Adds reasoning_effort to the OpenAI adapter request for reasoning models (isReasoning), taken from the model profile's thinkingBudget. A numeric budget above 10000 sends high, above 3000 medium, anything else low; low, medium and high are passed through. off, auto and no budget leave the parameter out, and non-reasoning models are unchanged. The profile schema only accepted off, auto or an integer, so I added low, medium and high to it so the string pass-through from the issue is reachable. No profile in model-profiles.json is for an OpenAI reasoning model today (grepped for o3, o4 and gpt-6), so no shipped request changes until such a profile sets a budget.

Fixes #177

Thanks for writing the sub-issue with the exact mapping and a Done When list; it made the scope easy to check.

Not verified: no request was sent to a real OpenAI endpoint. The adapter is also used for other OpenAI-compatible endpoints, so a server that rejects unknown fields and serves a model named like o3 could return an error when a numeric budget is set.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Chore (refactoring, dependency updates, etc.)

How Has This Been Tested?

  • Unit Tests: new test/openai-reasoning-effort.spec.ts (6 tests) covers the 3000/10000 boundaries, string pass-through, off/auto/absent budget, a standard model (gpt-4o), and the request body sent for o3-mini, o4-mini, o3 and gpt-6. It passes with the change; with the line that sets reasoning_effort removed, 2 of the 6 fail.
  • npm run lint: clean.
  • npm run typecheck: 22 errors, the same 22 as on the base commit (worker and test files, none in the touched files).
  • npx vitest run (whole suite): 84 failed, 465 passed. The same 20 files fail on the base commit without my change; I did not inspect each failure; the suite has Postgres-dependent tests and I had no Postgres running. I did not run npm test against a database or the integration suite.
  • Integration Tests (not run)
  • Manual Dashboard Verification (not applicable)
  • Manual GitHub Webhook Verification (not applicable)

Checklist:

  • I have starred Codra on GitHub
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes (the Postgres-dependent failures above also occur without my change)
  • I have signed the CLA

…ning models

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T10:10:59.389045Z d0efd2c PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codra-app-personal codra-app-personal 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.

Codra Review

✅ Nothing to flag. Reviewed 3 files (122 changed lines) and found no issues worth raising.

Reviewed commit: d0efd2ca8e

ℹ️ About Codra in GitHub

Your team has set up Codra to review pull requests in this repo. Reviews are triggered when you:

  • Open a pull request for review
  • Mark a draft as ready

Every review posts a summary here. A clean pass also gets a 👍 on the pull request itself.

@devarshishimpi devarshishimpi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for contributing.. !

@devarshishimpi
devarshishimpi merged commit 359b3b5 into devarshishimpi:main Nov 29, 2026
6 checks passed
devarshishimpi added a commit that referenced this pull request Nov 29, 2026
- core(review): deduplicate diff cache helper, cache empty diffs via != null, validate commit SHAs, and add PR-context JSDoc note (#181 / PR #203)

- api/node/worker: bypass Hyperdrive SQL caching via SELECT clock_timestamp(), fail fast on disconnected Redis via PING_REDIS, coalesce in-flight probes, suppress late rejections, preserve logger requestId on health probe warnings, and add adapter wiring tests + K8s timeoutSeconds docs (#173 / PR #202)

- models/schema: guard non-finite/negative thinkingBudget, exclude o1-mini/o1-preview from reasoning_effort, simplify Zod schema, and consolidate OpenAI tests with real schema parsing (#177 / PR #201)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map Thinking Budget to Reasoning Effort for OpenAI Models

2 participants