Skip to content

fix(api): treat tool.function description/parameters null as omit - #595

Closed
seonghobae wants to merge 9 commits into
mainfrom
feat/tool-description-params-null-noop-http-honesty-20260817002215
Closed

fix(api): treat tool.function description/parameters null as omit#595
seonghobae wants to merge 9 commits into
mainfrom
feat/tool-description-params-null-noop-http-honesty-20260817002215

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • tests/test_tool_description_parameters_null_noop_http_honesty.py
  • python -m pytest tests -q (976 passed)
  • CI Full unit + Semgrep

…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.
@seonghobae
seonghobae enabled auto-merge (squash) August 16, 2026 15:29
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 140 files, which is 40 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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fc709f2b-5a9f-493a-b56f-37712f473228

📥 Commits

Reviewing files that changed from the base of the PR and between 6841b71 and 5dace0f.

📒 Files selected for processing (140)
  • contextual_orchestrator/cost_ledger.py
  • contextual_orchestrator/orchestrator.py
  • contextual_orchestrator/server.py
  • tests/test_analytics_runtime.py
  • tests/test_assistant_refusal_annotations_http_honesty.py
  • tests/test_assistant_tool_calls_null_noop_http_honesty.py
  • tests/test_audio_websearch_reasoning_null_noop_http_honesty.py
  • tests/test_background_reasoning_reject_http_honesty.py
  • tests/test_batch_embeddings.py
  • tests/test_batch_embeddings_encoding_dimensions_http_honesty.py
  • tests/test_batch_embeddings_endpoint_http_honesty.py
  • tests/test_batch_embeddings_routing_http_honesty.py
  • tests/test_batch_embeddings_user_http_honesty.py
  • tests/test_budget_enforcement.py
  • tests/test_chat_assistant_tool_calls_http_honesty.py
  • tests/test_chat_attribution_routing_http_honesty.py
  • tests/test_chat_audio_web_search_reject_http_honesty.py
  • tests/test_chat_developer_multimodal_content_http_honesty.py
  • tests/test_chat_empty_user_system_content_http_honesty.py
  • tests/test_chat_include_orchestration_trace_http_honesty.py
  • tests/test_chat_include_reject_http_honesty.py
  • tests/test_chat_logit_bias_http_honesty.py
  • tests/test_chat_max_completion_tokens_http_honesty.py
  • tests/test_chat_max_tool_calls_http_honesty.py
  • tests/test_chat_message_name_http_honesty.py
  • tests/test_chat_modalities_http_honesty.py
  • tests/test_chat_n_gt1_http_honesty.py
  • tests/test_chat_openai_metadata_http_honesty.py
  • tests/test_chat_orchestration_mode_http_honesty.py
  • tests/test_chat_parallel_tool_calls_http_honesty.py
  • tests/test_chat_penalties_http_honesty.py
  • tests/test_chat_prediction_http_honesty.py
  • tests/test_chat_reasoning_effort_http_honesty.py
  • tests/test_chat_reasoning_object_reject_http_honesty.py
  • tests/test_chat_response_format_http_honesty.py
  • tests/test_chat_service_tier_http_honesty.py
  • tests/test_chat_store_http_honesty.py
  • tests/test_chat_stream_options_http_honesty.py
  • tests/test_chat_temperature_top_p_http_honesty.py
  • tests/test_chat_tool_call_id_http_honesty.py
  • tests/test_chat_tool_choice_functions_http_honesty.py
  • tests/test_chat_tools_shape_http_honesty.py
  • tests/test_chat_top_logprobs_http_honesty.py
  • tests/test_chat_unknown_fields_http_honesty.py
  • tests/test_commercial_readiness.py
  • tests/test_completions_chat_era_fields_reject_http_honesty.py
  • tests/test_completions_empty_tools_noop_http_honesty.py
  • tests/test_completions_include_reject_http_honesty.py
  • tests/test_completions_legacy_knobs_http_honesty.py
  • tests/test_completions_max_completion_tokens_http_honesty.py
  • tests/test_completions_max_tokens_http_honesty.py
  • tests/test_completions_max_tool_calls_http_honesty.py
  • tests/test_completions_metadata_service_tier_http_honesty.py
  • tests/test_completions_prompt_shape_http_honesty.py
  • tests/test_completions_response_format_audio_null_http_honesty.py
  • tests/test_completions_response_format_reject_http_honesty.py
  • tests/test_completions_sampling_knobs_http_honesty.py
  • tests/test_completions_seed_http_honesty.py
  • tests/test_completions_stop_http_honesty.py
  • tests/test_completions_store_http_honesty.py
  • tests/test_completions_stream_options_http_honesty.py
  • tests/test_completions_stream_reject_http_honesty.py
  • tests/test_completions_tool_choice_function_call_noop_http_honesty.py
  • tests/test_completions_tools_noop_extensions_http_honesty.py
  • tests/test_completions_tools_reject_http_honesty.py
  • tests/test_completions_top_logprobs_reject_http_honesty.py
  • tests/test_cost_review_server.py
  • tests/test_embeddings_blank_input_http_honesty.py
  • tests/test_embeddings_encoding_format_http_honesty.py
  • tests/test_embeddings_metadata_http_honesty.py
  • tests/test_embeddings_model_pool_http_honesty.py
  • tests/test_embeddings_null_optional_noop_http_honesty.py
  • tests/test_embeddings_routing_http_honesty.py
  • tests/test_embeddings_user_field_http_honesty.py
  • tests/test_empty_modalities_prediction_noop_http_honesty.py
  • tests/test_empty_stop_array_noop_http_honesty.py
  • tests/test_empty_stream_options_include_noop_http_honesty.py
  • tests/test_empty_string_controls_noop_http_honesty.py
  • tests/test_empty_string_encoding_tool_choice_endpoint_noop_http_honesty.py
  • tests/test_empty_string_numeric_controls_noop_http_honesty.py
  • tests/test_empty_string_reasoning_text_include_noop_http_honesty.py
  • tests/test_empty_string_stop_noop_http_honesty.py
  • tests/test_empty_tools_array_http_honesty.py
  • tests/test_function_call_reasoning_empty_noop_http_honesty.py
  • tests/test_functions_null_max_tool_calls_null_http_honesty.py
  • tests/test_include_orchestration_trace_null_noop_http_honesty.py
  • tests/test_ledger_execution_identity_http_honesty.py
  • tests/test_message_audio_function_call_http_honesty.py
  • tests/test_message_name_null_noop_http_honesty.py
  • tests/test_message_prefix_http_honesty.py
  • tests/test_message_unknown_fields_http_honesty.py
  • tests/test_message_weight_http_honesty.py
  • tests/test_multimodal_content_parts_shape_http_honesty.py
  • tests/test_multimodal_message_content_http_honesty.py
  • tests/test_openai_models_listing_http.py
  • tests/test_openai_passthrough.py
  • tests/test_openai_sdk_control_fields_reject_http_honesty.py
  • tests/test_openai_user_field_http_honesty.py
  • tests/test_prediction_modalities_model_strip_http_honesty.py
  • tests/test_prompt_cache_retention_reject_http_honesty.py
  • tests/test_reasoning_effort_none_store_stream_empty_noop_http_honesty.py
  • tests/test_responses_attribution_routing_http_honesty.py
  • tests/test_responses_conversation_controls_http_honesty.py
  • tests/test_responses_instructions_reasoning_http_honesty.py
  • tests/test_responses_logit_bias_logprobs_http_honesty.py
  • tests/test_responses_max_output_tokens_http_honesty.py
  • tests/test_responses_max_tokens_http_honesty.py
  • tests/test_responses_max_tool_calls_reject_http_honesty.py
  • tests/test_responses_metadata_http_honesty.py
  • tests/test_responses_modalities_prediction_http_honesty.py
  • tests/test_responses_model_required_http_honesty.py
  • tests/test_responses_n_http_honesty.py
  • tests/test_responses_parallel_tool_calls_http_honesty.py
  • tests/test_responses_penalties_http_honesty.py
  • tests/test_responses_response_format_http_honesty.py
  • tests/test_responses_seed_stop_http_honesty.py
  • tests/test_responses_service_tier_http_honesty.py
  • tests/test_responses_store_http_honesty.py
  • tests/test_responses_stream_options_http_honesty.py
  • tests/test_responses_stream_reject_http_honesty.py
  • tests/test_responses_temperature_top_p_http_honesty.py
  • tests/test_responses_tools_shape_http_honesty.py
  • tests/test_responses_user_field_http_honesty.py
  • tests/test_sales_readiness.py
  • tests/test_sdk_null_legacy_controls_noop_http_honesty.py
  • tests/test_sdk_null_object_optional_noop_http_honesty.py
  • tests/test_sdk_null_optional_noop_http_honesty.py
  • tests/test_security_hardening.py
  • tests/test_service_tier_encoding_format_strip_http_honesty.py
  • tests/test_stream_null_noop_http_honesty.py
  • tests/test_stream_options_false_tool_choice_empty_noop_http_honesty.py
  • tests/test_stream_options_null_flags_noop_http_honesty.py
  • tests/test_streaming.py
  • tests/test_tool_choice_auto_without_tools_noop_http_honesty.py
  • tests/test_tool_choice_strip_modalities_text_noop_http_honesty.py
  • tests/test_tool_description_parameters_null_noop_http_honesty.py
  • tests/test_tool_strict_null_noop_http_honesty.py
  • tests/test_top_logprobs_zero_omit_noop_http_honesty.py
  • tests/test_true_streaming.py
  • tests/test_user_null_omit_noop_http_honesty.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: COMMENT

