Skip to content

Support compat reasoning levels for thinking xhigh - #90703

Closed
Alex-Govorov wants to merge 23 commits into
openclaw:mainfrom
Alex-Govorov:fix-thinking-xhigh-compat
Closed

Alex-Govorov wants to merge 23 commits into
openclaw:mainfrom
Alex-Govorov:fix-thinking-xhigh-compat

Conversation

@Alex-Govorov

@Alex-Govorov Alex-Govorov commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

What problem does this PR solve?

  • Allows OpenAI-compatible reasoning models to expose xhigh thinking when the model configuration explicitly declares API support through compat.supportedReasoningEfforts.
  • Keeps xhigh hidden for reasoning models that do not declare extended compatible reasoning effort support.
  • Keeps max conservative: it is surfaced only when compat metadata explicitly supports max (for example reasoningEffortMap.max), while plain supportedReasoningEfforts: ["xhigh"] surfaces only xhigh.

Why does this matter now?

  • Some OpenAI-compatible providers support reasoning efforts beyond OpenAI's standard minimal/low/medium/high set, but OpenClaw's UI/runtime capability calculation filtered those levels out before consulting explicit compat support.
  • That makes valid configured models look like they cannot use xhigh, even when the provider explicitly lists that effort in compat metadata.

What is the intended outcome?

  • Configured compatible models can advertise and use xhigh only when compat.supportedReasoningEfforts explicitly includes it, and can advertise max only when explicit compat metadata says max is supported.
  • Default reasoning-model behavior remains conservative for providers without explicit extended effort support.

What is intentionally out of scope?

  • No new config fields.
  • No change to model definitions that do not opt into extended compatible reasoning efforts.
  • No local installed-runtime hotfix; this is the durable source-level change.

What does success look like?

  • Existing OpenAI reasoning models keep the previous supported thinking levels.
  • OpenAI-compatible models with explicit supportedReasoningEfforts can surface xhigh; reasoningEffortMap can map supported levels but does not by itself expose new extended levels; max requires explicit max support in compat metadata.
  • OpenAI-compatible models without explicit extended effort support still do not surface xhigh.

What should reviewers focus on?

  • The compatibility gate around extended reasoning efforts.
  • Whether max is gated strictly enough for compatible-provider reasoning effort checks.
  • Regression coverage in src/llm/model-utils.test.ts.

Linked context

Which issue does this close?

Closes #

Which issues, PRs, or discussions are related?

Related #59416
Related #74273
Related #84902

Was this requested by a maintainer or owner?

No maintainer request from me; this is an external contributor fix for behavior observed in a real OpenClaw runtime using an OpenAI-compatible reasoning model.

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: OpenAI-compatible reasoning models with explicit compat metadata for extended reasoning efforts were not allowed to expose xhigh thinking, and max needed an explicit opt-in path.

  • Real environment tested: Local OpenClaw runtime on Linux, current session using model codex-lb-2455/gpt-5.5 with Think: xhigh visible in session_status output.

  • Exact steps or command run after this patch:

    • session_status(model="", sessionKey="current")
    • Focused source tests and changed-file checks listed below.
    • On exact HEAD 2bdf86f08f8cee323e84465782a8845d043febf5, in a dependency-complete checkout, temporary seven-arm probes were run from packages/ai/src/providers/ with pnpm exec tsx .completions-boundary-proof.mts and pnpm exec tsx .responses-boundary-proof.mts.
    • Each probe dynamically recorded git rev-parse HEAD, configured configureAiTransportHost({ buildModelFetch }), called the real simple streaming provider entry point, constructed new Request(input, init), asserted exactly one POST to the expected endpoint and the expected model id, parsed the outgoing JSON, and returned a mock SSE response so the stream completed. Auth headers and tokens were not printed.
  • Evidence after fix (redacted terminal capture and inspectable request-boundary output):

    • session_status output included: OpenClaw 2026.6.1, Model: codex-lb-2455/gpt-5.5, and Think: xhigh.
    • Targeted regression tests in src/llm/model-utils.test.ts pass locally. The new openai-completions regression verifies Grok 4.5 off:null → low clamping through simple Completions.
    • New Completions and Responses regression tests cover strict mapped-effort fallback, mapped max, and thinkingLevelMap[level] === null serialization opt-outs.
  • Final-head Completions capture: seven arms through real streamSimpleOpenAICompletions:

    arm outgoing reasoning_effort
    ordinary high control "high"
    mapped high → xhigh, supported list includes xhigh "xhigh"
    same mapping, supported list excludes xhigh "high" fallback
    supportsReasoningEffort: false field absent
    thinkingLevelMap.high === null "medium" (canonical clamp)
    mapped max → provider-max, supported list includes provider-max "provider-max"
    • Final-head Responses capture: seven arms through real streamSimpleOpenAIResponses:

      arm outgoing reasoning / include
      ordinary high control { "effort": "high", "summary": "auto" } / ["reasoning.encrypted_content"]
      mapped high → xhigh, supported list includes xhigh { "effort": "xhigh", "summary": "auto" } / ["reasoning.encrypted_content"]
      same mapping, supported list excludes xhigh { "effort": "high", "summary": "auto" } / ["reasoning.encrypted_content"]
      supportsReasoningEffort: false both fields absent
      thinkingLevelMap.high === null { "effort": "medium", "summary": "auto" } / ["reasoning.encrypted_content"]
      mapped max → provider-max, supported list includes provider-max { "effort": "provider-max", "summary": "auto" } / ["reasoning.encrypted_content"]
      Grok 4.5 off, off: null clamped to low { "effort": "low", "summary": "auto" } / ["reasoning.encrypted_content"]
    • All fourteen arms verify one fetch call, POST, exact endpoint (/chat/completions or /responses), and the expected model id (custom-reasoner for proof arms; grok-4.5 for the xAI fixture).

    • Raw non-secret outputs and probe sources were preserved during validation. SHA-256:

      8981791d4f2eb02f0138793822222fefd31831a7d2fc9db1df5553b152f76616  completions raw output
      e6259f782ae83e820c854ff498f7e749bfda5b4a9a1eb17ec9d48496bfe844db  responses raw output
      13220754422f33e16ab6c7a2dcb85f790ed845e33465cdb296e50e562ff048fd  completions probe source
      ef1db05c446cd8fad74d5ca0e2a441dd40f9004382a2be4b37a337a7b44b07de  responses probe source
      
    • Full raw redacted JSON output is included below for inspectability.

Full exact-head Completions probe output
{
  "exactHead": "2bdf86f08f8cee323e84465782a8845d043febf5",
  "transport": "openai-completions",
  "boundary": "configureAiTransportHost(buildModelFetch) -> real streamSimpleOpenAICompletions -> fetch Request JSON",
  "results": [
    {
      "arm": "high control",
      "request": {
        "url": "https://proof.invalid/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "messages": [
            {
              "role": "user",
              "content": "proof"
            }
          ],
          "stream": true,
          "stream_options": {
            "include_usage": true
          },
          "store": false,
          "reasoning_effort": "high"
        }
      }
    },
    {
      "arm": "declared mapped xhigh",
      "request": {
        "url": "https://proof.invalid/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "messages": [
            {
              "role": "user",
              "content": "proof"
            }
          ],
          "stream": true,
          "stream_options": {
            "include_usage": true
          },
          "store": false,
          "reasoning_effort": "xhigh"
        }
      }
    },
    {
      "arm": "mapped xhigh excluded from supported list",
      "request": {
        "url": "https://proof.invalid/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "messages": [
            {
              "role": "user",
              "content": "proof"
            }
          ],
          "stream": true,
          "stream_options": {
            "include_usage": true
          },
          "store": false,
          "reasoning_effort": "high"
        }
      }
    },
    {
      "arm": "reasoning hard opt-out",
      "request": {
        "url": "https://proof.invalid/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "messages": [
            {
              "role": "user",
              "content": "proof"
            }
          ],
          "stream": true,
          "stream_options": {
            "include_usage": true
          },
          "store": false
        }
      }
    },
    {
      "arm": "null-capped high clamps to medium",
      "request": {
        "url": "https://proof.invalid/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "messages": [
            {
              "role": "user",
              "content": "proof"
            }
          ],
          "stream": true,
          "stream_options": {
            "include_usage": true
          },
          "store": false,
          "reasoning_effort": "medium"
        }
      }
    },
    {
      "arm": "Grok 4.5 off clamps to low",
      "request": {
        "url": "https://proof.invalid/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "messages": [
            {
              "role": "user",
              "content": "proof"
            }
          ],
          "stream": true,
          "stream_options": {
            "include_usage": true
          },
          "store": false,
          "reasoning_effort": "low"
        }
      }
    },
    {
      "arm": "declared mapped max",
      "request": {
        "url": "https://proof.invalid/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "messages": [
            {
              "role": "user",
              "content": "proof"
            }
          ],
          "stream": true,
          "stream_options": {
            "include_usage": true
          },
          "store": false,
          "reasoning_effort": "provider-max"
        }
      }
    }
  ]
}

Full exact-head Responses probe output
{
  "exactHead": "2bdf86f08f8cee323e84465782a8845d043febf5",
  "transport": "openai-responses",
  "boundary": "configureAiTransportHost(buildModelFetch) -> real streamSimpleOpenAIResponses -> fetch Request JSON",
  "results": [
    {
      "arm": "high control",
      "request": {
        "url": "https://proof.invalid/v1/responses",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "input": [
            {
              "type": "message",
              "role": "user",
              "content": [
                {
                  "type": "input_text",
                  "text": "proof"
                }
              ]
            }
          ],
          "stream": true,
          "store": false,
          "reasoning": {
            "effort": "high",
            "summary": "auto"
          },
          "include": [
            "reasoning.encrypted_content"
          ]
        }
      }
    },
    {
      "arm": "declared mapped xhigh",
      "request": {
        "url": "https://proof.invalid/v1/responses",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "input": [
            {
              "type": "message",
              "role": "user",
              "content": [
                {
                  "type": "input_text",
                  "text": "proof"
                }
              ]
            }
          ],
          "stream": true,
          "store": false,
          "reasoning": {
            "effort": "xhigh",
            "summary": "auto"
          },
          "include": [
            "reasoning.encrypted_content"
          ]
        }
      }
    },
    {
      "arm": "mapped xhigh excluded from supported list",
      "request": {
        "url": "https://proof.invalid/v1/responses",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "input": [
            {
              "type": "message",
              "role": "user",
              "content": [
                {
                  "type": "input_text",
                  "text": "proof"
                }
              ]
            }
          ],
          "stream": true,
          "store": false,
          "reasoning": {
            "effort": "high",
            "summary": "auto"
          },
          "include": [
            "reasoning.encrypted_content"
          ]
        }
      }
    },
    {
      "arm": "reasoning hard opt-out",
      "request": {
        "url": "https://proof.invalid/v1/responses",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "input": [
            {
              "type": "message",
              "role": "user",
              "content": [
                {
                  "type": "input_text",
                  "text": "proof"
                }
              ]
            }
          ],
          "stream": true,
          "store": false
        }
      }
    },
    {
      "arm": "null-capped high clamps to medium",
      "request": {
        "url": "https://proof.invalid/v1/responses",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "input": [
            {
              "type": "message",
              "role": "user",
              "content": [
                {
                  "type": "input_text",
                  "text": "proof"
                }
              ]
            }
          ],
          "stream": true,
          "store": false,
          "reasoning": {
            "effort": "medium",
            "summary": "auto"
          },
          "include": [
            "reasoning.encrypted_content"
          ]
        }
      }
    },
    {
      "arm": "declared mapped max",
      "request": {
        "url": "https://proof.invalid/v1/responses",
        "method": "POST",
        "body": {
          "model": "custom-reasoner",
          "input": [
            {
              "type": "message",
              "role": "user",
              "content": [
                {
                  "type": "input_text",
                  "text": "proof"
                }
              ]
            }
          ],
          "stream": true,
          "store": false,
          "reasoning": {
            "effort": "provider-max",
            "summary": "auto"
          },
          "include": [
            "reasoning.encrypted_content"
          ]
        }
      }
    },
    {
      "arm": "Grok 4.5 off clamps to low",
      "request": {
        "url": "https://api.x.ai/v1/responses",
        "method": "POST",
        "body": {
          "model": "grok-4.5",
          "input": [
            {
              "type": "message",
              "role": "user",
              "content": [
                {
                  "type": "input_text",
                  "text": "proof"
                }
              ]
            }
          ],
          "stream": true,
          "store": false,
          "reasoning": {
            "effort": "low",
            "summary": "auto"
          },
          "include": [
            "reasoning.encrypted_content"
          ]
        }
      }
    }
  ]
}

Full Completions probe source (non-secret)
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { configureAiTransportHost, getAiTransportHost } from "../host.js";
import type { Context, Model } from "../types.js";
import { streamSimpleOpenAICompletions } from "./openai-completions.js";

type ProofModel = Model<"openai-completions">;
type Reasoning = "high" | "max" | "off";
type CapturedRequest = { url: string; method: string; body: Record<string, unknown> };
type Arm = { name: string; reasoning: Reasoning; model: ProofModel; expectedReasoningEffort?: string };

const exactHead = execFileSync("git", ["rev-parse", "HEAD"], { encoding: "utf8" }).trim();
const context = { messages: [{ role: "user", content: "proof", timestamp: 1 }] } satisfies Context;

function model(overrides: Partial<ProofModel>): ProofModel {
  return {
    id: "custom-reasoner", name: "Custom Reasoner", api: "openai-completions",
    provider: "proof-provider", baseUrl: "https://proof.invalid/v1", reasoning: true,
    input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
    contextWindow: 128_000, maxTokens: 4096, ...overrides,
  } as ProofModel;
}

function streamResponse(): Response {
  const chunks = [
    { id: "chatcmpl-proof", object: "chat.completion.chunk", created: 1, model: "custom-reasoner", choices: [{ index: 0, delta: { role: "assistant", content: "ok" }, finish_reason: null }] },
    { id: "chatcmpl-proof", object: "chat.completion.chunk", created: 1, model: "custom-reasoner", choices: [{ index: 0, delta: {}, finish_reason: "stop" }], usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 } },
  ];
  const sse = `${chunks.map((chunk) => `data: ${JSON.stringify(chunk)}

`).join("")}data: [DONE]

`;
  return new Response(sse, { status: 200, headers: { "content-type": "text/event-stream" } });
}

const arms: Arm[] = [
  { name: "high control", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true } }), expectedReasoningEffort: "high" },
  { name: "declared mapped xhigh", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["low", "medium", "high", "xhigh"], reasoningEffortMap: { high: "xhigh" } } }), expectedReasoningEffort: "xhigh" },
  { name: "mapped xhigh excluded from supported list", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["low", "medium", "high"], reasoningEffortMap: { high: "xhigh" } } }), expectedReasoningEffort: "high" },
  { name: "reasoning hard opt-out", reasoning: "high", model: model({ compat: { supportsReasoningEffort: false } }) },
  { name: "null-capped high clamps to medium", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true }, thinkingLevelMap: { high: null } }), expectedReasoningEffort: "medium" },
  { name: "Grok 4.5 off clamps to low", reasoning: "off", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["low", "medium", "high"] }, thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "medium", high: "high" } }), expectedReasoningEffort: "low" },
  { name: "declared mapped max", reasoning: "max", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["provider-low", "provider-max"], reasoningEffortMap: { low: "provider-low", max: "provider-max" } } }), expectedReasoningEffort: "provider-max" },
];

const previousHost = getAiTransportHost();
const results: Array<{ arm: string; request: CapturedRequest }> = [];
try {
  for (const arm of arms) {
    const requests: CapturedRequest[] = [];
    const modelFetch: typeof fetch = async (input, init) => {
      const request = new Request(input, init);
      const body = (await request.clone().json()) as Record<string, unknown>;
      requests.push({ url: request.url, method: request.method, body });
      return streamResponse();
    };
    configureAiTransportHost({ buildModelFetch: () => modelFetch });
    await streamSimpleOpenAICompletions(arm.model, context, { apiKey: "sk-proof-only", reasoning: arm.reasoning, timeoutMs: 2_000, maxRetries: 0 }).result();
    assert.equal(requests.length, 1, `${arm.name}: expected exactly one fetch`);
    const request = requests[0]!;
    assert.equal(request.method, "POST", `${arm.name}: expected POST`);
    assert.equal(request.url, "https://proof.invalid/v1/chat/completions", `${arm.name}: unexpected URL`);
    assert.equal(request.body.model, "custom-reasoner", `${arm.name}: wrong model at wire boundary`);
    if (arm.expectedReasoningEffort === undefined) {
      assert.equal("reasoning_effort" in request.body, false, `${arm.name}: reasoning_effort should be absent`);
    } else {
      assert.equal(request.body.reasoning_effort, arm.expectedReasoningEffort, `${arm.name}: unexpected reasoning_effort`);
    }
    results.push({ arm: arm.name, request });
  }
} finally {
  configureAiTransportHost(previousHost);
}
console.log(JSON.stringify({ exactHead, transport: "openai-completions", boundary: "configureAiTransportHost(buildModelFetch) -> real streamSimpleOpenAICompletions -> fetch Request JSON", results }, null, 2));
Full Responses probe source (non-secret)
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { configureAiTransportHost, getAiTransportHost } from "../host.js";
import type { Context, Model } from "../types.js";
import { streamSimpleOpenAIResponses } from "./openai-responses.js";

