Skip to content

fix(provider): opencode-go context limits and 400 error surfacing (#50446) - #52731

Open
JerryLiu369 wants to merge 1 commit into
anomalyco:devfrom
JerryLiu369:fix/50446-autofix
Open

JerryLiu369 wants to merge 1 commit into
anomalyco:devfrom
JerryLiu369:fix/50446-autofix

Conversation

@JerryLiu369

@JerryLiu369 JerryLiu369 commented Oct 2, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #50446

Type of change

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

What does this PR do?

  • Caps opencode-go catalog limits to 148k context and 128k input in packages/core/src/plugin/models-dev.ts with a clamp in packages/core/src/session/runner/model.ts so automatic compaction fires before hitting the gateway's input ceiling.
  • Expands context overflow classification in packages/llm/src/provider-error.ts and packages/llm/src/protocols/anthropic-messages.ts to recognize gateway input length rejections.
  • Surfaces and preserves provider HTTP 400 error response bodies in packages/llm/src/route/executor.ts and packages/opencode/src/provider/error.ts instead of swallowing them into a bare status message.
  • Adds regression unit tests covering opencode-go gateway limits, error body preservation, and context overflow classification.

How did you verify your code works?

  • Tested with bun test test/opencode-go-gateway.test.ts in packages/llm (3 pass, 0 fail).
  • Tested with bun test test/provider/error.test.ts in packages/opencode (4 pass, 0 fail).
  • Tested with bun test test/plugin/models-dev.test.ts in packages/core (3 pass, 0 fail).
  • All tests pass cleanly.

Screenshots / recordings

N/A

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

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

This branch has not been deployed

No deployments
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.

provider: opencode-go gateway rejects ~148k input while catalog claims 1M context — 400 unrecoverable, body never surfaced

1 participant