Repository navigation
🎚️ feat: Filter OpenRouter Reasoning Efforts by the Selected Model - #16808
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
|
Lighthouse CI failed. The last 80 log lines contain the measured budgets and assertion failures. |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
…s for Reasoning Efforts
…rts While Loading
…nd Keep Restored Efforts
…known and Accept Auto
…etches Capabilities
…and Make the Lifetime Configurable
…Align Client Freshness
…Server Entry Expiry
… and Skip User-Scoped Catalogs
…te From the Remaining Lifetime
…Entries and Hide Efforts During Refresh
…Expired Idle Data as Unknown
…Lists and Keep Staged Efforts
8d00900 to
8251539
Compare
There was a problem hiding this comment.
💡 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".
| for (const [name, value] of configuredQuery) { | ||
| if (!nextURL.searchParams.has(name)) { | ||
| nextURL.searchParams.append(name, value); |
There was a problem hiding this comment.
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 👍 / 👎.
| const targetFingerprint = targetResolved | ||
| ? `${isAgent ? conversation?.agent_id : provider}:${model}:${settingFingerprint}` | ||
| ? `${isAgent ? conversation?.agent_id : provider}:${model}` |
There was a problem hiding this comment.
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 👍 / 👎.
| if (models != null) { | ||
| const entry: CatalogEntry = { models, expiresAt: Date.now() + target.ttlMs }; | ||
| await deps.cache.set(key, entry, target.ttlMs); | ||
| return entry; |
There was a problem hiding this comment.
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 👍 / 👎.
| (targetChanged || | ||
| (!capabilitiesPending && | ||
| (explicitlyUnavailable || unsupportedResolved || mismatchedSetting))) |
There was a problem hiding this comment.
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 👍 / 👎.
| refetchInterval: (data, query) => { | ||
| if (query.state.status === 'error') { | ||
| return Time.THIRTY_SECONDS; |
There was a problem hiding this comment.
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 👍 / 👎.
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
noneon a mandatory-reasoning model, ormaxon a model without it, failed at the provider.OpenRouter reports the efforts each model accepts (
reasoning.supported_efforts,reasoning.mandatory) inGET /models. The server now reads that catalog for the OpenRouter endpoints in the app config, caches it for an hour, and serves it atGET /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, dropnonewhen 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
Type of change
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 lintis clean andtsc --noEmitpasses inpackages/data-provider,packages/apiandclient.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.jsand the endpoints route gain wiring only, with the behavior inpackages/api. ThebuildEndpointOptionmiddleware spec could not run in this environment because@librechat/agentslacksGitHubCompareToolDefinition(unrelated to this change), so that wiring is covered by theapplyRequestReasoningOverridetests instead.Checklist