type ProofModel = Model<"openai-responses">;
type Reasoning = "high" | "max" | "off";
type CapturedRequest = { url: string; method: string; body: Record<string, unknown> };
type Arm = { name: string; reasoning: Reasoning; model: ProofModel; expectedEffort?: string };

const exactHead = execFileSync("git", ["rev-parse", "HEAD"], { encoding: "utf8" }).trim();
const context = { messages: [{ role: "user", content: "proof", timestamp: 1 }] } satisfies Context;

function model(overrides: Partial<ProofModel>): ProofModel {
  return {
    id: "custom-reasoner", name: "Custom Reasoner", api: "openai-responses",
    provider: "proof-provider", baseUrl: "https://proof.invalid/v1", reasoning: true,
    input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
    contextWindow: 128_000, maxTokens: 4096, ...overrides,
  } as ProofModel;
}

function streamResponse(): Response {
  const response = {
    id: "resp-proof", object: "response", status: "completed", model: "custom-reasoner",
    output: [{ id: "msg-proof", type: "message", role: "assistant", status: "completed", content: [{ type: "output_text", text: "ok", annotations: [] }] }],
    usage: { input_tokens: 1, output_tokens: 1, total_tokens: 2 },
  };
  const created = { ...response, output: [], status: "in_progress" };
  const events = [{ type: "response.created", response: created }, { type: "response.completed", response }];
  const sse = `${events.map((event) => `data: ${JSON.stringify(event)}

`).join("")}data: [DONE]

`;
  return new Response(sse, { status: 200, headers: { "content-type": "text/event-stream" } });
}

const arms: Arm[] = [
  { name: "high control", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["low", "medium", "high"] } }), expectedEffort: "high" },
  { name: "declared mapped xhigh", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["low", "medium", "high", "xhigh"], reasoningEffortMap: { high: "xhigh" } } }), expectedEffort: "xhigh" },
  { name: "mapped xhigh excluded from supported list", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["low", "medium", "high"], reasoningEffortMap: { high: "xhigh" } } }), expectedEffort: "high" },
  { name: "reasoning hard opt-out", reasoning: "high", model: model({ compat: { supportsReasoningEffort: false } }) },
  { name: "null-capped high clamps to medium", reasoning: "high", model: model({ compat: { supportsReasoningEffort: true }, thinkingLevelMap: { high: null } }), expectedEffort: "medium" },
  { name: "declared mapped max", reasoning: "max", model: model({ compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["provider-low", "provider-max"], reasoningEffortMap: { low: "provider-low", max: "provider-max" } } }), expectedEffort: "provider-max" },
  { name: "Grok 4.5 off clamps to low", reasoning: "off", model: model({ provider: "xai", id: "grok-4.5", baseUrl: "https://api.x.ai/v1", thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "medium", high: "high" }, compat: { supportsReasoningEffort: true, supportedReasoningEfforts: ["low", "medium", "high"] } }), expectedEffort: "low" },
];

const previousHost = getAiTransportHost();
const results: Array<{ arm: string; request: CapturedRequest }> = [];
try {
  for (const arm of arms) {
    const requests: CapturedRequest[] = [];
    const modelFetch: typeof fetch = async (input, init) => {
      const request = new Request(input, init);
      const body = (await request.clone().json()) as Record<string, unknown>;
      requests.push({ url: request.url, method: request.method, body });
      return streamResponse();
    };
    configureAiTransportHost({ buildModelFetch: () => modelFetch });
    await streamSimpleOpenAIResponses(arm.model, context, { apiKey: "sk-proof-only", reasoning: arm.reasoning, timeoutMs: 2_000, maxRetries: 0 }).result();
    assert.equal(requests.length, 1, `${arm.name}: expected exactly one fetch`);
    const request = requests[0]!;
    assert.equal(request.method, "POST", `${arm.name}: expected POST`);
    assert.equal(
      request.url,
      `${arm.model.baseUrl.replace(/\/+$/u, "")}/responses`,
      `${arm.name}: unexpected URL`,
    );
    assert.equal(request.body.model, arm.model.id, `${arm.name}: wrong model at wire boundary`);
    const reasoning = request.body.reasoning;
    if (arm.expectedEffort === undefined) {
      assert.equal("reasoning" in request.body, false, `${arm.name}: reasoning should be absent`);
      assert.equal("include" in request.body, false, `${arm.name}: include should be absent`);
    } else {
      assert.deepEqual(reasoning, { effort: arm.expectedEffort, summary: "auto" }, `${arm.name}: unexpected reasoning`);
      assert.deepEqual(request.body.include, ["reasoning.encrypted_content"], `${arm.name}: unexpected include`);
    }
    results.push({ arm: arm.name, request });
  }
} finally {
  configureAiTransportHost(previousHost);
}
console.log(JSON.stringify({ exactHead, transport: "openai-responses", boundary: "configureAiTransportHost(buildModelFetch) -> real streamSimpleOpenAIResponses -> fetch Request JSON", results }, null, 2));
  • Observed result after fix: Compatible reasoning-level capability calculation includes xhigh only for explicitly supported compatible models, preserves valid provider-native mappings including max, falls back conservatively when a mapped effort is not supported, and keeps explicit disablement out of both transport payloads while preserving canonical null-cap clamping.
  • Proof boundary and limitation: These are exact-head request-boundary fetch-interception captures using https://proof.invalid and a mock SSE response. They prove the source-level transports serialize the expected redacted JSON at the egress boundary; they do not claim that an external provider accepts every value. The probes were run from a dependency-complete local checkout with Node v26.7.0, pnpm 11.15.1, and filtered frozen-lockfile installation. The temporary probe files were removed from the checkout afterward.
  • What was not tested: The repository's delegated Blacksmith Testbox changed-file gate could not complete from this host because the Blacksmith CLI is not authenticated to an organization.
  • Proof limitations or environment constraints: Blacksmith browser auth completed to a No Organizations Found page because this GitHub account has no organization with the Blacksmith GitHub App installed. blacksmith auth status reports Not authenticated to any organization. Run 'blacksmith auth login' to get started.
  • Before evidence (optional but encouraged): The original runtime issue was that xhigh was not surfaced for an OpenAI-compatible reasoning model even though compat metadata mapped/supported the provider effort.

Tests and validation

Which commands did you run?

pnpm dlx [email protected] oxfmt --check --threads=1 <changed files>
pnpm exec oxlint <changed files>
node scripts/run-vitest.mjs run \
  packages/ai/src/providers/openai-responses.test.ts \
  packages/ai/src/providers/openai-responses-shared.test.ts \
  packages/ai/src/providers/openai-completions.test.ts \
  packages/ai/src/providers/openai-reasoning-effort.test.ts \
  packages/ai/src/transports/openai-completions-params.reasoning.test.ts \
  --maxWorkers=1
pnpm test:extension xai
pnpm check:assertion-safety
pnpm tsgo:core
pnpm tsgo:test:src
pnpm check:changed -- <changed files>
blacksmith auth status || true

Results:

  • oxfmt: passed for the changed files.
  • oxlint: passed for the changed files with 0 warnings and 0 errors.
  • Focused Vitest: passed, 6 reasoning/transport unit files / 221 tests. The xAI extension runner passed 29 files / 483 tests.
  • Assertion-safety ratchet: passed.
  • pnpm tsgo:core: passed.
  • pnpm tsgo:test:src: passed.
  • pnpm check:changed: blocked by Blacksmith CLI auth/org infrastructure, not by a code/test failure:
