Skip to content

feat(server): advertise reasoning-effort ladders on the raw /v1/models list - #853

Merged
Wibias merged 12 commits into
lidge-jun:devfrom
n3wr1ch:feat/grok-reasoning-effort-list
Aug 2, 2026
Merged

feat(server): advertise reasoning-effort ladders on the raw /v1/models list#853
Wibias merged 12 commits into
lidge-jun:devfrom
n3wr1ch:feat/grok-reasoning-effort-list

Conversation

@n3wr1ch

@n3wr1ch n3wr1ch commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Grok Build discovers models through the raw OpenAI list shape at GET /v1/models (no client_version), and its model picker only enables /effort (and accepts --effort) for entries that advertise the Grok catalog shape: supports_reasoning_effort plus reasoning_efforts options.
  • The raw list previously emitted only id, object, created, and owned_by, so routed models appeared in Grok Build without an effort control even when their ladder was already configured and available on the Codex catalog branch. The chat-completions path already honors reasoning_effort; model discovery was the missing link.
  • Raw-list entries with non-empty effort ladders now advertise their supported levels. Routed entries use provider-configured tiers and defaults, with the canonical fallback order of configured default, medium, high, then the first tier. Entries with an empty tier list remain unchanged.
  • Native entries preserve the pinned upstream ladder and default for each model. In particular, GPT-5.6 Sol and Terra include ultra, while GPT-5.6 Luna intentionally ends at max, matching OpenAI Codex's canonical models.json catalog.
  • The Grok Build guide documents how native and routed effort metadata is exposed.

Verification

  • bun test ./tests/grok-models-effort-list.test.ts ./tests/codex-catalog.test.ts — 122 passed, 0 failed. The five focused raw-list tests cover routed metadata, empty-tier omission, canonical default fallbacks, and exact Sol/Terra/Luna native ladders and defaults.
  • bun run typecheck — passed.
  • bun run lint:gui — passed.
  • bun run test — 6869 passed, 8 skipped, 0 failed across 479 files.
  • bun run privacy:scan — passed.
  • cd docs-site && bun install --frozen-lockfile && bun run build — passed (151 pages built).
  • Live provider check: a configured Kimi ladder (low, high, max, default max) is returned by GET /v1/models in Grok's expected shape. Sending reasoning_effort manually already produced distinct upstream reasoning-token counts (13 at low, 74 at high), confirming the backend path works and only discovery metadata was missing.

Checklist

  • Targets dev and keeps the implementation focused.
  • Adds regression coverage for changed server/catalog behavior.
  • Updates user-facing documentation.
  • Reviews security-sensitive behavior and introduces no new auth, secret, dependency, or workflow surface.
  • Passes typecheck, lint, full tests, privacy scan, and docs build.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 1, 2026
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The /v1/models endpoint now advertises reasoning-effort metadata for native and routed models. The catalog exposes native effort tiers and defaults. Tests cover configured tiers, omissions, and fallback defaults. Grok Build documentation describes the metadata.

Changes

Reasoning effort metadata

Layer / File(s) Summary
Model listing metadata
src/codex/catalog.ts, src/codex/catalog/metadata.ts, src/server/index.ts, docs-site/src/content/docs/guides/grok-build.md
The catalog exports native reasoning tiers and resolves non-empty native defaults. The /v1/models listing adds labeled reasoning-effort options and defaults for native and routed models. Models with empty tiers omit the reasoning fields. The documentation describes these rules.
Model listing validation
tests/grok-models-effort-list.test.ts
Integration tests isolate configuration and validate routed tiers, native defaults, empty-tier omission, medium fallback, high-tier fallback, and first-tier fallback.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Catalog as Catalog metadata
  participant Server as /v1/models
  participant GrokBuild as Grok Build
  Catalog->>Server: Provide native reasoning tiers and default
  Server->>Server: Build reasoning_efforts metadata
  Server->>GrokBuild: Return model entries with tiers and defaults
Loading

Possibly related PRs

  • lidge-jun/opencodex#494: Modifies related reasoning-effort metadata exposed by /v1/models and consumed by adapters and logging.
  • lidge-jun/opencodex#646: Modifies related reasoning-effort metadata and default-selection behavior in model adapters and catalog paths.

