mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix: preserve xAI Grok 4.3 default reasoning (#81227)
This commit is contained in:
@@ -52,6 +52,7 @@ Docs: https://docs.openclaw.ai
|
||||
- Agents/sessions: preserve fresh post-compaction token snapshots across stale usage updates, preventing repeated auto-compaction after every message. Fixes #82576. (#82578) Thanks @njuboy11.
|
||||
- Agents/OpenAI Responses: log redacted diagnostics for detail-less `response.failed` events while preserving failed response ids, so operators can correlate provider-side failures. Fixes #82558.
|
||||
- Agents/OpenRouter: strip non-replayable Anthropic/xAI reasoning provenance tags from follow-up requests, preventing poisoned thinking signatures from breaking second turns. Fixes #82335. (#82380) Thanks @hclsys.
|
||||
- Providers/xAI: send configurable reasoning effort only for Grok 4.3, preserving xAI's default low reasoning while omitting unsupported controls for Grok 4.20 reasoning models. (#81227) Thanks @jason-allen-oneal.
|
||||
- Agents/auth: redact OAuth refresh failure causes against in-memory, attempted, and reloaded credentials before generic token masking while ensuring failed ACP dispatch cleanup closes initialized runtimes.
|
||||
- Google/Gemini CLI OAuth: add provider-owned refresh support for `google-gemini-cli` so expired Gemini CLI tokens refresh in OpenClaw instead of falling through to the generic unknown-provider path. Fixes #42541. Thanks @jason-allen-oneal.
|
||||
- Telegram: cache successful startup bot identity by account and token fingerprint for up to 24 hours, so restarts can skip redundant `getMe` probes during Telegram API slow periods without permanently pinning renamed bots. Refs #82525.
|
||||
|
||||
@@ -9,6 +9,10 @@ describe("xai runtime model compat", () => {
|
||||
reasoning: true,
|
||||
});
|
||||
|
||||
expect(model.compat).toMatchObject({
|
||||
supportsReasoningEffort: true,
|
||||
supportedReasoningEfforts: ["low", "medium", "high"],
|
||||
});
|
||||
expect(model.thinkingLevelMap).toEqual({
|
||||
off: null,
|
||||
minimal: "low",
|
||||
|
||||
@@ -28,7 +28,7 @@ const XAI_REASONING_EFFORTS = {
|
||||
xhigh: "high",
|
||||
} satisfies NonNullable<XaiRuntimeModelCompat["thinkingLevelMap"]>;
|
||||
|
||||
const XAI_SUPPORTED_REASONING_EFFORTS = ["none", "low", "medium", "high"] as const;
|
||||
const XAI_SUPPORTED_REASONING_EFFORTS = ["low", "medium", "high"] as const;
|
||||
|
||||
function normalizeXaiCompatModelId(id: unknown): string {
|
||||
return typeof id === "string" ? id.trim().toLowerCase() : "";
|
||||
|
||||
@@ -88,4 +88,15 @@ describe("OpenAI reasoning effort support", () => {
|
||||
expect(resolveOpenAISupportedReasoningEfforts(model)).toEqual([]);
|
||||
expect(resolveOpenAIReasoningEffortForModel({ model, effort: "high" })).toBeUndefined();
|
||||
});
|
||||
|
||||
it("does not turn disabled reasoning into a fallback effort when compat omits none", () => {
|
||||
const model = {
|
||||
provider: "xai",
|
||||
id: "grok-4.3",
|
||||
compat: { supportedReasoningEfforts: ["low", "medium", "high"] },
|
||||
};
|
||||
|
||||
expect(resolveOpenAIReasoningEffortForModel({ model, effort: "none" })).toBeUndefined();
|
||||
expect(resolveOpenAIReasoningEffortForModel({ model, effort: "high" })).toBe("high");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1774,6 +1774,68 @@ describe("openai transport stream", () => {
|
||||
expect(params).not.toHaveProperty("include");
|
||||
});
|
||||
|
||||
it("preserves xAI Grok 4.3 default reasoning by omitting default none", () => {
|
||||
const params = buildOpenAIResponsesParams(
|
||||
{
|
||||
id: "grok-4.3",
|
||||
name: "Grok 4.3",
|
||||
api: "openai-responses",
|
||||
provider: "xai",
|
||||
baseUrl: "https://api.x.ai/v1",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 1_000_000,
|
||||
maxTokens: 128_000,
|
||||
compat: {
|
||||
supportsReasoningEffort: true,
|
||||
supportedReasoningEfforts: ["low", "medium", "high"],
|
||||
},
|
||||
} as unknown as Model<"openai-responses">,
|
||||
{
|
||||
systemPrompt: "system",
|
||||
messages: [],
|
||||
tools: [],
|
||||
} as never,
|
||||
undefined,
|
||||
) as { reasoning?: unknown; include?: string[] };
|
||||
|
||||
expect(params).not.toHaveProperty("reasoning");
|
||||
expect(params).not.toHaveProperty("include");
|
||||
});
|
||||
|
||||
it("passes explicit xAI Grok 4.3 reasoning effort through", () => {
|
||||
const params = buildOpenAIResponsesParams(
|
||||
{
|
||||
id: "grok-4.3",
|
||||
name: "Grok 4.3",
|
||||
api: "openai-responses",
|
||||
provider: "xai",
|
||||
baseUrl: "https://api.x.ai/v1",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 1_000_000,
|
||||
maxTokens: 128_000,
|
||||
compat: {
|
||||
supportsReasoningEffort: true,
|
||||
supportedReasoningEfforts: ["low", "medium", "high"],
|
||||
},
|
||||
} as unknown as Model<"openai-responses">,
|
||||
{
|
||||
systemPrompt: "system",
|
||||
messages: [],
|
||||
tools: [],
|
||||
} as never,
|
||||
{
|
||||
reasoning: "high",
|
||||
} as never,
|
||||
) as { reasoning?: unknown; include?: string[] };
|
||||
|
||||
expect(params.reasoning).toEqual({ effort: "high", summary: "auto" });
|
||||
expect(params.include).toEqual(["reasoning.encrypted_content"]);
|
||||
});
|
||||
|
||||
it("keeps developer role for native OpenAI reasoning responses models", () => {
|
||||
const params = buildOpenAIResponsesParams(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user