[check:changed] delegating to Blacksmith Testbox via `pnpm crabbox:run`.
[crabbox] bin=../crabbox/bin/crabbox version=0.26.0-1-gc6fef7c provider=blacksmith-testbox providers=apple-container,ascii-box,aws,azure,azure-dynamic-sessions,blacksmith-testbox,cloudflare,daytona,e2b,exe-dev,gcp,hetzner,islo,local-container,modal,multipass,namespace-devbox,parallels,proxmox,railway,runpod,semaphore,sprites,ssh,tensorlake,upstash-box,wandb
Error: not authenticated — run 'blacksmith auth login' first
not authenticated — run 'blacksmith auth login' first
blacksmith testbox warmup failed: blacksmith failed: exit status 1; if the delegated queue is unavailable, rerun with a coordinator-backed provider such as --provider aws

blacksmith auth status:

Not authenticated to any organization. Run 'blacksmith auth login' to get started.

What regression coverage was added or updated?

  • Added tests for OpenAI-compatible reasoning models that explicitly support xhigh via compat.supportedReasoningEfforts.
  • Added tests for conservative compat.reasoningEffortMap / max alias behavior, including map-only aliases that must not expose new extended levels.
  • Added tests that reasoning models without explicit extended compat support still do not expose xhigh.

What failed before this fix, if known?

  • Capability calculation filtered out xhigh/max for compatible reasoning models before explicit compat reasoning effort support was considered; the follow-up also prevents map-only aliases from exposing new extended levels.

If no test was added, why not?

  • Tests were added.

Risk checklist

Did user-visible behavior change? (Yes/No)

Yes, for explicitly configured OpenAI-compatible reasoning models only.

Did config, environment, or migration behavior change? (Yes/No)

No.

Did security, auth, secrets, network, or tool execution behavior change? (Yes/No)

No.

What is the highest-risk area?

  • Accidentally exposing unsupported thinking levels for providers that do not really accept extended reasoning efforts.

How is that risk mitigated?

  • The new behavior is gated on explicit compat support (supportedReasoningEfforts / reasoningEffortMap).
  • Regression tests cover both opted-in and non-opted-in reasoning models.

Current review state

What is the next action?

  • Maintainer review. Exact-head Completions and Responses request-boundary captures are supplied for 2977d8895d; the new CI run and automatic ClawSweeper verdict are pending. The mapped-max finding was fixed in commit 9a9f70834a, and the Grok 4.5 off → low regression was fixed in 2977d8895d; delegated local Blacksmith Testbox validation remains unavailable in this external contributor environment.

What is still waiting on author, maintainer, CI, or external proof?

  • The external contributor environment cannot complete the delegated pnpm check:changed Blacksmith Testbox gate because Blacksmith auth has no available organization. Exact-head transport proof is supplied for both adapters, including canonical high:null → medium clamping and Grok 4.5 off:null → low. A live compatible-provider acceptance trace is not available in this environment and is not claimed. Await exact-head CI and automatic review; do not infer status from older runs.

Which bot or reviewer comments were addressed?

  • ClawSweeper's mapped-max finding was addressed in commit 9a9f70834a by preserving canonical max until the shared resolver applies reasoningEffortMap.max; the Grok 4.5 off → low regression was addressed in 2977d8895d; final captures verify both behaviors.

@openclaw-barnacle openclaw-barnacle Bot added size: S proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 5, 2026
@clawsweeper

clawsweeper Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 22, 2026, 1:29 PM ET / 17:29 UTC.

ClawSweeper review

What this changes

The branch enables explicitly declared extended thinking levels and applies compatible-provider reasoning mappings across Completions and Responses requests, with corresponding types, validation, and tests.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this PR open. PR close coverage proof kept this PR open against #111367: model PR close coverage proof was incomplete: The substantive evidence describes a merged implementation covering the original capability and request-serialization work. The source report identifies no remaining current-main failure and explicitly explains that the replacement supplies the missing acceptance proof. No material source-only work requires independent review.

Priority: P2
Reviewed head: 2bdf86f08f8cee323e84465782a8845d043febf5

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful compatibility work and substantial boundary coverage informed the merged solution, but this branch's acceptance proof and duplicated policy are weaker than the shipped replacement.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The original branch supplies exact-head Completions and Responses serialization captures with mocked fetch, plus an older displayed-xhigh observation; these do not establish provider acceptance. The merged replacement independently supplies that live evidence, so no additional proof is needed for this supersession close. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The original branch supplies exact-head Completions and Responses serialization captures with mocked fetch, plus an older displayed-xhigh observation; these do not establish provider acceptance. The merged replacement independently supplies that live evidence, so no additional proof is needed for this supersession close. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 11 items PR close coverage proof: PR close coverage proof kept this PR open against #111367: model PR close coverage proof was incomplete: The substantive evidence describes a merged implementation covering the original capability and request-serialization work. The source report identifies no remaining current-main failure and explicitly explains that the replacement supplies the missing acceptance proof. No material source-only work requires independent review.
Pinned branch scope: Inspected the introduced production and test hunks from the verified merge base to the original PR head. The changes concern capability discovery, effort mapping, serialization, and compatibility types; they introduce no dependency, workflow, permission, or credential changes.
Merged canonical replacement: GitHub REST confirms #111367 merged on 2026-09-17 at ec798a4. Its body explicitly credits this contribution, describes preservation of declared xhigh and mapped efforts, and records a production Responses adapter sending xhigh to GitHub Copilot with HTTP 200 and an OK response.
Findings None None.
Security None None.

How this fits together

Model compatibility metadata determines which thinking levels OpenClaw offers and how those choices become provider request parameters. The AI adapters carry the selected effort into Completions or Responses requests.

flowchart LR
  A[Configured model metadata] --> B[Thinking capability resolution]
  C[Selected thinking level] --> B
  B --> D[Supported effort and mapping]
  D --> E[Completions request]
  D --> F[Responses request]
  E --> G[Compatible provider]
  F --> G
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The original branch supplies exact-head Completions and Responses serialization captures with mocked fetch, plus an older displayed-xhigh observation; these do not establish provider acceptance. The merged replacement independently supplies that live evidence, so no additional proof is needed for this supersession close. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Complete close-coverage proof - Complete the pull request close-coverage proof before merge.
  • Complete the correctness assessment - Record a definitive patch correctness assessment before merge.
Agent review details

Security

None.

PR surface

Source +285, Tests +656. Total +941 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 11 335 50 +285
Tests 7 657 1 +656
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 992 51 +941

Review metrics

Metric Value Why it matters
Production versus test growth Production +335/-50 (net +285); tests +657/-1 (net +656) The branch expands adapter-specific policy that the shipped replacement now handles through a shared owner.

Root-cause cluster

Relationship: superseded
Canonical: #111367
Summary: The explicitly credited replacement has merged and owns the remaining compatibility repair.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure.

Do we have a high-confidence way to reproduce the issue?

No current-main failure was reproduced in this read-only review; current source, request-boundary tests, and the merged replacement's live acceptance trace cover the central reported failure.

Is this the best way to solve the issue?

The shipped shared resolver is the better solution: it covers both request families and their capability contract without retaining this branch's separate adapter policies.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b419a4add99f; fix evidence: release v2026.9.5, commit ec798a4687fa.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This concerns bounded custom-provider thinking compatibility, now covered by a merged and released replacement.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The original branch supplies exact-head Completions and Responses serialization captures with mocked fetch, plus an older displayed-xhigh observation; these do not establish provider acceptance. The merged replacement independently supplies that live evidence, so no additional proof is needed for this supersession close. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • PR close coverage proof: PR close coverage proof kept this PR open against fix(ai): preserve compat xhigh reasoning effort #111367: model PR close coverage proof was incomplete: The substantive evidence describes a merged implementation covering the original capability and request-serialization work. The source report identifies no remaining current-main failure and explicitly explains that the replacement supplies the missing acceptance proof. No material source-only work requires independent review.
  • Pinned branch scope: Inspected the introduced production and test hunks from the verified merge base to the original PR head. The changes concern capability discovery, effort mapping, serialization, and compatibility types; they introduce no dependency, workflow, permission, or credential changes. (packages/ai/src/model-utils.ts:48, 2bdf86f08f8c)
  • Merged canonical replacement: GitHub REST confirms fix(ai): preserve compat xhigh reasoning effort #111367 merged on 2026-09-17 at ec798a4. Its body explicitly credits this contribution, describes preservation of declared xhigh and mapped efforts, and records a production Responses adapter sending xhigh to GitHub Copilot with HTTP 200 and an OK response. (ec798a4687fa)
  • Current capability owner: Current main exposes declared xhigh/max through the model capability resolver, retains null caps, and prevents disabled scalar effort from exposing extended mappings. The shared catalog API classification includes Azure and managed transport aliases. (packages/ai/src/model-utils.ts:40, b419a4add99f)
  • Canonical request owner and sibling paths: Current main resolves model and compat mappings through one request owner, checks declared supported labels, preserves native casing and hard null opt-outs, and separates binary thinking from scalar effort. Completions and the shared Responses serializer call this owner; simple OpenAI and Azure entrypoints preserve canonical levels until serialization. (packages/ai/src/providers/openai-request-reasoning.ts:26, b419a4add99f)
  • Replacement regression coverage: The current request-boundary matrix covers both Completions and Responses: declared xhigh, constrained mappings, exact native labels, disabled scalar effort, null opt-outs, logical off, native none, and unknown-provider mappings. Embedded-session coverage separately checks declared max across four OpenAI-style APIs. Tests were inspected, not executed. (packages/ai/src/providers/openai-request-reasoning.test.ts:22, b419a4add99f)

