Skip to content

fix(security): bound SDK event streams and validate streamed item identities - #2415

Open
HAYDEN-OAI wants to merge 23 commits into
mainfrom
agent/security-batch5-stream-hardening-01a01726
Open

fix(security): bound SDK event streams and validate streamed item identities#2415
HAYDEN-OAI wants to merge 23 commits into
mainfrom
agent/security-batch5-stream-hardening-01a01726

Conversation

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor

Security findings

  • csf_f748424407d7f9a4c8cd94f9: cap detached chat, assistant, and Responses iterators at 4,096 events / 8 MiB, including nested objects, collections, shared buffers, and hidden error data; fail closed and abort the transport.
  • csf_184ca4005f95edde69d61854: reject unknown, mismatched, duplicate, out-of-order, and post-terminal assistant message IDs before mutation or emission.
  • csf_f90473f146356354c5bfe391: replace quadratic structured-output/tool prefix reparsing with adaptive coalescing and enforce aggregate UTF-8 byte, fragment, nesting-depth, and parse-work budgets.
  • csf_dd139bc420237c584e757348: require matching own item_id and event-family item types across all 42 item-scoped Responses events; validate created, added, completed, duplicate, and lifecycle item identities.

Compatibility and scope

  • Preserve raw snapshots, final parsed output, linear private ResponseStream accumulation, public snapshot mutation, and schema-valid function/custom tool items whose platform ID is optional by checking their stable call_id.
  • Correct synthetic test fixtures that previously omitted schema-required IDs or performed impossible cross-type completion replacements.
  • Keep generated files, vendored parsers, Zod helpers, core SSE decoders, and upstream-owned changes untouched.
  • Assistant history retention (csf_8c5b2acede7459533e2038cc) was already fixed by merged fix(security): stop retaining sensitive assistant stream events #2407 and is intentionally excluded.

Verification

  • 602 focused tests passing across 14 stream, assistant, accumulator, parser, performance, privacy, and merged upstream SSE suites.
  • ./node_modules/.bin/tsc --noEmit
  • ./scripts/lint
  • git diff --check origin/main...HEAD
  • Added failing-before/passing-after regressions for queue overflow, hidden retained bytes, delayed tool identity, empty fragments, parser starvation, nesting, all item-scoped event families, duplicate IDs, optional tool IDs, public snapshot mutations, and clone-failure recovery.

@HAYDEN-OAI
HAYDEN-OAI requested a review from a team as a code owner August 18, 2026 23:44
@openai-sdks

openai-sdks Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 9.823s for Node SDK PR #2415.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 135ms
tests/chat-completions-create.test.ts ✅ Passed 184ms
tests/chat-completions-stream.test.ts ✅ Passed 174ms
tests/files-content-binary.test.ts ✅ Passed 177ms
tests/files-create-multipart.test.ts ✅ Passed 131ms
tests/files-list-pagination.test.ts ✅ Passed 133ms
tests/initialize-config.test.ts ✅ Passed 180ms
tests/instance-isolation.test.ts ✅ Passed 104ms
tests/models-list.test.ts ✅ Passed 117ms
tests/responses-background-lifecycle.test.ts ✅ Passed 196ms
tests/responses-body-method-errors.test.ts ✅ Passed 291ms
tests/responses-cancel-timeout.test.ts ✅ Passed 185ms
tests/responses-cancel.test.ts ✅ Passed 208ms
tests/responses-compact-retries.test.ts ✅ Passed 234ms
tests/responses-compact.test.ts ✅ Passed 179ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 122ms
tests/responses-create-advanced.test.ts ✅ Passed 160ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.209s
tests/responses-create-errors.test.ts ✅ Passed 226ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 137ms
tests/responses-create-retries.test.ts ✅ Passed 269ms
tests/responses-create-stream-failures.test.ts ✅ Passed 190ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.149s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.382s
tests/responses-create-stream.test.ts ✅ Passed 72ms
tests/responses-create-terminal-states.test.ts ✅ Passed 199ms
tests/responses-create-timeout.test.ts ✅ Passed 260ms
tests/responses-create.test.ts ✅ Passed 139ms
tests/responses-delete.test.ts ✅ Passed 209ms
tests/responses-input-items-errors.test.ts ✅ Passed 209ms
tests/responses-input-items-list.test.ts ✅ Passed 168ms
tests/responses-input-items-options.test.ts ✅ Passed 99ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 231ms
tests/responses-input-tokens-count.test.ts ✅ Passed 215ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.031s
tests/responses-not-found-errors.test.ts ✅ Passed 214ms
tests/responses-parse.test.ts ✅ Passed 181ms
tests/responses-retrieve-retries.test.ts ✅ Passed 258ms
tests/responses-retrieve.test.ts ✅ Passed 189ms
tests/responses-stored-method-errors.test.ts ✅ Passed 513ms
tests/retry-behavior.test.ts ✅ Passed 2.904s
tests/sdk-error-shape.test.ts ✅ Passed 290ms

