Skip to content

fix(opencode): use xhigh instead of max for GLM-5.2 OpenAI-compatible variants - #34360

Closed
weiconghe wants to merge 2 commits into
anomalyco:devfrom
weiconghe:fix-glm52-xhigh
Closed

fix(opencode): use xhigh instead of max for GLM-5.2 OpenAI-compatible variants#34360
weiconghe wants to merge 2 commits into
anomalyco:devfrom
weiconghe:fix-glm52-xhigh

Conversation

@weiconghe

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #34278

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The @ai-sdk/openai-compatible branch in ProviderTransform.variants() returned { high, max } for GLM-5.2 models, but max is not part of the OpenAI reasoning_effort enum (none/minimal/low/medium/high/xhigh). Spec-compliant upstreams (e.g. hyper, Cloudflare AI Gateway) reject max with HTTP 400.

The OpenRouter branch already correctly uses xhigh. This PR aligns the OpenAI-compatible branch to match.

Changes:

  • packages/opencode/src/provider/transform.ts line 693: changed max to xhigh
  • packages/opencode/test/provider/transform.test.ts: updated 3 test expectations to match

How did you verify your code works?

cd packages/opencode
bun test test/provider/transform.test.ts --timeout 30000

Result: 275 pass, 0 fail, 522 expect() calls

Screenshots / recordings

N/A — logic fix, no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The instance-context middleware unconditionally called InstanceStore.load
with whatever directory the client supplied, so requests that referenced
a stale path (e.g. after the user moved the project folder) caused the
server to bootstrap a phantom instance for a directory that doesn't exist
on disk. Downstream calls on that instance then surfaced as 503 errors,
and nothing pruned the stale entry from the client's cached project list.

Add an fs.existsSafe guard at the middleware boundary: when the resolved
directory does not exist, return 404 immediately so the client can drop
the stale entry rather than retrying against a phantom instance.

Fixes anomalyco#31888.
… variants

The OpenAI-compatible branch returned { high, max } but max is not part
of the OpenAI reasoning_effort enum. Spec-compliant upstreams (e.g.
hyper, Cloudflare AI Gateway) reject max with 400. The OpenRouter
branch already correctly uses xhigh. This aligns the OpenAI-compatible
branch to match.

Fixes anomalyco#34278
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

Why they're related: Both PRs address the same issue (#34278) — fixing GLM-5.2 models in the OpenAI-compatible branch to use xhigh instead of max for the reasoning_effort parameter. They appear to be duplicate solutions for the identical problem.

Please check if PR #34283 is already merged or in progress before proceeding with PR #34360.

@weiconghe

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #34283.

@weiconghe weiconghe closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GLM-5.2 on OpenAI-compatible providers: TUI variant switcher shows max (invalid reasoning_effort) instead of xhigh

1 participant