Likely related people:

  • snowzlmbot: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 5, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 5, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jun 5, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 5, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jun 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M and removed size: S proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 5, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 5, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 6, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jun 6, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 15, 2026
@Yigtwxx

Yigtwxx commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The four commits pushed at 18:10-18:12 moved rows of my 18:05 table, so that table is superseded. I re-ran the same wire capture on the current head (030cab4c02f) against current main (b1d53fcddae), and added four arms that exercise the default-off branch which the last commit (030cab4c, "map default-off Responses reasoning") now routes through compat metadata.

Harness is unchanged: configureAiTransportHost({ buildModelFetch }), then a real streamSimpleOpenAIResponses(...), reading the outgoing body with new Request(input, init).json(). Every arm asserts body.model === "custom-reasoner" first, so an arm that never reached the wire fails instead of reading as a clean result. Model in every arm: api: "openai-responses", reasoning: true, non-catalog id, so resolveOpenAISupportedReasoningEfforts falls back to GENERIC_REASONING_EFFORTS = ["low","medium","high"] unless the arm declares a list. All three columns were measured by checking out each commit separately and running the identical probe file.

arm config main 971e2da (prev) 030cab4c (now)
A control none, ask high {"effort":"high",...} same same
B compat.supportsReasoningEffort:false, ask high {"effort":"high",...} no reasoning field no reasoning field
C B + thinkingLevelMap:{off:null} {"effort":"high",...} no reasoning field no reasoning field
D compat.reasoningEffortMap:{high:"xhigh"}, ask high {"effort":"high",...} {"effort":"low",...} {"effort":"low",...}
E discriminator thinkingLevelMap:{high:"medium"}, ask high {"effort":"medium",...} same same
F no level asked {"effort":"none"} same same
G compat.reasoningEffortMap:{off:"minimal"}, no level asked {"effort":"none"} {"effort":"none"} no reasoning field
H control thinkingLevelMap:{off:"minimal"}, no level asked {"effort":"minimal"} same same
I D + compat.supportedReasoningEfforts:["low","medium","high","xhigh"] {"effort":"high",...} {"effort":"xhigh",...} {"effort":"xhigh",...}
J declaration only, no map, ask high {"effort":"high",...} same same
K compat.reasoningEffortMap:{off:"low"}, no level asked {"effort":"none"} {"effort":"none"} {"effort":"low"}
L control compat.reasoningEffortMap:{high:"xhigh"}, no off key, no level asked {"effort":"none"} same same
M control G + compat.supportedReasoningEfforts:["none","low","medium","high"] {"effort":"none"} same same
N compat.supportedReasoningEfforts:["low","medium","high"] + {off:"low"}, no level asked {"effort":"none"} {"effort":"none"} {"effort":"low"}

Row I is unchanged, so the branch's own goal still measures out on this head: xhigh reaches the wire when supportedReasoningEfforts declares it, and cannot on main.

What the last commit moved

Rows G, K and N are new deltas. On 971e2da the default-off branch was byte-identical to main, which is why my earlier comment called that asymmetry pre-existing rather than a regression of this branch. Routing it through the compat resolver changes it in both directions:

  • K and N: default-off now sends reasoning on. resolveResponsesApiReasoningEffort(model, "off", "none") sends off into resolveOpenAIReasoningEffortForModel; the mapped value low is in the supported list, so it is returned verbatim and the request carries {"effort":"low"} where main and the previous head both sent {"effort":"none"}. N shows that declaring supportedReasoningEfforts does not protect the config unless the declared list contains none.
  • G: default-off now sends no reasoning field at all. With off -> "minimal" the mapped value is not in the supported list; requested === "off" && supported.includes("none") misses because the generic list has no none; isDisabledReasoningEffort("off") then returns undefined at packages/ai/src/providers/openai-reasoning-effort.ts:196-198. applyCommonResponsesParams reads that undefined as an opt-out and returns early, so the payload omits reasoning entirely and the provider's own default applies instead of an explicit off.

The undefined return is carrying two different meanings at that call site. For supportsReasoningEffort:false and thinkingLevelMap.off === null it means "the operator opted out", which is rows B and C and is intended. For a compat mapping that cannot be resolved it means "no answer", which is not an opt-out. Falling back to "none" in the second case, or resolving off through the map only when the mapped value is itself a disabled value, would leave G/K/N on main's payload while keeping B and C exactly as they are now.

Scope of exposure

No in-repo catalog is affected. Every extension that ships a reasoningEffortMap (baseten, cohere, stepfun, groq, lmstudio, mistral) declares api: "openai-completions", and the Completions path reads off on its own line (packages/ai/src/providers/openai-completions.ts:912). So these rows land only on operator-written openai-responses compat blocks: the same population this PR is written for, and the one its proof model (codex-lb-2455/gpt-5.5) belongs to.

Still open from the previous capture

Row D is unchanged on this head: declaring only compat.reasoningEffortMap: { high: "xhigh" } and asking for high still puts "low" on the wire, where main sends "high". The mapped xhigh is not in the generic supported list and none of the special cases match a requested high, so the tail supported.find(...) at openai-reasoning-effort.ts:211-213 returns the first entry. Row I is the same config plus the declaration and lands on xhigh, which keeps the trigger isolated to the missing declaration.

Scope of this capture: the Responses request path only, with the transport host's fetch as the seam. The Completions compat path in this diff is not covered by these arms, and I did not run the branch's own suite beyond this capture.

@Yigtwxx

Yigtwxx commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The five commits pushed after 18:12 moved my last table, so it is superseded. I re-ran the same wire capture on the final reviewed head 207040bf973 against current main (16d1e486e01), plus the previous head as the before-column. This is also the exact-head request-boundary artifact the review says is still missing, so it is attached rather than described.

Harness unchanged: configureAiTransportHost({ buildModelFetch }), a real streamSimpleOpenAIResponses(...) call, and the outgoing body read with new Request(input, init).json(). Every arm asserts body.model === "custom-reasoner" first, so an arm that never reached the wire fails instead of reading as a clean result. Model in every arm: api: "openai-responses", reasoning: true, non-catalog id. Each column was measured by checking that commit out separately and running the identical probe file.

Final head, 14 arms

arm config main 16d1e486e01 prev 030cab4c02f final 207040bf973
A control none, ask high {"effort":"high","summary":"auto"} same same
B supportsReasoningEffort:false, ask high {"effort":"high",…} no reasoning field no reasoning field
C B + thinkingLevelMap:{off:null} {"effort":"high",…} no reasoning field no reasoning field
D reasoningEffortMap:{high:"xhigh"}, ask high {"effort":"high",…} {"effort":"low",…} {"effort":"xhigh",…} ✅
E discriminator thinkingLevelMap:{high:"medium"} {"effort":"medium",…} same same
F discriminator no level asked {"effort":"none"} same same
G reasoningEffortMap:{off:"minimal"}, no level {"effort":"none"} no reasoning field {"effort":"minimal"} ✅
H control thinkingLevelMap:{off:"minimal"}, no level {"effort":"minimal"} same same
I D + list declares xhigh, ask high {"effort":"high",…} {"effort":"xhigh",…} same ← the PR's purpose
J declaration only, no map, ask high {"effort":"high",…} same same
K reasoningEffortMap:{off:"low"}, no level {"effort":"none"} {"effort":"low"} {"effort":"low"}
L control map without an off key, no level {"effort":"none"} same same
M control G + list declares none, no level {"effort":"none"} same same
N K + list ["low","medium","high"], no level {"effort":"none"} {"effort":"low"} {"effort":"low"}

