Skip to content

fix(api): preserve multi-graders alongside named grader maps - #729

Closed
markstuart-oai wants to merge 2 commits into
mainfrom
castiron/promotions/pr-129
Closed

markstuart-oai wants to merge 2 commits into
mainfrom
castiron/promotions/pr-129

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

A multi-grader needs explicit keys for the variables in calculate_output. The SDK now accepts named grader maps and keeps the single-grader Ruby forms already exposed to callers. For example:

multi = OpenAI::Graders::MultiGrader.new(
  name: "Combined",
  graders: {quality: quality_grader},
  calculate_output: "quality"
)

The existing MultiGrader::Graders union and RBS graders alias remain available and retain their matching behavior. Named values use MultiGrader::Grader/grader. Existing single values still serialize in their original shape; names are never invented from display names or array positions. Use an explicit map when sending a multi-grader to the API.

Validation: real second generation retained the Ruby model, RBI, RBS and tests byte-for-byte. Six tests / 46 assertions cover all five grader types, string/symbol keys, a variable called type, unchanged legacy payloads and complete Run/Validate request/response round trips. Full RuboCop, Ruby/RBI and RBS formatting, Sorbet and 1,568 RBS signature checks passed. Native custom-code budget: 3,696/4,000.

The local full SDK test runner could not download the pinned mock server's JSR dependencies, so the published PR's full CI must pass before review.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

Mixed files: 87 → 90

3 newly customized · 0 customizations removed · 0 existing customizations changed · 0 generated baselines changed

Compared baaec487ca85 → 9c3789498b9f. Generated baselines verified.

File Result Current custom patch
lib/openai/models/graders/multi_grader.rb Newly customized +43 / −7
rbi/openai/models/graders/multi_grader.rbi Newly customized +37 / −4
sig/openai/models/graders/multi_grader.rbs Newly customized +28 / −8
87 existing customizations unchanged
  • lib/openai.rb
  • lib/openai/client.rb
  • lib/openai/models/audio/transcription_create_response.rb
  • lib/openai/models/audio/translation_create_response.rb
  • lib/openai/models/audio/voice_create_params.rb
  • lib/openai/models/beta/agents/vault_status_filter.rb
  • lib/openai/models/chat/chat_completion_message.rb
  • lib/openai/models/chat/chat_completion_message_function_tool_call.rb
  • lib/openai/models/chat/completion_create_params.rb
  • lib/openai/models/image_edit_completed_event.rb
  • lib/openai/models/image_edit_partial_image_event.rb
  • lib/openai/models/image_gen_completed_event.rb
  • lib/openai/models/image_gen_partial_image_event.rb
  • lib/openai/models/images_response.rb
  • lib/openai/models/response_format_json_schema.rb
  • lib/openai/models/responses/function_tool.rb
  • lib/openai/models/responses/response.rb
  • lib/openai/models/responses/response_create_params.rb
  • lib/openai/models/responses/response_format_text_config.rb
  • lib/openai/models/responses/response_format_text_json_schema_config.rb
  • lib/openai/models/responses/response_function_tool_call.rb
  • lib/openai/models/responses/response_function_web_search.rb
  • lib/openai/models/responses/response_output_text.rb
  • lib/openai/models/responses/tool.rb
  • lib/openai/models/webhooks/webhook_endpoint_with_secret.rb
  • lib/openai/resources/audio/transcriptions.rb
  • lib/openai/resources/audio/translations.rb
  • lib/openai/resources/beta/agents/environments/files.rb
  • lib/openai/resources/beta/agents/sessions.rb
  • lib/openai/resources/beta/agents/sessions/artifacts.rb
  • lib/openai/resources/beta/threads.rb
  • lib/openai/resources/chat/completions.rb
  • lib/openai/resources/containers/files.rb
  • lib/openai/resources/files.rb
  • lib/openai/resources/responses.rb
  • lib/openai/resources/vector_stores/file_batches.rb
  • lib/openai/resources/vector_stores/files.rb
  • lib/openai/resources/webhooks.rb
  • rbi/openai/client.rbi
  • rbi/openai/models/audio/transcription_create_response.rbi

47 more in the full report.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 37075524545 --repo openai/openai-ruby \
  --name castiron-custom-code-37075524545-1 --dir /tmp/castiron-custom-code-37075524545-1
git apply --stat /tmp/castiron-custom-code-37075524545-1/custom-code.patch
cat /tmp/castiron-custom-code-37075524545-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin baaec487ca85117d6ee149cabdfe0cb8837d883c 9c3789498b9f2d4843c0949fcf31fa34c6b2e426
python3 scripts/castiron/custom_code_report.py report \
  --base baaec487ca85117d6ee149cabdfe0cb8837d883c \
  --head 9c3789498b9f2d4843c0949fcf31fa34c6b2e426 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-9c3789498b9f
cat /tmp/castiron-custom-code-9c3789498b9f/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@markstuart-oai
markstuart-oai marked this pull request as ready for review September 20, 2026 17:51
@markstuart-oai
markstuart-oai requested a review from a team as a code owner September 20, 2026 17:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T23:03:28.168462Z 9c37894 New commits
🔒 Security Review ✅ Completed 2026-10-02T23:02:41.484916Z 9c37894 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openai-sdks

openai-sdks Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

OkTest Summary

