Skip to content

fix(provider): reject malformed chat completions - #275

Merged
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
alexsmolya:bounty/issue-267-malformed-completions
Sep 6, 2026
Merged

fix(provider): reject malformed chat completions#275
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
alexsmolya:bounty/issue-267-malformed-completions

Conversation

@alexsmolya

Copy link
Copy Markdown
Contributor

Summary

  • Reject successful responses without a non-empty choices array, an object first choice/message, and string message.content.
  • Guard successful JSON parsing with HTTP status context and a bounded body excerpt for malformed responses.
  • Preserve valid responses, non-2xx errors, and network failure handling.

Validation

  • Focused provider tests: 13/13 passed.
  • Format, lint, typecheck, build, and git diff --check: passed.
  • npm run verify: format/lint/typecheck passed; 231 tests passed and one unrelated pre-existing flaky memory property test failed (RangeError: Invalid time value in tests/memory/in-memory-memory-store.property.test.ts). The same failure was reproduced against untouched main; the complete suite is not represented as green.

Fixes #267

@David-patrick-chuks-02
David-patrick-chuks-02 merged commit 5b4c121 into Lilly-Protocol:main Sep 6, 2026
0 of 2 checks passed
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.

[Bounty: $90] Fail loudly on malformed chat completion responses in OpenAICompatibleModelProvider

3 participants