Both deviations I opened on 18 August are closed, and the silent downgrade with them.

  • D, the regression that was not on the review's list — {high:"xhigh"} declared without supportedReasoningEfforts used to reach the wire as low, the opposite direction from this PR's purpose. It now sends xhigh.
  • G, where the reasoning field vanished entirely so the provider default took over, now sends the operator's mapped value.

Attribution, since "which commit did it" is checkable: 7e4dd5883ef (preserve map-only reasoning mappings) closed both. The four commits after it — 4e1a32e0e2e, fad4a96648b, cb699c86f69, 207040bf973 — produce a byte-identical 14-arm payload set to 7e4dd5883ef, so nothing in the reasoning wire path moved after 18:52.

The remaining main-vs-branch rows now follow one rule

G, K and N still differ from main, but they are no longer an inconsistency to chase — the final head implements a single rule, and the control arms draw its boundary:

For the default-off branch, use the provider's native none when the model can express it; otherwise use the operator's off mapping; otherwise send none.

Mechanism, at openai-reasoning-effort.ts:203-217 on this head: the map-only early return is gated on !hasExplicitSupportedEfforts, so a config that declares a supported list skips it and falls through to supported.some(...) and then to requested === "off" && supported.includes("none").

arm declares a list? list contains none? wire rule says
G no — minimal map wins, generic list has no none
K no — low same
M yes yes none native none available, map ignored
N yes no low no native none, map wins
L no off key — none nothing mapped, fallback = "none"

That is the same shape main already applies to thinkingLevelMap — arm H sends minimal on main today from thinkingLevelMap:{off:"minimal"}. So the branch makes compat.reasoningEffortMap behave for off the way thinkingLevelMap already behaves, which is what the PR set out to do. I withdraw the "silently enabling disabled reasoning" reading I gave K and N on 18 August: with G fixed and M/L held as controls, the three rows are the declared mapping being honoured, not a leak. The explicit opt-outs still win ahead of all of it — B and C drop the field entirely.

Scope, restated because it bounds the risk

Unchanged from my earlier measurement and re-checked on this head: no in-repo catalog is affected. All six extensions that carry a reasoningEffortMap (baseten, cohere, stepfun, groq, lmstudio, mistral) declare api: "openai-completions" and never take the Responses path. The behaviour above is reachable only through operator-written openai-responses compat blocks — which is this PR's target audience.

I still have no standing on the merge decision between this branch and #111367; #111367 remains at 6f075ca976b, conflict-dirty, with the two null-opt-out P1s that this head's B and C rows answer.

Probe file, so anyone can reproduce or refute the table: 14 arms, drop into packages/ai/src/providers/ and run with node scripts/run-vitest.mjs. Measured on Node 22.23.2.

@Yigtwxx

Yigtwxx commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The new P1 names a payload consequence — "Responses then preserves it at the request boundary and Completions sends it unless a map happens to override it" — so I measured it at the request boundary on both adapters and on both heads instead of arguing it from the diff. Same harness as my earlier table: configureAiTransportHost({ buildModelFetch }), a real call into the registered stream implementation (streamSimpleOpenAIResponses / streamSimpleOpenAICompletions, the two entries in packages/ai/src/providers/register-builtins.ts:102-119), and the outgoing body read with new Request(input, init).json(). Every arm asserts body.model === "custom-reasoner" first, so an arm that never reached the wire fails instead of reading as a clean result. Model in every arm: provider: "custom", non-catalog id, reasoning: true. Columns measured by checking each commit out separately and running the identical probe. main f68503084b7, head 207040bf973, Node 22.20.0.

Responses rows also carry summary:"auto" and include:["reasoning.encrypted_content"]; only the effort is shown.

What reaches the wire

# compat asks Responses main Responses head Completions main Completions head
1 supportedReasoningEfforts:["low","medium","high","xhigh"] minimal minimal minimal minimal minimal
2 none minimal minimal minimal minimal minimal
3 same list as 1 low low low low low
4 list as 1 + reasoningEffortMap:{minimal:"low"} minimal minimal low low low
5 supportedReasoningEfforts:["low","medium","high"] xhigh high high high high
6 same list as 1 high high high high high

Arm 1 is the finding's exact configuration, and it is identical in all four cells. A declared list that omits minimal lets minimal reach the wire on main today, on both adapters, and this head does not change that. So the described defect is current main's behaviour, not something the branch introduces or worsens.

Arm 4 is the only cell this branch moves, and it moves toward the finding's own goal: main's Responses path never consults compat.reasoningEffortMap (openai-responses-shared.ts on main reads model.thinkingLevelMap?.[level] ?? level), so an operator's minimal → low mapping is silently dropped and minimal is sent anyway. Completions already honoured it. On this head Responses honours it too. For the merge risk as written — "an endpoint that declares accepted efforts without minimal can still receive minimal" — the head is strictly better than main, because it gives the operator a mapping that actually caps the value.

The cited lines, model-utils.ts:135-145

Same probe, calling getSupportedThinkingLevels / clampThinkingLevel directly:

compat main head
supportedReasoningEfforts:["low","medium","high","xhigh"] ["off","minimal","low","medium","high"], clamp(xhigh)=high ["off","minimal","low","medium","high","xhigh"], clamp(xhigh)=xhigh
none ["off","minimal","low","medium","high"], clamp(xhigh)=high same
supportedReasoningEfforts:["low","medium","high"] ["off","minimal","low","medium","high"], clamp(xhigh)=high same

minimal is exposed in every cell of both columns; the only delta is xhigh, which is this PR's purpose, and row 3 is the control showing the new gate does refuse xhigh when the list omits it.

Scope of the requested repair

The finding asks to "make the list a hard capability/payload cap for all canonical levels". That is a bigger change than an operator-facing compat fix, because compat.supportedReasoningEfforts is already produced by two in-repo catalogs, not only by hand-written config:

  • extensions/codex/src/app-server/model-catalog.ts:35-38 sets it from whatever the Codex app server advertises (those rows carry api: "openai-chatgpt-responses"; getSupportedThinkingLevels only branches on anthropic-messages, so a cap on canonical levels would reach them the same way).
  • src/agents/harness/model-catalog.ts:60-68 sets it from the provider/observed snapshot.

The repository's own fixtures for those two producers use ["low","medium","high","xhigh","max","ultra"] (extensions/codex/src/app-server/model-catalog.test.ts:31, src/agents/harness/model-catalog.test.ts:43) — which omits minimal — and ["high"] (src/agents/harness/model-catalog.test.ts:106). Under a hard cap the first shape would drop minimal from the level picker for those models and the second would collapse it to off + high. That may well be the correct end state, but it is a user-visible narrowing for shipped catalogs rather than a repair confined to this branch's surface, so it looks like its own change with its own before/after.

What I did not measure

Whether an operator can already set supportedReasoningEfforts on an openai-responses model before this PR is source reading, not measurement: OpenAIResponsesCompatSchema (src/agents/sessions/model-registry.ts:138-142 on main) is a plain Type.Object with no additionalProperties: false, validation is Check-only (:541), and mergeCompat (:279-312) is a spread with no key whitelist, so unknown compat keys are carried through to Model.compat verbatim. If that reading is right, this PR's schema and type additions declare a field that already flowed through rather than opening a new one; if it is wrong, the arm-1 rows above still hold for the catalogs named in the previous section, which set the field in code.

I still have no standing on the merge decision between this branch and #111367. Probe file is 6 arms × 2 adapters + 3 capability rows, drop into the repo root and run with node --import tsx, so the table can be reproduced or refuted.

@Yigtwxx

Yigtwxx commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

8e303541be8 landed nine minutes before my last comment, so the Completions column of that table was already stale when I posted it — it was measured on 207040bf973. Here is the same harness re-run on the current head, plus the arms the new finding needs. main f68503084b7, head 8e303541be8, Node 22.20.0, every arm asserts body.model before reading the effort. Responses rows also carry summary/include; only the effort is shown.

Refreshed table, main → 8e303541be8

