fix(api): treat chat message name empty/whitespace as omit - #614
fix(api): treat chat message name empty/whitespace as omit#614seonghobae wants to merge 11 commits into
Conversation
…closed otherwise Chat history: message-level audio and legacy function_call are null/empty omit no-ops; non-empty fail closed with named errors (including tools passthrough). Tip substrate from #577 assistant refusal/annotations honesty. Local full unit: 940 passed.
…ed otherwise OpenAI fine-tune style message weight is not applied on this gateway. Accept null/0/1 as honest no-ops; reject other types and values with invalid_message_weight. Tip substrate from #578. Local full unit: 943 passed.
…ion role Reject unsupported message keys with named unknown_message_fields (not silent strip or tools-passthrough smuggle). Reject legacy function role with invalid_message_role migration to tool. Tip substrate from #579. Local full unit: 947 passed.
OpenAI partial-assistant prefix flag is not applied on this gateway. null/false are honest no-ops; true and non-booleans fail closed with invalid_message_prefix. Tip substrate from #580. Local full unit: 950 passed.
…therwise Named invalid_max_tool_calls on /v1/chat/completions instead of opaque unknown_fields. Aligns with Responses max_tool_calls honesty; gateway has no multi-step tool loop.
…losed otherwise Legacy /v1/completions treated max_tool_calls as unknown_fields. Accept the key for named invalid_max_tool_calls (null/empty/whitespace omit-equivalent), matching chat/Responses honesty so SDKs get a clear migration path.
SDK clients often send include_usage/include_obfuscation as JSON null. Drop null flag values before validation so null (and null+false mixes) match omit / all-false no-ops on chat, Completions, and Responses. True flags remain fail-closed with invalid_stream_options.
…or Responses parallel true SDK optional defaults often send function.strict and json_schema.strict as null — treat as omit rather than type errors. Align Responses parallel_tool_calls=true with chat by requiring a non-empty tools array.
SDK optional defaults often send description and parameters as JSON null. Treat null as omit rather than type errors; non-null non-string/object values remain fail-closed with invalid_tools.
OpenAI-style tool descriptions are at most 1024 characters. Over-long descriptions fail closed with named invalid_tools so SDKs never believe a truncated description was accepted.
SDK optional participant name blanks ("" / whitespace) are omit-equivalent
like JSON null. Non-string, over-long, and invalid charset names remain
fail-closed with invalid_message_name.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Important Review skippedToo many files! This PR contains 142 files, which is 42 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (142)
You can disable this status message by setting the 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 |
There was a problem hiding this comment.
Unique tip 4f84700 is sound. Do not merge this 142-file stack onto main.
Reviewed only the unique commit vs parent #602 55d7a45 (4 files, +123/−12). The rest of the 142-file honesty stack is substrate, not this slice.
What the tip actually does
_validate_messages treats JSON null, "", and ASCII/Unicode whitespace as omit-equivalent and does not copy name onto the rebuilt orchestration entry. Non-string, over-long (>64), and charset-invalid names still raise invalid_message_name. Live helper checks on this head: None / "" / " " / "\t " / NBSP omit; 123 / 65-char / "bad name!" / ZWSP fail closed; tool + blank name omits; tool + "tool_fn" is 400.
Local unique-tip scripts printed ok:
python3 tests/test_message_name_empty_omit_http_honesty.pypython3 tests/test_chat_message_name_http_honesty.py
CodeRabbit CLI is not authenticated in this environment (coderabbit auth login --agent stays on browser auth). This is not a CodeRabbit result.
Residual that this tip does not close
Tools passthrough (server.py ~3600) proxies the original body before _validate_messages. On this head, tools + name 123 / "n"*65 / ZWSP / "bad name!" still return 200. The commit’s “remain fail-closed” claim is true on the orchestration path only.
HTTP tests in the tip assert status 200 only. They do not lock omit ("name" not in the rebuilt message).
Next action
Do not merge #614 onto main. Keep it as the name-omit substrate. The follow-up on cursor/bc-0264e185-4eb5-4824-9123-9c26f9754c29-724c hoists _omit_or_validate_message_name / _validate_chat_message_name before proxy_completion, pops blank names in place, and adds tools-path HTTP plus omit assertions. Review that successor; independent non-author APPROVE is still required. This automation cannot merge.
Do not open a third empty-name stack PR. Prefer the hoist successor over landing this stack.
Sent by Cursor Automation: Fix Issues
Pull request was closed
|
Superseded by tip substrate ≥ #691 (cumulative OpenAI/gateway honesty band + auto-merge tip). Closing to free product-gate runners (Full unit + Semgrep). |


Summary
name: ""/ whitespace is omit-equivalent (parity with null).Test plan
python -m pytest tests -q(981 passed)