Skip to content

fix(api): persist #668 omit-real (args/instructions/metadata/tlp hoist) - #686

Closed
cursor[bot] wants to merge 15 commits into
mainfrom
cursor/bc-62e532b1-619a-443c-8641-d53d4992b06d-2c9a
Closed

fix(api): persist #668 omit-real (args/instructions/metadata/tlp hoist)#686
cursor[bot] wants to merge 15 commits into
mainfrom
cursor/bc-62e532b1-619a-443c-8641-d53d4992b06d-2c9a

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

Summary

#668 restored SDK omit accept-path 200s on the #653 substrate but did not persist the omit-equivalent payload. This unique tip writes the cleaned shape back onto the request body before proxy_completion:

  • tool_calls[].function.arguments: null"" in place
  • blank/null/NBSP Responses instructions popped
  • null metadata values omitted and written back (key dropped when only nulls remain)
  • chat logprobs / top_logprobs hoisted before tools passthrough; empty/whitespace/0 top_logprobs popped; tools + nonzero top_logprobs is invalid_top_logprobs

Mock echo now includes instructions, metadata, messages, and top_logprobs so HTTP tests lock persist, not just status 200.

Prefer this tip over merging #668 as the 145-file honesty stack. Do not merge this stack onto main either — land the unique persist slice after an independent non-author APPROVE.

Test plan

  • python3 tests/test_tip_reland_sdk_omit_persist_http_honesty.py
  • python3 tests/test_tip_reland_sdk_omit_http_honesty.py
  • Related honesty + passthrough + paper/API/convention/self-check scripts printed ok
  • CI Full unit + Semgrep

Buyer next action

Send the SDK payload (null arguments, blank instructions, mixed null metadata, tools + top_logprobs). Expect the upstream echo to match omit, and expect nonzero top_logprobs with tools to return invalid_top_logprobs.

Open in Web View Automation 

seonghobae and others added 15 commits August 16, 2026 21:18
…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.
SDK optional defaults serialize omitted tool.function description/parameters/strict
as JSON null. Accepting those keys without popping them is not omit-equivalent:
proxy_completion forwards the body and several providers reject null parameters.
Pop in place so passthrough matches omit; keep non-null wrong types on invalid_tools.
Also pop response_format.json_schema.strict null. Tip substrate from #614.
Local full unit: 989 passed.
Null flag values on allowed keys (include_usage / include_obfuscation) stay
omit-equivalent. Dropping nulls before the allow-list made {unknown: null}
look empty and silently omit — dishonest for buyers. Fail closed with
invalid_stream_options on chat, Completions, and Responses. Tip substrate
from #638. Local full unit: 996 passed.
…ix/mode/metadata)

Parallel tip #653 lacked later omit seams. Restore top_logprobs empty-string
omit, tool_calls arguments null→empty string, Responses instructions
blank omit, Completions whitespace suffix omit, mode strip, and metadata
null value key-omit. Fail-closed paths for nonzero/non-string remain.
#668 restored accept-path 200s but left omit-equivalent keys on the
proxied body. Write back empty tool_calls arguments, pop blank
Responses instructions, persist cleaned metadata, and hoist chat
logprobs/top_logprobs before tools passthrough so providers see the
omit-equivalent payload.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@cursor
cursor Bot requested a review from seonghobae August 16, 2026 16:57
@seonghobae
seonghobae marked this pull request as ready for review August 16, 2026 17:05
@seonghobae
seonghobae enabled auto-merge (squash) August 16, 2026 17:05
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Author

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.

@seonghobae seonghobae closed this Aug 16, 2026
auto-merge was automatically disabled August 16, 2026 18:22

Pull request was closed

@seonghobae

Copy link
Copy Markdown
Contributor

Superseded by tip #691 (cumulative honesty substrate ≥ #689). Closing to free Full unit + Semgrep runners.

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