Skip to content

fix(api): treat assistant refusal/annotations null-empty as omit; fail-closed otherwise - #577

Closed
seonghobae wants to merge 15 commits into
mainfrom
feat/assistant-refusal-noop-http-honesty-20260816202253
Closed

fix(api): treat assistant refusal/annotations null-empty as omit; fail-closed otherwise#577
seonghobae wants to merge 15 commits into
mainfrom
feat/assistant-refusal-noop-http-honesty-20260816202253

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • Chat messages: refusal null/empty omit; non-empty fails closed (invalid_message_refusal).
  • Chat messages: annotations null/empty omit; non-empty fails closed (invalid_message_annotations).
  • Tip substrate from fix(api): fail-closed multimodal content-part shape honesty #576 multimodal shape honesty. Local full unit: 932 passed.

Test plan

  • pytest tests/test_assistant_refusal_annotations_http_honesty.py
  • pytest tests -q (932 passed) — evidence implementer/evidence/pytest-577-full.log
  • CI Full unit + Semgrep product gates

Product gates only: Full unit + Semgrep (Strix ignored). Independent non-author APPROVE still required.

… effort as omit

Buyer SDKs often send stream_options with only false flags, tool_choice:{},
and reasoning_effort:"" as optional defaults. Accept them as omit no-ops
while still fail-closing true stream_options flags without stream=true and
non-empty reasoning_effort. Tip honesty substrate re-ship; 849 unit pass.
SDK clients send user:null as an optional default. Treat null as omit on
chat Completions, legacy Completions, Responses, embeddings, and batch
embeddings. Empty/whitespace/non-string user still fail closed with
invalid_user. Local full unit: 857 passed.
…l/response_format/endpoint as omit

SDK clients and stringified optional controls may send empty or
whitespace strings. Treat as omit no-ops on embeddings encoding_format,
chat/Responses tool_choice and function_call, response_format, and batch
embeddings endpoint. Non-empty unsupported values still fail closed.
Local full unit: 865 passed.
SDK stringified empty controls for reasoning, Responses text, and include
are treat-as-omit on chat Completions, legacy Completions, and Responses.
Non-empty unsupported values still fail closed with named errors.
Local full unit: 872 passed.
… as omit

Legacy Completions has no tools surface. Treat SDK defaults tool_choice
none/auto/empty-string/empty-object and function_call none/auto/empty-string
as omit no-ops (parity with chat). Non-default controls and non-empty tools
still fail closed with a chat migration path. Local full unit: 877 passed.
SDK clients may send top_logprobs:0 (no top alternatives). Treat 0 and
null as omit on chat Completions and legacy Completions. Non-zero values
still fail closed with invalid_top_logprobs. Local full unit: 881 passed.
…format float

Incidental whitespace around honest no-op values (" auto ", " float ")
is stripped before validation so SDK-padded strings match. Unsupported
values (flex, base64) still fail closed after strip. Local full unit:
886 passed.
…ll named honesty

Treat empty-string response_format/prediction/reasoning_effort as omit on
legacy Completions. Accept audio/web_search_options keys with null/empty
as omit and non-empty as named invalid_* (not unknown_fields). Local full
unit: 894 passed.
…ns modalities text no-op

Whitespace-padded none/auto on tool_choice and function_call are omit
no-ops on chat, Completions, and Responses. Completions modalities
["text"] is an honest text-only no-op; non-text modalities still fail
closed. Local full unit: 901 passed.
…l names

Treat empty/whitespace prediction as omit on chat and Responses. Strip
modalities array items and empty-string modalities for text-only match.
Strip model names on Completions/chat, Responses, and embeddings so
SDK-padded pool ids resolve. Local full unit: 907 passed.
…nd as omit

OpenAI reasoning_effort none disables extra reasoning — honest omit no-op
on chat and Completions. Empty/whitespace store, stream, and background
strings are treat-as-omit across chat Completions, Completions, and
Responses store. Local full unit: 911 passed.
SDK clients may stringify omitted optionals as empty strings. Treat
empty/whitespace temperature, top_p, max_tokens, max_completion_tokens,
penalties, n, seed, logprobs, parallel_tool_calls, include_orchestration_trace,
echo, best_of, dimensions, max_output_tokens, and responses stream as omit.
Whitespace-only stop arrays are also omit. Local full unit: 917 passed.
Vision callers send content-parts arrays. Shape-check and passthrough
text/image_url parts; unsupported part types fail closed. Coerce part
text for agent selection so list content does not 500. Tip substrate
from empty-string numeric honesty. Local full unit: 921 passed.
Reject empty/whitespace text parts and empty image_url.url; accept bare-string
image_url; validate optional detail to auto/low/high (null/empty omit). HTTP
tests lock named invalid_message_content errors. Local full unit: 928 passed.
…l-closed otherwise

SDK clients send refusal:null and annotations:[] as optional defaults.
Treat null/empty as omit. Non-empty refusal or annotations fail closed
with named errors so clients never believe those planes were applied.
Tip substrate from #576. Local full unit: 932 passed.
@seonghobae
seonghobae enabled auto-merge (squash) August 16, 2026 11:29
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 131 files, which is 31 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: 9aacb533-ce77-4450-8404-12e4cf28e70f

📥 Commits

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

📒 Files selected for processing (131)
  • 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_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_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_name_null_noop_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_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_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.

@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 b8ec73b312d6b82b9c5859bfa5dbefc2d594713f.

  • Head SHA: b8ec73b312d6b82b9c5859bfa5dbefc2d594713f

  • Workflow run: 32020845339

  • Workflow attempt: 1

Coverage evidence

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

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (3 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (3 files)"]
  R1 --> V1["required checks"]
  Evidence --> S2["Test (128 files)"]
  S2 --> I2["regression suite"]
  I2 --> R2["Review risk: Test (128 files)"]
  R2 --> V2["targeted test run"]
Loading

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: b8ec73b312d6b82b9c5859bfa5dbefc2d594713f
  • Workflow run: 32020845339
  • 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 b8ec73b312d6b82b9c5859bfa5dbefc2d594713f.

  • Head SHA: b8ec73b312d6b82b9c5859bfa5dbefc2d594713f

  • Workflow run: 32020845339

  • Workflow attempt: 1

Coverage evidence

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

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (3 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (3 files)"]
  R1 --> V1["required checks"]
  Evidence --> S2["Test (128 files)"]
  S2 --> I2["regression suite"]
  I2 --> R2["Review risk: Test (128 files)"]
  R2 --> V2["targeted test run"]
Loading

@opencode-agent
opencode-agent Bot disabled auto-merge August 17, 2026 11:36
@seonghobae seonghobae closed this Aug 20, 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