Repository navigation
feat(thinking): allow custom model compat to opt into xhigh - #48904
Milchstrassse wants to merge 6 commits into
Conversation
Greptile SummaryThis PR extends the thinking-level system so that custom model definitions (under Key observations:
Confidence Score: 3/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/auto-reply/thinking.ts
Line: 204-212
Comment:
**Explicit config override bypasses binary-thinking provider guard**
`supportsXHighThinking` returns the explicit config/catalog override immediately without first checking `isBinaryThinkingProvider`. This means that if a user (or catalog) configures `compat.supportsXHighThinking: true` for a provider that `isBinaryThinkingProvider` recognises as binary (e.g. `zai`), the function returns `true`, while `listThinkingLevelLabels` (which checks `isBinaryThinkingProvider` first) would still return `["off", "on"]`.
The practical consequence is that all the validation paths that gate on `supportsXHighThinking` alone — `agent-command.ts`, `get-reply-run.ts`, `directive-handling.impl.ts`, `sessions-patch.ts`, `cron/isolated-agent/run.ts`, and `llm-task-tool.ts` — would allow `xhigh` through for a misconfigured binary-thinking model, while the formatted level list would not include it and could confuse callers downstream.
Consider adding an early guard:
```
export function supportsXHighThinking(
provider?: string | null,
model?: string | null,
source?: ThinkingSupportSource,
): boolean {
if (isBinaryThinkingProvider(provider, model)) {
return false;
}
const explicitOverride = resolveExplicitXHighOverride(provider, model, source);
if (typeof explicitOverride === "boolean") {
return explicitOverride;
}
// ... rest of provider-runtime lookup
}
```
This also makes `supportsXHighThinking` and `listThinkingLevelLabels` agree for all inputs.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/auto-reply/thinking.ts
Line: 270-276
Comment:
**Potentially misleading "including" phrasing in hint**
When explicit refs exist, the hint is formatted as:
```
"provider models that advertise xhigh reasoning (including robot/gpt-5.4)"
```
The word "including" implies `robot/gpt-5.4` is a member of the "provider models that advertise xhigh reasoning" set, when in reality it is separately opted in via config. If no provider-runtime models actually support `xhigh` in the current deployment (only the custom one does), the phrasing is misleading — a user reading the error might look for `robot/gpt-5.4` in a provider catalogue and not find it there.
Consider a phrasing that explicitly distinguishes the two sources, e.g.:
```
"provider models that advertise xhigh reasoning, or config-defined models: robot/gpt-5.4"
```
or simply listing only the config-defined models when `explicitRefs` is non-empty and no enumerable provider-runtime list is available.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 94b0917 |
|
I tested this against a real custom provider setup and the direction in this PR looks right to me. Concrete repro from my side:
So the underlying issue is real for config-defined custom models, and I agree with the design choice here: explicit opt-in via While comparing the call sites against this diff, I noticed two user-visible surfaces that still seem uncovered:
One more edge case I would strongly recommend handling before merge:
Overall: the main approach in this PR matches the problem I reproduced locally, but I think the native command choices + ACP presentation + binary-provider guard should be covered so the user-facing behavior is consistent everywhere. |
94b0917 to
fe33c21
Compare
|
Addressed the remaining review gaps in
I also rebased the branch onto current Testing note: I did not run project code locally in this environment; verification here was static review only. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe33c21d0e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return collectExplicitXHighRefs(source) | ||
| .filter((entry) => entry.supported) | ||
| .map((entry) => entry.ref); |
There was a problem hiding this comment.
Exclude binary providers from xhigh hint candidates
supportsXHighThinking now correctly blocks xhigh for binary-thinking providers, but this hint path only filters by the raw supported flag from config/catalog. If a user sets compat.supportsXHighThinking: true on a binary provider model (for example a zai/* entry), formatXHighModelHint({ config }) will still advertise that ref as xhigh-capable even though every validator rejects xhigh for it. That creates contradictory guidance in /think and error messages; the hint list should also enforce the same binary-provider gate used by supportsXHighThinking.
Useful? React with 👍 / 👎.
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep this PR open. Current main has a provider-profile-based thinking architecture, but it still does not implement the PR’s central behavior: allowing a custom Best possible solution: Keep this PR open for maintainer review or contributor refresh. The best path is to adapt the custom-model xhigh opt-in to current main’s What I checked:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against f256eeba431b. |
|
Thanks @Milchstrassse. I landed a maintainer rewrite of this in #74273, now on main as 93d5cd1. The landed version keeps the fix focused on configured custom-model compat: Closing this PR as superseded by #74273. |
Summary
Describe the problem and fix in 2–5 bullets:
models.providers.*.models[*]definitions could not opt intoxhigh; validation and help paths only trusted built-in/provider-advertised support and rejected or downgraded those refs.highand surfaced misleading guidance.compat.supportsXHighThinking, taught thinking helpers to honor config/catalog overrides in a browser-safe way, and threaded config-aware hints/validation through reply, gateway, agent, cron, TUI, andllm-taskentry points with regression coverage.AI-assisted: Yes (
Codex)Testing: Untested locally; statically reviewed only (project execution was intentionally not run in this environment)
Prompts/session logs: available in the Codex session history
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
xhighby settingmodels.providers.*.models[*].compat.supportsXHighThinking: true.xhighfor an otherwise provider-advertised model withcompat.supportsXHighThinking: false./thinkhelp, validation errors, gateway session patches, agent CLI validation, cron fallback, andllm-taskerrors now reflect config-awarexhighsupport.Security Impact (required)
Yes/No)NoYes/No)NoYes/No)NoYes/No)NoYes/No)NoYes, explain risk + mitigation:N/ARepro + Verification
Environment
llm-taskmodels.providers.robot.models[0].compat.supportsXHighThinking = trueSteps
compat.supportsXHighThinking: true.xhighvalidation/help path such as/think, gateway session patching, agent CLI validation, orllm-task.falseon a provider-advertisedxhighmodel and repeat the same paths.Expected
xhighis surfaced and accepted for explicit custom opt-ins.falsesuppressesxhighand updates the hint/error text consistently.Actual
Evidence
Attach at least one:
Static inspection snippets:
Human Verification (required)
What you personally verified (not just CI), and how:
compat.supportsXHighThinkingfrom config/schema intosupportsXHighThinking(), then through reply handling, session patch validation, agent CLI checks, cron downgrade logic, TUI help/completions, andllm-taskvalidation.falsesuppresses built-in/provider-advertisedxhigh, and the thinking helper stays browser-safe by consuming injected config instead of runtime config lookup.codex review --base origin/mainin this environment.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No)YesYes/No)Yes(new optionalcompat.supportsXHighThinking)Yes/No)NoN/AFailure Recovery (if this breaks)
compat.supportsXHighThinkingfrom the affected model config or revert this commit.models.providers.*.models[*].compat,src/auto-reply/thinking.ts, and the caller validations listed in this PR.xhighappears for a model that should stay athigh, or a config-opted model still gets downgraded/rejected.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.xhigheven if the backend does not actually support it.falsestill disablesxhigh, and all validation/help paths now consistently read the same override source.ThinkingSupportSourceand does not call runtime config loaders.