Would be REQUEST_CHANGES if GitHub allowed that event on an author-owned PR. Do not merge #595 onto main.

Merge-safe? no

The unique tip is accept-not-omit: description: null / parameters: null skip the type check and stay on the body that proxy_completion forwards. Mock 200 hides provider-hop rejection. The 140-file stacked diff also still carries the inherited tools-passthrough and stream_options unknown-null fail-opens.

Scope reviewed: unique tip 5dace0f only (2 files, +202/−2) plus live HTTP probes of claimed omit behavior and known inherited residuals at HEAD. Stack vs main (6841b71) is 9 commits / 140 files; that inherited surface is merge-unsafe even where this tip is locally correct. CodeRabbit CLI was not installed in this environment (command not found); this review is from the tip diff, validators, honesty tests, and live mock HTTP.

Unique tip: claimed vs real

Claim Evidence at 5dace0f
tools[].function.description: null and parameters: null are omit-equivalent Partial. Validators no longer 400. They do not pop the keys. Live mock echo.tools still contains description: null, parameters: null, and (inherited) strict: null on both /v1/chat/completions and /v1/responses.
Non-null wrong types stay fail-closed with named invalid_tools Real. description: 123 and parameters: "not-an-object" return 400 invalid_tools (chat test + live Responses description: 123).
HTTP honesty tests cover the contract Status-only. tests/test_tool_description_parameters_null_noop_http_honesty.py printed ok. Every accept case asserts status == 200 and never inspects echo.

