Skip to content

fix: avoid replaying orphan hosted shell calls across turns#1099

Merged
seratch merged 2 commits intomainfrom
fix/orphan-hosted-shell-replay
Mar 15, 2026
Merged

fix: avoid replaying orphan hosted shell calls across turns#1099
seratch merged 2 commits intomainfrom
fix/orphan-hosted-shell-replay

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented Mar 14, 2026

This pull request fixes a multi-turn runner bug where hosted shell_call items without matching shell_call_output results could be replayed into a follow-up Responses request, which can trigger provider-side errors such as missing tool output on the next turn.

It updates the default turn assembly in packages/agents-core/src/runner/turnPreparation.ts and packages/agents-core/src/runner/items.ts to prune orphan tool calls only from runner-generated continuity history while preserving caller-provided input. It also hardens packages/agents-core/src/runner/sessionPersistence.ts so session history cannot reintroduce the same orphan hosted shell items, while still keeping fresh caller-provided pending shell calls intact. The change adds targeted regressions in packages/agents-core/test/run.test.ts, packages/agents-core/test/run.stream.test.ts, packages/agents-core/test/runner/items.helpers.test.ts, and packages/agents-core/test/runner/sessionPersistence.test.ts, and includes the untracked patch changeset file .changeset/calm-spoons-sparkle.md for release coverage.

see also: openai/openai-agents-python#2665

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 14, 2026

🦋 Changeset detected

Latest commit: 9bd7e23

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

This PR includes changesets to release 5 packages
Name Type
@openai/agents-core Patch
@openai/agents-extensions 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

@github-actions github-actions bot added this to the 0.7.x milestone Mar 14, 2026
Copy link
Copy Markdown

@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 automated review suggestions for this pull request.

Reviewed commit: 09455233b8

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

@seratch seratch merged commit 5f86461 into main Mar 15, 2026
6 checks passed
@seratch seratch deleted the fix/orphan-hosted-shell-replay branch March 15, 2026 00:41
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.

1 participant