Skip to content

fix(assistants): reject identity fields in run-step deltas - #2685

Closed
HAYDEN-OAI wants to merge 30 commits into
mainfrom
fix/assistant-run-step-delta-identity
Closed

HAYDEN-OAI wants to merge 30 commits into
mainfrom
fix/assistant-run-step-delta-identity

Conversation

@HAYDEN-OAI

@HAYDEN-OAI HAYDEN-OAI commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Run-step deltas reject a root id before raw-event dispatch or snapshot accumulation. Accumulation uses a private representation while valid runStepDelta callbacks retain the original delta, including its prototype, non-enumerable metadata, and frozen state. Permitted delta properties are read on their original receiver; listener-added root identity fields are excluded without invoking their getters. Envelope aliases and nested tool-call IDs retain their existing behavior.

Validation:

  • Public SSE, serialized-stream, and custom-transport regressions cover callback identity, listener mutations, and receiver-sensitive getters. Both new getter regressions fail on the preceding PR head and pass after the fix.
  • All 295 AssistantStream tests pass on Node 24.20.0; all 68 run-step identity tests pass on exact minimum Node 22.0.0.
  • Canonical lint, full TypeScript checking, and production CJS/ESM builds and import checks pass.

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

32 mixed files remain; 0 existing customizations changed.

Compared f65d190316d3 → e84fbc33b3ba. Generated baselines verified.

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

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

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

@HAYDEN-OAI
HAYDEN-OAI marked this pull request as ready for review September 7, 2026 17:59
@HAYDEN-OAI
HAYDEN-OAI requested a review from a team as a code owner September 7, 2026 17:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 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-08T06:54:35.794119Z e84fbc3 New commits
🔒 Security Review ✅ Completed 2026-09-08T06:56:01.125011Z e84fbc3 New commits
ℹ️ 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 7, 2026 •

Copy link
Copy Markdown
Contributor

OkTest Summary

✅ 236/236 SDK tests passed in 10.925s for Node SDK PR #2685.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 168ms
tests/chat-completions-create.test.ts ✅ Passed 299ms
tests/chat-completions-stream.test.ts ✅ Passed 152ms
tests/files-content-binary.test.ts ✅ Passed 209ms
tests/files-create-multipart.test.ts ✅ Passed 278ms
tests/files-list-pagination.test.ts ✅ Passed 184ms
tests/initialize-config.test.ts ✅ Passed 188ms
tests/instance-isolation.test.ts ✅ Passed 190ms
tests/models-list.test.ts ✅ Passed 244ms
tests/responses-background-lifecycle.test.ts ✅ Passed 222ms
tests/responses-body-method-errors.test.ts ✅ Passed 336ms
tests/responses-cancel-timeout.test.ts ✅ Passed 185ms
tests/responses-cancel.test.ts ✅ Passed 313ms
tests/responses-compact-retries.test.ts ✅ Passed 301ms
tests/responses-compact.test.ts ✅ Passed 206ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 130ms
tests/responses-create-advanced.test.ts ✅ Passed 247ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.061s
tests/responses-create-errors.test.ts ✅ Passed 229ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 250ms
tests/responses-create-retries.test.ts ✅ Passed 250ms
tests/responses-create-stream-failures.test.ts ✅ Passed 237ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.171s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.558s
tests/responses-create-stream.test.ts ✅ Passed 94ms
tests/responses-create-terminal-states.test.ts ✅ Passed 227ms
tests/responses-create-timeout.test.ts ✅ Passed 201ms
tests/responses-create.test.ts ✅ Passed 314ms
tests/responses-delete.test.ts ✅ Passed 210ms
tests/responses-input-items-errors.test.ts ✅ Passed 178ms
tests/responses-input-items-list.test.ts ✅ Passed 194ms
tests/responses-input-items-options.test.ts ✅ Passed 183ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 218ms
tests/responses-input-tokens-count.test.ts ✅ Passed 243ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.201s
tests/responses-not-found-errors.test.ts ✅ Passed 262ms
tests/responses-parse.test.ts ✅ Passed 210ms
tests/responses-retrieve-retries.test.ts ✅ Passed 246ms
tests/responses-retrieve.test.ts ✅ Passed 235ms
tests/responses-stored-method-errors.test.ts ✅ Passed 555ms
tests/retry-behavior.test.ts ✅ Passed 3.165s
tests/sdk-error-shape.test.ts ✅ Passed 295ms

View OkTest run #34196248942

SDK merge (90846414ace3) · head (e84fbc33b3ba) · base (f65d190316d3) · 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: 827ec98ee6