# model config asks Responses Completions
1 supportedReasoningEfforts:["low","medium","high","xhigh"] minimal minimal → minimal minimal → low
2 no compat at all minimal minimal → minimal minimal → low
3 list as 1 low low → low low → low
4 list as 1 + reasoningEffortMap:{minimal:"low"} minimal minimal → low low → low
5 supportedReasoningEfforts:["low","medium","high"] xhigh high → high high → high
6 list as 1 high high → high high → high
7 thinkingLevelMap:{max:"ultra"} max xhigh → ultra xhigh → high
8 supportedReasoningEfforts:[…,"max"] + reasoningEffortMap:{max:"ultra"} max high → xhigh high → xhigh
9 supportedReasoningEfforts:[…,"max"], no map max high → max high → xhigh
10 thinkingLevelMap:{xhigh:"ultra"} xhigh ultra → ultra ultra → ultra
11 config as 8 high high → high high → high

Row 1 answers the previous P1: the new commit makes the declared list a real cap on the Completions provider path, so my earlier "identical in all four cells" no longer holds for that adapter. Rows 3, 6, 10 and 11 are unchanged controls.

Row 2: the change is not limited to models that declare a list

Row 2 has no compat block at all, and the wire value still moves. resolveOpenAIReasoningEffortForModel falls back to GENERIC_REASONING_EFFORTS = ["low","medium","high"] for any id outside the GPT-5 families (openai-reasoning-effort.ts:41), and minimal is not in it. Swept over three ids and four levels on both heads:

id asks Completions main → head Responses main → head
custom-reasoner minimal minimal → low minimal → minimal
qwen3-32b minimal minimal → low minimal → minimal
deepseek-r1 minimal minimal → low minimal → minimal
all three low / medium / high unchanged unchanged

Only the minimal row moves, on one adapter. getSupportedThinkingLevels still offers minimal for these models on both heads, so the level stays selectable and the request is silently rewritten — and the two adapters now disagree about the same selection where main had them agree. Whether that rewrite is desirable is a call for the reviewers; what it is not, today, is stated in the PR body or covered by a test, and it reaches every reasoning-capable openai-completions model an operator configures without a compat block, not only the ones this PR is aimed at.

Row 7/9: the new P1 is real, and its root is a line main already has

Row 9 is the finding's exact scenario and it reproduces: a model advertising max gets max on Responses and xhigh on Completions from the same selection. That divergence is this branch's — on main both adapters answered high because max was not selectable at all.

The rewrite that causes it, though, is main's:

// packages/ai/src/providers/openai-completions.ts, identical on main and this head
const reasoningEffort =
  clampedReasoning === "off" ? undefined : clampedReasoning === "max" ? "xhigh" : clampedReasoning;

Row 7 measures what that costs on main today, through main's own supported mechanism: thinkingLevelMap:{max:"ultra"} is honoured by the capability layer (getSupportedThinkingLevels returns max, clampThinkingLevel("max") === "max" on both heads) and then dropped at the wire — main sends xhigh, not ultra, on both adapters. Row 10 is the discriminator: the identical map shape one level down ({xhigh:"ultra"}) sends ultra everywhere. So max is the only level whose operator mapping is silently discarded, and that is true before this branch.

On this head row 7 splits: Responses now sends ultra (the mapping is honoured), Completions sends high — the simple lane rewrites max to xhigh, buildParams then resolves xhigh against a generic list that lacks it and steps down to high. So for an operator already using thinkingLevelMap.max on a Completions model, this head moves the wire value from xhigh to high rather than to the mapped ultra.

That makes the requested repair — keep canonical max through streamSimpleOpenAICompletions and let the shared resolver apply the mapping — worth more than closing this branch's divergence: the same edit repairs a mapping main drops today. Row 8 is the control for the boundary the repair must keep: when the map's target (ultra) is not in the declared list, capability already clamps to xhigh and both adapters agree.

Probe files: 11 arms × 2 adapters + the 3-id sweep, node --import tsx, no vitest. Same standing as before — I have no opinion on the merge decision between this branch and #111367.

@Yigtwxx

Yigtwxx commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

975ebbda210 landed eight minutes after my last comment, so that table was measured on 8e303541be8. Same harness on the real final head, plus the arms the new commit's semantics need. main f68503084b7, Node 22.20.0. Cells are openai-responses / azure-openai-responses; - means the request carried no reasoning field at all. Every arm records body.model, and it is custom-reasoner in all cells. Responses rows also carry summary/include; only the effort is shown.

Wire table, main → 8e303541be8 → 975ebbda210

# model config asks main 8e30354 975ebbd
1 plain reasoning model high high / high high / high high / high
2 thinkingLevelMap:{high:null} high medium / medium medium / medium - / none
3 thinkingLevelMap:{high:null} medium medium / medium medium / medium medium / medium
4 thinkingLevelMap:{high:null} – none / none none / none none / none
5 thinkingLevelMap:{off:null} high high / high high / high high / high
6 thinkingLevelMap:{off:null} – - / - - / - - / -
7 thinkingLevelMap:{max:null} max high / high high / high - / none
8 thinkingLevelMap:{minimal:null} minimal low / low low / low - / none
9 thinkingLevelMap:{high:"medium"} high medium / medium medium / medium medium / medium
10 compat:{supportsReasoningEffort:false} high high / high - / high - / high
11 compat:{supportedReasoningEfforts:["low","medium","high","xhigh"]} minimal minimal / minimal minimal / minimal minimal / minimal
12 thinkingLevelMap:{max:"ultra"} max xhigh / xhigh ultra / ultra ultra / ultra
13 thinkingLevelMap:{high:null} + compat:{reasoningEffortMap:{high:"xhigh"}} high medium / medium medium / medium - / none

Rows 11 and 12 confirm the claims in my previous comment survive the new commit unchanged, which is expected: the diff 8e303541be8...975ebbda210 touches only openai-responses.ts, openai-responses-shared.ts and their tests, so the Completions column I posted earlier is untouched.

Row 2/7/8/13: the opt-out is evaluated before the clamp, and null carries two meanings

resolveResponsesReasoningEffort now returns early on hasNullThinkingLevelOptOut(model, reasoning) (openai-responses-shared.ts:237) using the requested level, two lines before it calls clampThinkingLevel. The capability layer reads a null on a non-off key as a hard cap rather than an opt-out, and says so in its own comment:

// packages/ai/src/model-utils.ts:164, identical on main and this head
// Explicit provider opt-outs are hard caps. Downgrade them before considering
// stronger levels so unsupported xhigh/max requests cannot increase cost.

Measured on both main and 975ebbda210, byte-identical:

config level selectable? clampThinkingLevel
{high:null}, ask high no medium
{max:null}, ask max no high
{minimal:null}, ask minimal no low
{off:null}, ask high yes high

So the capability layer still answers "downgrade to medium/high/low" for rows 2, 7 and 8 on this head, and the Responses lane discards that answer and sends nothing. Row 5/6 is the discriminator: {off:null} is the shape whose opt-out meaning main already honours, and it is unchanged in all three columns. Row 13 shows the early return also skips a compat.reasoningEffortMap entry this branch otherwise honours.

Reachability, stated plainly: I could not get an unclamped level to the provider from an agent session — setThinkingLevel clamps at set time (agent-session-models.ts:150) and every model switch re-clamps through applyModelSwitch. The divergence is at the provider boundary, which this branch itself treats as a clamping layer. On in-repo catalogs: the only thinkingLevelMap null that ships on a Responses-api model is off (extensions/openai/openai-provider.ts:449, extensions/opencode/provider-catalog.ts:433), and rows 5/6 leave it alone. The {xhigh:null, max:null} shape does ship, on anthropic-messages models (extensions/github-copilot/model-metadata.ts:41,53, extensions/anthropic-vertex/provider-catalog.ts:162,171), so it is idiomatic config rather than something only this probe writes.

Rows 2/7/8/13 again: the suppression reaches one of the three Responses lanes

disableReasoningSerialization is computed in streamSimpleOpenAIResponses only (openai-responses.ts:116). streamSimpleAzureOpenAIResponses (azure-openai-responses.ts:102) and the ChatGPT lane (openai-chatgpt-responses.ts:652) call the same resolveResponsesReasoningEffort, get undefined, and fall through to applyCommonResponsesParams's default-off branch, which emits {"effort":"none"}. Identical model config, two different bodies.

