Skip to content

fix(openai-compat): retain complete calls - #1

Merged
arjunkmrm merged 2 commits into
clavia/ai-providersfrom
fix/compat-length-tools
Oct 15, 2026
Merged

arjunkmrm merged 2 commits into
clavia/ai-providersfrom
fix/compat-length-tools

Conversation

@calclavia

@calclavia calclavia commented Sep 12, 2026 •

Copy link
Copy Markdown

Preserve complete tool calls when an OpenAI-compatible stream reaches the output limit.

buffered arguments -> secure JSON parser
                        |
                        +-- valid ------------> tool-call
                        +-- invalid + length -> omit call
                        +-- invalid + normal -> existing error

finish reason + usage -> preserved
.changeset/complete-tools-on-length.md              +5/-0
packages/ai/openai-compat/
  src/OpenAiLanguageModel.ts                       +10/-8
  test/OpenAiLanguageModel.test.ts                +183/-0
packages/ai/clavia/test/ProviderStreams.test.ts      +7/-1

Rebased onto clavia/ai-providers at bb7b490; unrelated publishing history removed. OpenRouter's separate adapter remains outside this fix.

Validation: 88 targeted tests pass; pnpm lint-fix and pnpm check pass.

@arjunkmrm
arjunkmrm force-pushed the fix/compat-length-tools branch from cdca4fb to c30f690 Compare October 15, 2026 08:47
@arjunkmrm
arjunkmrm merged commit ee4af41 into clavia/ai-providers Oct 15, 2026
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.

2 participants