ℹ️ 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/AssistantStream.ts Resolved

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

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

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

ℹ️ 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/AssistantStream.ts Resolved
@HAYDEN-OAI HAYDEN-OAI added the codex-security Result of a Codex Security scan label Sep 7, 2026

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

Reviewed both changed files and the surrounding event, accumulation, alias, and callback contracts at 594c83e against merge-base fe3770f (PR base c581c17). The malformed-root-ID fix works in independent public-entrypoint probes, but two P2 compatibility regressions need correction: the previously acknowledged callback-identity issue remains, and descriptor reconstruction changes getter receivers.

Validation: all 289 AssistantStream tests and canonical lint passed on Node 24.20.0; all 62 identity tests passed on Node 22.0.0. Independent base/head probes reproduced both findings, with the getter-receiver probe also repeated on Node 22.0.0. Full TypeScript checking stopped on missing example dependencies (dotenv/config, @azure/identity, express); production build/import checks were not rerun. Existing dependencies were reused locally.

Structural assessment: keep private accumulation data separate from the public delta, and remove the temporary descriptor-reconstructed object used only to spread its values. That extra representation directly causes the getter regression. AssistantStream.ts grows 1025→1085 lines; the test file grows 647→945, so neither newly crosses 1,000 lines.

Comment thread src/lib/AssistantStream.ts Resolved
Comment thread src/lib/AssistantStream.ts Resolved

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

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

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

Re-reviewed df518eb, including both current changed files, the delta since my review 5134685288, and the author responses (3952079544, 3952080407, and re-review request 3952085655).

The ordinary public delta identity/prototype/non-enumerable/frozen-state finding is fixed: my original SSE, serialized-stream, and custom-transport probes now preserve those contracts. The getter-receiver finding remains reproducible. Independent base/head probes also confirm the two new bot findings about explicit delta replacements. Inline comments below identify the remaining fixes and the test-file decomposition required by this review's maintainability bar.

Validation: 293 AssistantStream tests and canonical lint passed on Node 24.20.0; 66 identity tests passed on exact Node 22.0.0. Malformed root IDs remain rejected before raw dispatch in the independent probes. Used existing local dependencies. Full typechecking and production build/import checks were not rerun; the prior typecheck encountered missing example dependencies.

Reviewed in a fresh isolated worktree from fetched main c11870e, preserving PR base c581c17 and merge-base fe3770f. Final state and fully paginated reviews were rechecked before submission.

Comment thread src/lib/AssistantStream.ts Resolved
Comment thread src/lib/AssistantStream.ts Resolved
Comment thread src/lib/AssistantStream.ts Resolved

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

Re-reviewed 57dd5c7 after review 5134731352 and author responses 3952125339/3952125793, covering both current changed files, the new commit, prior discussion, and the surrounding accumulation/callback contracts.

The getter-receiver finding is now fixed: the independent reproduction succeeds on Node 24.20.0 and 22.0.0. The direct projection removes the unnecessary reconstructed object and preserves the original receiver. Ordinary public delta identity, prototype, non-enumerable metadata, and frozen-state probes still pass; malformed root IDs remain rejected before raw dispatch. The two listener-replacement findings and the test-file decomposition finding remain, as detailed inline.

Validation: 295 AssistantStream tests and canonical lint passed on Node 24.20.0; 68 identity tests passed on exact Node 22.0.0. Re-ran all prior independent contract probes on this head, with the merge-base behavior already established. Existing local dependencies were reused. Full typechecking and production build/import checks were not rerun; the earlier full typecheck encountered missing example dependencies.

Fresh isolated worktree from fetched main c11870e; actual PR base c581c17; merge-base fe3770f. Final open/non-draft/head state and fully paginated review history were rechecked.

Comment thread src/lib/AssistantStream.ts Resolved
Comment thread src/lib/AssistantStream.ts Resolved

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

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

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

Re-reviewed ffab3c1 after review 5134746986, covering all four changed files, the full PR diff, the previous-head delta, shared-fixture callers, and the new author responses.

All three R3 findings are fixed: tool-callback replacements and explicit accessor-to-value replacements now behave like the merge-base in my independent probes; the suite is decomposed into 465-line delta and 626-line identity suites with shared fixtures. Earlier ordinary identity/prototype/metadata/frozen-state and getter-receiver fixes remain intact. The shared delta reader now serves both accumulation refresh and later public callback selection, and fixture reuse removes duplicated setup.

Two additional P2 cases remain. I independently reproduced the current bot findings (3952184716/3952184724), which the author acknowledged in 3952193257/3952193105: a nonenumerable root ID revealed during proxy enumeration reaches raw dispatch, and inherited/nonenumerable step_details no longer triggers tool callbacks. Details and remedies are inline.

