feat(api): expose image tool call metadata - #907
Conversation
Castiron-Internal-PR: openai/openai-go-internal#85 Castiron-Source-SHA: 8b48f7b78cde1185ead61ad6574f9726a297a21e Castiron-Public-Base-SHA: 0028f60
Castiron custom code✅ No new custom-code files detected. 16 mixed files remain; 0 existing customizations changed; 9 generated baselines changed. Compared
7 existing customizations unchanged
A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload 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.patchOr 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.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| // The action used for image generation. | ||
| // | ||
| // Any of "generate", "edit", "auto". | ||
| Action string `json:"action,omitzero"` |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
| // 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"` |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
| // 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"` |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
Summary
Add image tool call metadata fields and service-account API-key expiry support.
Changes
Known limitation
The new
action,background, andoutput_formatimage-call input fields currently support omission and string values, but do not yet expose typed explicit JSONnull. Stable and beta inputs, including conversation items, need this nullable representation before this change is ready. Existingqualityand custom-size behavior are preserved.