View OkTest run #32319309812

SDK merge (6618dc6fbd35) · head (a5a1cf194af1) · base (a0d68cc53125) · OkTest (2b1bdfd25e98)

@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: 2f220cce2b

ℹ️ 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 src/internal/responses/response-accumulator.ts Outdated
Comment thread src/lib/AssistantStream.ts Outdated
Comment thread src/lib/EventStream.ts Outdated
Comment thread src/lib/AssistantStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated

@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: 8283fd463c

ℹ️ 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 src/lib/EventStream.ts Outdated
Comment thread src/internal/responses/response-accumulator.ts Outdated
Comment thread src/internal/responses/response-accumulator.ts
Comment thread src/lib/EventStream.ts Outdated

@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: d0ed2b4614

ℹ️ 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 src/lib/EventStream.ts Outdated
Comment thread src/internal/responses/response-accumulator.ts Outdated
Comment thread src/lib/EventStream.ts Outdated

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

Independent two-pass review confirms the existing cross-realm Map accounting and inherited routing-getter discussions are actionable; please resolve those existing threads. Both are reachable through programmatic/custom event inputs rather than normal JSON-decoded provider events, so Medium severity is better calibrated than P1.

The third existing claim that iterator overflow skips later listeners is not reproducible: executing the exact implementation confirms later listeners still run because dispatch uses an earlier listener-array snapshot while cleanup mutates the replacement registry. Please avoid changing correct dispatch behavior based solely on that false positive.

@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: 4f2c2f95d8

ℹ️ 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 src/lib/ChatCompletionStream.ts
Comment thread src/lib/EventStream.ts Outdated

@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: 5498320c05

ℹ️ 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 src/internal/responses/response-accumulator.ts
Comment thread src/lib/EventStream.ts
Comment thread src/lib/EventStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts
Comment thread src/lib/EventStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/EventStream.ts

@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