Validation: 304 AssistantStream tests and canonical lint passed on Node 24.20.0; 77 focused delta/identity tests passed on exact Node 22.0.0. All prior probes were rerun; both additional cases were checked against the merge-base and repeated on Node 22.0.0. Canonical production CJS/ESM build and import checks passed. Full TypeScript checking reports missing example dependencies (dotenv/config, @azure/identity, express); existing local dependencies were reused.

Fresh isolated worktree from fetched main c11870e; PR base c581c17; merge-base fe3770f. Final state/head and all 33 reviews were rechecked before submission.

Comment thread src/lib/AssistantStream.ts Resolved
Comment thread src/lib/AssistantStream.ts Resolved

@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: 7016e03056

ℹ️ 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/AssistantStream.ts Resolved

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

ℹ️ 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/AssistantStream.ts Resolved

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

Re-reviewed all four changed files and the full PR diff at 8359712, including the changes since review 5134821060 and the new author responses. No remaining substantive findings.

Both R4 findings are fixed in independent probes: inherited/nonenumerable step_details reaches tool callbacks without changing own-enumerable accumulation, and proxy-revealed nonenumerable root IDs are rejected before raw dispatch. Earlier identity/prototype/metadata/frozen-state, getter-receiver, and listener-replacement probes still pass. I also independently verified that inner delta-property getters now run after raw listeners, fixing the intermediate-head regression.

The implementation separates accumulation from tool/public property lookup, shares descriptor-aware delta selection across callback phases, and retains focused suites with shared fixtures (617/626 lines). The per-event descriptor state serves the explicit-replacement contract; I found no further material simplification or new file-size crossing to require here.

Validation: 313 AssistantStream tests, canonical lint, and production CJS/ESM build/import checks passed on Node 24.20.0; 86 focused delta/identity tests passed on exact Node 22.0.0. Both R4 probes also passed on Node 22.0.0. Full TypeScript checking reports missing example dependencies (dotenv/config, @azure/identity, express); existing local dependencies were reused.

Fresh isolated worktree from fetched main c11870e; actual base c581c17; merge-base fe3770f. Final open/non-draft/head state and all 51 prior reviews were rechecked before submission.

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

Re-reviewed 22db34a, including the delta since approval 5134872614, all four current changed files, relevant stream contracts, and author responses 3952280463/3952303077. No substantive findings.

The two widened type checks correctly route callable deltas through the existing projection and identity filtering. An independent probe fails on 8359712 but passes here for listener-added ID getters on callable deltas and object-to-callable replacements; the callable is never invoked and snapshot identity remains unchanged. All previous identity, getter, replacement, inherited/nonenumerable-field, and proxy-ID probes still pass. The change reuses the existing flow without another mode or helper; focused suites remain 717/626 lines.

Fresh validation: 320 AssistantStream tests, canonical lint, and production CJS/ESM build/import checks passed on Node 24.20.0; 93 focused tests and the independent callable probe passed on exact Node 22.0.0. Full TypeScript checking reports only the missing example dependencies (dotenv/config, @azure/identity, express). Existing dependency installation and prior audit context were reused; tests and probes were rerun on this head.

Fresh isolated worktree from fetched main c11870e; actual base c581c17; merge-base fe3770f. Final head/state and all 57 prior reviews were checked before submission.

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

The original R14 reproductions now pass: a getter-mutated conflicting envelope rejects before raw dispatch, and an ordinary accessor's projection-time replacement reaches the callback while accumulation retains the original content. Earlier identity/listener repairs remain covered.

Two Proxy cases remain, independently reproduced against f65d190: a get-trap replacement is missed because its descriptor has no getter, and synthetic prototype chains can make the inherited-descriptor walk unbounded. The first calls for treating projection as a potential mutation boundary rather than adding descriptor-specific refresh rules; the second needs bounded traversal or a design that avoids manually following untrusted prototype chains.

Reviewed all five PR files and current discussion, reusing inspection only for byte-identical tests/fixtures/contracts. Fresh validation passed: 397 tests across ten relevant suites, 137 focused tests on exact Node 22.0.0, production CJS/ESM build/import checks, and targeted reproductions/base controls. Lint passed with cached oxlint 1.79 rather than the 1.80 pin; full-project typechecking was not rerun. No file newly crosses 1,000 lines.

Comment thread src/lib/AssistantStream.ts Resolved
Comment thread src/lib/AssistantStream.ts Resolved

