Skip to content

fix: normalize malformed Responses rate limit errors - #411

Merged
7Sageer merged 1 commit into
MoonshotAI:mainfrom
7Sageer:fix/openai-responses-rate-limit-error
Jun 4, 2026
Merged

fix: normalize malformed Responses rate limit errors#411
7Sageer merged 1 commit into
MoonshotAI:mainfrom
7Sageer:fix/openai-responses-rate-limit-error

Conversation

@7Sageer

@7Sageer 7Sageer commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue; this fixes malformed Responses-compatible stream error frames that currently surface as client decode failures.

Problem

Some Responses-compatible streaming gateways may emit an error frame without a top-level type, with the actual provider error nested inside a message string. Kimi Code then reports a generic Responses decode error instead of the underlying rate limit failure.

What changed

Normalize malformed gateway stream error messages that contain nested rate limit JSON into provider rate limit errors, while still rejecting malformed events that include a non-string type. Added coverage for normal response.failed rate limits, the malformed gateway frame, and the strict non-string type boundary.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Verification

  • pnpm -C packages/kosong exec vitest run
  • pnpm -C packages/kosong run typecheck

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7f14cf8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kosong Patch
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 4, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@7f14cf8
npx https://pkg.pr.new/@moonshot-ai/kimi-code@7f14cf8

commit: 7f14cf8

@7Sageer
7Sageer merged commit 4598262 into MoonshotAI:main Jun 4, 2026
9 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 4, 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.

1 participant