for (const { index, id, type, function: fn, custom, ...rest } of tool_calls) {
if (!Number.isSafeInteger(index) || index < 0 || index >= MAX_STREAM_TOOL_CALLS) {
throw new OpenAIError(`Chat completion stream contains an invalid tool call index: ${index}`);

P2 Badge Allow valid tool-call indices beyond the choice limit

When a streamed completion contains 129 or more parallel tool calls, the call at index 128 is rejected even though the generated Chat Completions schema places no 128-item bound on delta.tool_calls or the finalized tool-call array. The comment derives this ceiling from the unrelated n limit, so the streaming helper now rejects a schema-valid response that the non-streaming path accepts; prevent sparse allocation with a contiguity or memory check rather than imposing an undocumented tool-count capability limit.

AGENTS.md reference: AGENTS.md:L46-L48

ℹ️ 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 src/lib/EventStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated

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

Two independently validated, existing unresolved threads still need fixes: [P1] accessor-backed buffered event objects evade retained-size accounting and can retain unbounded closure data: #2415 (comment) ; [P2] an unrelated strict tool incorrectly applies structured parsing limits to identifiable non-strict tool arguments: #2415 (comment) . Prior cross-realm collection and inherited-routing issues are fixed. Avoiding duplicate inline comments.

@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: 266cd10056

ℹ️ 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 src/lib/EventStream.ts Outdated
Comment thread src/lib/EventStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated

@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: 4903a36b96

ℹ️ 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 src/lib/EventStream.ts Outdated
Comment thread src/lib/AssistantStream.ts
Comment thread src/lib/EventStream.ts Outdated
Comment thread src/internal/responses/response-accumulator.ts

@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: 1ad4b0529c

ℹ️ 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 src/lib/EventStream.ts
Comment thread src/lib/ChatCompletionStream.ts Outdated
Comment thread src/internal/responses/response-accumulator.ts

@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: be87d1f170

ℹ️ 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 src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/AssistantStream.ts Outdated
Comment thread src/internal/responses/response-accumulator.ts
Comment thread src/lib/EventStream.ts
Comment thread src/lib/EventStream.ts
Comment thread src/lib/ChatCompletionStream.ts
Comment thread src/lib/ChatCompletionStream.ts Outdated

@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: 2c99abcd72

ℹ️ 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 src/lib/EventStream.ts Outdated
Comment thread src/lib/AssistantStream.ts
Comment thread src/lib/ChatCompletionStream.ts

@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: 6bafad1baa

ℹ️ 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 src/lib/EventStream.ts
Comment thread src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts

@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: acd97e7d3f

ℹ️ 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 src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/EventStream.ts Outdated

@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: de9c49c9c4

ℹ️ 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 src/lib/EventStream.ts

@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: 39697164fc

ℹ️ 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 src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts

@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: 06d4b1c205

ℹ️ 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 src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/EventStream.ts
Comment thread src/lib/ChatCompletionStream.ts Outdated

@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

const requestedChoiceCount = this.#params?.n;

P2 Badge Validate choices against the serialized n value

When an enumerable request-level toJSON() changes n—for example, the caller object contains n: 1 but serializes with n: 2—the server legitimately returns choice index 1, while this limit is still derived from the pre-serialization parser snapshot and rejects that choice. The serialization observer only updates tools and response_format (and is not installed at all when both are absent), so the value enforced here can differ from the actual request body. Capture the serialized n from the same encoding pass or retain the schema-wide ceiling instead of narrowing with an undispatched value.

AGENTS.md reference: AGENTS.md:L86-L90

ℹ️ 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 src/lib/ChatCompletionStream.ts
Comment thread src/lib/EventStream.ts Outdated
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

34 mixed files remain; 0 existing customizations changed.

Compared a0d68cc53125a5a1cf194af1. Generated baselines verified.

34 existing customizations unchanged
  • api.md
  • 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/api-resources/embeddings.test.ts
  • tests/api-resources/responses/responses.test.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 32319309694 --repo openai/openai-node \
  --name castiron-custom-code-32319309694-1 --dir /tmp/castiron-custom-code-32319309694-1
git apply --stat /tmp/castiron-custom-code-32319309694-1/custom-code.patch
cat /tmp/castiron-custom-code-32319309694-1/custom-code.patch

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

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

@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

const requestedChoiceCount = this.#params?.n;
const maxChoices =
typeof requestedChoiceCount === 'number' &&
Number.isSafeInteger(requestedChoiceCount) &&
requestedChoiceCount > 0

P2 Badge Bind the choice limit to the serialized n value

When a request-level toJSON() changes n from 1 to 2, the wire request legitimately asks the server for two choices, but #params.n remains the pre-serialization value because the serializer observer captures only tools and response format. The first chunk for choice index 1 is then rejected here as invalid. Capture the serialized n alongside the other wire settings, or enforce only the schema-wide 128-choice ceiling when the dispatched value is unavailable.

AGENTS.md reference: AGENTS.md:L86-L90

ℹ️ 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 src/lib/ChatCompletionStream.ts
Comment thread src/lib/ChatCompletionStream.ts
Comment thread src/lib/EventStream.ts
Comment thread src/lib/ChatCompletionStream.ts

@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: b18e1a6cee

ℹ️ 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 src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/EventStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts

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

Independent two-pass review confirms the new existing Medium finding in discussion #3817576174: AssistantStream repeatedly queues events referencing the same accumulated message, but each event uses a fresh WeakSet for retained-byte estimation. The shared message graph is repeatedly charged, so ordinary streams can exceed the 8 MiB cap and abort despite retaining far less memory. Track shared reachability across the entire iterator queue. Other newly opened related threads also warrant review. The Castiron reporter check failure is separately an inherited stale-base infrastructure issue; no duplicate inline comment added.

@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: 836c27c547

ℹ️ 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 src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/EventStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts Outdated
Comment thread src/lib/ChatCompletionStream.ts

@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: dd41cae973

ℹ️ 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 src/internal/responses/response-accumulator.ts
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