Skip to content

feat: expose request IDs - #352

Merged
jbeckwith-oai merged 3 commits into
mainfrom
codex/expose-request-id
Aug 10, 2026
Merged

feat: expose request IDs#352
jbeckwith-oai merged 3 commits into
mainfrom
codex/expose-request-id

Conversation

@jbeckwith-oai

Copy link
Copy Markdown
Contributor

Summary

  • expose the server-generated x-request-id as _request_id on successful typed model and paginated responses
  • expose request_id on API errors
  • add RBI and RBS declarations plus user-facing documentation
  • cover model responses, page responses, error responses, and serialization behavior

Why

The Ruby SDK retained response headers at the transport boundary but discarded them while coercing successful responses into typed objects. Errors retained their headers but required callers to inspect the header hash manually. This left Ruby behind the other official SDKs for request-ID convenience and made production troubleshooting harder.

Request IDs are response metadata, so they are attached only to the top-level returned object and are excluded from to_h, JSON, and YAML serialization.

Validation

  • thermo-nuclear code-quality review
  • ./scripts/test on Ruby 4.0.6 — 518 runs, 1702 assertions
  • ./scripts/test on Ruby 3.3.12 — 518 runs, 1702 assertions
  • bundle exec rake lint:rubocop — 2596 files, no offenses
  • bundle exec rake typecheck:sorbet
  • bundle exec rake validate:rbs — 1211 files
  • bundle exec rake build:gem

Surface gap: https://openai-sdk-surface-atlas.openai.chatgpt.site/?capability=request-id#matrix

@jbeckwith-oai
jbeckwith-oai marked this pull request as ready for review August 10, 2026 18:57
@jbeckwith-oai
jbeckwith-oai requested a review from a team as a code owner August 10, 2026 18:57
@openai-sdks

openai-sdks Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 8.54s for Ruby SDK PR #352.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 188ms
tests/chat-completions-create.test.ts ✅ Passed 260ms
tests/chat-completions-stream.test.ts ✅ Passed 128ms
tests/files-content-binary.test.ts ✅ Passed 285ms
tests/files-create-multipart.test.ts ✅ Passed 245ms
tests/files-list-pagination.test.ts ✅ Passed 180ms
tests/initialize-config.test.ts ✅ Passed 140ms
tests/instance-isolation.test.ts ✅ Passed 233ms
tests/models-list.test.ts ✅ Passed 175ms
tests/responses-background-lifecycle.test.ts ✅ Passed 223ms
tests/responses-body-method-errors.test.ts ✅ Passed 393ms
tests/responses-cancel-timeout.test.ts ✅ Passed 219ms
tests/responses-cancel.test.ts ✅ Passed 206ms
tests/responses-compact-retries.test.ts ✅ Passed 237ms
tests/responses-compact.test.ts ✅ Passed 211ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 132ms
tests/responses-create-advanced.test.ts ✅ Passed 188ms
tests/responses-create-disconnect.test.ts ✅ Passed 148ms
tests/responses-create-errors.test.ts ✅ Passed 276ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 151ms
tests/responses-create-retries.test.ts ✅ Passed 317ms
tests/responses-create-stream-failures.test.ts ✅ Passed 141ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 212ms
tests/responses-create-stream-wire.test.ts ✅ Passed 1.945s
tests/responses-create-stream.test.ts ✅ Passed 132ms
tests/responses-create-terminal-states.test.ts ✅ Passed 258ms
tests/responses-create-timeout.test.ts ✅ Passed 222ms
tests/responses-create.test.ts ✅ Passed 305ms
tests/responses-delete.test.ts ✅ Passed 278ms
tests/responses-input-items-errors.test.ts ✅ Passed 195ms
tests/responses-input-items-list.test.ts ✅ Passed 208ms
tests/responses-input-items-options.test.ts ✅ Passed 216ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 328ms
tests/responses-input-tokens-count.test.ts ✅ Passed 245ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.091s
tests/responses-not-found-errors.test.ts ✅ Passed 300ms
tests/responses-parse.test.ts ✅ Passed 196ms
tests/responses-retrieve-retries.test.ts ✅ Passed 322ms
tests/responses-retrieve.test.ts ✅ Passed 232ms
tests/responses-stored-method-errors.test.ts ✅ Passed 660ms
tests/retry-behavior.test.ts ✅ Passed 1.875s
tests/sdk-error-shape.test.ts ✅ Passed 373ms

View OkTest run #31432280139

SDK merge (12016b4b9d39) · head (56fa2f2617e6) · base (20fbb0942991) · OkTest (91635c6a2723)

@jbeckwith-oai jbeckwith-oai added the generator Touches generated SDK files label Aug 10, 2026
Comment thread lib/openai/internal/transport/base_client.rb Outdated
Comment thread AGENTS.md Outdated
@jbeckwith-oai
jbeckwith-oai added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit c15fb7b Aug 10, 2026
14 checks passed
@jbeckwith-oai
jbeckwith-oai deleted the codex/expose-request-id branch August 10, 2026 21:11
@openai-sdks openai-sdks Bot mentioned this pull request Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

generator Touches generated SDK files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants