Skip to content

feat(api): Add project residency and usage quantity_unit fields - #2461

Merged
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-76
Aug 25, 2026
Merged

apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-76

Conversation

@apcha-oai

@apcha-oai apcha-oai commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add optional typed residency support to project models and project creation, while retaining the existing optional nullable geography inputs for both creation and update. Geography is deprecated, with its original descriptions preserved and migration guidance appended. Add optional quantity_unit fields to organization usage cost results, including known units and unknown string values.

Changes

  • Add the residency configuration enum to Project and ProjectCreateParams; residency remains a create-time input, not a new update parameter.
  • Preserve geography?: string | null on ProjectCreateParams and ProjectUpdateParams, marked deprecated. Existing callers can continue using geography; creation must not supply both geography and residency.
  • Add optional quantity_unit fields to cost results carried by the usage response types.

Project responses and project-creation inputs now reuse a shared residency model. Usage cost responses reuse a shared quantity-unit model, with unknown unit values and optional/null fields preserved.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

32 mixed files remain; 0 existing customizations changed; 1 generated baselines changed.

Compared 39c06d100d98 → 344f228cfeff. Generated baselines verified.

File Result Current custom patch
api.md Generated baseline changed +16 / −0
31 existing customizations unchanged
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • src/client.ts
  • src/resources/audio/transcriptions.ts
  • src/resources/audio/translations.ts
  • src/resources/beta/assistants.ts
  • src/resources/beta/beta.ts
  • src/resources/beta/index.ts
  • src/resources/beta/responses/internal-base.ts
  • src/resources/beta/responses/responses.ts
  • src/resources/beta/threads/index.ts
  • src/resources/beta/threads/runs/index.ts
  • src/resources/beta/threads/runs/runs.ts
  • src/resources/beta/threads/threads.ts
  • src/resources/chat/completions/completions.ts
  • src/resources/chat/completions/index.ts
  • src/resources/conversations/index.ts
  • src/resources/embeddings.ts
  • src/resources/files.ts
  • src/resources/fine-tuning/checkpoints/permissions.ts
  • src/resources/images.ts
  • src/resources/responses/internal-base.ts
  • src/resources/responses/responses.ts
  • src/resources/skills/skills.ts
  • src/resources/skills/versions/versions.ts
  • src/resources/vector-stores/file-batches.ts
  • src/resources/vector-stores/files.ts
  • src/resources/webhooks/index.ts
  • src/resources/webhooks/webhooks.ts
  • tests/lib/data-residency.test.ts

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 32799511169 --repo openai/openai-node \
  --name castiron-custom-code-32799511169-1 --dir /tmp/castiron-custom-code-32799511169-1
git apply --stat /tmp/castiron-custom-code-32799511169-1/custom-code.patch
cat /tmp/castiron-custom-code-32799511169-1/custom-code.patch

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

git fetch --no-tags origin 39c06d100d98a0afd1731b49d5a10aaf45a569bb 344f228cfeffdb703927eb9983165a464f401b32
python3 scripts/castiron/custom_code_report.py report \
  --base 39c06d100d98a0afd1731b49d5a10aaf45a569bb \
  --head 344f228cfeffdb703927eb9983165a464f401b32 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-344f228cfeff
cat /tmp/castiron-custom-code-344f228cfeff/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

@apcha-oai
apcha-oai marked this pull request as ready for review August 24, 2026 16:55
@apcha-oai
apcha-oai requested a review from a team as a code owner August 24, 2026 16:55
@apcha-oai
apcha-oai enabled auto-merge August 24, 2026 16:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 24, 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-08-25T01:58:32.921973Z 344f228 Draft marked ready
🔒 Security Review ✅ Completed 2026-08-25T01:58:13.940257Z 344f228 Draft marked ready
ℹ️ 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 Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

OkTest Summary

✅ 237/237 SDK tests passed in 10.079s for Node SDK PR #2461.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 154ms
tests/chat-completions-create.test.ts ✅ Passed 245ms
tests/chat-completions-stream.test.ts ✅ Passed 148ms
tests/files-content-binary.test.ts ✅ Passed 135ms
tests/files-create-multipart.test.ts ✅ Passed 149ms
tests/files-list-pagination.test.ts ✅ Passed 152ms
tests/initialize-config.test.ts ✅ Passed 175ms
tests/instance-isolation.test.ts ✅ Passed 96ms
tests/models-list.test.ts ✅ Passed 147ms
tests/responses-background-lifecycle.test.ts ✅ Passed 188ms
tests/responses-body-method-errors.test.ts ✅ Passed 309ms
tests/responses-cancel-timeout.test.ts ✅ Passed 188ms
tests/responses-cancel.test.ts ✅ Passed 237ms
tests/responses-compact-retries.test.ts ✅ Passed 218ms
tests/responses-compact.test.ts ✅ Passed 241ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 113ms
tests/responses-create-advanced.test.ts ✅ Passed 220ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.098s
tests/responses-create-errors.test.ts ✅ Passed 192ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 121ms
tests/responses-create-retries.test.ts ✅ Passed 205ms
tests/responses-create-stream-failures.test.ts ✅ Passed 208ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.176s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.393s
tests/responses-create-stream.test.ts ✅ Passed 68ms
tests/responses-create-terminal-states.test.ts ✅ Passed 215ms
tests/responses-create-timeout.test.ts ✅ Passed 196ms
tests/responses-create.test.ts ✅ Passed 218ms
tests/responses-delete.test.ts ✅ Passed 199ms
tests/responses-input-items-errors.test.ts ✅ Passed 165ms
tests/responses-input-items-list.test.ts ✅ Passed 181ms
tests/responses-input-items-options.test.ts ✅ Passed 116ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 230ms
tests/responses-input-tokens-count.test.ts ✅ Passed 311ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.109s
tests/responses-not-found-errors.test.ts ✅ Passed 239ms
tests/responses-parse.test.ts ✅ Passed 176ms
tests/responses-retrieve-retries.test.ts ✅ Passed 305ms
tests/responses-retrieve.test.ts ✅ Passed 205ms
tests/responses-stored-method-errors.test.ts ✅ Passed 529ms
tests/retry-behavior.test.ts ✅ Passed 3.046s
tests/sdk-error-shape.test.ts ✅ Passed 256ms

View OkTest run #32799486794

SDK merge (5efd32567833) · head (344f228cfeff) · base (39c06d100d98) · OkTest (2b1bdfd25e98)

@apcha-oai
apcha-oai disabled auto-merge August 24, 2026 17:29
@apcha-oai
apcha-oai marked this pull request as draft August 24, 2026 17:29
Castiron-Internal-PR: openai/openai-node-internal#76
Castiron-Source-SHA: 982400f64bce211b45d7c768f3a3329fa1101581
Castiron-Public-Base-SHA: 39c06d1
@apcha-oai
apcha-oai force-pushed the castiron/promotions/pr-76 branch from 766b4ee to 344f228 Compare August 25, 2026 01:48
@apcha-oai
apcha-oai marked this pull request as ready for review August 25, 2026 01:56

@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: 344f228cfe

ℹ️ 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 on lines +42500 to +42503
residency:
anyOf:
- $ref: '#/components/schemas/PublicProjectResidency'
- type: 'null'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Encode the residency fields as mutually exclusive

When callers provide both optional fields, the generated schema and ProjectCreateParams accept the request—and the new optional-parameters test sends exactly that combination—even though the adjacent contract explicitly says not to provide both geography and residency. An endpoint enforcing that contract will reject this otherwise well-typed request, while the schema-backed mock accepts it, so the test does not establish that residency creation succeeds. Express the exclusion in the owning source schema/generator so it produces a mutually exclusive request type and valid fixture.

AGENTS.md reference: AGENTS.md:L14-L17

Useful? React with 👍 / 👎.

@apcha-oai
apcha-oai enabled auto-merge August 25, 2026 02: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.

Requesting changes for the existing P2 finding in #2461 (comment): the transformed contract and generated test permit simultaneous geography and residency despite explicitly forbidding that combination, allowing mocks to accept requests the API rejects. Encode mutual exclusion upstream and generate separate valid legacy/new-residency fixtures.

@apcha-oai
apcha-oai disabled auto-merge August 25, 2026 02:11

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

LGTM.

@apcha-oai
apcha-oai added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 26d8158 Aug 25, 2026
62 checks passed
@apcha-oai
apcha-oai deleted the castiron/promotions/pr-76 branch August 25, 2026 16:57
@openai-sdks openai-sdks Bot mentioned this pull request Aug 25, 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.

2 participants