Skip to content

fix(ai): classify gateway configured input limit overflow - #56454

Open
rudycelekli wants to merge 2 commits into
anomalyco:devfrom
rudycelekli:gateway-input-overflow
Open

rudycelekli wants to merge 2 commits into
anomalyco:devfrom
rudycelekli:gateway-input-overflow

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 17, 2026 •

Copy link
Copy Markdown

Issue for this PR

Fixes #56296

Type of change

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

What does this PR do?

Recognizes the Go gateway's “This text request is too large for the model's configured input limit” error as context overflow, so it reaches the existing compaction recovery path. Other unsupported_request errors, including unsupported attachments, keep their existing classification. Model catalog limits are unchanged.

How did you verify your code works?

  • Locally on Bun 1.4.2: the classifier regression fails on the base (37 pass, 1 fail); the candidate passes 380 tests across ten repetitions.
  • Exact-patch qualification: AI tests 1,823 pass; Core tests 6,336 pass; both package typechecks and root bun run check pass. Initial and final full-index patches match the submitted patch byte for byte.
  • Tests cover the exact gateway wording, a nested error body, and an unrelated unsupported-attachment rejection. They do not contact a live gateway or exercise a complete session compaction cycle.

Screenshots / recordings

Not applicable; provider error classification only.

Checklist

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

Independently reviewed before publication.

@github-actions

Copy link
Copy Markdown
Contributor

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

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works. With the mock-gateway reproduction from #56296, the base returns the 400 and never sends a compaction request. With this change, the same 400 is followed by compaction requests, which matches the existing prompt is too long path. The packages/ai tests and typecheck pass, and the new classifier test fails on the base.

The pattern is specific enough. It doesn't run into exclusions or the payload-too-large patterns, and other unsupported_request errors, such as the text-only attachment rejection, are still not treated as context overflow.

Public API: unchanged.

The pattern plus the small case in provider-error.test.ts is enough. The extra end-to-end test in openai-compatible-chat.test.ts checks nothing the classifier test doesn't already cover, so it can be dropped to keep the change minimal.

Related: #50761, #50446, #50574

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.

opencode-go: long sessions stuck at provider input limit; auto-compaction never triggers

1 participant