Row 10 is the control for the objection that this is just the deliberate openai-only scoping of compat: getCompatReasoningConfig returns undefined for every api other than openai-completions and openai-responses (model-utils.ts:54), which is why Azure keeps sending high there on both heads. thinkingLevelMap is not scoped that way — it is a plain Model field (packages/llm-core/src/types.ts:678) that clampThinkingLevel honours for every api, so nothing in the type or the capability layer says one adapter should suppress and the other should send none. I measured Azure; the ChatGPT lane is a source reading, not a measurement.

Both rows point at the same one-line choice: if the early return moved below the clamp (or were restricted to off), rows 2/7/8/13 would return to the clamped value on both adapters and rows 5/6 would keep today's behaviour. If full suppression is the intent for those shapes, computing it inside resolveResponsesReasoningEffort rather than in one caller would give all three lanes the same answer.

Probe: 13 arms x 2 adapters plus the selectability sweep, node --import tsx, no vitest, each ref checked out and run separately. Same standing as before — I have no opinion on the merge decision between this branch and #111367.

@Yigtwxx

Yigtwxx commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Re-measured on 738c92fb12c, against main 0a8226c3db5 and the previous head 975ebbda210. Same harness as before: node --import tsx, no vitest, each ref checked out and run separately, request body captured at the transport boundary. Every arm records body.model and it is the probe model in all cells; - means the request carried no reasoning_effort / reasoning field at all.

9a9f70834a4 and 738c92fb12c change two things I had measured, so both columns below are new numbers rather than a restatement.

The off guard added in 738c92fb12c is Responses-only

shouldDisableResponsesReasoningSerialization (openai-responses-shared.ts:192) now lets reasoning === "off" through when clampThinkingLevel escapes off, which restores main's answer on the Responses lane. The same pre-clamp opt-out in the Completions lane (openai-completions.ts:701 for the simple path, :916 for buildParams) was added by this branch too and is unchanged, so the identical config now answers differently depending on api:

model config ask lane main 975ebbd 738c92f
the branch's own Grok 4.5 shape1 off openai-responses low - low
the branch's own Grok 4.5 shape1 off openai-completions low - -
thinkingLevelMap:{off:null} off openai-responses minimal - minimal
thinkingLevelMap:{off:null} off openai-completions minimal - -

1 {off:null, minimal:"low", low:"low", medium:"medium", high:"high"} + compat:{supportsReasoningEffort:true, supportedReasoningEfforts:["low","medium","high"]} — copied verbatim from openai-responses.test.ts and openai-responses-shared.test.ts in this commit.

The Completions path reaches the same outcome by a different route: explicitlyDisabledByThinkingLevel makes requestedThinkingEnabled false, execution falls to the trailing else if at openai-completions.ts:973, and offReasoningEffort is null rather than a string, so nothing is written. Net effect is the field's absence either way.

Both new tests in this commit are on the Responses surface; there is no sibling test on openai-completions, which is why CI is green on it.

Reachability for the Completions row, stated plainly: thinkingLevelMap is a plain Model field (packages/llm-core/src/types.ts:678) with no api gating, and applyXaiRuntimeModelCompat writes XAI_REASONING_EFFORTS regardless of api (extensions/xai/runtime-model-compat.ts:82), while provider-models.ts:45 takes the api straight from providerConfig.api. resolveXaiTransport reroutes xAI back to Responses only when the baseUrl is a native xAI host or absent (extensions/xai/provider-routing.ts:30), so a Grok model pointed at a gateway with api: "openai-completions" stays on the Completions lane with that map intact. I measured the config, not that deployment.

Rows 2/7/8/13 from my previous comment are unchanged on this head

The new guard only relaxes reasoning === "off"; reasoning !== "off" still short-circuits before the clamp, so the non-off null keys behave exactly as measured last time. Cells are openai-responses / azure-openai-responses:

model config ask main 738c92f clampThinkingLevel on this head
thinkingLevelMap:{high:null} high medium / medium - / none medium
thinkingLevelMap:{max:null} max high / high - / none high
thinkingLevelMap:{minimal:null} minimal low / low - / none low
{high:null} + compat:{reasoningEffortMap:{high:"xhigh"}} high medium / medium - / none medium

resolveResponsesReasoningEffort returns undefined for these, openai-responses.ts:116 turns that into full suppression, and azure-openai-responses.ts:102 and openai-chatgpt-responses.ts:652 get the same undefined and fall through to applyCommonResponsesParams's default-off branch, which emits {"effort":"none"}. I measured Azure; the ChatGPT lane is a source reading.

9a9f70834a4 fixes a regression this branch had introduced, and improves on main

Dropping the hardcoded max → xhigh in streamSimpleOpenAICompletions lets the downstream fallback map do the mapping. Measured, Completions lane:

model config ask main 975ebbd 738c92f
thinkingLevelMap:{max:"ultra"} max xhigh high ultra
compat:{supportedReasoningEfforts:["provider-low","provider-max"], reasoningEffortMap:{low:"provider-low", max:"provider-max"}} max high provider-low provider-max
compat:{supportedReasoningEfforts:["low","medium","high","max"]} max high high max
{max:"ultra"} + compat:{supportedReasoningEfforts:["low","medium","high"]} max xhigh high high

Rows 1 and 2 were wrong on 975ebbd and are right now. Row 3 puts a literal max on the wire where main sent high, which matches what the catalog declared, so I read it as intended rather than as a finding.

Probe: 18 Responses arms x 2 adapters plus 13 Completions arms, three refs, main 0a8226c3db5, Node 22.20.0. Same standing as before — no opinion on the merge decision between this branch and #111367.

@Yigtwxx

Yigtwxx commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Re-measured on 2bdf86f08f8, against main 7c7e10ab853, with the same harness as before
(node --import tsx, no vitest, each ref checked out and run separately; every row is the JSON
body the adapter actually put on the wire).

First, the previous finding is fixed. 39bc3d066d6 carried the off exemption into the
Completions lane, and the two rows that regressed there now match main:

config ask lane main 2bdf86f08f8
your Grok 4.5 shape off openai-completions low low
{off: null} off openai-completions minimal low (see below)

Two things the sweep turned up on this head.

1. The compat reasoning contract never reaches azure-openai-responses

getCompatReasoningConfig (packages/ai/src/model-utils.ts) returns early unless
model.api is openai-completions or openai-responses, and the opt-out gate in
openai-responses-shared.ts:176 is only consulted on the OpenAI path. Azure Responses models
carry the same compat block and go through the same shared serializer, so the same config now
produces two different results:

compat block openai-responses azure-openai-responses
supportsReasoningEffort: false, ask high levels [off], clamp off, wire absent levels [off,minimal,low,medium,high], clamp high, wire "high"
supportedReasoningEfforts: [low,medium,high,xhigh], ask xhigh levels include xhigh, clamp xhigh xhigh not offered, clamp falls back to high

The second row is this PR's headline capability: an Azure Responses model that declares xhigh
in supportedReasoningEfforts still cannot select it. On main both lanes behaved identically,
so this asymmetry is introduced here. No test in the diff touches an azure-openai-responses
model, which is why CI stays green — the same shape as the Completions gap in my previous
comment.

2. Completions now sends low where main sent minimal

Not limited to off requests; the plain case shows it:

config ask main 2bdf86f08f8 clampThinkingLevel
plain model, no map, no compat minimal "minimal" "low" minimal
{off: null} minimal "minimal" "low" minimal
{off: null} off "minimal" "low" minimal

The clamped level is still minimal and getSupportedThinkingLevels still offers minimal, but
the wire value is low, because the clamp result is now routed through
resolveOpenAIReasoningEffortForModel, whose minimal -> low ladder applies when the resolved
support list has no minimal — the default for custom OpenAI-compatible models. If that upgrade
is intended (sending a level the provider actually accepts), the selectable set probably should
not keep advertising minimal; if it is not intended, every user who picks the cheapest level on
an OpenAI-compatible model silently gets the next one up.

Harness, arms and both raw outputs are the same probe I posted earlier, extended with the Azure
lane and the minimal rows.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper recorded closeout evidence for this proposed close.

  • Action: close remains subject to final live verification.
  • Close reason: duplicate or superseded.
    Review evidence: durable ClawSweeper review.
  • Coverage proof: The report supplies concrete capability, serialization, regression, and provider-acceptance evidence connecting A's useful work to B's merged shared implementation. It identifies no remaining current-main defect or material independent scope; A's helper structure and schema differences do not establish separate work. Covering PR: fix(ai): preserve compat xhigh reasoning effort #111367.

@Alex-Govorov

Alex-Govorov commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Superseded by #146134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants