Skip to content

fix(llm): classify zai token limit overflow#35671

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
fengjikui:zai-overflow-pattern
Jul 7, 2026
Merged

fix(llm): classify zai token limit overflow#35671
rekram1-node merged 1 commit into
anomalyco:devfrom
fengjikui:zai-overflow-pattern

Conversation

@fengjikui

@fengjikui fengjikui commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Fixes #27519
Also covers the Z.AI/GLM repro in #27629.

Type of change

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

What does this PR do?

Adds the Z.AI/GLM error text tokens in request more than max tokens allowed to the shared context-overflow matcher. That makes APICallError conversion produce ContextOverflowError, so the existing compaction path can run instead of treating the provider response as a generic API error.

I added coverage at the shared LLM matcher and at the opencode session error conversion layer.

How did you verify your code works?

Before the implementation, bun test --timeout 30000 test/session/message-v2.test.ts from packages/opencode failed on the added provider message case.

Passing checks after the fix:

  • bun test --timeout 30000 test/provider-error.test.ts from packages/llm
  • bun test --timeout 30000 test/session/message-v2.test.ts from packages/opencode
  • bun typecheck from packages/llm
  • bun typecheck from packages/opencode
  • Pre-push hook: bun turbo typecheck from repo root, 30 successful / 30 total

Screenshots / recordings

Not a UI change.

Checklist

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

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@rekram1-node

Copy link
Copy Markdown
Collaborator

good pr ty

@rekram1-node rekram1-node merged commit adf178a into anomalyco:dev Jul 7, 2026
12 checks passed
shaheislam pushed a commit to shaheislam/opencode-vim that referenced this pull request Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(provider): classify "tokens in request more than max tokens allowed" as context overflow

2 participants