Skip to content

Conversation

Copy link

changeset-bot bot commented Sep 2, 2025

🦋 Changeset detected

Latest commit: 269c2fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@openai/agents-core Patch
@openai/agents-openai Patch
@openai/agents-realtime Patch
@openai/agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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

Reply with @codex fix comments to fix any unresolved comments.

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, or 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 fix this CI failure" or "@codex address that feedback".

Comment on lines 1015 to 1023
const executeRun = async () => {
if (resolvedOptions.stream) {
const streamResult = await this.#runIndividualStream(
agent,
preparedInput,
resolvedOptions,
);
// for streaming runs, the outputs will be save later on
await saveStreamInputToSession(session, sessionOriginalInput);

Choose a reason for hiding this comment

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

[P1] Record streamed input before writing outputs to session

When a session is provided to Runner.run for streaming runs, saveStreamResultToSession is invoked inside the streaming loop before the method resolves, yet saveStreamInputToSession is only executed afterwards. As a result, assistant outputs are added to the session before the corresponding user message, so the persisted conversation history appears in reverse order. Persist the user input before or along with the streamed outputs so the saved transcript matches the actual turn order.

Useful? React with 👍 / 👎.

Copy link
Member Author

Choose a reason for hiding this comment

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

@codex yeah, good catch; can you fix the issue?

Choose a reason for hiding this comment

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

Summary

Testing

  • ⚠️ pnpm -r build-check (fails in @openai/agents-openai: tsc --noEmit -p ./tsconfig.test.json)

View task →

Copy link
Collaborator

@dkundel-openai dkundel-openai left a comment

Choose a reason for hiding this comment

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

Approving assuming you are doing more testing on compatibility with resuming state in the case of human in the loop

@seratch
Copy link
Member Author

seratch commented Sep 3, 2025

Yeah, I'll take some time to further tests before merging this

@seratch seratch marked this pull request as draft September 3, 2025 22:50
Copy link
Contributor

This PR is stale because it has been open for 10 days with no activity.

Copy link
Contributor

This PR is stale because it has been open for 10 days with no activity.

@github-actions github-actions bot added the stale label Sep 26, 2025
@seratch seratch removed the stale label Sep 26, 2025
@davidwhearn
Copy link

How's this going? Would be great to get sessions in there to get more parity with the Python SDK! Plus, I could really use it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add memory feature to TS SDK
3 participants