fix(openai-chat): tolerate null tool-call padding - #1468
Conversation
📝 WalkthroughWalkthroughThe OpenAI Chat adapter now treats null tool-call payloads as absent in streaming and non-streaming responses. Hardening tests verify preserved text output, completion usage, and error-free processing. ChangesOpenAI null tool-call handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
Ingwannu
left a comment
There was a problem hiding this comment.
This is a valid, focused compatibility correction. tool_calls: null is an absent optional value in both Chat Completions response modes, while the patch still rejects non-array containers, null array entries, and incomplete claimed calls through the existing fail-closed adapter error path.
I rechecked exact head 53c1f425 on current dev@20c513198:
- nine adjacent OpenAI Chat / Chat Completions suites: 161 passed, 0 failed;
- typecheck: passed;
- privacy scan: passed;
git diff --check: passed.
The added streaming and buffered regressions cover the intended boundary, and no documentation change is needed for this internal wire-compatibility fix. I did not find a blocker in the diff.
I am not approving or merging while the PR is draft with the readiness checklist at 0/4 and no exact-head full CI. Once the author completes the checklist against this head, current-head automated review has run, and required CI is green, this should be a strong merge candidate.
|
|
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
Ingwannu
left a comment
There was a problem hiding this comment.
Readiness follow-up: the focused null-padding fix remains a valid, minimal merge candidate, and I still find no code blocker in exact head 53c1f425. However, dev has moved 52 commits since this head and the only Actions runs attached to the current commit were cancelled before a required full cross-platform result was produced.
Please rebase onto current dev@849ab5e35 and let required exact-head CI complete. I am not requesting code expansion; this is only the integration evidence needed before maintainer approval or merge.
53c1f42 to
98bf145
Compare
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
|
Rebased onto current Local verification at the rebased head:
CI at the new head: housekeeping ( |
|
I rechecked the rebased exact head I approved the fork-gated Cross-platform CI and React Doctor workflow runs so exact-head validation can proceed. This is approval to execute CI, not PR approval or merge approval. The PR should remain draft until the author updates the four readiness boxes against this exact head. If the required checks finish green and no new review finding appears, the patch remains a strong merge candidate. |
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
flyingsquirrel0419
left a comment
There was a problem hiding this comment.
Approved at exact head 98bf1454d216bca5bfd10c9e33ac520c38fa1be3.
The rebased diff remains the focused two-file correction: tool_calls: null is treated as absence in buffered and streamed Chat Completions frames, while non-array containers, null array entries, and incomplete claimed calls continue through the existing fail-closed validation path. The focused regressions cover both response modes.
Exact-head Cross-platform CI is now fully green, including all Linux shards, gates, macOS, storage/API jobs, keyring jobs, and npm-global jobs. I found no remaining blocker in this patch.
Wrong connector identity; resubmitting through the designated Ingwannu maintainer account.
Ingwannu
left a comment
There was a problem hiding this comment.
Approved at exact head 98bf1454d216bca5bfd10c9e33ac520c38fa1be3.
The rebased diff remains the focused two-file correction: tool_calls: null is treated as absence in buffered and streamed Chat Completions frames, while non-array containers, null array entries, and incomplete claimed calls continue through the existing fail-closed validation path. The focused regressions cover both response modes.
Exact-head Cross-platform CI is now fully green, including all Linux shards, gates, macOS, storage/API jobs, keyring jobs, and npm-global jobs. I found no remaining blocker in this patch.
Wibias
left a comment
There was a problem hiding this comment.
Thanks @dbc-hbin for the focused compatibility fix. This is useful because a number of OpenAI-compatible providers legitimately send tool_calls: null as padding when there is no tool call. Treating that as absence prevents valid text responses from failing unnecessarily, while the existing fail-closed checks still reject malformed non-null tool-call payloads. Small change, but it improves provider interoperability without weakening validation.
Summary
tool_calls: nullas an absent optional field in streamed and buffered OpenAI-compatible responses.This restores compatibility with providers that use
nullas padding when no tool call is present, without accepting malformed claimed tool-call payloads.Verification
bun test tests/openai-chat-hardening.test.tsbun run typecheckbun run testbun run privacy:scanNo documentation change is needed because this is an internal adapter compatibility correction with no configuration or public API change.
Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
null.