_validate_chat_tools mutates nothing. Its return value is discarded at contextual_orchestrator/server.py:3566 (chat) and :4135 (Responses). TaskOrchestrator.proxy_completion copies body minus orchestration-only keys and ModelClient._mock_raw echoes tools verbatim (orchestrator.py:450-454, :967-976). That is fail-open to real providers: several OpenAI-compatible backends reject parameters: null / description: null as non-objects.

No docs/CHANGELOG/README update in the tip. docs/rest_api_design.md and README.md still do not mention tool description/parameters null-as-omit (or tools honesty at all).

Concrete bugs (HEAD lines)

  1. contextual_orchestrator/server.py:2612-2619parameters is not None skips the object check but leaves parameters: null on function. Not omit-real.
  2. contextual_orchestrator/server.py:2621-2630 — same for description: null.
  3. contextual_orchestrator/server.py:2581-2589 (inherited #590 tip, still at this HEAD) — strict: null accepted, not popped. No _normalize_optional_strict_flag on this stack (512d5b8 is not included).
  4. contextual_orchestrator/server.py:3566 / :4135_validate_chat_tools(body) return discarded; original body is proxied.
  5. tests/test_tool_description_parameters_null_noop_http_honesty.py:75, :100, :134 — 200-only asserts. The combined-null case even sends strict: None and would pass while echo still carries all three nulls.

Missing tests

  • Mock-echo (or equivalent) assertion that null description / parameters / strict keys are absent after validation — the omit-real contract this series used on later #590 repair.
  • Responses-path accept + echo for the same nulls (validator is shared; forwarding bug is shared; untested).
  • Docs/API-contract coverage if this repo still requires docs/*.md updates for honesty behavior.
  • No coverage that {unknown_flag: null} / tools+prefix / tools+developer stay fail-closed — those are inherited, but this PR advertises a merge onto main.

Inherited merge-blockers still at HEAD (live HTTP on this process)

Probe Result Contrast
tools + prefix: true 200 same message without tools → 400 invalid_message_prefix
tools + weight: 0.5 200 without tools → 400 invalid_message_weight
tools + role: developer 200 without tools → 400 invalid_message_role
stream_options: {unknown_flag: null} 200 nulls dropped before unknown-key check (server.py:1074-1077)
tools + that stream_options 200 same
Responses-native {type,name,parameters,strict} 400 invalid_tools chat-shaped type+function still required

Cause: _validate_messages (prefix/weight/developer) runs only after the PASSTHROUGH_TRIGGER_KEYS early-return. Pre-passthrough helpers (_validate_chat_message_known_fields, _validate_chat_message_audio_function_call) do not hoist those value checks. weight/prefix are in ALLOWED_MESSAGE_KEYS, so they pass the known-field gate.

Recommended next successor slice

Do not merge this 140-file stack. Do not open another competing honesty-stack PR.

Prefer the current honesty vehicle (#597, built on #592's unknown-null + message-honesty hoist). If this tip is still wanted, add a thin commit there that:

  1. Pops description / parameters / strict when JSON-null (in-place on the function dict, same pattern as #590's later _normalize_optional_strict_flag).
  2. Asserts omit-real via mock echo.tools on chat and Responses.
  3. Leaves non-null wrong types on invalid_tools.
  4. Documents the omit in docs/rest_api_design.md (and README if that surface lists chat tools).

Independent non-author APPROVE is still required on whatever lands. Do not self-approve.

Inline comment targets (unique-tip RIGHT-side lines)

Not posted as GitHub inline comments: this PR diff is +23325 lines and the review API rejects inlines past ~20k. Use these if a later thin PR re-opens the hunks:

  • contextual_orchestrator/server.py:2614if parameters is not None and not isinstance(parameters, dict): — accept-not-omit; pop None before proxy.
  • contextual_orchestrator/server.py:2623and function.get("description") is not None — same for description.
  • tests/test_tool_description_parameters_null_noop_http_honesty.py:75assert status == 200, body — also assert "description" not in echo["tools"][0]["function"].
  • tests/test_tool_description_parameters_null_noop_http_honesty.py:100 — same for parameters.
  • tests/test_tool_description_parameters_null_noop_http_honesty.py:134 — combined-null + strict: None; assert all three keys absent in echo.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: COMMENT

Do not merge #595 at 5dace0f. The unique tip is accept-not-omit, not omit-real.

Unique tip vs claimed contract

tools[].function.description: null and parameters: null no longer 400. The keys stay on the body that proxy_completion forwards. Mock 200 hides provider-hop rejection: live echo.tools still contains description: null, parameters: null, and inherited strict: null on chat and Responses. Non-null wrong types correctly stay invalid_tools.

_validate_chat_tools does not pop. Its return is discarded. Tests assert status == 200 only.

Inherited merge-blockers still at this head

This 140-file stack does not include #592's repairs. Live HTTP on 5dace0f still returns 200 for tools+prefix: true, tools+weight: 0.5, tools+developer, and stream_options: {unknown_flag: null}.

Successor

Prefer #603 (e58cb2f on the #592 substrate). That tip pops JSON-null description / parameters / strict in place and asserts omit-real via mock echo.tools on chat and Responses. Keep #595 closed or superseded once #603 is independently approved.

Independent non-author APPROVE is still required on whatever lands. Do not self-approve.

Next action

Review and land #603 for this slice. Do not add another competing honesty-stack PR for the same null-field accept.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 5dace0fb504fd6c291f9923847fdef500ccb5b88.

  • Head SHA: 5dace0fb504fd6c291f9923847fdef500ccb5b88

  • Workflow run: 32086390944

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  Evidence["OpenCode evidence"] --> Review["Current PR review path"]
  Review --> Verify["Required checks"]
Loading

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 5dace0fb504fd6c291f9923847fdef500ccb5b88
  • Workflow run: 32086390944
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 5dace0fb504fd6c291f9923847fdef500ccb5b88.

  • Head SHA: 5dace0fb504fd6c291f9923847fdef500ccb5b88

  • Workflow run: 32086390944

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  Evidence["OpenCode evidence"] --> Review["Current PR review path"]
  Review --> Verify["Required checks"]
Loading

@opencode-agent
opencode-agent Bot disabled auto-merge August 18, 2026 02:19
@seonghobae

Copy link
Copy Markdown
Contributor Author

Superseded by #759. The current head is included in the published http-honesty integration tree (integration commit c1aa96a; published tree fdf2fbec), and this PR has no commit outside that integrated stack.

@seonghobae seonghobae closed this Aug 19, 2026
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.

1 participant