✅ 236/236 SDK tests passed in 9.044s for Ruby SDK PR #729.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 178ms
tests/chat-completions-create.test.ts ✅ Passed 264ms
tests/chat-completions-stream.test.ts ✅ Passed 110ms
tests/files-content-binary.test.ts ✅ Passed 147ms
tests/files-create-multipart.test.ts ✅ Passed 158ms
tests/files-list-pagination.test.ts ✅ Passed 140ms
tests/initialize-config.test.ts ✅ Passed 97ms
tests/instance-isolation.test.ts ✅ Passed 96ms
tests/models-list.test.ts ✅ Passed 185ms
tests/responses-background-lifecycle.test.ts ✅ Passed 115ms
tests/responses-body-method-errors.test.ts ✅ Passed 497ms
tests/responses-cancel-timeout.test.ts ✅ Passed 236ms
tests/responses-cancel.test.ts ✅ Passed 257ms
tests/responses-compact-retries.test.ts ✅ Passed 155ms
tests/responses-compact.test.ts ✅ Passed 219ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 224ms
tests/responses-create-advanced.test.ts ✅ Passed 144ms
tests/responses-create-disconnect.test.ts ✅ Passed 128ms
tests/responses-create-errors.test.ts ✅ Passed 355ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 113ms
tests/responses-create-retries.test.ts ✅ Passed 140ms
tests/responses-create-stream-failures.test.ts ✅ Passed 118ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 235ms
tests/responses-create-stream-wire.test.ts ✅ Passed 2.062s
tests/responses-create-stream.test.ts ✅ Passed 163ms
tests/responses-create-terminal-states.test.ts ✅ Passed 276ms
tests/responses-create-timeout.test.ts ✅ Passed 293ms
tests/responses-create.test.ts ✅ Passed 126ms
tests/responses-delete.test.ts ✅ Passed 111ms
tests/responses-input-items-errors.test.ts ✅ Passed 207ms
tests/responses-input-items-list.test.ts ✅ Passed 145ms
tests/responses-input-items-options.test.ts ✅ Passed 159ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 270ms
tests/responses-input-tokens-count.test.ts ✅ Passed 149ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.177s
tests/responses-not-found-errors.test.ts ✅ Passed 450ms
tests/responses-parse.test.ts ✅ Passed 157ms
tests/responses-retrieve-retries.test.ts ✅ Passed 231ms
tests/responses-retrieve.test.ts ✅ Passed 184ms
tests/responses-stored-method-errors.test.ts ✅ Passed 975ms
tests/retry-behavior.test.ts ✅ Passed 3.225s
tests/sdk-error-shape.test.ts ✅ Passed 557ms

View OkTest run #37075493791

SDK merge (898f46509446) · head (9c3789498b9f) · base (baaec487ca85) · OkTest (505ac0e34283)

@jbeckwith-oai jbeckwith-oai 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.

not as a breaking change, nah

@markstuart-oai
markstuart-oai marked this pull request as draft September 22, 2026 05:37
@markstuart-oai

markstuart-oai commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

In response to the nonbreaking-release review:

Agreed — this should not ship as a breaking release. The current diff really does remove MultiGrader::Graders (including its RBI/RBS types) and replace the single-grader field contract with a named map, so just removing ! from the title would hide an incompatibility.

I’m keeping this PR in draft with your change request outstanding. It needs an additive compatibility revision that retains the existing public names and legacy input behavior while supporting correctly named grader maps, plus regression coverage for both paths. The old flat payload must not be silently given an invented grader name or represented as an API-valid request. No compatibility fix or release is claimed yet.

@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-129 branch from 34732db to 203e0c1 Compare September 27, 2026 23:40
@markstuart-oai markstuart-oai changed the title fix(api)!: represent multi-graders as named grader maps fix(api): preserve multi-graders alongside named grader maps Sep 27, 2026
@markstuart-oai
markstuart-oai marked this pull request as ready for review September 27, 2026 23:40

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 203e0c1a59

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/openai/models/graders/multi_grader.rb
Comment thread rbi/openai/models/graders/multi_grader.rbi
@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-129 branch from 203e0c1 to e04bcf4 Compare September 27, 2026 23:50

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e04bcf4e10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sig/openai/models/graders/multi_grader.rbs
@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-129 branch from e04bcf4 to d1b2d68 Compare September 28, 2026 00:02

@jbeckwith-oai jbeckwith-oai 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.

Re-reviewed d1b2d686d2f3ee1c9c2f1791e9fec91c1837edcd. The restored public union and the Sorbet/RBS input changes look good, but one reproducible legacy-input regression remains, so I am keeping changes requested.

Reviewed all seven changed files and the conversion machinery. A focused offline Ruby 3.3.12 probe accepts the omitted-type single-grader hash on exact base e1903035d709a6b8aa40c0049ea8305c63eccc61 and rejects it on the reviewed head. Existing exact-head Ruby 3.3/3.4/4.0, typecheck, package and lint checks are green; the added compatibility tests only cover explicit-type legacy hashes. The local Minitest file could not start because minitest/mock is not installed, so I am not claiming a local full-suite pass.

Comment thread lib/openai/models/graders/multi_grader.rb Outdated
Castiron-Internal-PR: openai/openai-ruby-internal#129
Castiron-Source-SHA: a57df9ba45efb8d930a9ca21348d270b1932ced9
Castiron-Public-Base-SHA: dc3566d
@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-129 branch from d1b2d68 to 7d0a4d7 Compare September 28, 2026 01:39
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.

3 participants