Suggested reviewers: lidge-jun, wibias, ingwannu

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding reasoning-effort ladders to the raw /v1/models response.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/guides/grok-build.md`:
- Around line 51-58: Clarify the documentation around reasoningEfforts and
modelReasoningEfforts to state that these fields describe the proxy-configured
ladder for routed provider entries. Explicitly distinguish this metadata from
native upstream reasoning support, including native entries that do not
advertise these fields, and note that adapters may emulate or map effort levels
to provider-specific fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 42ef54dc-1741-4a47-b468-c514c64f4e3b

📥 Commits

Reviewing files that changed from the base of the PR and between e1fc0f2 and 108bd4b.

📒 Files selected for processing (3)
  • docs-site/src/content/docs/guides/grok-build.md
  • src/server/index.ts
  • tests/grok-models-effort-list.test.ts

Comment thread docs-site/src/content/docs/guides/grok-build.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 108bd4b81a

ℹ️ 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".

Comment thread src/server/index.ts Outdated
Comment thread src/server/index.ts Outdated
@n3wr1ch

n3wr1ch commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews — all three comments addressed in ceb5fe75:

  1. Codex P2 (default fallback): the raw list now resolves the default with the same canonical order as applyReasoningLevels in src/codex/catalog/effort.ts (configured default → medium → high → first tier), so both branches advertise the same default when no modelDefaultReasoningEfforts is set. Covered by a new test (ladder without a configured default → medium; invalid configured default → high for a low/high/max ladder).
  2. Codex P2 (native rows): native entries are now decorated too via nativeReasoningEfforts (upstream snapshot ladder, with max+ultra restored for the gpt-5.6 family), re-exported through the codex/catalog facade. ocx-gpt-* native models get a working /effort control as well. Verified live: gpt-5.6-sol advertises low/medium(default)/high/xhigh/max/ultra.
  3. CodeRabbit (docs): the guide now states the mirrored tiers describe the proxy-configured routed ladder, not native upstream reasoning support, and notes adapters may emulate reasoning or map levels to provider-specific fields.

Full suite green after the changes: bun run test 6513 pass / 0 fail, bun run typecheck clean.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/guides/grok-build.md`:
- Around line 54-61: Update the reasoning metadata documentation near the routed
model description to separately state that native GPT-5.6 entries preserve and
expose their pinned upstream reasoning ladders. Keep routed entries described as
exposing proxy-configured provider tiers that adapters may map or emulate,
maintaining the distinction between native and routed behavior.

In `@tests/grok-models-effort-list.test.ts`:
- Around line 61-66: Extend the native gpt-5.6-sol assertions in the existing
test to verify its complete reasoning_efforts list matches the pinned GPT-5.6
ladder, including max and ultra, while preserving the supports_reasoning_effort
and medium default assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 11b8d5e9-ffd9-47ee-9081-98691ccc8b89

📥 Commits

Reviewing files that changed from the base of the PR and between 108bd4b and ceb5fe7.

📒 Files selected for processing (4)
  • docs-site/src/content/docs/guides/grok-build.md
  • src/codex/catalog.ts
  • src/server/index.ts
  • tests/grok-models-effort-list.test.ts

Comment thread docs-site/src/content/docs/guides/grok-build.md Outdated
Comment thread tests/grok-models-effort-list.test.ts Outdated
n3wr1ch added 5 commits August 1, 2026 20:52
…s list

Grok Build discovers models through the plain OpenAI list shape at
GET /v1/models (no client_version). Its model picker only enables the
/effort control for entries that advertise the ladder in the Grok model
catalog shape (supports_reasoning_effort + reasoning_efforts[] with
value/label/default options), and --effort is ignored for models that do
not advertise it.

The raw list previously emitted only id/object/created/owned_by, so
routed models appeared without effort controls even though the same
tiers were already configured (reasoningEfforts /
modelReasoningEfforts) and shipped on the Codex catalog branch
(?client_version) and honored end-to-end by the chat-completions
inbound path.

Mirror the configured ladder onto raw list entries: entries with a
non-empty reasoningEfforts list now also carry
supports_reasoning_effort, reasoning_effort (the configured default,
falling back to the first tier when the configured default is not in
the visible list), and reasoning_efforts as {value, label, default}
options. Entries with an empty tier list are unchanged. Extra fields
are ignored by plain OpenAI clients.
…ers too

Address review feedback on the reasoning-effort advertisement:

- Codex review (P2): the raw list now resolves the default with the
  same canonical fallback as the Codex catalog resolver in
  src/codex/catalog/effort.ts (configured default, then medium, then
  high, then the first tier) instead of always falling back to the
  first tier, so both branches advertise the same default for a model
  without an explicit modelDefaultReasoningEfforts entry.
- Codex review (P2): native rows are decorated too, using the
  canonical native ladder from nativeReasoningEfforts (upstream
  snapshot, with max+ultra restored for the gpt-5.6 family), so
  auto-registered ocx-gpt-* native models also get a working /effort
  control in Grok Build.
- CodeRabbit (docs): the Grok Build guide now states that the mirrored
  tiers describe the proxy-configured routed ladder, not native
  upstream reasoning support, and that adapters may emulate reasoning
  or map levels onto provider-specific fields.

The shared grokEffortFields helper builds the Grok catalog shape for
both row kinds; nativeReasoningEfforts is re-exported through the
codex/catalog facade. Tests cover the native advertisement, the
medium-first canonical fallback with and without a configured
default, and the empty-tier omission.
Address the follow-up CodeRabbit review:

- Document that native GPT-5.6 rows expose their pinned upstream
  reasoning ladders, separately from routed entries whose tiers come
  from proxy provider configuration and may be mapped or emulated by
  adapters.
- Assert the complete gpt-5.6-sol ladder (low through ultra), not only
  the support flag and medium default, so max/ultra cannot regress
  silently.
@n3wr1ch
n3wr1ch force-pushed the feat/grok-reasoning-effort-list branch from ceb5fe7 to 0938eaf Compare August 1, 2026 11:54
@n3wr1ch

n3wr1ch commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the two follow-up CodeRabbit findings in the latest branch:

  • Native ladder docs: the Grok Build guide now states separately that native GPT-5.6 entries expose their pinned upstream ladder, while routed entries expose proxy-configured provider tiers that adapters may map or emulate.
  • Complete native regression: the gpt-5.6-sol test now asserts the full pinned value list (low, medium, high, xhigh, max, ultra) in addition to the support flag and medium default.

The branch is rebased onto current dev (fa5780d5) and preserves the new upstream CatalogGatherBusyError handling in /v1/models. Focused tests: 4 pass / 0 fail; typecheck clean.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/grok-models-effort-list.test.ts`:
- Around line 109-121: Extend the invalid-default fallback coverage in the test
around the existing k3 case with a model whose reasoning tiers are ordered
["low", "max"] and whose configured default is invalid. Assert that
reasoning_effort is "low" and that only the low option is marked default,
exercising the efforts[0] fallback branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2847fe5b-4a7f-4e6b-be2a-568f7f9a5795

📥 Commits

Reviewing files that changed from the base of the PR and between ceb5fe7 and 0938eaf.

📒 Files selected for processing (4)
  • docs-site/src/content/docs/guides/grok-build.md
  • src/codex/catalog.ts
  • src/server/index.ts
  • tests/grok-models-effort-list.test.ts

Comment thread tests/grok-models-effort-list.test.ts
Address the latest CodeRabbit coverage request by exercising the final branch
of the canonical configured -> medium -> high -> first fallback. Use a custom
routed model with only low/max tiers so provider registry wire-map self-healing
does not add a high tier, then assert low is the sole default option.
@n3wr1ch

n3wr1ch commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest CodeRabbit coverage request in 30c7e97f: added a routed custom model with only low/max tiers and an invalid configured default, then asserted low is selected and is the only option marked default. This directly exercises the final efforts[0] branch of the canonical configured → medium → high → first fallback. I used a custom model id so registry wire-map self-healing cannot add a high tier to the fixture. Focused suite: 5 pass / 0 fail; typecheck remains clean.

Wibias added 3 commits August 2, 2026 00:25
…t ads

gpt-5.6-sol pins default_reasoning_level=low in the Codex catalog path, but the
raw list always fell through to medium. Pass the upstream native default into
grokEffortFields so both discovery surfaces advertise the same default.
@Wibias

Wibias commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

[shipping-github] Verdict: changes-requested

PR: #853 — feat(server): advertise reasoning-effort ladders on the raw /v1/models list
Head: c0426f67 on dev (mergeStateStatus: UNSTABLE, mergeable)
Linked: none

Usefulness

Useful and in scope: it makes configured routed reasoning ladders, and pinned native ladders, discoverable by Grok Build through the plain OpenAI GET /v1/models surface so /effort can be enabled consistently.

Bugs / correctness

  • Complementary deep review completed for silent failures, resource leaks, edge cases, API compatibility, resource lifecycle, boundary conditions, filesystem/test cleanup, error propagation, and network cancellation. No open blocking finding remains.
  • A native-default mismatch found during this review was fixed in 38da7912: gpt-5.6-sol now preserves the upstream low default through nativeDefaultReasoningEffort, with a regression assertion in tests/grok-models-effort-list.test.ts.

Security

  • No confirmed security finding. The change only serializes server-controlled catalog metadata into JSON; it does not add authentication, authorization, outbound destinations, shell/HTML evaluation, secrets, or dependency/workflow changes.
  • AI/agent/MCP review completed: this is model metadata discovery, not tool invocation, prompt construction, MCP registration, or agent-permission expansion.

Spec / standards

  • Spec source: PR body and existing catalog behavior. The implementation covers routed/native ladders, empty-tier omission, canonical defaults, native upstream defaults, focused tests, and docs.
  • The PR body’s verification paragraph is stale (3 new tests / 6512 pass and the old first-tier-only fallback description); the current branch has five focused tests and the canonical medium/high/first fallback plus native default preservation. Please refresh that text.

Reviews

  • Owners/maintainers: no open human threads.
  • Bots: all six review threads are resolved; CodeRabbit and Codex findings were verified and addressed or superseded by later commits.

Base / CI

  • Updated from current upstream/dev in c0426f67; no conflicts and the effective PR diff remains five focused files.
  • Local bun test tests/grok-models-effort-list.test.ts passed 5/5, bun run typecheck passed, and bun run privacy:scan passed. The full bun run test attempt exceeded the 10-minute local command budget without completing.
  • Required workflows for the new fork head are not green: Cross-platform CI and React Doctor are action_required with no jobs, so GitHub has not executed them on c0426f67. The prior head 38da7912 had green cross-platform and React Doctor runs.

Gate

Hard blocker: approve/execute the two action_required fork workflows, then wait for their results on c0426f67. This is a GitHub permission/approval state, not a reported code failure.

Bottom line

The implementation is useful, focused, locally validated, and has no remaining confirmed bug or security blocker. I cannot give an approve-comment verdict while the required workflows have not run on the current synced head; after the fork workflow approval completes and the PR description counts are refreshed, rerun the final gate.

@lidge-jun

Copy link
Copy Markdown
Owner

Pre-merge review result: not merge-ready yet. @Wibias's verification covered the native-default fix, but one independently reproduced mismatch remains:

  1. src/codex/catalog/metadata.ts:95 adds ultra to every GPT-5.6 native, so raw /v1/models advertises Luna as low…ultra while the canonical catalog intentionally ends Luna at max (src/codex/catalog/sync.ts:145, tests/codex-catalog.test.ts:1113). Probe: raw helper returns [low, medium, high, xhigh, max, ultra] vs canonical [low, medium, high, xhigh, max]. This would expose a noncanonical effort option to Grok Build.
  2. tests/grok-models-effort-list.test.ts:61 only asserts Sol's ladder (which legitimately contains ultra), so it cannot catch the Luna discrepancy — please add Luna/Terra assertions.
  3. The windows CI job was still in progress at review time; full green CI is required before merge. The PR body is also stale (says three focused tests; head has five).

Otherwise the shape is good: the /v1/models change is additive-only and the default-ladder fallback order matches canonical behavior. Small fix, fast re-review.

@n3wr1ch

n3wr1ch commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the remaining native-ladder mismatch in 53d83740.

  • nativeReasoningEfforts now preserves the exact pinned per-model ladder instead of adding ultra to every GPT-5.6 native.
  • Raw /v1/models now advertises Sol and Terra through ultra, while Luna correctly ends at max; defaults remain Sol=low, Terra/Luna=medium.
  • The focused integration test now asserts all three complete ladders and defaults.
  • Refreshed the PR description with current behavior and verification counts.

Verification: focused catalog/server tests 122/122, typecheck, GUI lint, full suite 6869 pass / 8 skip / 0 fail, privacy scan, and docs build (151 pages) all passed.

@n3wr1ch

n3wr1ch commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

The latest windows job has one unrelated timeout in tests/codex-auth-context.test.ts:

Codex auth context > busy and stale Codex refresh failures do not mark the auth-context account for reauth
This test timed out after 5000ms.

The run otherwise completed with 6873 passing tests, and the PR's /v1/models / GPT-5.6 ladder tests passed. Ubuntu, macOS, npm-global Windows, typecheck, and the local full suite are green. This auth-context test and its runtime code are outside the five-file PR diff, so this appears to be a Windows timing flake rather than a regression from this change.

Could a maintainer please rerun the failed Windows job?

@Wibias

Wibias commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

[shipping-github] Addressed feedback
feedback: issue_comment:5154105797
commit: 53d8374

Verified on dd813da2: Luna's raw /v1/models ladder ends at max, Sol and Terra retain ultra, and the focused catalog/server tests pass 118/118. The branch is also updated through dev@6ac6beaf.

@Wibias

Wibias commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks @n3wr1ch — merging this.

Why it helps: raw GET /v1/models now advertises the exact reasoning-effort ladders Grok Build needs, so routed and native models expose /effort without widening Luna beyond its canonical max. Sol and Terra retain ultra, defaults follow the canonical fallback, and complete ladder regressions cover the public response.

Ship it.

@Wibias
Wibias merged commit 48d59a8 into lidge-jun:dev Aug 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants