Skip to content

🎚️ feat: Filter OpenRouter Reasoning Efforts by the Selected Model - #16808

Merged
berry-13 merged 18 commits into
devfrom
feat/openrouter-per-model-reasoning-efforts
Oct 8, 2026
Merged

berry-13 merged 18 commits into
devfrom
feat/openrouter-per-model-reasoning-efforts

Conversation

@berry-13

@berry-13 berry-13 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

OpenRouter endpoints show a reasoning effort control without extra config. That control, and the "Reasoning Effort" setting in the parameters panels, offered one generic list (none, minimal, low, medium, high, xhigh, max) for every OpenRouter model. OpenRouter rejects an effort a model does not support, so picking none on a mandatory-reasoning model, or max on a model without it, failed at the provider.

OpenRouter reports the efforts each model accepts (reasoning.supported_efforts, reasoning.mandatory) in GET /models. The server now reads that catalog for the OpenRouter endpoints in the app config, caches it for an hour, and serves it at GET /api/endpoints/reasoning-capabilities. The composer selector, the conversation and agent parameter panels and the preset settings narrow the effort list to what the selected model accepts, drop none when reasoning is mandatory, and hide the control for a model the catalog lists without reasoning. The server re-checks a submitted override against the same data, so a stale or hand-built request is refused too.

While the catalog is loading or cannot be fetched, the generic list stays, so a provider outage never removes a control that worked before. Only an endpoint whose base URL host is OpenRouter is fetched, with the administrator's key and never a user's; user-provided keys and URLs are skipped.

How it works

GET {openrouter}/models   (admin key, cached 1h by baseURL+key)
  loadReasoningCapabilities   packages/api/src/endpoints/reasoning.ts
    -> { endpoint: { model: { efforts, mandatory } } }
  GET /api/endpoints/reasoning-capabilities      client queries it for OpenRouter endpoints only
  buildEndpointOption                            loads it only when a request carries an override

applyModelAwareDefaults(..., modelReasoning)     one narrowing step shared by every surface
  undefined  capabilities unknown  -> generic list
  null       model has no reasoning -> control hidden
  { efforts, mandatory }           -> listed efforts (+ Auto), minus none when mandatory

Type of change

  • Feature

Testing

Tested environments/configuration:

Jest only. Not run against a live OpenRouter request or in a browser.

Automated tests:

New cases cover the narrowing (supported efforts, mandatory, unknown, no reasoning, unrecognized levels, non-OpenRouter endpoints, explicit definitions untouched), the model variant lookup, the catalog loader (parsing, caching, one fetch per shared key, failed fetch not cached, non-OpenRouter hosts and user-provided URLs skipped), server override validation, lazy capability loading, the client hook and the composer. The narrowing, server rejection, lazy loading and composer cases each failed before the change. Passing: parameterSettings.spec.ts, reasoning.spec.ts, reasoningOverride.spec.ts, custom/config.spec.ts, plus the related client suites (Reasoning, Thinking, ModelPanel, Panel, parameters, useModelReasoning, useChatFunctions.regenerate). lc lint is clean and tsc --noEmit passes in packages/data-provider, packages/api and client.

Screenshots / recordings

Not captured; the changed lists were not checked in a running app.

Risk / compatibility

Adds one outbound request: the server fetches OpenRouter's model catalog at most once an hour per base URL and key, only when an OpenRouter endpoint exists and a session on one asks for it. A model absent from the catalog loses its effort control. buildEndpointOption.js and the endpoints route gain wiring only, with the behavior in packages/api. The buildEndpointOption middleware spec could not run in this environment because @librechat/agents lacks GitHubCompareToolDefinition (unrelated to this change), so that wiring is covered by the applyRequestReasoningOverride tests instead.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • Required dependency changes have been merged/published
  • Required documentation PR: N/A

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T16:08:37.248909Z 8251539 New commits
🔒 Security Review ✅ Completed 2026-10-06T07:33:54.099755Z 450bd3b 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.

@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: 450bd3b05a

ℹ️ 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 client/src/components/SidePanel/Parameters/Panel.tsx
Comment thread packages/data-provider/src/parameterSettings.ts Outdated
Comment thread packages/api/src/modelSpecs/reasoningOverride.ts
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts
Comment thread client/src/components/SidePanel/Parameters/Panel.tsx
Comment thread client/src/components/Endpoints/Settings/OpenAI.tsx 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: 439da5998e

ℹ️ 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 packages/api/src/endpoints/reasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts 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: cf9b9de933

ℹ️ 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 api/server/controllers/ReasoningCapabilitiesController.js Outdated
Comment thread packages/api/src/endpoints/reasoning.ts
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread packages/api/src/endpoints/custom/initialize.ts Outdated
Comment thread client/src/hooks/Endpoint/useModelReasoning.ts Outdated
Comment thread packages/api/src/endpoints/custom/initialize.ts 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: f14c0f3a9f

ℹ️ 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 packages/api/src/endpoints/capabilities.ts Outdated
Comment thread packages/api/src/modelSpecs/reasoningOverride.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread client/src/components/SidePanel/Parameters/Panel.tsx

@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: 612bf16bc8

ℹ️ 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 client/src/hooks/Chat/useChatFunctions.ts Outdated
Comment thread client/src/components/Chat/Input/Reasoning.tsx
Comment thread packages/api/src/modelSpecs/reasoningOverride.ts 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: d3d4dc1052

ℹ️ 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 client/src/data-provider/Endpoints/queries.ts 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: e008deed3f

ℹ️ 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 packages/api/src/endpoints/custom/initialize.ts Outdated
Comment thread client/src/components/Chat/Input/Reasoning.tsx Outdated
Comment thread packages/api/src/modelSpecs/reasoningOverride.ts

@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: 31bd79f23c

ℹ️ 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 client/src/data-provider/Endpoints/queries.ts Outdated
Comment thread packages/data-provider/src/parameterSettings.ts Outdated
Comment thread client/src/data-provider/Endpoints/queries.ts Outdated
Comment thread packages/api/src/modelSpecs/reasoningOverride.ts 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: 6abe1c23fb

ℹ️ 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 client/src/hooks/Endpoint/useModelReasoning.ts

@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: d26f2b4ef7

ℹ️ 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 packages/api/src/endpoints/custom/config.ts
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread client/src/components/Chat/Input/Reasoning.tsx
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts 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: a53507c812

ℹ️ 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 client/src/data-provider/Endpoints/queries.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Lighthouse CI failed. The last 80 log lines contain the measured budgets and assertion failures.

│ 22      │ 'http://localhost:3080/api/permissions/mcpServer/effective/all'                                                 │ 2810.215999999986  │ 3569.832000000024  │ 200    │
│ 23      │ 'http://localhost:3080/api/prompts/groups?limit=10'                                                             │ 2811.8430000000226 │ 4081.8640000000305 │ 200    │
│ 24      │ 'http://localhost:3080/api/keys?name=openAI'                                                                    │ 3168.451000000001  │ 3676.8640000000305 │ 200    │
│ 25      │ 'http://localhost:3080/api/presets'                                                                             │ 3169.8949999999895 │ 3708.0100000000093 │ 200    │
│ 26      │ 'http://localhost:3080/api/tags'                                                                                │ 3171.3239999999932 │ 3713.345000000001  │ 200    │
│ 27      │ 'http://localhost:3080/api/share/link/16390000-0000-4000-8000-000000000001'                                     │ 3171.5830000000133 │ 4082.110000000015  │ 200    │
│ 28      │ 'http://localhost:3080/api/messages/16390000-0000-4000-8000-000000000001?toolPreviews=1'                        │ 3171.8040000000037 │ 4185.582000000024  │ 200    │
│ 29      │ 'http://localhost:3080/api/files/config'                                                                        │ 3173.5130000000063 │ 3962.6380000000063 │ 200    │
│ 30      │ 'http://localhost:3080/api/user/settings/favorites/tools'                                                       │ 3173.7460000000137 │ 4221.078999999998  │ 200    │
│ 31      │ 'http://localhost:3080/api/endpoints/token-config'                                                              │ 3173.9320000000007 │ 4221.331000000035  │ 200    │
│ 32      │ 'http://localhost:3080/api/user/settings/skills/active'                                                         │ 3174.719000000012  │ 4592.937999999995  │ 200    │
│ 33      │ 'http://localhost:3080/api/agents/tools/web_search/auth'                                                        │ 3175.2940000000235 │ 7114.002999999997  │ 200    │
│ 34      │ 'http://localhost:3080/api/agents/tools/calls?conversationId=16390000-0000-4000-8000-000000000001'              │ 3175.8430000000226 │ 4593.928000000014  │ 200    │
│ 35      │ 'http://localhost:3080/api/agents/chat/status/16390000-0000-4000-8000-000000000001?generationProtocolVersion=2' │ 4314.809000000008  │ 4569.786000000022  │ 200    │
└─────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────┘

Inspect .lighthouse HTML/JSON and e2e/lighthouse/README.md. Reuse loaded user/config data; overlap independent reads without bypassing authorization.

┌─────────┬────────────────────────────┬──────────────────────┬───────┐
│ (index) │ audit                      │ median               │ limit │
├─────────┼────────────────────────────┼──────────────────────┼───────┤
│ 0       │ 'largest-contentful-paint' │ 4265.005             │ 4500  │
│ 1       │ 'cumulative-layout-shift'  │ 0.017915458366167585 │ 0.1   │
│ 2       │ 'total-blocking-time'      │ 503.3829999999998    │ 500   │
└─────────┴────────────────────────────┴──────────────────────┴───────┘

  1) [chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

    Error: Median total-blocking-time must stay within 500

    expect(received).toBeLessThanOrEqual(expected)

    Expected: <= 500
    Received:    503.3829999999998

       at audit.ts:159

      157 |   console.table(measured);
      158 |   for (const { audit, median, limit } of measured) {
    > 159 |     expect(median, `Median ${audit} must stay within ${limit}`).toBeLessThanOrEqual(limit);
          |                                                                 ^
      160 |   }
      161 |   return results;
      162 | }
        at auditPage (/home/runner/work/LibreChat/LibreChat/e2e/lighthouse/audit.ts:159:65)
        at /home/runner/work/LibreChat/LibreChat/e2e/lighthouse/load.spec.ts:33:19

    attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/test-failed-1.png
    ────────────────────────────────────────────────────────────────────────────────────────────────

    Error Context: e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/error-context.md

    attachment #3: trace (application/zip) ─────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/trace.zip
    Usage:

        npx playwright show-trace e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/trace.zip

    ────────────────────────────────────────────────────────────────────────────────────────────────