@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: 05ab4848a4

ℹ️ 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".

initializeRunStepDelta = () => {
// Validate the captured envelope before reading delta content, then reject root identity fields
// before raw dispatch. Project content privately for accumulation after raw listeners run.
const delta = Reflect.get(exposedData, 'delta', exposedData) as RunStepDelta;

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 Stabilize accessor-backed deltas exposed to raw listeners

When a custom Runs transport supplies a non-idempotent data.delta accessor, this pre-dispatch read validates only its first result while exposedEvent retains the original accessor. A raw event listener that reads event.data.delta therefore invokes it again and can receive a second object containing an own id that was never validated or rejected. Fresh evidence on this head is that the captured value is used only by the private envelope, while raw dispatch still exposes the accessor-backed data object; expose the captured value to listeners or validate the exact value they observe.

AGENTS.md reference: AGENTS.md:L106-L110

Useful? React with 👍 / 👎.

Comment thread src/lib/AssistantStream.ts Resolved

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

Re-reviewed the complete five-file PR and the eaf91a1-to-05ab4848 delta. The original direct Proxy replacement and unbounded prototype traversal findings are repaired; earlier inherited/setter/listener and envelope controls remain intact. Two P2 cases remain, independently reproduced against the actual f65d190 base: a Proxy-triggered setter replacement still leaves the callback cached, and a changing envelope delta getter exposes an unvalidated identity-bearing value to raw listeners. Details inline.

Fresh validation: 403 relevant tests, 143 focused tests on Node 22.0.0, and production build with CJS/ESM import checks passed. Lint passed with cached oxlint 1.79 rather than the pinned 1.80; full-project typecheck was not rerun. All five changed files were covered; no file crosses from below 1,000 to above 1,000 lines. The bounded traversal is an improvement, but projection refresh still models user-code execution too narrowly.

Comment thread src/lib/AssistantStream.ts Outdated
capturedData.delta = accumulationDelta as RunStepDelta;
// Property reads and enumeration can run Proxy traps even for data descriptors.
// Recheck replacements while accumulation keeps the content just projected.
readCurrentDelta(getterRan);

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.

[P2] Refresh setter-backed replacements caused by Proxy traps

This still misses the R15 replacement shape when exposedData.delta is a getter/setter over a backing variable. Give the delta Proxy ordinary data descriptors and let its get('step_details') trap assign exposedData.delta = replacement: projection runs user code, but getterRan stays false and the getter/setter descriptor is unchanged. readCurrentDelta(false) therefore returns the old Proxy, and runStepDelta emits it instead of the replacement. I reproduced this on 05ab484; the actual f65d190 base emits the replacement, while both accumulate the original arguments.

Please account for Proxy-triggered backing-value changes at this projection boundary rather than using accessor descriptors as the test for whether user code ran. Preserve the original projected content for accumulation and the existing no-listener getter behavior, and add this unchanged-setter-descriptor regression.

Comment thread src/lib/AssistantStream.ts Outdated
let observedInheritedDescriptor = observedDescriptor
? undefined
: getInheritedDeltaDescriptor(exposedData);
if (delta && (hasOwn(delta, 'id') || hasOwn(Object.getOwnPropertyDescriptors(delta), 'id'))) {

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.

[P2] Ensure raw listeners receive the delta value that was validated

The pre-dispatch check validates one getter result, but the raw event still exposes the original accessor. With data.delta returning a valid delta on its first read and { id: 'injected' } thereafter, initialization passes this check and an event listener reading event.data.delta immediately receives the identity-bearing object without an error. An independent public-stream probe on this head confirms that result; the same raw listener on f65d190 receives the first, safe value. No listener mutation is involved.

Please make the value exposed during raw dispatch subject to the same root-identity invariant as the captured value, while preserving ordinary object identity and the established getter-receiver contract. Add an accessor-backed envelope regression that checks the actual value observed by the raw listener, not only the private accumulation snapshot.

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

Re-reviewed 05ab484 → b07d51c and accounted for all five current PR files, reusing inspection of the three byte-identical test/fixture files and unchanged contracts. The new post-projection alias validation is sound: an independent collision probe now rejects before accumulation and typed callbacks. It uses the existing alias validator without introducing a new helper or mode. No file crosses from below 1,000 to above 1,000 lines.

Both R16 P2 cases remain independently reproducible on this head; fresh controls against actual base f65d190 still observe the correct replacement/safe first raw value. Details inline. Fresh validation: all 147 focused tests passed on exact Node 22.0.0, plus prior inherited/setter, envelope, Proxy, bounded-prototype, callable and symbol probes. Build/import/lint results are historical R16 evidence, not rerun for R17; full-project typecheck was not rerun.

Comment thread src/lib/AssistantStream.ts Outdated
capturedData.delta = accumulationDelta as RunStepDelta;
// Property reads and enumeration can run Proxy traps even for data descriptors.
// Recheck replacements while accumulation keeps the content just projected.
readCurrentDelta(getterRan);

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.

[P2] Observe Proxy-triggered replacements through an unchanged setter

R16 finding 3954347434 still reproduces on b07d51c. When exposedData.delta is a getter/setter over a backing variable and its current Proxy's get('step_details') trap assigns exposedData.delta = replacement, projection executes user code but all reported property descriptors are data descriptors. getterRan stays false, the envelope getter/setter descriptor stays unchanged, and readCurrentDelta(false) returns the cached Proxy. runStepDelta consequently emits the old object. Fresh f65d190 control emits the replacement; both accumulate the original arguments.

Please account for backing-value changes caused by Proxy traps at the projection boundary instead of inferring user-code execution solely from accessor descriptors. Preserve original-content accumulation and the established no-listener getter behavior, and cover this unchanged-setter-descriptor case.

Comment thread src/lib/AssistantStream.ts Outdated
let observedInheritedDescriptor = observedDescriptor
? undefined
: getInheritedDeltaDescriptor(exposedData);
if (delta && (hasOwn(delta, 'id') || hasOwn(Object.getOwnPropertyDescriptors(delta), 'id'))) {

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.

[P2] Validate the delta value actually exposed to raw listeners

R16 finding 3954347438 also remains on b07d51c. Set data.delta to a getter returning a valid delta on its first read and { id: 'injected' } afterward. This check accepts the first result, but the raw event retains the accessor, so an event listener reading event.data.delta immediately receives the unchecked identity-bearing second result without an error. My fresh public-stream probe confirms this; the same listener on actual base f65d190 receives the safe first result. There is no listener mutation.

Please ensure the value exposed during raw dispatch satisfies the same root-identity invariant as the captured value, preserving ordinary object identity and getter receiver semantics. Add a regression asserting the actual raw-listener value, rather than only the private accumulation snapshot.

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

ℹ️ 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/AssistantStream.ts Resolved

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

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

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

Re-reviewed b07d51c → c0bda2a and accounted for all five current PR files, reusing inspection of the three byte-identical test/fixture files and unchanged contracts. The inherited-owner cache repair is confirmed independently: raw-event, toolCallCreated and toolCallDelta owner-swap probes pass here and fail on b07d51c. The owner now belongs in the cache identity; no separate new helper layer was added. No below-1,000 to above-1,000 file crossing occurs.

Both R17 P2s still reproduce. I also independently confirmed the bot's throwing-prototype regression against actual base f65d190; the separate snapshot-observation probe behaved the same on the base and is excluded. Three actionable P2s inline.

Fresh validation: 150 focused tests passed on exact Node 22.0.0, plus owner-swap, inherited-getter, setter, envelope/null-repair and bounded-prototype probes. Build/import/lint evidence remains historical R16 validation, not rerun on this head; full-project typecheck was not rerun.

Comment thread src/lib/AssistantStream.ts Outdated
capturedData.delta = accumulationDelta as RunStepDelta;
// Property reads and enumeration can run Proxy traps even for data descriptors.
// Recheck replacements while accumulation keeps the content just projected.
readCurrentDelta(getterRan);

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.

[P2] Refresh setter-backed replacements triggered by Proxy traps

R17 finding 3954410256 remains reproducible on c0bda2a. Let exposedData.delta be a getter/setter over a backing variable and let the current delta Proxy's get('step_details') trap assign exposedData.delta = replacement. Its reported properties are data descriptors, so getterRan remains false; the envelope getter/setter descriptor is unchanged, so this returns the cached Proxy and runStepDelta emits the old object. The actual f65d190 control emits the replacement while retaining original-content accumulation.

Please account for Proxy-triggered backing-value mutation at the projection boundary rather than treating accessor descriptors as the complete indicator of user-code execution. Preserve the established no-listener getter semantics and add this unchanged-setter-descriptor regression.

Comment thread src/lib/AssistantStream.ts Outdated
// its post-read state, then detect subsequent replacements from validation or projection.
let observedDescriptor = Object.getOwnPropertyDescriptor(exposedData, 'delta');
let observedInheritedProperty = observedDescriptor ? undefined : getInheritedDeltaProperty(exposedData);
if (delta && (hasOwn(delta, 'id') || hasOwn(Object.getOwnPropertyDescriptors(delta), 'id'))) {

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.

[P2] Apply root-identity validation to the value exposed to raw listeners

R17 finding 3954410267 remains reproducible here. A data.delta getter returning a valid delta once and { id: 'injected' } thereafter passes initialization's root check, but the original accessor remains on the raw event. An event listener reading event.data.delta receives the unchecked identity-bearing second result without an error; the actual base's raw listener receives the safe first result. No listener mutation is involved.

Please ensure raw dispatch exposes a value satisfying the same root-identity invariant as the captured value, preserving ordinary object identity and getter receiver semantics. Cover the actual raw-listener value in the regression test, rather than only the private snapshot.

Comment thread src/lib/AssistantStream.ts Resolved

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

Re-reviewed c0bda2a → dfad061, all five current PR files and affected contracts, reusing inspection of the three byte-identical test/fixture files. I read author responses 3954604419/3954605357/3954606328 and independently confirmed the optional-prototype-metadata repair: the previously failing public-stream probe now completes and preserves delta identity and accumulation. The new snapshot revalidation also rejects the tested initialization-time collision before raw dispatch. Earlier inherited-owner/setter/envelope/null-repair and bounded-prototype controls remain intact.

Two P2s remain reproducible on this exact head: Proxy-triggered replacement through an unchanged setter, and a changing envelope getter exposing an unchecked identity-bearing value to raw listeners. Their implementation is unchanged from R18; the independent actual-base controls remain applicable. Details inline.

Fresh validation: 160 focused tests passed on exact Node 22.0.0, plus the listed independent probes. Build/import/lint results remain historical R16 evidence; full-project typecheck was not rerun. No file crosses from below 1,000 to above 1,000 lines. The metadata failure path appropriately reuses the existing bounded-inspection fallback; I found no additional structural regression in this delta.

Comment thread src/lib/AssistantStream.ts Outdated
capturedData.delta = accumulationDelta as RunStepDelta;
// Property reads and enumeration can run Proxy traps even for data descriptors.
// Recheck replacements while accumulation keeps the content just projected.
readCurrentDelta(getterRan);

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.

[P2] Observe Proxy-triggered replacements through an unchanged setter

R18 finding 3954506808 still reproduces on dfad061. With exposedData.delta implemented as a getter/setter over a backing variable, a delta Proxy's get('step_details') trap can assign exposedData.delta = replacement. The Proxy reports ordinary data descriptors, so getterRan stays false, and the envelope accessor descriptor remains unchanged. This refresh returns the cached Proxy; runStepDelta emits it instead of the replacement. The actual f65d190 control emits the replacement, with original-content accumulation preserved.

Please account for backing-value mutations caused by Proxy traps at this projection boundary instead of equating user-code execution with accessor descriptors. Add this unchanged-setter-descriptor regression while retaining no-listener getter compatibility.

Comment thread src/lib/AssistantStream.ts Outdated
// its post-read state, then detect subsequent replacements from validation or projection.
let observedDescriptor = Object.getOwnPropertyDescriptor(exposedData, 'delta');
let observedInheritedProperty = observedDescriptor ? undefined : getInheritedDeltaProperty(exposedData);
if (delta && (hasOwn(delta, 'id') || hasOwn(Object.getOwnPropertyDescriptors(delta), 'id'))) {

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.

[P2] Validate the delta value exposed during raw dispatch

R18 finding 3954506815 still reproduces on dfad061. A data.delta getter returning a valid delta on its first read and { id: 'injected' } thereafter passes this check. Because the original accessor stays on the raw event, an event listener reading event.data.delta receives the unchecked identity-bearing second result without any stream error. The actual-base raw listener receives the safe first result; no listener mutation is needed.

Please make the raw-dispatch value satisfy the same root-identity invariant as the captured value, preserving ordinary object identity and getter receiver semantics. Cover what the raw listener actually observes, not only the private accumulation snapshot.

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

ℹ️ 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/AssistantStream.ts Outdated
this.#reserveRunStepAlias(activeRunStep, runStepID);
}
}
this.#handleRunStep(stableEvent, runStepID, getRunStepDelta);

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 Revalidate aliases after accumulating nested deltas

When a custom Runs transport supplies a nested step_details proxy or getter, #accumulateRunStep() recursively enumerates that value and can mutate runStepData.id or the retained snapshot's id after the checks at lines 630–635. This call then proceeds to toolCallCreated, toolCallDelta, and runStepDelta callbacks before control returns to the alias checks at lines 638–645, so listeners can observe an identity that already collides with another step. Revalidate the envelope and accumulated snapshot after accumulation and before typed dispatch.

AGENTS.md reference: AGENTS.md:L106-L110

Useful? React with 👍 / 👎.

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

ℹ️ 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/AssistantStream.ts Resolved

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

Re-reviewed dfad061 → f1aa823 and accounted for all five current PR files and relevant dispatch/accumulation contracts, reusing inspection of the three byte-identical test/fixture files. Fresh probes confirm the new post-accumulation validation prevents typed callbacks after a nested identity mutation where R19 emitted them. The metadata fallback, inherited-owner, setter, envelope/null-repair and bounded-prototype controls remain intact.

Two correctness findings remain: projection-triggered setter replacement and unchecked identity-bearing raw getter results. The new refresh flag additionally regresses a depth-33 inherited setter replacement that passes on R19. I also found a structural regression: the new emission helper copies the canonical emission implementation while validation remains manually bracketed throughout the tool loop. Three P2 comments inline.

Fresh validation: 423 tests across ten relevant suites and 163 focused tests on exact Node 22.0.0 passed, plus independent current/previous-head probes. Build/import/lint evidence remains historical R16 validation; full-project typecheck was not rerun. No below-1,000 to above-1,000 file crossing occurs (AssistantStream.ts was already above the threshold).

capturedData.delta = accumulationDelta as RunStepDelta;
// Property reads and enumeration can run Proxy traps even for data descriptors.
// Recheck replacements while accumulation keeps the content just projected.
readCurrentDelta(getterRan, false);

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.

[P2] Preserve projection-triggered setter replacements, including deep accessors

The R19 Proxy/setter case still emits the cached delta on this head: a Proxy get('step_details') trap writes data.delta = replacement through an unchanged setter, while getterRan stays false. There is also a new regression from the hard-coded second argument: put the envelope's getter/setter at prototype depth 33 and let an ordinary enumerable step_details getter assign the replacement. getterRan is true, but the unknown-owner refresh is now disabled. My independent probe emits the replacement on dfad061 and the old delta on f1aa823; both accumulate the original content.

Please preserve setter-backed replacement observation without treating all uninspected accessors as immutable or using descriptor shape as the complete indicator of user-code execution. Add the depth-33 setter case alongside the new getter-only tests, retaining the no-listener getter-read contract.

Comment thread src/lib/AssistantStream.ts Outdated
// its post-read state, then detect subsequent replacements from validation or projection.
let observedDescriptor = Object.getOwnPropertyDescriptor(exposedData, 'delta');
let observedInheritedProperty = observedDescriptor ? undefined : getInheritedDeltaProperty(exposedData);
if (delta && (hasOwn(delta, 'id') || hasOwn(Object.getOwnPropertyDescriptors(delta), 'id'))) {

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.

[P2] Validate the actual raw-listener delta value

R19 finding 3954622915 still reproduces on f1aa823. A data.delta getter returning a valid delta once and { id: 'injected' } thereafter passes this check, but the original accessor remains on the raw event. An event listener reading event.data.delta receives the unchecked identity-bearing second result without a stream error. The independent actual-base control receives the safe first result; no listener mutation is involved.

Please ensure the value exposed during raw dispatch satisfies the same root-identity invariant as the captured value, while retaining ordinary object identity and getter receiver semantics. Test the actual raw-listener observation, not only the private snapshot.

Comment thread src/lib/AssistantStream.ts Resolved

@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: 177d970a09

ℹ️ 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/AssistantStream.ts Resolved
capturedData.delta = accumulationDelta as RunStepDelta;
// Property reads and enumeration can run Proxy traps even for data descriptors.
// Recheck replacements while accumulation keeps the content just projected.
readCurrentDelta(getterRan, false);

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 Refresh deep inherited deltas after projection

When a custom Runs transport inherits data.delta from more than 32 prototype levels deep and an enumerable getter on the captured delta replaces that deep owner's delta property during projection, this call suppresses the ordinary fallback read even though the owner is recorded as unknown. Both metadata snapshots therefore compare as { owner: null }, so accumulation uses the projected original while tool callbacks and runStepDelta also receive the stale original; the base implementation reread event.data.delta after accumulation and observed the replacement. Refresh the ordinary property value after projection when bounded inspection could not identify its owner.

AGENTS.md reference: AGENTS.md:L101-L103

Useful? React with 👍 / 👎.

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

The substantive R20 structural finding 3954697197 is resolved on 177d970: duplicate emission bookkeeping is removed, the canonical emitter owns the after-marking/before-dispatch hook, and run-step emission owns post-listener validation. This removes 34 production lines while preserving the tested dispatch behavior. The shared root-ID check also rejects the tested stateful-Proxy replacements that R20 emitted.

The existing correctness findings projection/setter replacement and raw getter identity still reproduce; I am retaining those threads without duplicate inlines. No additional finding is asserted here.

Fresh exact-head validation: 423 tests across ten relevant suites, 163 focused tests on Node 22.0.0, production build and CJS/ESM root/Bedrock import checks passed, plus independent current/previous-head probes. All five PR files were accounted for; Git diff verified all four test/fixture files byte-identical to R20, whose inspection was reused. No new 1,000-line crossing. Lint and full-project typecheck were not rerun.

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

Verified the material repair in 3954824119, following author response 3954909503: independent toolCallCreated/toolCallDelta replacement probes that expose an ID-bearing Proxy on 177d970 now reject it before runStepDelta on 6ba158c. The check runs after callback-argument marking and preserves the single canonical emission path.

The existing projection/setter and raw getter identity findings still reproduce. No duplicate inlines or additional findings are added.

Fresh validation: 423 tests across ten relevant suites, 163 focused tests on exact Node 22.0.0, and independent current/previous-head probes passed. All five PR files were accounted for; Git verified all four test/fixture files byte-identical to R21, whose inspection was reused. No new structural regression or 1,000-line crossing found. Build/import checks remain R21 evidence; lint and full-project typecheck were not rerun.

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

ℹ️ 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/AssistantStream.ts Resolved

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

Confirmed the substantive repair in 3954953479, following author response 3955108249. Independent mutation/no-mutation probes show e84fbc3 restores the actual f65d190 base's tool lifecycle and subsequent delta routing; R22 selects the stale tool after the done listener changes its index. Accumulation remains unchanged.

Fresh validation: 167 focused tests passed on exact Node 22.0.0, plus previous-head/base controls and the post-marking ID regression probe. All five PR files were accounted for; Git verified three test/fixture files unchanged. No new structural issue or 1,000-line crossing found. Build/lint/full typecheck were not rerun.

The existing projection/setter and raw getter identity findings remain. This update credits the verified repair without duplicate inlines or additional findings.

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor Author

Superseded by #2698 with a smaller implementation: two local root-ID checks and focused tests in the existing identity suite. The replacement preserves valid callback objects, nested tool-call IDs, extension fields, and existing alias handling. Its description states the decoded-protocol-input threat scope and validation results.

@HAYDEN-OAI HAYDEN-OAI closed this Sep 8, 2026
gh-actions-shared Bot pushed a commit to xf-qubit/openai-node that referenced this pull request Sep 8, 2026
Supersedes openai#2685.

Run-step deltas must not carry a root `id`. Reject that field before
raw-event dispatch and recheck the captured delta immediately before
accumulation, so an ordinary raw listener cannot introduce it between
validation and merging. A listener-added root ID rejects the event
instead of being silently stripped.

This keeps run-step identity out of delta accumulation while preserving
valid callback objects, nested tool-call IDs, extension properties, and
existing alias handling. The production change is 14 additions and 3
deletions in `AssistantStream.ts`.

## Scope

The security guarantee covers decoded SSE/NDJSON protocol data. The
pre-merge check also covers ordinary listener additions and
replacements. It follows the repository's [documented distinction
between protocol data and executable application
authority](https://github.com/openai/openai-node/blob/80ce89f355ddb2ea74e48da0284a85d536597446/docs/architecture/security-model.md#L90);
arbitrary hostile getters, Proxies, and callback code running with
application authority are outside this change's security guarantee.

## Validation

- Added 14 focused cases covering both byte-decoding entrypoints:
rejection before raw dispatch, listener-added/replaced root IDs, and
preservation of valid callback identity, nested IDs, and extension
fields.
- All 278 tests across the seven AssistantStream suites pass on Node
24.20.0 using `./scripts/test tests/lib/AssistantStream.test.ts
tests/lib/assistant-stream`.
- All 51 run-step identity tests pass on exact minimum Node 22.0.0.
- Canonical `pnpm lint`, full `pnpm exec tsc`, and `pnpm build` pass
with the pinned dependencies.
- Built AssistantStream CJS/ESM imports pass on Node 22.0.0 and 24.20.0.
- One independent static review found no actionable issues within the
stated scope.

Validation uses focused rejection tests; the original heap-exhaustion
experiment was not rerun.
@HAYDEN-OAI
HAYDEN-OAI deleted the fix/assistant-run-step-delta-identity branch September 16, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security Result of a Codex Security scan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants