Skip to content

fix(protocols): ignore null chat function call deltas - #806

Merged
yyyr-p merged 1 commit into
Menci:mainfrom
XiaoMengXinX:fix/null-chat-function-call-delta
Dec 2, 2026
Merged

yyyr-p merged 1 commit into
Menci:mainfrom
XiaoMengXinX:fix/null-chat-function-call-delta

Conversation

@XiaoMengXinX

Copy link
Copy Markdown
Contributor

Summary

Treat a null legacy choices[].delta.function_call as an omitted fragment when reassembling Chat Completions SSE for a non-streaming response. An OpenAI-compatible upstream can return an otherwise successful stream with this field set to null. Reading its name currently throws and turns the successful upstream response into HTTP 502.

The regression coverage checks that null call fields leave regular text intact and that a null fragment between two legacy function-call fragments preserves the accumulated name and arguments.

Verification

  • Reproduced the original TypeError in both regression cases before applying the fix.
  • Ran the focused reassembly test file (5 tests), the protocols package typecheck, and ESLint on both changed files.
  • Verified that a deployed build returned HTTP 200 and a complete non-streaming completion from an upstream SSE stream containing 12 null function-call deltas.

@yyyr-p
yyyr-p merged commit edc5b07 into Menci:main Dec 2, 2026
21 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