🤖: global teardown has been started
2026-10-06 18:55:12 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-10-06 18:55:12 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
🤖:  ✅  Connected to Database
🤖:  ✅  Found user in Database
🤖:  ✅  Deleted 1 convos & 2 messages
🤖:  ✅  Deleted user from Database
🤖: global teardown has been started
2026-10-06 18:55:13 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-10-06 18:55:13 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
🤖:  ✅  Connected to Database
🤖:  ⚠️  User not found in Database
  1 failed
    [chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

Open the full run

@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: c92a276815

ℹ️ 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 packages/api/src/endpoints/reasoning.ts Outdated
Comment thread client/src/hooks/Endpoint/useModelReasoning.ts 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: 2ef28057c7

ℹ️ 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 client/src/hooks/Endpoint/useModelReasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts
Comment thread packages/api/src/endpoints/reasoning.ts 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: 9fedc9bb92

ℹ️ 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 client/src/data-provider/Endpoints/queries.ts Outdated
Comment thread packages/api/src/modelSpecs/reasoningOverride.ts Outdated
Comment thread packages/data-provider/src/parameterSettings.ts 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: 5e0ccf24c2

ℹ️ 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 client/src/hooks/Endpoint/useModelReasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread client/src/hooks/Chat/useChatFunctions.ts
Comment thread packages/api/src/endpoints/custom/initialize.ts Outdated
@berry-13
berry-13 added this pull request to stack #16846 October 6, 2026 20:31
Copilot AI balanced review requested due to automatic review settings October 6, 2026 20:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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: 65c64246dd

ℹ️ 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 packages/api/src/endpoints/reasoning.ts
Comment thread client/src/hooks/Chat/useChatFunctions.ts 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: 304d9f854d

ℹ️ 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 packages/api/src/endpoints/reasoning.ts Outdated
Comment thread client/src/components/Chat/Input/Reasoning.tsx Outdated
Comment thread packages/api/src/endpoints/reasoning.ts Outdated
Comment thread client/src/hooks/Chat/useChatFunctions.ts
Base automatically changed from feat/host-implied-reasoning-effort to dev October 8, 2026 16:00
@berry-13
berry-13 force-pushed the feat/openrouter-per-model-reasoning-efforts branch from 8d00900 to 8251539 Compare October 8, 2026 16:00
@berry-13
berry-13 merged commit 5785723 into dev Oct 8, 2026
44 checks passed
@berry-13
berry-13 deleted the feat/openrouter-per-model-reasoning-efforts branch October 8, 2026 16:04

@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: 8251539920

ℹ️ 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 on lines +217 to +219
for (const [name, value] of configuredQuery) {
if (!nextURL.searchParams.has(name)) {
nextURL.searchParams.append(name, value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve repeated base-query values across catalog pages

When an accepted baseURL contains a repeated query parameter, such as ?scope=models&scope=reasoning, and a pagination link omits that parameter, the first configured value is appended and then has(name) suppresses every later value with the same name. The first catalog page therefore receives the complete configured query while subsequent pages receive only one value, which can change proxy authorization/filtering or make the remaining catalog unavailable. Track which parameter names were supplied by the pagination link before merging so all configured values for an absent name are retained.

Useful? React with 👍 / 👎.

Comment on lines 375 to +376
const targetFingerprint = targetResolved
? `${isAgent ? conversation?.agent_id : provider}:${model}:${settingFingerprint}`
? `${isAgent ? conversation?.agent_id : provider}:${model}`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Encode target identity without delimiter collisions

Endpoint names are unrestricted strings and OpenRouter model IDs commonly contain :, so two distinct targets can produce the same fingerprint—for example endpoint foo with model bar:baz and endpoint foo:bar with model baz. Switching between those targets then leaves targetChanged false; if both support the staged value, a one-shot reasoning override selected for the old target silently carries into the new one. Use a structured tuple or otherwise collision-free encoding for the endpoint/agent and model identity.

Useful? React with 👍 / 👎.

Comment on lines +373 to +376
if (models != null) {
const entry: CatalogEntry = { models, expiresAt: Date.now() + target.ttlMs };
await deps.cache.set(key, entry, target.ttlMs);
return entry;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear a stale failure marker after a successful catalog read

In a multi-replica deployment using the shared cache, two cold lookups can pass the failure-marker check concurrently, after which one replica fails and writes the marker while another succeeds and writes the catalog. If reasoningCatalogTtlMs is shorter than reasoningCatalogFailureTtlMs—for example the allowed 60 seconds versus 10 minutes—the successful entry expires while the failure marker remains, and every subsequent lookup returns unavailable without retrying for the rest of the failure window. Remove the failure marker when a successful read is cached so a concurrent transient failure cannot override the newer success.

Useful? React with 👍 / 👎.

Comment on lines +410 to +412
(targetChanged ||
(!capabilitiesPending &&
(explicitlyUnavailable || unsupportedResolved || mismatchedSetting)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear definitively unavailable overrides during refresh

When an OpenRouter capability request is pending or has failed, capabilitiesPending also prevents clearing for definitive conditions such as enabled === false or hasAddedConversation === true. A value staged before the parameters interface is disabled can therefore remain hidden in the atom throughout an outage and later resurface; an Auto value can also be drained and submitted because the send path always accepts that sentinel. Only catalog-dependent conditions should wait for capabilities—explicitly unavailable controls should clear their staged override immediately.

Useful? React with 👍 / 👎.

Comment on lines +86 to +88
refetchInterval: (data, query) => {
if (query.state.status === 'error') {
return Time.THIRTY_SECONDS;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor the configured failure retry window in the client

When an administrator changes reasoningCatalogFailureTtlMs, the browser still retries an errored capability query every fixed 30 seconds. With a zero or short failure TTL, controls can remain hidden long after the server is ready to retry; with the allowed 10-minute TTL, every client repeatedly hits a server entry that cannot retry yet. Carry the server's remaining failure lifetime in the error response or derive this interval from the endpoint configuration instead of hard-coding a second policy.

AGENTS.md reference: AGENTS.md:L90-L92

Useful? React with 👍 / 👎.

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.

2 participants