Skip to content

feat(api): expose image tool call metadata - #907

Open
markstuart-oai wants to merge 1 commit into
mainfrom
castiron/promotions/pr-85
Open

feat(api): expose image tool call metadata#907
markstuart-oai wants to merge 1 commit into
mainfrom
castiron/promotions/pr-85

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Add image tool call metadata fields and service-account API-key expiry support.

Changes

  • Expose action, background, output format, and revised prompt on image tool calls.
  • Preserve existing quality, custom dimensions, and legacy image-call input types.
  • Add optional service-account API-key expiry controls and expiry timestamps.
  • Refresh API documentation links.

Known limitation

The new action, background, and output_format image-call input fields currently support omission and string values, but do not yet expose typed explicit JSON null. Stable and beta inputs, including conversation items, need this nullable representation before this change is ready. Existing quality and custom-size behavior are preserved.

Castiron-Internal-PR: openai/openai-go-internal#85
Castiron-Source-SHA: 8b48f7b78cde1185ead61ad6574f9726a297a21e
Castiron-Public-Base-SHA: 0028f60
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

16 mixed files remain; 0 existing customizations changed; 9 generated baselines changed.

Compared 0028f604484592cfe79d1d65. Generated baselines verified.

File Result Current custom patch
betaresponse.go Generated baseline changed +10 / −0
betathreadmessage.go Generated baseline changed +5 / −5
chatcompletion.go Generated baseline changed +13 / −0
finetuningcheckpointpermission.go Generated baseline changed +4 / −4
responses/response.go Generated baseline changed +48 / −64
shared/shared.go Generated baseline changed +1 / −1
vectorstorefile.go Generated baseline changed +24 / −0
vectorstorefilebatch.go Generated baseline changed +18 / −0
webhooks/webhook.go Generated baseline changed +39 / −7
7 existing customizations unchanged
  • api.md
  • client.go
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • vectorstorefile_test.go
  • video.go

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

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

git fetch --no-tags origin 0028f6044845e792e9e011e44f15ef7401a3057e 92cfe79d1d6519766fb453f43f4ada8df810f94c
python3 scripts/castiron/custom_code_report.py report \
  --base 0028f6044845e792e9e011e44f15ef7401a3057e \
  --head 92cfe79d1d6519766fb453f43f4ada8df810f94c --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-92cfe79d1d65
cat /tmp/castiron-custom-code-92cfe79d1d65/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 9, 2026 06:04
@markstuart-oai
markstuart-oai requested a review from a team as a code owner September 9, 2026 06:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 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-09-09T06:13:53.722878Z 92cfe79 Draft marked ready
🔒 Security Review Completed 2026-09-09T06:09:30.287161Z 92cfe79 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 Sep 9, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

236/236 SDK tests passed in 10.718s for Go SDK PR #907.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 198ms
tests/chat-completions-create.test.ts ✅ Passed 257ms
tests/chat-completions-stream.test.ts ✅ Passed 247ms
tests/files-content-binary.test.ts ✅ Passed 229ms
tests/files-create-multipart.test.ts ✅ Passed 333ms
tests/files-list-pagination.test.ts ✅ Passed 255ms
tests/initialize-config.test.ts ✅ Passed 272ms
tests/instance-isolation.test.ts ✅ Passed 260ms
tests/models-list.test.ts ✅ Passed 351ms
tests/responses-background-lifecycle.test.ts ✅ Passed 265ms
tests/responses-body-method-errors.test.ts ✅ Passed 297ms
tests/responses-cancel-timeout.test.ts ✅ Passed 198ms
tests/responses-cancel.test.ts ✅ Passed 202ms
tests/responses-compact-retries.test.ts ✅ Passed 348ms
tests/responses-compact.test.ts ✅ Passed 310ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 147ms
tests/responses-create-advanced.test.ts ✅ Passed 176ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.187s
tests/responses-create-errors.test.ts ✅ Passed 211ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 201ms
tests/responses-create-retries.test.ts ✅ Passed 397ms
tests/responses-create-stream-failures.test.ts ✅ Passed 179ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 265ms
tests/responses-create-stream-wire.test.ts ✅ Passed 2.601s
tests/responses-create-stream.test.ts ✅ Passed 102ms
tests/responses-create-terminal-states.test.ts ✅ Passed 248ms
tests/responses-create-timeout.test.ts ✅ Passed 207ms
tests/responses-create.test.ts ✅ Passed 398ms
tests/responses-delete.test.ts ✅ Passed 344ms
tests/responses-input-items-errors.test.ts ✅ Passed 222ms
tests/responses-input-items-list.test.ts ✅ Passed 260ms
tests/responses-input-items-options.test.ts ✅ Passed 270ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 227ms
tests/responses-input-tokens-count.test.ts ✅ Passed 331ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.184s
tests/responses-not-found-errors.test.ts ✅ Passed 236ms
tests/responses-parse.test.ts ✅ Passed 233ms
tests/responses-retrieve-retries.test.ts ✅ Passed 340ms
tests/responses-retrieve.test.ts ✅ Passed 232ms
tests/responses-stored-method-errors.test.ts ✅ Passed 580ms
tests/retry-behavior.test.ts ✅ Passed 3.243s
tests/sdk-error-shape.test.ts ✅ Passed 272ms

View OkTest run #34317484279

SDK merge (c931952f14e6) · head (92cfe79d1d65) · base (0028f6044845) · OkTest (08ec4299e769)

@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: 92cfe79d1d

ℹ️ 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 responses/response.go
// The action used for image generation.
//
// Any of "generate", "edit", "auto".
Action string `json:"action,omitzero"`

@chatgpt-codex-connector chatgpt-codex-connector Bot Sep 9, 2026

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 Preserve nulls in image-call metadata inputs

When a caller constructs an image-generation-call input with an explicitly null action, this typed field cannot preserve the schema-valid wire value: omitzero turns "" into omission, and param.Null[string]() is not assignable without bypassing the typed surface. background and output_format have the same representation in this struct and its beta counterpart, while adjacent revised_prompt correctly uses param.Opt[string]. Generate nullable option fields for all three so these inputs do not collapse null into absent.

AGENTS.md reference: AGENTS.md:L68-L73

Useful? React with 👍 / 👎.

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.

Confirmed. The current public head still loses typed explicit null for these fields. The generator fix preserves omission, null, and value for action, background, and output_format, with HTTP serialization coverage. This PR must be refreshed after that generator change lands; leaving this thread unresolved until the corrected output is published here.

Comment thread betaresponse.go
// This field will be present if the value is a [string] instead of an object.
OfBetaResponseInputItemMultiAgentCallOutputAction string `json:",inline"`
// This field will be present if the value is a [string] instead of an object.
OfBetaResponseInputItemImageGenerationCallAction string `json:",inline"`

@chatgpt-codex-connector chatgpt-codex-connector Bot Sep 9, 2026

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 Avoid duplicate string arms in beta action unions

Whenever a beta item has a scalar action, including an existing multi_agent_call_output or a new image_generation_call, this inline string decoder succeeds alongside the pre-existing inline string arm because apijson tries every inline decoder independently. Both variant-specific Action.JSON fields are consequently marked valid, so code using the documented valid arm to identify the action sees the item as both variants; the same regression occurs in BetaResponseItemUnionAction and BetaResponseOutputItemUnionAction. Coalesce identical scalar arms or decode them using the parent discriminator, then regenerate all three unions.

AGENTS.md reference: AGENTS.md:L68-L73

Useful? React with 👍 / 👎.

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.

Confirmed. The generator fix coalesces equivalent string arms in all three beta action unions, retaining the existing scalar carrier and its metadata. Focused regression coverage checks that one scalar does not mark duplicate arms valid. The current public head still contains the old output, so this thread stays unresolved until the generator change lands and this PR is refreshed.

Comment thread responses/response.go
// will be valid: OfResponseInputItemImageGenerationCallAction]
type ResponseInputItemUnionAction struct {
// This field will be present if the value is a [string] instead of an object.
OfResponseInputItemImageGenerationCallAction string `json:",inline"`

@chatgpt-codex-connector chatgpt-codex-connector Bot Sep 9, 2026

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 Keep unsupported action scalars marked invalid

When a custom endpoint or malformed response supplies a numeric, boolean, or array action, adding this inline string arm disables the subunion's non-object root check. The strict string decoder fails, but the struct decoder returns success after no arm matches, causing the enclosing JSON.Action.Valid() to become true even though the value has an unexpected type; before this change the field was recorded as invalid. Return an error when no inline decoder matches and add a focused malformed-response regression test.

AGENTS.md reference: AGENTS.md:L35-L40

Useful? React with 👍 / 👎.

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.

Confirmed. The generator fix returns an error when an unsupported scalar matches no inline arm, preserving invalid enclosing field metadata and raw JSON. Regression coverage includes numeric, boolean, and array actions. The current public head still contains the old decoder, so this thread stays unresolved until the generator change lands and this PR is refreshed.

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

This public head is not ready to promote yet. It still has the documented omit/value-only representation for action, background, and output_format; explicit JSON null is unavailable until the compiler fix is merged and this PR is regenerated. It also introduces two generated action-subunion regressions: duplicate beta inline string arms independently decode the same scalar and mark multiple variant metadata fields valid, while adding a scalar inline arm lets unsupported non-object action values fail every arm without returning an error, so the enclosing JSON.Action is marked valid instead of preserving the prior invalid state. Please refresh after the compiler prerequisite and fix the union generation issues with focused duplicate-arm and malformed-value regressions.

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